From 13c97d76348b5451381320aa54efa0706f38ecb6 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 31 十月 2024 08:49:52 +0800
Subject: [PATCH] 测点列表.xlsx

---
 src/views/data/point/DaPointChart.vue |   54 +++++++++++++++++++++++-------------------------------
 1 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/src/views/data/point/DaPointChart.vue b/src/views/data/point/DaPointChart.vue
index fabc2f6..ddc9a2d 100644
--- a/src/views/data/point/DaPointChart.vue
+++ b/src/views/data/point/DaPointChart.vue
@@ -63,9 +63,9 @@
     endTime: undefined,
   });
   const queryParams = reactive({
-    pointNo: "",
-    start: undefined,
-    end: undefined,
+    codes: [],
+    startDate: undefined,
+    endDate: undefined,
   })
   function getYMDHMS() {
     let timestamp = new Date().getTime();
@@ -119,34 +119,27 @@
     visible.value = true;
     if (dataForm.value.id) {
       try {
-        queryParams.pointNo=dataForm.value.pointNo;
-        queryParams.start = dataForm.value.startTime;
-        queryParams.end = dataForm.value.endTime;
+        queryParams.codes=[dataForm.value.pointNo];
+        queryParams.startDate = dataForm.value.startTime;
+        queryParams.endDate = dataForm.value.endTime;
         const data = await DaPoint.getPointDaChart(queryParams)
-        const dataList = [];
-        const xAxisData = [];
-        data[dataForm.value.pointNo].forEach(function (value) {
-          // 判断数据是否为布尔型
-          if (typeof value["value"] === "boolean") {
-            value["value"] = value["value"]? 1 : 0;
-          }
-          dataList.push([value["time"], value["value"]]);
-          xAxisData.push(value["time"]);
-        });
-        let seriesData = [];
-        seriesData.push({
-          name: "采集值",
-          type: "line",
-          data: dataList,
-          showSymbol: false,
-          smooth: false,
-          lineStyle: {
-            normal: {
-              color: "#5B8FF9",
-              width: 1,
+        let seriesData = []
+        data.series.forEach(item => {
+          seriesData.push({
+            name: item.name,
+            type: "line",
+            data: item.data,
+            showSymbol: true,
+            smooth: false,
+            lineStyle: {
+              normal: {
+                color: "#5B8FF9",
+                width: 1,
+              },
             },
-          },
-        });
+          });
+        })
+
         myChart = echarts.init(chartDom.value);
         const option = {
           title: {
@@ -182,7 +175,7 @@
           xAxis: {
             type: "category",
             boundaryGap: false,
-            data: xAxisData,
+            data: data.categories,
           },
           yAxis: {
             type: "value",
@@ -194,7 +187,6 @@
           ],
           series: seriesData,
         };
-        myChart.clear();
         myChart.setOption(option);
       } catch (error) {
         console.error(error)

--
Gitblit v1.9.3