From 346adb79f263ae12193758e1c9be227e5f913246 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 19 十二月 2023 15:30:20 +0800
Subject: [PATCH] 新项目

---
 src/views/monitorData/gasData/index.vue |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/views/monitorData/gasData/index.vue b/src/views/monitorData/gasData/index.vue
index 043df7a..fe4ad87 100644
--- a/src/views/monitorData/gasData/index.vue
+++ b/src/views/monitorData/gasData/index.vue
@@ -38,7 +38,7 @@
                     </el-button>
                 </el-form>
             </div>
-            <div id="gasChart" style="height: 500px;width: auto"></div>
+            <div :id="gasChart" style="height: 500px;width: auto"></div>
             <el-table :data="state.tableData.data" style="width: 100%;margin-top: 20px" v-loading="loading">
                 <el-table-column type="index" label="序号" width="80" />
                 <el-table-column align="center" prop="time" label="采集时间"/>
@@ -93,6 +93,7 @@
         gasList: []
     }
 });
+const gasChart = ref("eChartgasN" + Date .now() + Math .random())
 
 const chooseTime = (val: any) => {
     let sTime = Date.parse(new Date(val[0]));
@@ -149,8 +150,6 @@
                 return item.gasValue;
             })
             dataZoomEnd.value = xData.value.length > 25 ? 30 : 100;
-            markLines.value = 110;
-
         }else {
             xData.value = [];
             yData.value = [];
@@ -195,7 +194,10 @@
     let res = await gasManageApi().getGas({});
     if(res.data.code == 100) {
         state.tableData.gasList = res.data.data;
+        console.log("气体",state.tableData.gasList)
+        //默认选择第一个气体
         state.tableData.listQuery.searchParams.gas = state.tableData.gasList[0].id;
+        markLines.value = state.tableData.gasList[0].threshold;
         initInfoData();
     }else {
         ElMessage({
@@ -216,12 +218,17 @@
 };
 const search = () => {
     state.tableData.listQuery.pageIndex = 1;
+    const gasObj = state.tableData.gasList.filter(item => {
+        return item.id == state.tableData.listQuery.searchParams.gas
+    });
+    markLines.value = gasObj[0].threshold;
+
     initInfoData();
-    console.log("vla",state.tableData.listQuery.searchParams)
 }
 const reset = () => {
     getNowTime();
     state.tableData.listQuery.searchParams.gas = state.tableData.gasList[0].id;
+    markLines.value = state.tableData.gasList[0].threshold;
     state.tableData.listQuery.pageIndex = 1;
     initInfoData();
 }
@@ -230,7 +237,7 @@
     if (myChart.value != null && myChart.value != "" && myChart.value != undefined) {
         myChart.value.dispose();
     }
-     myChart.value = echarts.init(document.getElementById('gasChart'));
+     myChart.value = echarts.init(document.getElementById(gasChart.value));
     // 指定图表的配置项和数据
     const option = {
         tooltip: {

--
Gitblit v1.9.2