whj 2 yıl önce
ebeveyn
işleme
355bc3a739
1 değiştirilmiş dosya ile 8 ekleme ve 4 silme
  1. 8 4
      src/views/remote/opc-log/modules/Detail.vue

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

@@ -154,6 +154,7 @@ export default {
   watch: {
     chartsData: {
       handler (newDate) {
+        console.log(this.chart.changeData)
         this.chart.changeData(newDate)
       },
       deep: true
@@ -163,6 +164,8 @@ export default {
     // 下拉框map
     this.map = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_OPC)
   },
+  mounted () {
+  },
   methods: {
     base (record) {
       this.visible = true
@@ -172,7 +175,7 @@ export default {
       this.onChange(1)
     },
     getCharts () {
-      this.chart && this.chart.destroy()// 防止点击搜索按钮新增一个
+      // this.chart && this.chart.destroy()// 防止点击搜索按钮新增一个
       const data1 = [
         { time: '1991', value: 3 },
         { time: '1992', value: 4 },
@@ -195,7 +198,7 @@ export default {
       })
 
       // data 数据
-      this.chart.data(this.chartsData)
+      this.chart.data(data1)
       // scale 度量配置, 生成坐标轴刻度值
 
       // tooltip 提示信息,是指当鼠标悬停在图形上时,以提示框的形式展示该点的数据
@@ -227,7 +230,9 @@ export default {
           this.$message.info('无数据')
         }
         this.chartsData = JSON.parse(this.model.dataJsonStr)
-        // this.getCharts(this.chartsData)
+        if (!this.chart) {
+          this.getCharts(this.chartsData)
+        }
         this.confirmLoading = false
       }).catch(() => {
         this.confirmLoading = false
@@ -244,7 +249,6 @@ export default {
       this.visible = false
       this.confirmLoading = false
       this.searchDay = 1
-      this.chart = null
       this.chartsData = []
       this.$emit('ok')
     }