warnMonitor.vue 4.5 KB

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