warnMonitor.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div class="fusion-home">
  3. <div class="top-bg">
  4. <NewNav Title="预警监测管控系统" />
  5. </div>
  6. <template v-if="!route.query.deviceType">
  7. <div class="main-container">
  8. <ModuleDustNew
  9. v-for="(cfg, index) in configs"
  10. :key="cfg.deviceType + index"
  11. :show-style="cfg.showStyle"
  12. :module-data="cfg.moduleData"
  13. :module-name="cfg.moduleName"
  14. :device-type="cfg.deviceType"
  15. :data="data"
  16. :visible="true"
  17. />
  18. </div>
  19. </template>
  20. <div class="center-area">
  21. <CenterAreaWarn :echartData="paramData"></CenterAreaWarn>
  22. </div>
  23. </div>
  24. </template>
  25. <script lang="ts" setup>
  26. import { onMounted, onUnmounted, reactive, ref } from 'vue';
  27. import { useInitConfigs, useInitPage } from '../hooks/useInit';
  28. import ModuleDustNew from './components/ModuleDustNew.vue';
  29. import CenterAreaWarn from './components/center-area-warn.vue';
  30. import { useRoute } from 'vue-router';
  31. import { useGlobSetting } from '/@/hooks/setting';
  32. import { testConfigWarnMonitor } from '../configurable.data';
  33. import NewNav from './components/NewNavFire.vue';
  34. import { getTotal, getDisasterProportion } from '../configurable.api';
  35. const { title = '智能通风管控系统' } = useGlobSetting();
  36. const { configs, fetchConfigs } = useInitConfigs();
  37. const { data, updateData } = useInitPage(title);
  38. const route = useRoute();
  39. const paramData = reactive<any>({});
  40. // https获取监测数据
  41. let timer: null | NodeJS.Timeout = null;
  42. function getMonitor(flag = false) {
  43. timer = setTimeout(
  44. async () => {
  45. getTotal({}).then(updateData);
  46. getCenterList();
  47. if (timer) {
  48. timer = null;
  49. }
  50. getMonitor();
  51. },
  52. flag ? 0 : 20000
  53. );
  54. }
  55. async function getCenterList() {
  56. let res = await getTotal({});
  57. paramData.fire = res.info.sysInfo.fireS.maxLevel;
  58. paramData.tf = res.info.sysInfo.ventS.maxLevel;
  59. paramData.ws = res.info.sysInfo.gasS.maxLevel;
  60. paramData.sb = res.info.deviceWarnInfo.maxLevel;
  61. paramData.fc = res.info.sysInfo.dustS.maxLevel;
  62. paramData.riskLevel = res.info.riskLevel;
  63. let Levels = Object.assign({}, await getDisasterProportion({}));
  64. paramData.levels =
  65. Levels.level > 0 && Levels.level <= 1
  66. ? 101
  67. : Levels.level > 1 && Levels.level <= 2
  68. ? 102
  69. : Levels.level > 2 && Levels.level <= 3
  70. ? 103
  71. : Levels.level > 3 && Levels.level <= 4
  72. ? 104
  73. : 0;
  74. paramData.riskData = [
  75. { name: '通风', value: Levels.vent },
  76. { name: '火灾', value: Levels.fire },
  77. { name: '瓦斯', value: Levels.gas },
  78. { name: '粉尘', value: Levels.dust },
  79. ];
  80. }
  81. onMounted(() => {
  82. fetchConfigs('fusion-warn-green').then(() => {
  83. configs.value = testConfigWarnMonitor;
  84. // updateEnhancedConfigs(configs.value);
  85. // Promise.resolve(BDFireMock).then(updateData);
  86. getMonitor(true);
  87. });
  88. });
  89. onUnmounted(() => {
  90. clearTimeout(timer);
  91. timer = undefined;
  92. });
  93. </script>
  94. <style lang="less" scoped>
  95. @import '/@/design/theme.less';
  96. @font-face {
  97. font-family: 'douyuFont';
  98. src: url('/@/assets/font/douyuFont.otf');
  99. }
  100. .fusion-home {
  101. width: 100%;
  102. height: 100%;
  103. position: relative;
  104. .top-bg {
  105. width: 100%;
  106. height: 56px;
  107. background: url('@/assets/images/home-warn/1-1.png') no-repeat center;
  108. position: absolute;
  109. z-index: 1;
  110. .main-title {
  111. height: 56px;
  112. color: #fff;
  113. font-family: 'douyuFont';
  114. font-size: 20px;
  115. letter-spacing: 2px;
  116. display: flex;
  117. justify-content: center;
  118. align-items: center;
  119. }
  120. .top-nav {
  121. position: absolute;
  122. top: 0;
  123. width: 880px;
  124. height: 100%;
  125. display: flex;
  126. justify-content: flex-start;
  127. }
  128. }
  129. .main-container {
  130. width: 100%;
  131. height: 100%;
  132. background: url('@/assets/images/home-warn/bg.png') no-repeat;
  133. background-size: 100% 100%;
  134. .left-area {
  135. position: absolute;
  136. left: 0;
  137. top: 0;
  138. width: 420px;
  139. height: 100%;
  140. padding: 15px;
  141. box-sizing: border-box;
  142. overflow-y: auto;
  143. }
  144. .bottom-area {
  145. position: absolute;
  146. left: 435px;
  147. bottom: 0;
  148. width: calc(100% - 435px);
  149. height: 290px;
  150. padding: 15px;
  151. box-sizing: border-box;
  152. }
  153. .right-area {
  154. position: absolute;
  155. right: 0px;
  156. top: 0px;
  157. width: 420px;
  158. height: calc(100% - 305px);
  159. padding: 15px 15px 0px 15px;
  160. box-sizing: border-box;
  161. overflow-y: auto;
  162. }
  163. }
  164. .center-area {
  165. position: absolute;
  166. left: 450px;
  167. top: 0;
  168. width: calc(100% - 900px);
  169. height: calc(100% - 270px);
  170. }
  171. }
  172. :deep(.loading-box) {
  173. position: unset;
  174. }
  175. </style>