Browse Source

Merge branch 'master' of http://39.106.8.246:3003/sagacloud/sagacloud-manager-control

zhaojijng 2 years ago
parent
commit
cf91b03c80
1 changed files with 12 additions and 8 deletions
  1. 12 8
      src/pages/Environment/components/chartModal/lineChart.jsx

+ 12 - 8
src/pages/Environment/components/chartModal/lineChart.jsx

@@ -40,15 +40,19 @@ export default ({ paramObj, spaceId }) => {
       funcid: objId,
     };
     return queryPropertyData(params).then((res) => {
-      const max = res.dayTarget[0] && res.dayTarget[0][paramObj.maxType];
-      setLevelMax(max); // 最大值
-      res.propertyData.shift();
-      const arr = res.propertyData;
       let chartArr = [];
-      arr.forEach((itemArr) => {
-        const scales = itemArr[1] == '-9999' ? '--' : Number(itemArr[1].toFixed(paramObj.pointNum));
-        chartArr.push({ Date: dealTime(itemArr[0]), scales: scales, type: type });
-      });
+      if (res.dayTarget) {
+        const max = res.dayTarget[0] && res.dayTarget[0][paramObj.maxType];
+        setLevelMax(max); // 最大值
+        res.propertyData.shift();
+        const arr = res.propertyData;
+
+        arr.forEach((itemArr) => {
+          const scales =
+            itemArr[1] == '-9999' ? '--' : Number(itemArr[1].toFixed(paramObj.pointNum));
+          chartArr.push({ Date: dealTime(itemArr[0]), scales: scales, type: type });
+        });
+      }
       return chartArr;
     });
   };