common-green.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="company-home">
  3. <!-- 如果是有 deviceType、type 等 query,认为是详情页,不需要展示普通模块,只需要模型 -->
  4. <template v-if="!route.query.deviceType">
  5. <div class="main-container">
  6. <div class="left-area">
  7. <!-- 采用定位方式以避免出现各个模块隐藏时其他模块下移的问题 -->
  8. <template v-if="isOriginal">
  9. <ModuleOriginal v-for="cfg in configsLeft" :key="cfg.deviceType" :show-style="cfg.showStyle"
  10. :module-data="cfg.moduleData" :module-name="cfg.moduleName" :device-type="cfg.deviceType" :data="data"
  11. :visible="true" />
  12. </template>
  13. </div>
  14. <div class="bottom-area">
  15. <!-- 采用定位方式以避免出现各个模块隐藏时其他模块下移的问题 -->
  16. <template v-if="isOriginal">
  17. <ModuleOriginal v-for="cfg in configsBottom" :key="cfg.deviceType" :show-style="cfg.showStyle"
  18. :module-data="cfg.moduleData" :module-name="cfg.moduleName" :device-type="cfg.deviceType" :data="data"
  19. :visible="true" />
  20. </template>
  21. </div>
  22. <div class="right-area">
  23. <greenRightTag></greenRightTag>
  24. </div>
  25. </div>
  26. </template>
  27. </div>
  28. </template>
  29. <script lang="ts" setup>
  30. import { onMounted, onUnmounted, ref, watch, computed } from 'vue';
  31. import { useInitConfigs, useInitPage } from './hooks/useInit';
  32. import ModuleOriginal from './components/ModuleOriginal-green.vue';
  33. import greenRightTag from './components/green-right-tag.vue';
  34. import { list } from './configurable.api';
  35. import { useRoute, useRouter } from 'vue-router';
  36. import { useGlobSetting } from '/@/hooks/setting';
  37. import { testConfigVent, testConfigVentRealtime } from './configurable.data';
  38. const { title = '智能通风管控系统' } = useGlobSetting();
  39. // const { configs, isOriginal, isCommon, fetchConfigs } = useInitConfigs();
  40. const { isOriginal, fetchConfigs } = useInitConfigs();
  41. const { mainTitle, data, updateData, updateEnhancedConfigs } = useInitPage(title);
  42. const route = useRoute();
  43. let interval: number | undefined;
  44. let configs = ref<any[]>([]);
  45. let configsLeft = computed(() => {
  46. return configs.value.filter((v) => v.showStyle.position.includes('top'));
  47. });
  48. let configsBottom = computed(() => {
  49. return configs.value.filter((v) => v.showStyle.position.includes('bottom'));
  50. });
  51. function refresh() {
  52. fetchConfigs('vent').then(() => {
  53. configs.value = testConfigVent;
  54. updateEnhancedConfigs(configs.value);
  55. // 测风装置 windrect
  56. // 自动风窗 window
  57. // 自动风门 gate
  58. // 传感器 modelsensor
  59. // 局部通风机 fanlocal
  60. // 主通风机 fanmain
  61. // 密闭 obfurage
  62. // 安全监控 safetymonitor
  63. // 光纤测温 fiber
  64. // 束管监测 bundletube
  65. // 制氮 nitrogen
  66. // 制浆 pulping
  67. // 喷淋 spray
  68. // 喷粉 dustdev
  69. // 喷雾设备 atomizing
  70. // 除尘风机 dedustefan
  71. // 粉尘传感器 dustsensor
  72. // 转载点 transferpoint
  73. // 瓦斯抽采泵 pump
  74. // 粉尘 dusting
  75. // 瓦斯监测 gasmonitor
  76. // 球阀 ballvalve
  77. // 压风机 forcFan
  78. // 瓦斯巡检 gaspatrol
  79. // 防火门 firedoor
  80. // 隔爆设施 explosionProof
  81. // 瓦斯管道阀门 gasvalve
  82. list({
  83. types: configs.value
  84. .filter((e) => e.deviceType)
  85. .map((e) => e.deviceType)
  86. .join(','),
  87. }).then(updateData);
  88. });
  89. }
  90. function initInterval() {
  91. setInterval(() => {
  92. list({
  93. types: configs.value
  94. .filter((e) => e.deviceType)
  95. .map((e) => e.deviceType)
  96. .join(','),
  97. }).then(updateData);
  98. }, 60000);
  99. }
  100. watch(
  101. () => route.query,
  102. () => {
  103. if (route.query.deviceType) {
  104. // 仅需要展示子应用,模拟 unmounted
  105. clearInterval(interval);
  106. } else {
  107. // 模拟 mounted
  108. refresh();
  109. initInterval();
  110. }
  111. }
  112. );
  113. onMounted(() => {
  114. refresh();
  115. initInterval();
  116. });
  117. onUnmounted(() => {
  118. clearInterval(interval);
  119. });
  120. </script>
  121. <style lang="less" scoped>
  122. @import '/@/design/theme.less';
  123. @font-face {
  124. font-family: 'douyuFont';
  125. src: url('/@/assets/font/douyuFont.otf');
  126. }
  127. @{theme-deepblue} {
  128. .company-home {
  129. --image-modal-top: url('/@/assets/images/themify/deepblue/vent/home/modal-top.png');
  130. }
  131. }
  132. .company-home {
  133. --image-modal-top: url('/@/assets/images/vent/home/modal-top.png');
  134. --image-monitor-realtime: url('/@/assets/images/company/monitor-realtime.png');
  135. --image-monitor-doc: url('/@/assets/images/company/monitor-doc.png');
  136. --image-monitor-goto: url('/@/assets/images/company/monitor-goto.png');
  137. width: 100%;
  138. height: 100%;
  139. color: @white;
  140. position: relative;
  141. background: #181b24;
  142. .main-container {
  143. width: 100%;
  144. height: 100%;
  145. margin: 0px 15px;
  146. .left-area {
  147. position: absolute;
  148. left: 0;
  149. top: 0;
  150. width: 420px;
  151. height: 100%;
  152. padding: 15px;
  153. background: url('../../../../assets/images/home-green/green-bd-left.png') no-repeat;
  154. background-size: 100% 100%;
  155. box-sizing: border-box;
  156. overflow-y: auto;
  157. }
  158. .bottom-area {
  159. position: absolute;
  160. left: 435px;
  161. bottom: 0;
  162. width: calc(100% - 435px);
  163. height: 290px;
  164. padding: 15px;
  165. background: url('../../../../assets/images/home-green/green-bd-bottom.png') no-repeat;
  166. background-size: 100% 100%;
  167. box-sizing: border-box;
  168. }
  169. .right-area {
  170. position: absolute;
  171. right: 0px;
  172. top: 0px;
  173. width: 120px;
  174. height: calc(100% - 305px);
  175. }
  176. }
  177. .module-dropdown {
  178. padding: 5px;
  179. background-image: @vent-configurable-dropdown;
  180. border-bottom: 2px solid @vent-configurable-home-light-border;
  181. color: @vent-font-color;
  182. position: absolute;
  183. top: 60px;
  184. right: 480px;
  185. }
  186. .module-dropdown-original {
  187. padding: 10px;
  188. background-image: @vent-configurable-dropdown;
  189. border-bottom: 2px solid @vent-configurable-home-light-border;
  190. color: @vent-font-color;
  191. position: absolute;
  192. top: 70px;
  193. right: 460px;
  194. }
  195. .module-trigger-button {
  196. color: @vent-font-color;
  197. background-image: @vent-configurable-dropdown;
  198. border: none;
  199. border-bottom: 2px solid @vent-configurable-home-light-border;
  200. }
  201. .realtime-mode {
  202. background-image: var(--image-monitor-realtime);
  203. }
  204. .module-monitor-bar {
  205. position: absolute;
  206. top: 100px;
  207. width: 1000px;
  208. height: 200px;
  209. left: calc(50% - 500px);
  210. }
  211. }
  212. :deep(.loading-box) {
  213. position: unset;
  214. }
  215. </style>