Browse Source

scada历史曲线弹框处理

liangluogis 1 year ago
parent
commit
b5a6c8c420
1 changed files with 20 additions and 29 deletions
  1. 20 29
      src/views/zhpt/scada/scadaMonitorAll/components/scadaMapCom.vue

+ 20 - 29
src/views/zhpt/scada/scadaMonitorAll/components/scadaMapCom.vue

@@ -563,7 +563,6 @@ export default {
       if (e.hasOwnProperty('zbx')) {
         zbx = e.zbx
       }
-
       this.siteVisible = true
       this.historyLoading = true
       // 默认查询当天的数据(不查询前一天的)
@@ -575,7 +574,6 @@ export default {
         [date.getFullYear(), date.getMonth() + 1, date.getDate()].join('-') +
         ' 23:59:59'
       ]
-
       const siteFilter = this.siteData.filter(item => {
         return item.id == stid
       })
@@ -583,34 +581,27 @@ export default {
         // 设置历史标题
         this.siteTitle = siteFilter[0].scadaEntity.name
       }
-
-      getScadaMonitor({ deviceId: stid }).then((res) => {
-        if (res.code == 1) {
-          res = res.result[0]
-          this.selectSite = res
-          var index = (this.selectZBXIndex = {})
-          const allocations = res.allocations.sort((a, b) => { return parseInt(a.sortNumber) - parseInt(b.sortNumber) })
-          this.sites = allocations.map((e) => {
-            index[e.variableCode] = [e.displayName, e.unit]
-            return { value: e.variableCode, label: e.displayName }
-          })
-          if(this.sites&&this.sites.length>0){
-            this.siteType = zbx || this.sites[0].value
-            this.showResult()
+      this.$nextTick(e=>{
+        getScadaMonitor({ deviceId: stid }).then((res) => {
+          if (res.code == 1) {
+            res = res.result[0]
+            this.selectSite = res
+            var index = (this.selectZBXIndex = {})
+            const allocations = res.allocations.sort((a, b) => { return parseInt(a.sortNumber) - parseInt(b.sortNumber) })
+            this.sites = allocations.map((e) => {
+              index[e.variableCode] = [e.displayName, e.unit]
+              return { value: e.variableCode, label: e.displayName }
+            })
+            if(this.sites&&this.sites.length>0){
+              this.siteType = zbx || this.sites[0].value
+              this.showResult()
+            }
+          } else {
+            this.$message.error('获取测站失败!')
+            console.error(res)
+            this.siteVisible = false
           }
-
-          // this.$nextTick(() => {
-          //   this.historychart = this.$echarts.init(
-          //     this.$nextTick(() => { this.$refs.chart })
-          //   );
-          // });
-
-  
-        } else {
-          this.$message.error('获取测站失败!')
-          console.error(res)
-          this.siteVisible = false
-        }
+        })
       })
     },