Browse Source

修改首页

chenbaoxin 4 months ago
parent
commit
990636ad28
1 changed files with 36 additions and 44 deletions
  1. 36 44
      src/views/HealthStatusAnalysis/index.vue

+ 36 - 44
src/views/HealthStatusAnalysis/index.vue

@@ -644,10 +644,10 @@ const runstatusMessage = (data: { label: string; state: 0 | 1 | 2 }) => {
 };
 const workMessage = (data: Object) => {
   // 获取工况数据 一小时来一次
-  data.forEach(element => {
-    element.type=Math.floor(Math.random() * 3)
+  // data.forEach(element => {
+  //   element.type=Math.floor(Math.random() * 3)
 
-  });
+  // });
   let currentValue=workParamsAllRef.value
   workParamsAllRef.value = currentValue.concat(data);
   workChange()
@@ -774,19 +774,19 @@ const healthyStatusText = ref({
 });
 let flag = false
 const healthyMessage = (data: Object) => {
-  if (data.avg_num == 99) {
-    if (flag) {
-      data.avg_num = 92
-      flag = false
-    } else {
-      data.avg_num = 98
-      flag = true
-    }
-  }
+  // if (data.avg_num == 99) {
+  //   if (flag) {
+  //     data.avg_num = 92
+  //     flag = false
+  //   } else {
+  //     data.avg_num = 98
+  //     flag = true
+  //   }
+  // }
 
   // 获取健康数据
   // let obj=determineHealthStatus(data.avg_num)
-  let obj=`${data.sha}(${data.avg_num}%)`
+  let obj=determineHealthStatus(`${data.sha}(${data.avg_num}%)`)
   healthyStatusText.value=obj
   xAxisData.value.push(moment(data.date).format('HH:mm:ss'));
   seriesData.value[0].data.push(data.avg_num)
@@ -802,38 +802,30 @@ interface HealthData {
   deviation_percentage: number;
   health_status: string;
 }
-const determineHealthStatus = (value: number): string => {
-  // let value=avgNum/100
-  // if (value < 1-0.10) {
-  //   return  {
-  //     name:`健康(${avgNum}%)`,
-  //     color:''
-  //   };
-  // } else if (value >= 1-0.10 && value <= 1-0.25) {
-  //   return {
-  //     name:`轻微异常(${avgNum}%)`,
-  //     color:'warn'
-  //   };
-  // } else if (value > 1-0.25 && value <= 1-0.75) {
-  //      return {
-  //     name:`故障(${avgNum}%)`,
-  //     color:'danger'
-  //   };
-  // } else if (value > 1-0.75) {
-  //      return {
-  //     name:`严重故障(${avgNum}%)`,
-  //     color:'error'
-  //   };
-  // }
-  // return "未知状态"; // 如果数据不在任何已定义的范围内
-  value=1-value
-  for (const item of gridData) {
-    const [min, max] = item.deviation_value.split('-').map(parseFloat);
-    if (value >= min && value <= max) {
-      return `${item.health_status} (${item.deviation_percentage}%)`;
-    }
+const determineHealthStatus = (value: string) => {
+  if (value.includes('健康')) {
+    return  {
+      name:value,
+      color:''
+    };
+  } else if (value.includes('轻微')) {
+    return {
+    name:value,
+      color:'warn'
+    };
+  } else if (value.includes('故障')) {
+       return {
+    name:value,
+      color:'danger'
+    };
+  } else if (value.includes('严重')) {
+       return {
+    name:value,
+      color:'error'
+    };
   }
-  return "未知状态";
+  return "未知状态"; // 如果数据不在任何已定义的范围内
+
 };
 const healthColor = (status: string) => {
   switch (status) {