ソースを参照

[Feat 0000] 预警看板对接

houzekong 5 ヶ月 前
コミット
e7bd251c71

+ 13 - 19
src/views/vent/home/billboard/billboard.data.ts

@@ -442,12 +442,12 @@ export const SUMMARY_COLUMN = [
 
 // 预警总览相关的内容配置项
 export const WARNING_CONFIG = [
-  { src: '', text: '监测总数', prop: 'total', prop2: 'total', id: 'warning_cfg_000' },
-  { src: SafetyIcon, text: '安全监测', prop: 'safety', prop2: 'safetyRisk', id: 'warning_cfg_005' },
-  { src: VentIcon, text: '通风', prop: 'vent', prop2: 'ventRisk', id: 'warning_cfg_004' },
-  { src: DustIcon, text: '粉尘', prop: 'dust', prop2: 'dustRisk', id: 'warning_cfg_003' },
-  { src: GasIcon, text: '瓦斯', prop: 'gas', prop2: 'gasRisk', id: 'warning_cfg_001' },
-  { src: FireIcon, text: '火灾', prop: 'fire', prop2: 'fireRisk', id: 'warning_cfg_002' },
+  { src: '', text: '监测总数', prop1: 'allNum', prop2: 'allNum', id: 'warning_cfg_000' },
+  { src: SafetyIcon, text: '安全监测', prop1: 'synthesizeSWarnInfo.totalNum', prop2: 'synthesizeSWarnInfo.maxWarnLevel', id: 'warning_cfg_005' },
+  { src: VentIcon, text: '通风', prop1: 'ventSWarnInfo.totalNum', prop2: 'ventSWarnInfo.maxWarnLevel', id: 'warning_cfg_004' },
+  { src: DustIcon, text: '粉尘', prop1: 'dustSWarnInfo.totalNum', prop2: 'dustSWarnInfo.maxWarnLevel', id: 'warning_cfg_003' },
+  { src: GasIcon, text: '瓦斯', prop1: 'gasSWarnInfo.totalNum', prop2: 'gasSWarnInfo.maxWarnLevel', id: 'warning_cfg_001' },
+  { src: FireIcon, text: '火灾', prop1: 'fireSWarnInfo.totalNum', prop2: 'fireSWarnInfo.maxWarnLevel', id: 'warning_cfg_002' },
 ];
 
 export const DEFAULT_TEST_DATA = {
@@ -617,19 +617,13 @@ export const DEFAULT_TEST_DATA = {
       },
     },
   },
-  warnInfo: {
-    total: 5,
-    vent: 1,
-    ventRisk: '低风险',
-    gas: 1,
-    gasRisk: '低风险',
-    dust: 1,
-    dustRisk: '低风险',
-    fire: 1,
-    fireRisk: '低风险',
-    safety: 1,
-    safetyRisk: '低风险',
-    maxLevel: 5,
+  warn: {
+    allNum: 19,
+    synthesizeSWarnInfo: { totalNum: '2', maxWarnLevel: '安全的' }, //安全监控
+    ventSWarnInfo: { totalNum: '2', maxWarnLevel: '安全的' }, //通风
+    dustSWarnInfo: { totalNum: '2', maxWarnLevel: '安全的' }, //粉尘
+    gasSWarnInfo: { totalNum: '2', maxWarnLevel: '安全的' }, //瓦斯
+    fireSWarnInfo: { totalNum: '2', maxWarnLevel: '安全的' }, //火灾
   },
   orgname: '/',
   orgcode: '/',

+ 11 - 16
src/views/vent/home/billboard/components/Warning.vue

@@ -5,8 +5,8 @@
       <div class="img"> <img :src="item.src" alt="" /> </div>
       <div class="text">{{ item.text }}</div>
       <div class="extra">监测数量</div>
-      <div class="num" :class="`warning-level_${warnData.maxLevel}`">{{ warnData[item.prop] }}</div>
-      <div class="risk" :class="`warning-level_${warnData.maxLevel}`">{{ warnData[item.prop2] }}</div>
+      <div class="num">{{ get(warnData, item.prop1) }}</div>
+      <div class="risk" :class="`warning-level_${get(warnData, item.prop2)}`">{{ get(warnData, item.prop2) }}</div>
     </div>
   </div>
 </template>
@@ -14,6 +14,7 @@
   import { shallowRef, onMounted } from 'vue';
   import { BillboardType, DEFAULT_TEST_DATA, WARNING_CONFIG } from '../billboard.data';
   import _ from 'lodash-es';
+  import { get } from '../utils';
 
   const props = withDefaults(
     defineProps<{
@@ -25,23 +26,17 @@
   );
   defineEmits(['click']);
 
-  const warnData = shallowRef<BillboardType['warningInfo']>({
-    total: 5,
-    vent: 1,
-    ventRisk: '低风险',
-    gas: 1,
-    gasRisk: '低风险',
-    dust: 1,
-    dustRisk: '低风险',
-    fire: 1,
-    fireRisk: '低风险',
-    safety: 1,
-    safetyRisk: '低风险',
-    maxLevel: 5,
+  const warnData = shallowRef<BillboardType['warn']>({
+    allNum: 19,
+    synthesizeSWarnInfo: { totalNum: '预警总数', maxWarnLevel: '最高预警级别' }, //安全监控
+    ventSWarnInfo: { totalNum: '预警总数', maxWarnLevel: '最高预警级别' }, //通风
+    dustSWarnInfo: { totalNum: '预警总数', maxWarnLevel: '最高预警级别' }, //粉尘
+    gasSWarnInfo: { totalNum: '预警总数', maxWarnLevel: '最高预警级别' }, //瓦斯
+    fireSWarnInfo: { totalNum: '预警总数', maxWarnLevel: '最高预警级别' }, //火灾
   });
 
   function fetchData() {
-    const info = props.data.warnInfo;
+    const info = props.data.warn;
     if (!info) return;
     warnData.value = info;
   }