vent_v5.vue 7.1 KB

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