From 23c8b8154fcf7c9251d07f028f3e14737ba4cecd Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期二, 31 十二月 2024 19:04:35 +0800
Subject: [PATCH] 调度模型下发配置

---
 src/views/model/pre/item/MmPredictItemChart.vue |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/views/model/pre/item/MmPredictItemChart.vue b/src/views/model/pre/item/MmPredictItemChart.vue
index a0f867a..14afaed 100644
--- a/src/views/model/pre/item/MmPredictItemChart.vue
+++ b/src/views/model/pre/item/MmPredictItemChart.vue
@@ -58,8 +58,8 @@
 
 const message = useMessage() // 消息弹窗
 const visible = ref(false);
-const chartDomPre = ref(null);
-let myChart = null;
+const chartDomPre = ref();
+let myChart = undefined;
 const chartParams = reactive({
   itemId: undefined,
   startTime: undefined,
@@ -79,6 +79,8 @@
   dataForm.value.id = row.id;
   dataForm.value.itemName = row.itemname;
   if (row.id) {
+    myChart = echarts.init(chartDomPre.value);
+    myChart.clear()
     getDataList();
   }
 }
@@ -131,18 +133,20 @@
       if (data.viewMap) {
         Object.keys(data.viewMap).forEach(key => {
           let viewData = data.viewMap[key]
-          seriesData.push({
-            name: key + ":" + '真实值',
-            type: "line",
-            data: viewData.realData,
-            showSymbol: false,
-            smooth: false,
-            lineStyle: {
-              normal: {
-                width: 1,
+          if(viewData.realData) {
+            seriesData.push({
+              name: key + ":" + '真实值',
+              type: "line",
+              data: viewData.realData,
+              showSymbol: false,
+              smooth: false,
+              lineStyle: {
+                normal: {
+                  width: 1,
+                },
               },
-            },
-          })
+            })
+          }
           seriesData.push({
             name: key + ":" + '预测值',
             type: "line",
@@ -158,7 +162,6 @@
         })
       }
 
-      myChart = echarts.init(chartDomPre.value);
       const option = {
         title: {
           text: dataForm.value.itemName,

--
Gitblit v1.9.3