vent.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. <div v-if="!route.query.embed" class="top-bg">
  8. <!-- <img style="width: 300px; height: 40px; position: fixed; left: 5px; top: 5px" src="./meeee.png" /> -->
  9. <div class="main-title">{{ mainTitle }}</div>
  10. </div>
  11. <!-- <a-dropdown class="module-dropdown" :class="{ 'module-dropdown-original': isOriginal }" :trigger="['click']" placement="bottomRight">
  12. <a class="ant-dropdown-link" @click.prevent>
  13. 全矿井通风检测
  14. <CaretDownOutlined />
  15. </a>
  16. <template #overlay>
  17. <MonitorCenter />
  18. </template>
  19. </a-dropdown> -->
  20. <!-- 采用定位方式以避免出现各个模块隐藏时其他模块下移的问题 -->
  21. <template v-if="isOriginal">
  22. <ModuleOriginal
  23. v-for="cfg in configs"
  24. :key="cfg.deviceType"
  25. :show-style="cfg.showStyle"
  26. :module-data="cfg.moduleData"
  27. :module-name="cfg.moduleName"
  28. :device-type="cfg.deviceType"
  29. :data="data"
  30. :visible="true"
  31. />
  32. </template>
  33. <template v-else-if="isCommon">
  34. <ModuleCommon
  35. v-for="cfg in configs"
  36. :key="cfg.deviceType"
  37. :show-style="cfg.showStyle"
  38. :module-data="cfg.moduleData"
  39. :module-name="cfg.moduleName"
  40. :device-type="cfg.deviceType"
  41. :data="data"
  42. :visible="true"
  43. />
  44. </template>
  45. <template v-else>
  46. <!-- 下面是正常展示的各新版模块 -->
  47. <ModuleEnhanced
  48. v-for="cfg in enhancedConfigs"
  49. :key="cfg.deviceType"
  50. :visible="cfg.visible"
  51. :show-style="cfg.showStyle"
  52. :module-data="cfg.moduleData"
  53. :module-name="cfg.moduleName"
  54. :device-type="cfg.deviceType"
  55. :data="data"
  56. @close="cfg.visible = false"
  57. />
  58. <!-- 下面是用于呼出已隐藏的模块的按钮 -->
  59. <div class="pos-absolute top-70px left-460px z-3">
  60. <div v-for="(item, i) in hiddenList" :key="`vvhchg${i}`">
  61. <AButton class="module-trigger-button" @click="item.visible = true">{{ item.moduleName }}</AButton>
  62. </div>
  63. </div>
  64. </template>
  65. </div>
  66. </template>
  67. <script lang="ts" setup>
  68. import { onMounted, onUnmounted } from 'vue';
  69. // import { CaretDownOutlined } from '@ant-design/icons-vue';
  70. // import MonitorCenter from './components/MonitorCenter.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 { getHomeData } from './configurable.api';
  78. import { useRoute } from 'vue-router';
  79. // import { testConfigSY } from './configurable.data.wz';
  80. const { configs, isOriginal, isCommon, fetchConfigs } = useInitConfigs();
  81. const { mainTitle, enhancedConfigs, hiddenList, data, updateData, updateEnhancedConfigs } = useInitPage('智能通风管控系统');
  82. const route = useRoute();
  83. let interval: number | undefined;
  84. onMounted(() => {
  85. fetchConfigs('vent').then(() => {
  86. // configs.value = testConfigSY;
  87. updateEnhancedConfigs(configs.value);
  88. getHomeData({}).then(updateData);
  89. });
  90. setInterval(() => {
  91. getHomeData({}).then(updateData);
  92. }, 60000);
  93. });
  94. onUnmounted(() => {
  95. clearInterval(interval);
  96. });
  97. </script>
  98. <style lang="less" scoped>
  99. @import '/@/design/theme.less';
  100. @font-face {
  101. font-family: 'douyuFont';
  102. src: url('../../../../assets/font/douyuFont.otf');
  103. }
  104. @{theme-deepblue} {
  105. .company-home {
  106. --image-modal-top: url('@/assets/images/themify/deepblue/vent/home/modal-top.png');
  107. }
  108. }
  109. .company-home {
  110. --image-modal-top: url('@/assets/images/vent/home/modal-top.png');
  111. width: 100%;
  112. height: 100%;
  113. color: @white;
  114. position: relative;
  115. // background: url('@/assets/images/home-container/configurable/firehome/bg.png') no-repeat center;
  116. .top-bg {
  117. width: 100%;
  118. height: 56px;
  119. background: var(--image-modal-top) no-repeat center;
  120. position: absolute;
  121. z-index: 1;
  122. .main-title {
  123. height: 56px;
  124. font-family: 'douyuFont';
  125. font-size: 20px;
  126. letter-spacing: 2px;
  127. display: flex;
  128. justify-content: center;
  129. align-items: center;
  130. }
  131. }
  132. // .module-left {
  133. // position: absolute;
  134. // width: 450px;
  135. // height: 280px;
  136. // left: 0;
  137. // }
  138. // .module-right {
  139. // position: absolute;
  140. // width: 450px;
  141. // height: 280px;
  142. // right: 0;
  143. // }
  144. // .module-bottom {
  145. // position: absolute;
  146. // width: 1000px;
  147. // height: 280px;
  148. // }
  149. .module-dropdown {
  150. padding: 10px;
  151. background-image: @vent-configurable-dropdown;
  152. border-bottom: 2px solid @vent-configurable-home-light-border;
  153. color: @vent-font-color;
  154. position: absolute;
  155. top: 70px;
  156. right: 460px;
  157. }
  158. .module-dropdown-original {
  159. padding: 10px;
  160. background-image: @vent-configurable-dropdown;
  161. border-bottom: 2px solid @vent-configurable-home-light-border;
  162. color: @vent-font-color;
  163. position: absolute;
  164. top: 70px;
  165. right: 460px;
  166. }
  167. .module-trigger-button {
  168. color: @vent-font-color;
  169. background-image: @vent-configurable-dropdown;
  170. border: none;
  171. border-bottom: 2px solid @vent-configurable-home-light-border;
  172. }
  173. }
  174. :deep(.loading-box) {
  175. position: unset;
  176. }
  177. </style>