Quellcode durchsuchen

#669 历史健康趋图未显示缓存数据

zhangchuang vor 3 Monaten
Ursprung
Commit
8cf3db72ee
1 geänderte Dateien mit 35 neuen und 0 gelöschten Zeilen
  1. 35 0
      src/views/HealthStatusAnalysis/mock.vue

+ 35 - 0
src/views/HealthStatusAnalysis/mock.vue

@@ -628,6 +628,9 @@ const pageInit = async () => {
           data: its,
         };
       });
+      res.data.healths.forEach((item: any) => {
+        newHealthyMessage(item)
+      })
     }
   });
   // 处理接收到的消息
@@ -871,6 +874,9 @@ const mockStart = async (state: boolean = false) => {
           data: its,
         };
       });
+      resultCatch.data.healths.forEach((item: any) => {
+        newHealthyMessage(item)
+      })
     }
   } else {
     lineParamsAllRef.value = [];
@@ -1441,6 +1447,35 @@ const healthyStatusText = ref({
   color: "",
 });
 let flag = false;
+
+const newHealthyMessage = (data: Object) => {
+  console.log('newHealthyMessage ===>', data)
+  if (data.health == 99) {
+    if (flag) {
+      data.health = 92;
+      flag = false;
+    } else {
+      data.health = 98;
+      flag = true;
+    }
+  }
+
+  // 获取健康数据
+  // let obj=determineHealthStatus(data.avg_num)
+  let obj = determineHealthStatus(`${data.sha}(${data.health}%)`);
+  healthyStatusText.value = obj;
+  sessionStorage.setItem("healthyStatusText", JSON.stringify(data));
+  xAxisData.value.push(moment(data._ts).format("HH:mm:ss"));
+  seriesData.value[0].data.push(data.health);
+  let arr = seriesData.value[0].data;
+  seriesData.value = [
+    {
+      name: "趋势",
+      data: arr,
+    },
+  ];
+};
+
 const healthyMessage = (data: Object) => {
   if (data.avg_num == 99) {
     if (flag) {