Koishi před 3 roky
rodič
revize
833c8b92d2
1 změnil soubory, kde provedl 28 přidání a 21 odebrání
  1. 28 21
      src/views/powerCurve/index.vue

+ 28 - 21
src/views/powerCurve/index.vue

@@ -152,33 +152,40 @@ export default {
       that.API.requestData({
         method: "POST",
         subUrl: "scatter/scatterWtAjax",
+        showLoading: true,
         data: {
           wtId: that.wtId,
           year: that.recorddate.split("-")[0],
           month: that.recorddate.split("-")[1],
         },
         success(res) {
-          let chartLineData = {
-            xTitle: "风速",
-            yTitle: "功率",
-            legends: [],
-            data: [[], []],
-          };
-
-          res.data.line.forEach((ele) => {
-            chartLineData.data[0].push(ele[0]);
-            chartLineData.data[1].push(ele[1]);
-          });
-
-          let chartData = [
-            {
-              title: "功率曲线拟合",
-              value: res.data.scatter,
-            },
-          ];
-
-          that.chartLineData = chartLineData;
-          that.chartData = chartData;
+          if (res.data.line.length) {
+            let chartLineData = {
+              xTitle: "风速",
+              yTitle: "功率",
+              legends: [],
+              data: [[], []],
+            };
+
+            res.data.line.forEach((ele) => {
+              chartLineData.data[0].push(ele[0]);
+              chartLineData.data[1].push(ele[1]);
+            });
+
+            let chartData = [
+              {
+                title: "功率曲线拟合",
+                value: res.data.scatter,
+              },
+            ];
+
+            that.chartLineData = chartLineData;
+            that.chartData = chartData;
+          } else {
+            that.BASE.showMsg({
+              msg: "所选日期区间暂无数据",
+            });
+          }
         },
       });
     },