dustControl.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="company-home" ref="dustControlContainer">
  4. <!-- 顶部标题样式块 -->
  5. <div class="top-bg">
  6. <div class="main-title">{{ mainTitle }}</div>
  7. </div>
  8. <!-- 渲染所有模块 -->
  9. <ModuleCommon
  10. v-for="cfg in cfgs"
  11. :key="cfg.deviceType + cfg.moduleName"
  12. :show-style="cfg.showStyle"
  13. :module-data="cfg.moduleData"
  14. :module-name="cfg.moduleName"
  15. :device-type="cfg.deviceType"
  16. :data="data"
  17. :visible="true"
  18. />
  19. </div>
  20. </template>
  21. <script lang="ts" setup>
  22. import { computed, onMounted, onUnmounted, ref } from 'vue';
  23. import { useInitConfigs, useInitPage } from './hooks/useInit';
  24. import { testConfigDustControl } from './configurable.data.dustControl';
  25. import ModuleCommon from './components/ModuleCommon.vue';
  26. const cfgs = computed(() => configs.value);
  27. const { configs, fetchConfigs } = useInitConfigs();
  28. const { mainTitle, data } = useInitPage('除尘装置控制系统');
  29. let interval: ReturnType<typeof setInterval> | undefined;
  30. // 新增:获取容器DOM元素
  31. const dustControlContainer = ref<HTMLDivElement>();
  32. const handleRadioChange = (event: Event) => {
  33. // 类型断言,获取事件详情
  34. const detail = (event as CustomEvent).detail;
  35. if (detail) {
  36. console.log('监听到radio切换:', detail.value);
  37. // 这里处理业务逻辑
  38. }
  39. };
  40. onMounted(() => {
  41. fetchConfigs('mine_fire').then(() => {
  42. configs.value = testConfigDustControl;
  43. // getDisHome({
  44. // dataList: devicesTypes.value.concat('fireAllMineWarn').join(','),
  45. // }).then(updateData);
  46. });
  47. interval = setInterval(() => {
  48. // getDisHome({
  49. // dataList: devicesTypes.value.concat('fireAllMineWarn').join(','),
  50. // }).then(updateData);
  51. }, 2000);
  52. // 监听自定义原生事件
  53. // 在容器上监听事件(事件会从radio组件冒泡到这里)
  54. if (dustControlContainer.value) {
  55. dustControlContainer.value.addEventListener('radio-value-change', handleRadioChange);
  56. }
  57. });
  58. onUnmounted(() => {
  59. clearInterval(interval);
  60. if (dustControlContainer.value) {
  61. dustControlContainer.value.removeEventListener('radio-value-change', handleRadioChange);
  62. }
  63. });
  64. </script>
  65. <style lang="less" scoped>
  66. @import '/@/design/theme.less';
  67. @font-face {
  68. font-family: 'douyuFont';
  69. src: url('../../../../assets/font/douyuFont.otf');
  70. }
  71. .company-home {
  72. --image-fire-title: url(/@/assets/images/vent/vent-header1.png);
  73. --image-common-border1: url('/@/assets/images/home-container/configurable/minehome/common-border1.png');
  74. --image-common-border3: url('/@/assets/images/home-container/configurable/minehome/common-border3.png');
  75. width: 100%;
  76. height: 100%;
  77. color: @white;
  78. position: relative;
  79. background: #09172c;
  80. .top-bg {
  81. width: 100%;
  82. height: 73px;
  83. background: var(--image-fire-title) no-repeat top;
  84. position: absolute;
  85. z-index: 1;
  86. .main-title {
  87. height: 80px;
  88. font-family: 'douyuFont';
  89. font-size: 26px;
  90. letter-spacing: 2px;
  91. display: flex;
  92. justify-content: center;
  93. align-items: center;
  94. padding: 0 0 10px 0;
  95. }
  96. }
  97. // 顶部中间样式块
  98. .center-info-bar {
  99. position: relative;
  100. top: 75px;
  101. left: 50%;
  102. transform: translateX(-50%);
  103. width: 900px;
  104. height: 160px;
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. background: url('@/assets/images/home-container/configurable/tashanhome/center-bar-bg.png') no-repeat center;
  109. .center-info-content {
  110. position: relative;
  111. top: 15px;
  112. background: url('@/assets/images/home-container/configurable/tashanhome/center-bar-circle.png') no-repeat center;
  113. width: 160px;
  114. height: 160px;
  115. text-align: center;
  116. .info-value {
  117. position: absolute;
  118. top: 34%;
  119. left: 50%;
  120. transform: translateX(-50%);
  121. font-family: 'douyuFont';
  122. font-size: 25px;
  123. color: #2cffdd;
  124. }
  125. .info-label {
  126. width: 100%;
  127. position: absolute;
  128. bottom: 25px;
  129. font-size: 17px;
  130. left: 50%;
  131. transform: translateX(-50%);
  132. }
  133. }
  134. .left-info-content {
  135. position: relative;
  136. text-align: right;
  137. .left-block {
  138. position: absolute;
  139. width: 190px;
  140. height: 55px;
  141. background: url('@/assets/images/home-container/configurable/tashanhome/leftbar-bg1.png') no-repeat right;
  142. padding-right: 52px;
  143. .info-value {
  144. height: 28px;
  145. line-height: 28px;
  146. font-family: 'douyuFont';
  147. font-size: 12px;
  148. color: var(--vent-gas-primary-text);
  149. }
  150. .info-label {
  151. height: 28px;
  152. line-height: 28px;
  153. }
  154. }
  155. .block1 {
  156. top: -70px;
  157. right: -5px;
  158. }
  159. .block2 {
  160. top: -15px;
  161. left: -280px;
  162. background: url('@/assets/images/home-container/configurable/tashanhome/leftbar-bg2.png') no-repeat right;
  163. .info-value {
  164. color: #2cffdd;
  165. }
  166. }
  167. .block3 {
  168. top: 40px;
  169. right: -5px;
  170. }
  171. }
  172. .right-info-content {
  173. position: relative;
  174. .right-block {
  175. position: absolute;
  176. width: 190px;
  177. height: 55px;
  178. background: url('@/assets/images/home-container/configurable/tashanhome/rightbar-bg1.png') no-repeat left;
  179. padding-left: 52px;
  180. .info-value {
  181. height: 28px;
  182. line-height: 28px;
  183. font-family: 'douyuFont';
  184. font-size: 12px;
  185. color: var(--vent-gas-primary-text);
  186. }
  187. .info-label {
  188. height: 28px;
  189. line-height: 28px;
  190. }
  191. }
  192. .block1 {
  193. top: -70px;
  194. left: -5px;
  195. }
  196. .block2 {
  197. top: -15px;
  198. right: -280px;
  199. background: url('@/assets/images/home-container/configurable/tashanhome/rightbar-bg2.png') no-repeat left;
  200. .info-value {
  201. color: #2cffdd;
  202. }
  203. }
  204. .block3 {
  205. top: 40px;
  206. left: -5px;
  207. }
  208. }
  209. }
  210. ::v-deep .dane-bd {
  211. background-repeat: no-repeat;
  212. background-position: center;
  213. background-size: 100% 100%;
  214. &.dane-w {
  215. background-image: var(--image-common-border3);
  216. }
  217. .dane-title {
  218. justify-content: space-around;
  219. padding: 0 50px 0 0;
  220. .common-navL {
  221. font-size: 14px;
  222. font-weight: bold;
  223. font-family: 'douyuFont';
  224. }
  225. }
  226. .dane-content {
  227. border: none;
  228. background: none;
  229. padding: 10px 35px;
  230. }
  231. }
  232. ::v-deep .table__content .table__content_list {
  233. width: 95%;
  234. }
  235. ::v-deep .table__content .table__content_label {
  236. width: 95%;
  237. }
  238. }
  239. </style>