ventSY.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. <div class="main-title">{{ mainTitle }}</div>
  11. </div>
  12. <!-- 采用定位方式以避免出现各个模块隐藏时其他模块下移的问题 -->
  13. <template v-if="isOriginal">
  14. <ModuleOriginal
  15. v-for="cfg in configs"
  16. :key="cfg.deviceType"
  17. :show-style="cfg.showStyle"
  18. :module-data="cfg.moduleData"
  19. :module-name="cfg.moduleName"
  20. :device-type="cfg.deviceType"
  21. :data="data"
  22. :visible="true"
  23. />
  24. </template>
  25. <template v-else-if="isCommon">
  26. <ModuleCommon
  27. v-for="cfg in configs"
  28. :key="cfg.deviceType"
  29. :show-style="cfg.showStyle"
  30. :module-data="cfg.moduleData"
  31. :module-name="cfg.moduleName"
  32. :device-type="cfg.deviceType"
  33. :data="data"
  34. :visible="true"
  35. />
  36. </template>
  37. <template v-else>
  38. <!-- 下面是正常展示的各新版模块 -->
  39. <ModuleEnhanced
  40. v-for="cfg in enhancedConfigs"
  41. :key="cfg.deviceType"
  42. :visible="cfg.visible"
  43. :show-style="cfg.showStyle"
  44. :module-data="cfg.moduleData"
  45. :module-name="cfg.moduleName"
  46. :device-type="cfg.deviceType"
  47. :data="data"
  48. @close="cfg.visible = false"
  49. />
  50. <!-- 下面是用于呼出已隐藏的模块的按钮 -->
  51. <div class="pos-absolute top-70px left-460px z-3">
  52. <div v-for="(item, i) in hiddenList" :key="`vvhchg${i}`">
  53. <AButton class="module-trigger-button" @click="item.visible = true">{{ item.moduleName }}</AButton>
  54. </div>
  55. </div>
  56. </template>
  57. <!-- <div
  58. v-if="sysDataType === 'all'"
  59. :class="{ 'realtime-mode': isDataRealTime }"
  60. alt="切换数据模式"
  61. class="switch-button report-mode right-525px"
  62. @click="switchDataMode"
  63. ></div> -->
  64. <div class="switch-button icon-goto right-475px" @click="goMicroApp()"></div>
  65. </template>
  66. </div>
  67. </template>
  68. <script lang="ts" setup>
  69. import { onMounted, onUnmounted, watch } from 'vue';
  70. // import { CaretDownOutlined } from '@ant-design/icons-vue';
  71. import { useInitConfigs, useInitPage } from './hooks/useInit';
  72. import ModuleEnhanced from './components/ModuleEnhanced.vue';
  73. import ModuleOriginal from './components/ModuleOriginal.vue';
  74. import ModuleCommon from './components/ModuleCommon.vue';
  75. // import { useRoute } from 'vue-router';
  76. import VentModal from '/@/components/vent/micro/ventModal.vue';
  77. import { list } from './configurable.api';
  78. import { useRoute, useRouter } from 'vue-router';
  79. import { useGlobSetting } from '/@/hooks/setting';
  80. // import { testConfigVent, testConfigVentRealtime } from './configurable.data';
  81. const { title = '智能通风管控系统' } = useGlobSetting();
  82. const { configs, isOriginal, isCommon, fetchConfigs } = useInitConfigs();
  83. const { mainTitle, enhancedConfigs, hiddenList, data, updateData, updateEnhancedConfigs } = useInitPage(title);
  84. const route = useRoute();
  85. const router = useRouter();
  86. // const isDataRealTime = ref(sysDataType === 'monitor');
  87. let interval: number | undefined;
  88. // function switchDataMode() {
  89. // isDataRealTime.value = !isDataRealTime.value;
  90. // refresh();
  91. // }
  92. function refresh() {
  93. fetchConfigs('vent').then(() => {
  94. // configs.value = isDataRealTime.value ? testConfigVentRealtime : testConfigVent;
  95. updateEnhancedConfigs(configs.value);
  96. list({}).then(updateData);
  97. });
  98. }
  99. function initInterval() {
  100. setInterval(() => {
  101. list({}).then(updateData);
  102. }, 60000);
  103. }
  104. function goMicroApp() {
  105. router.push({
  106. path: route.path,
  107. query: {
  108. ...route.query,
  109. type: 'model3D',
  110. deviceType: 'model3D',
  111. },
  112. });
  113. }
  114. watch(
  115. () => route.query,
  116. () => {
  117. if (route.query.deviceType) {
  118. // 仅需要展示子应用,模拟 unmounted
  119. clearInterval(interval);
  120. } else {
  121. // 模拟 mounted
  122. refresh();
  123. initInterval();
  124. }
  125. }
  126. );
  127. onMounted(() => {
  128. refresh();
  129. initInterval();
  130. });
  131. onUnmounted(() => {
  132. clearInterval(interval);
  133. });
  134. </script>
  135. <style>
  136. #__qiankun_microapp_wrapper_for_micro_vent_3_d_modal__ #app {
  137. background-color: transparent;
  138. }
  139. </style>
  140. <style lang="less" scoped>
  141. @import '/@/design/theme.less';
  142. @font-face {
  143. font-family: 'douyuFont';
  144. src: url('/@/assets/font/douyuFont.otf');
  145. }
  146. @{theme-deepblue} {
  147. .company-home {
  148. --image-modal-top: url('/@/assets/images/themify/deepblue/vent/home/modal-top.png');
  149. }
  150. }
  151. .company-home {
  152. --image-modal-top: url('/@/assets/images/vent/home/modal-top.png');
  153. --image-monitor-realtime: url('/@/assets/images/company/monitor-realtime.png');
  154. --image-monitor-doc: url('/@/assets/images/company/monitor-doc.png');
  155. --image-monitor-goto: url('/@/assets/images/company/monitor-goto.png');
  156. width: 100%;
  157. height: 100%;
  158. color: @white;
  159. position: relative;
  160. // background: url('@/assets/images/home-container/configurable/firehome/bg.png') no-repeat center;
  161. .top-bg {
  162. width: 100%;
  163. height: 56px;
  164. background: var(--image-modal-top) no-repeat center;
  165. position: absolute;
  166. z-index: 1;
  167. .main-title {
  168. height: 56px;
  169. font-family: 'douyuFont';
  170. font-size: 20px;
  171. letter-spacing: 2px;
  172. display: flex;
  173. justify-content: center;
  174. align-items: center;
  175. }
  176. }
  177. // .module-left {
  178. // position: absolute;
  179. // width: 450px;
  180. // height: 280px;
  181. // left: 0;
  182. // }
  183. // .module-right {
  184. // position: absolute;
  185. // width: 450px;
  186. // height: 280px;
  187. // right: 0;
  188. // }
  189. // .module-bottom {
  190. // position: absolute;
  191. // width: 1000px;
  192. // height: 280px;
  193. // }
  194. .module-dropdown {
  195. padding: 5px;
  196. background-image: @vent-configurable-dropdown;
  197. border-bottom: 2px solid @vent-configurable-home-light-border;
  198. color: @vent-font-color;
  199. position: absolute;
  200. top: 60px;
  201. right: 480px;
  202. }
  203. .module-dropdown-original {
  204. padding: 10px;
  205. background-image: @vent-configurable-dropdown;
  206. border-bottom: 2px solid @vent-configurable-home-light-border;
  207. color: @vent-font-color;
  208. position: absolute;
  209. top: 70px;
  210. right: 460px;
  211. }
  212. .module-trigger-button {
  213. color: @vent-font-color;
  214. background-image: @vent-configurable-dropdown;
  215. border: none;
  216. border-bottom: 2px solid @vent-configurable-home-light-border;
  217. }
  218. .switch-button {
  219. width: 34px;
  220. height: 34px;
  221. position: absolute;
  222. // right: 5px;
  223. bottom: 300px;
  224. z-index: 5;
  225. background-repeat: no-repeat;
  226. background-size: 100% 100%;
  227. }
  228. .report-mode {
  229. background-image: var(--image-monitor-doc);
  230. }
  231. .realtime-mode {
  232. background-image: var(--image-monitor-realtime);
  233. }
  234. .icon-goto {
  235. background-image: var(--image-monitor-goto);
  236. }
  237. .module-monitor-bar {
  238. position: absolute;
  239. top: 100px;
  240. width: 1000px;
  241. height: 200px;
  242. left: calc(50% - 500px);
  243. }
  244. }
  245. :deep(.loading-box) {
  246. position: unset;
  247. }
  248. </style>