Selaa lähdekoodia

设备数量为空时显示为0

xujie 1 vuosi sitten
vanhempi
commit
ad70041974
1 muutettua tiedostoa jossa 14 lisäystä ja 14 poistoa
  1. 14 14
      src/views/menu/iot/envMonitor/index.vue

+ 14 - 14
src/views/menu/iot/envMonitor/index.vue

@@ -68,8 +68,8 @@ export default {
       waterCheckBadge: null,
       upsCheckBadge: null,
       airCheckBadge: null,
-      totalCount: null,
-      alarmCount: null,
+      totalCount: 0,
+      alarmCount: 0,
       dataInfo:{},
       tabName:"thiefCheck"
     }
@@ -157,28 +157,28 @@ export default {
     },
     tabActiveHandler(name){
       if (name === "thiefCheck"){
-        this.totalCount = this.dataInfo.thiefCount;
-        this.alarmCount = this.dataInfo.thiefAlarmCount;
+        this.totalCount = this.dataInfo.thiefCount === null ? 0 : this.dataInfo.thiefCount;
+        this.alarmCount = this.dataInfo.thiefAlarmCount === null ? 0 : this.dataInfo.thiefAlarmCount;
         this.search.deviceType = "41881";
       }else if (name === "infraredCheck"){
-        this.totalCount = this.dataInfo.infraredCount;
-        this.alarmCount = this.dataInfo.infraredAlarmCount;
+        this.totalCount = this.dataInfo.infraredCount === null ? 0 : this.dataInfo.infraredCount;
+        this.alarmCount = this.dataInfo.infraredAlarmCount === null ? 0 : this.dataInfo.infraredAlarmCount;
         this.search.deviceType = "4181";
       }else if (name === "doorCheck"){
-        this.totalCount = this.dataInfo.doorCount;
-        this.alarmCount = this.dataInfo.doorAlarmCount;
+        this.totalCount = this.dataInfo.doorCount === null ? 0 : this.dataInfo.doorCount;
+        this.alarmCount = this.dataInfo.doorAlarmCount === null ? 0 : this.dataInfo.doorAlarmCount;
         this.search.deviceType = "4188";
       }else if (name === "waterCheck"){
-        this.totalCount = this.dataInfo.waterCount;
-        this.alarmCount = this.dataInfo.waterAlarmCount;
+        this.totalCount = this.dataInfo.waterCount === null ? 0 : this.dataInfo.waterCount;
+        this.alarmCount = this.dataInfo.waterAlarmCount === null ? 0 : this.dataInfo.waterAlarmCount;
         this.search.deviceType = "4184";
       }else if (name === "upsCheck"){
-        this.totalCount = this.dataInfo.upsCount;
-        this.alarmCount = this.dataInfo.upsAlarmCount;
+        this.totalCount = this.dataInfo.upsCount === null ? 0 : this.dataInfo.upsCount;
+        this.alarmCount = this.dataInfo.upsAlarmCount === null ? 0 : this.dataInfo.upsAlarmCount;
         this.search.deviceType = "408";
       }else if (name === "airCheck"){
-        this.totalCount = this.dataInfo.airCount;
-        this.alarmCount = this.dataInfo.airAlarmCount;
+        this.totalCount = this.dataInfo.airCount === null ? 0 : this.dataInfo.airCount;
+        this.alarmCount = this.dataInfo.airAlarmCount === null ? 0 : this.dataInfo.airAlarmCount;
         this.search.deviceType = "415";
       }
       this.tabName = name;