xsh 3 vuotta sitten
vanhempi
commit
d28a8c54c4
1 muutettua tiedostoa jossa 34 lisäystä ja 24 poistoa
  1. 34 24
      src/views/dashboard/dashboard.vue

+ 34 - 24
src/views/dashboard/dashboard.vue

@@ -461,7 +461,9 @@ export default {
             //   name: res.data.roomName,
             //   list: res.data.humidities
             // }
-            this.TempAndHumList = res.data;
+            if(res.data !== null ) {
+              this.TempAndHumList = res.data;
+            }
           }
           // getListWater(params).then(res => {
           //   if(res.code === 10000) {
@@ -621,37 +623,45 @@ export default {
             that.tempLoading = false;
             that.waterLoading = false;
             if (res1.code === 10000) {
-              const { money, quantity, warning, weekQuantity } =
+              if(res1.data !== null) {
+                const { money, quantity, warning, weekQuantity } =
                 res1.data || {};
-              that.iconList[0].num = warning;
-              that.iconList[1].num = quantity;
-              that.iconList[2].num = money;
-              that.iconList[3].num = weekQuantity;
+                that.iconList[0].num = warning;
+                that.iconList[1].num = quantity;
+                that.iconList[2].num = money;
+                that.iconList[3].num = weekQuantity;
+              }
               // that.incon
             }
             if (res2.code === 10000) {
-              that.TempAndHumList = res2.data;
+              if(res2.data !== null) {
+                that.TempAndHumList = res2.data;
+              }
             }
             if (res3.code === 10000) {
-              that.waterList = res3.data.data;
-              that.waterRoom = res3.data.room;
-              that.weekWater = res3.data.weekWater;
-              that.weekWeekPercent = res3.data.weekWeekPercent;
-              that.monthWater = res3.data.monthWater;
-              that.monthWeekPercent = res3.data.monthWeekPercent;
+              if(res3.data !== null) {
+                that.waterList = res3.data.data;
+                that.waterRoom = res3.data.room;
+                that.weekWater = res3.data.weekWater;
+                that.weekWeekPercent = res3.data.weekWeekPercent;
+                that.monthWater = res3.data.monthWater;
+                that.monthWeekPercent = res3.data.monthWeekPercent;
+              }
             }
             if (res4.code === 10000) {
-              that.monthSales = res4.data.nowMoney.toLocaleString();
-              that.monthAmount = res4.data.nowQuantity.toLocaleString();
-              that.weekSales = res4.data.money;
-              that.weekSalesChange = res4.data.moneyPercent;
-              that.weekSalesVolume = res4.data.quantity;
-              that.weekSalesVolumeChange = res4.data.quantityPercent;
-              that.salesChartData = {
-                moneyList: res4.data.moneyList,
-                quantityList: res4.data.quantityList,
-                timeList: res4.data.timeList,
-              };
+              if(res4.data !== null) {
+                that.monthSales = res4.data.nowMoney.toLocaleString();
+                that.monthAmount = res4.data.nowQuantity.toLocaleString();
+                that.weekSales = res4.data.money;
+                that.weekSalesChange = res4.data.moneyPercent;
+                that.weekSalesVolume = res4.data.quantity;
+                that.weekSalesVolumeChange = res4.data.quantityPercent;
+                that.salesChartData = {
+                  moneyList: res4.data.moneyList,
+                  quantityList: res4.data.quantityList,
+                  timeList: res4.data.timeList,
+                };
+              }
             }
           })
         );