소스 검색

update 2022-09-27

1. 调整部分图表 在后台数据为3或更多时 弹框不显示的问题
moccus 2 년 전
부모
커밋
e93fe4c6b4
1개의 변경된 파일22개의 추가작업 그리고 53개의 파일을 삭제
  1. 22 53
      src/views/NewPages/alarm-center-1.vue

+ 22 - 53
src/views/NewPages/alarm-center-1.vue

@@ -460,73 +460,42 @@ export default {
             // });
 
             that.Analysis = aList2;
-          } else if (res.data.length == 4) {
+          } else if (res.data.length >=3) {
             that.dialogVisible = true;
             BASE.closeLoading();
-            let aKey4 = [
-              "doubleValue",
-              "doubleValue",
-              "doubleValue",
-              "doubleValue",
-            ];
-            let aList4 = [
-              {
-                title: "",
-                // yAxisIndex:"",
-                smooth: true,
-                value: [],
-              },
-              {
-                title: "",
-                // yAxisIndex:"",
-                smooth: true,
-                value: [],
-              },
-              {
-                title: "",
-                // yAxisIndex:"",
-                smooth: true,
-                value: [],
-              },
-              {
-                title: "",
-                // yAxisIndex:"",
-                smooth: true,
-                value: [],
-              },
-            ];
+            let aList4 = []
             let yaxises2 = [
               {
                 name: "",
                 min: 0,
                 max: null,
-                unit: "",
-                position: "left",
+                unit: '',
+                position: 'left'
               },
               {
                 name: "",
                 min: 0,
                 max: null,
-                unit: "",
-                position: "right",
-              },
-            ];
-            yaxises2.forEach((aEle, aIndex) => {
-              res.data.forEach((rEle) => {
-                // aEle.name = rEle.name;
-                aEle.unit = rEle.unit;
-              });
+                unit: '',
+                position: 'right'
+              }
+            ]
+            res.data.forEach((aEle, keyIndex) => {
+              yaxises2[0].unit = aEle.unit
+              yaxises2[1].unit = aEle.unit
+              aList4.push({
+                title: aEle.name,
+                yAxisIndex: 0,
+                smooth: true,
+                value: aEle.data.map(o => {
+                  return {
+                    text: new Date(o.ts).formatDate("hh:mm"),
+                    value: o.doubleValue,
+                  }
+                }),
+              })
             });
             that.AnalysisYAxises = yaxises2;
-            aKey4.forEach((keyEle, keyIndex) => {
-              aList4[keyIndex].title = res.data[keyIndex].name;
-              res.data[keyIndex].data.forEach((rEle) => {
-                aList4[keyIndex].value.push({
-                  text: new Date(rEle.ts).formatDate("hh:mm"),
-                  value: rEle.doubleValue,
-                });
-              });
-            });
             that.Analysis = aList4;
           } else if (res.data.length == 0) {
             that.dialogVisible = false;