vent-Green.vue 8.7 KB

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