From 778f36da39618e73d362f70de5fd77be57b34fb7 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 31 十二月 2024 14:52:53 +0800
Subject: [PATCH] 调度方案配置界面优化

---
 src/views/model/pre/item/MmPredictItemChart.vue |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/views/model/pre/item/MmPredictItemChart.vue b/src/views/model/pre/item/MmPredictItemChart.vue
index 3fd55b5..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();
   }
 }
@@ -102,7 +104,7 @@
       }
 
       let seriesData = []
-      if (data.lastTime) {
+      if (data.predictTime) {
         seriesData.push({
           name: '',
           data: [null],
@@ -116,11 +118,11 @@
               width: 2
             },
             data: [{
-              xAxis: data.lastTime
+              xAxis: data.predictTime
             }],
             label: {
               normal: {
-                formatter: data.lastTime
+                formatter: data.predictTime
               }
             },
             symbol: ['circle', 'none'],
@@ -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,
@@ -217,15 +220,15 @@
 const exportLoading = ref(false)
 const handleExport = async () => {
   chartParams.itemId = dataForm.value.id;
-  chartParams.startTime = dataForm.value.startTime;
-  chartParams.endTime = dataForm.value.endTime;
+  chartParams.startTime = dataForm.value.startTime?dataForm.value.startTime:"";
+  chartParams.endTime = dataForm.value.endTime?dataForm.value.endTime:"";
   try {
     // 导出的二次确认
     await message.exportConfirm()
     // 发起导出
     exportLoading.value = true
-    /*const data = await DaPoint.exportDaPointValue(chartParams)
-    download.excel(data, dataForm.value.pointName + '.xls')*/
+    const data = await McsApi.exportPredictValue(chartParams)
+    download.excel(data, dataForm.value.itemName + '.xls')
   } catch {
   } finally {
     exportLoading.value = false

--
Gitblit v1.9.3