Ver código fonte

历史弹框字段修改

123 1 ano atrás
pai
commit
0ff0c2a3d8

+ 13 - 6
src/views/runData/components/systemData/components/HistoryDialog.vue

@@ -78,7 +78,7 @@
         </t-tag>
       </div>
       <div
-        id="chartMain"
+        id="myChart"
         ref="EchartRef"
         style="width: 100%; height: 450px"
       ></div>
@@ -92,6 +92,7 @@ import { MessagePlugin } from 'tdesign-vue-next';
 import { formatTime } from '@/utils/date';
 import { getSystemHistory, histroyDownLoad } from '@/api/runData/index.ts';
 const EchartRef = ref(null);
+var myChart;
 const state = reactive({
   visible: false,
   dialogInfo: {},
@@ -109,8 +110,8 @@ const state = reactive({
     { value: 'ychswd', label: '一次回温' },
     { value: 'ycwdc', label: '一次温差' },
     { value: 'fmkd', label: '阀门开度' },
-    { value: 'ycgsyd', label: '一次供压' },
-    { value: 'ychsyd', label: '一次回压' },
+    { value: 'ycgsyl', label: '一次供压' },
+    { value: 'ychsyl', label: '一次回压' },
     { value: 'ycylc', label: '一次压差' },
     { value: 'ecgswd', label: '二次供温' },
     { value: 'echswd', label: '二次回温' },
@@ -214,7 +215,13 @@ const comporeTime = (startTime, endTime) => {
 const initChart = (list) => {
   nextTick(() => {
     const { legendArr, xAxisArr, seriesData } = filterData(list);
-    const myChars = echarts.init(EchartRef.value);
+
+    if (myChart != null && myChart != '' && myChart != undefined) {
+      myChart.dispose(); //销毁
+    }
+
+    myChart = echarts.init(EchartRef.value);
+
     let options = {
       tooltip: {
         trigger: 'axis',
@@ -239,8 +246,8 @@ const initChart = (list) => {
       },
       series: seriesData,
     };
-    myChars.setOption(options, true);
-    myChars.resize();
+    myChart.setOption(options, true);
+    myChart.resize();
   });
 };