vent-Green.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="company-home">
  4. <div style="width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 0">
  5. <VentModal />
  6. </div>
  7. <!-- 如果是有 deviceType、type 等 query,认为是详情页,不需要展示普通模块,只需要模型 -->
  8. <template v-if="!route.query.deviceType">
  9. <div v-if="!route.query.embed" class="top-bg">
  10. <greenNav :Title="mainTitle"></greenNav>
  11. </div>
  12. <div class="main-container">
  13. <div class="left-area">
  14. <!-- 采用定位方式以避免出现各个模块隐藏时其他模块下移的问题 -->
  15. <template v-if="isOriginal">
  16. <ModuleOriginal
  17. v-for="cfg in configsLeft"
  18. :key="cfg.deviceType"
  19. :show-style="cfg.showStyle"
  20. :module-data="cfg.moduleData"
  21. :module-name="cfg.moduleName"
  22. :device-type="cfg.deviceType"
  23. :data="data"
  24. :visible="true"
  25. />
  26. </template>
  27. </div>
  28. <div class="bottom-area">
  29. <!-- 采用定位方式以避免出现各个模块隐藏时其他模块下移的问题 -->
  30. <template v-if="isOriginal">
  31. <ModuleOriginal
  32. v-for="cfg in configsBottom"
  33. :key="cfg.deviceType"
  34. :show-style="cfg.showStyle"
  35. :module-data="cfg.moduleData"
  36. :module-name="cfg.moduleName"
  37. :device-type="cfg.deviceType"
  38. :data="data"
  39. :visible="true"
  40. />
  41. </template>
  42. </div>
  43. <div class="right-area">
  44. <greenRightTag></greenRightTag>
  45. </div>
  46. <!-- <div
  47. v-if="sysDataType === 'all'"
  48. :class="{ 'realtime-mode': isDataRealTime }"
  49. alt="切换数据模式"
  50. class="switch-button report-mode right-525px"
  51. @click="switchDataMode"
  52. ></div> -->
  53. <!-- <div class="switch-button icon-goto right-475px" @click="goMicroApp()"></div> -->
  54. </div>
  55. </template>
  56. </div>
  57. </template>
  58. <script lang="ts" setup>
  59. import { onMounted, onUnmounted, ref, watch, computed } from 'vue';
  60. // import { CaretDownOutlined } from '@ant-design/icons-vue';
  61. // import MonitorBar from './components/MonitorBar.vue';
  62. import { useInitConfigs, useInitPage } from './hooks/useInit';
  63. import ModuleOriginal from './components/ModuleOriginal-green.vue';
  64. import greenNav from './components/green-nav.vue';
  65. import greenRightTag from './components/green-right-tag.vue';
  66. // import { useRoute } from 'vue-router';
  67. import VentModal from '/@/components/vent/micro/ventModal.vue';
  68. import { list } from './configurable.api';
  69. import { useRoute, useRouter } from 'vue-router';
  70. import { useGlobSetting } from '/@/hooks/setting';
  71. import { testConfigVent, testConfigVentRealtime } from './configurable.data';
  72. const { sysDataType = 'monitor', title = '智能通风管控系统' } = useGlobSetting();
  73. // const { configs, isOriginal, isCommon, fetchConfigs } = useInitConfigs();
  74. const { isOriginal, isCommon, fetchConfigs } = useInitConfigs();
  75. const { mainTitle, enhancedConfigs, hiddenList, data, updateData, updateEnhancedConfigs } = useInitPage(title);
  76. const route = useRoute();
  77. const router = useRouter();
  78. const isDataRealTime = ref(sysDataType === 'monitor');
  79. // const showBar = ref(true);
  80. let interval: number | undefined;
  81. let configs = ref<any[]>([]);
  82. // function switchDataMode() {
  83. // isDataRealTime.value = !isDataRealTime.value;
  84. // refresh();
  85. // }
  86. let configsLeft = computed(() => {
  87. return configs.value.filter((v) => v.showStyle.position.includes('top'));
  88. });
  89. let configsBottom = computed(() => {
  90. return configs.value.filter((v) => v.showStyle.position.includes('bottom'));
  91. });
  92. function refresh() {
  93. fetchConfigs(isDataRealTime.value ? 'vent_realtime' : 'vent').then(() => {
  94. configs.value = isDataRealTime.value ? testConfigVentRealtime : testConfigVent;
  95. updateEnhancedConfigs(configs.value);
  96. // 测风装置 windrect
  97. // 自动风窗 window
  98. // 自动风门 gate
  99. // 传感器 modelsensor
  100. // 局部通风机 fanlocal
  101. // 主通风机 fanmain
  102. // 密闭 obfurage
  103. // 安全监控 safetymonitor
  104. // 光纤测温 fiber
  105. // 束管监测 bundletube
  106. // 制氮 nitrogen
  107. // 制浆 pulping
  108. // 喷淋 spray
  109. // 喷粉 dustdev
  110. // 喷雾设备 atomizing
  111. // 除尘风机 dedustefan
  112. // 粉尘传感器 dustsensor
  113. // 转载点 transferpoint
  114. // 瓦斯抽采泵 pump
  115. // 粉尘 dusting
  116. // 瓦斯监测 gasmonitor
  117. // 球阀 ballvalve
  118. // 压风机 forcFan
  119. // 瓦斯巡检 gaspatrol
  120. // 防火门 firedoor
  121. // 隔爆设施 explosionProof
  122. // 瓦斯管道阀门 gasvalve
  123. list({
  124. types: configs.value
  125. .filter((e) => e.deviceType)
  126. .map((e) => e.deviceType)
  127. .join(','),
  128. }).then(updateData);
  129. });
  130. }
  131. function initInterval() {
  132. setInterval(() => {
  133. list({
  134. types: configs.value
  135. .filter((e) => e.deviceType)
  136. .map((e) => e.deviceType)
  137. .join(','),
  138. }).then(updateData);
  139. }, 60000);
  140. }
  141. function goMicroApp() {
  142. router.push({
  143. path: route.path,
  144. query: {
  145. ...route.query,
  146. type: 'model3D',
  147. deviceType: 'model3D',
  148. },
  149. });
  150. }
  151. watch(
  152. () => route.query,
  153. () => {
  154. if (route.query.deviceType) {
  155. // 仅需要展示子应用,模拟 unmounted
  156. clearInterval(interval);
  157. } else {
  158. // 模拟 mounted
  159. refresh();
  160. initInterval();
  161. }
  162. }
  163. );
  164. onMounted(() => {
  165. refresh();
  166. initInterval();
  167. });
  168. onUnmounted(() => {
  169. clearInterval(interval);
  170. });
  171. </script>
  172. <style lang="less" scoped>
  173. @import '/@/design/theme.less';
  174. @font-face {
  175. font-family: 'douyuFont';
  176. src: url('/@/assets/font/douyuFont.otf');
  177. }
  178. @{theme-deepblue} {
  179. .company-home {
  180. --image-modal-top: url('/@/assets/images/themify/deepblue/vent/home/modal-top.png');
  181. }
  182. }
  183. .company-home {
  184. --image-modal-top: url('/@/assets/images/vent/home/modal-top.png');
  185. --image-monitor-realtime: url('/@/assets/images/company/monitor-realtime.png');
  186. --image-monitor-doc: url('/@/assets/images/company/monitor-doc.png');
  187. --image-monitor-goto: url('/@/assets/images/company/monitor-goto.png');
  188. width: 100%;
  189. height: 100%;
  190. color: @white;
  191. position: relative;
  192. background: #181b24;
  193. .top-bg {
  194. width: 100%;
  195. height: 96px;
  196. // background: var(--image-modal-top) no-repeat center;
  197. position: absolute;
  198. z-index: 1;
  199. }
  200. .main-container {
  201. position: absolute;
  202. top: 96px;
  203. width: calc(100% - 30px);
  204. height: calc(100% - 96px);
  205. margin: 0px 15px;
  206. box-sizing: border-box;
  207. .left-area {
  208. position: absolute;
  209. left: 0;
  210. top: 0;
  211. width: 420px;
  212. height: 100%;
  213. padding: 15px;
  214. background: url('../../../../assets/images/home-green/green-bd-left.png') no-repeat;
  215. background-size: 100% 100%;
  216. box-sizing: border-box;
  217. overflow-y: auto;
  218. }
  219. .bottom-area {
  220. position: absolute;
  221. left: 435px;
  222. bottom: 0;
  223. width: calc(100% - 435px);
  224. height: 290px;
  225. padding: 15px;
  226. background: url('../../../../assets/images/home-green/green-bd-bottom.png') no-repeat;
  227. background-size: 100% 100%;
  228. box-sizing: border-box;
  229. }
  230. .right-area {
  231. position: absolute;
  232. right: 0px;
  233. top: 0px;
  234. width: 120px;
  235. height: calc(100% - 305px);
  236. }
  237. }
  238. // .module-left {
  239. // position: absolute;
  240. // width: 450px;
  241. // height: 280px;
  242. // left: 0;
  243. // }
  244. // .module-right {
  245. // position: absolute;
  246. // width: 450px;
  247. // height: 280px;
  248. // right: 0;
  249. // }
  250. // .module-bottom {
  251. // position: absolute;
  252. // width: 1000px;
  253. // height: 280px;
  254. // }
  255. .module-dropdown {
  256. padding: 5px;
  257. background-image: @vent-configurable-dropdown;
  258. border-bottom: 2px solid @vent-configurable-home-light-border;
  259. color: @vent-font-color;
  260. position: absolute;
  261. top: 60px;
  262. right: 480px;
  263. }
  264. .module-dropdown-original {
  265. padding: 10px;
  266. background-image: @vent-configurable-dropdown;
  267. border-bottom: 2px solid @vent-configurable-home-light-border;
  268. color: @vent-font-color;
  269. position: absolute;
  270. top: 70px;
  271. right: 460px;
  272. }
  273. .module-trigger-button {
  274. color: @vent-font-color;
  275. background-image: @vent-configurable-dropdown;
  276. border: none;
  277. border-bottom: 2px solid @vent-configurable-home-light-border;
  278. }
  279. .switch-button {
  280. width: 34px;
  281. height: 34px;
  282. position: absolute;
  283. // right: 5px;
  284. bottom: 300px;
  285. z-index: 5;
  286. background-repeat: no-repeat;
  287. background-size: 100% 100%;
  288. }
  289. .report-mode {
  290. background-image: var(--image-monitor-doc);
  291. }
  292. .realtime-mode {
  293. background-image: var(--image-monitor-realtime);
  294. }
  295. .icon-goto {
  296. background-image: var(--image-monitor-goto);
  297. }
  298. .module-monitor-bar {
  299. position: absolute;
  300. top: 100px;
  301. width: 1000px;
  302. height: 200px;
  303. left: calc(50% - 500px);
  304. }
  305. }
  306. :deep(.loading-box) {
  307. position: unset;
  308. }
  309. </style>