tester.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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="flex pos-absolute bottom-10px left-60px 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 { testConfigVent } from './configurable.data';
  80. import { useGlobSetting } from '/@/hooks/setting';
  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. let interval: number | undefined;
  86. onMounted(() => {
  87. fetchConfigs('demo_page').then((res) => {
  88. configs.value = res;
  89. updateEnhancedConfigs(configs.value);
  90. getHomeData({}).then(updateData);
  91. setInterval(() => {
  92. getHomeData({}).then(updateData);
  93. }, 60000);
  94. });
  95. });
  96. onUnmounted(() => {
  97. clearInterval(interval);
  98. });
  99. </script>
  100. <style lang="less" scoped>
  101. @import '/@/design/theme.less';
  102. @font-face {
  103. font-family: 'douyuFont';
  104. src: url('../../../../assets/font/douyuFont.otf');
  105. }
  106. @{theme-deepblue} {
  107. .company-home {
  108. --image-modal-top: url('@/assets/images/themify/deepblue/vent/home/modal-top.png');
  109. }
  110. }
  111. .company-home {
  112. --image-modal-top: url('@/assets/images/vent/home/modal-top.png');
  113. width: 100%;
  114. height: 100%;
  115. color: @white;
  116. position: relative;
  117. background: #000000;
  118. // background: url('@/assets/images/home-container/configurable/firehome/bg.png') no-repeat center;
  119. .top-bg {
  120. width: 100%;
  121. height: 56px;
  122. background: var(--image-modal-top) no-repeat center;
  123. position: absolute;
  124. z-index: 1;
  125. .main-title {
  126. height: 56px;
  127. font-family: 'douyuFont';
  128. font-size: 20px;
  129. letter-spacing: 2px;
  130. display: flex;
  131. justify-content: center;
  132. align-items: center;
  133. }
  134. }
  135. // .module-left {
  136. // position: absolute;
  137. // width: 450px;
  138. // height: 280px;
  139. // left: 0;
  140. // }
  141. // .module-right {
  142. // position: absolute;
  143. // width: 450px;
  144. // height: 280px;
  145. // right: 0;
  146. // }
  147. // .module-bottom {
  148. // position: absolute;
  149. // width: 1000px;
  150. // height: 280px;
  151. // }
  152. .module-dropdown {
  153. padding: 10px;
  154. background-image: @vent-configurable-dropdown;
  155. border-bottom: 2px solid @vent-configurable-home-light-border;
  156. color: @vent-font-color;
  157. position: absolute;
  158. top: 70px;
  159. right: 460px;
  160. }
  161. .module-dropdown-original {
  162. padding: 10px;
  163. background-image: @vent-configurable-dropdown;
  164. border-bottom: 2px solid @vent-configurable-home-light-border;
  165. color: @vent-font-color;
  166. position: absolute;
  167. top: 70px;
  168. right: 460px;
  169. }
  170. .module-trigger-button {
  171. color: @vent-font-color;
  172. background-image: @vent-configurable-dropdown;
  173. border: none;
  174. border-bottom: 2px solid @vent-configurable-home-light-border;
  175. }
  176. }
  177. :deep(.loading-box) {
  178. position: unset;
  179. }
  180. </style>