whj há 2 anos atrás
pai
commit
4f7f385cda
1 ficheiros alterados com 12 adições e 4 exclusões
  1. 12 4
      src/views/remote/opc-log/modules/Detail.vue

+ 12 - 4
src/views/remote/opc-log/modules/Detail.vue

@@ -25,7 +25,7 @@
             <a-select-option value="3">
               1小时
             </a-select-option>
-<!--            <a-select-option value="4">
+            <!--            <a-select-option value="4">
               3小时
             </a-select-option>
             <a-select-option value="5">
@@ -151,6 +151,14 @@ export default {
       ]
     }
   },
+  watch: {
+    chartsData: {
+      handler (newDate) {
+        this.chart.changeData(newDate)
+      },
+      deep: true
+    }
+  },
   created () {
     // 下拉框map
     this.map = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_OPC)
@@ -163,7 +171,7 @@ export default {
       this.model = record
       this.onChange(1)
     },
-    getCharts (data) {
+    getCharts () {
       this.chart && this.chart.destroy()// 防止点击搜索按钮新增一个
       const data1 = [
         { time: '1991', value: 3 },
@@ -187,7 +195,7 @@ export default {
       })
 
       // data 数据
-      this.chart.data(data)
+      this.chart.data(this.chartsData)
       // scale 度量配置, 生成坐标轴刻度值
 
       // tooltip 提示信息,是指当鼠标悬停在图形上时,以提示框的形式展示该点的数据
@@ -219,7 +227,7 @@ export default {
           this.$message.info('无数据')
         }
         this.chartsData = JSON.parse(this.model.dataJsonStr)
-        this.getCharts(this.chartsData)
+        // this.getCharts(this.chartsData)
         this.confirmLoading = false
       }).catch(() => {
         this.confirmLoading = false