Forráskód Böngészése

于涵——数据优化

wyh 1 éve%!(EXTRA string=óta)
szülő
commit
1d5c5b9e64

+ 3 - 1
src/views/modules_guAn/visualization/index.vue

@@ -261,7 +261,9 @@ export default {
       // 旧版本
       // this.newAlarmData = redata['最新一条报警信息']
       // 新版本
-      this.newAlarmData = redata['最近24H报警信息']
+      console.log('判断是否含有1',redata.hasOwnProperty('最近24H报警信息'))
+      console.log('判断是否含有2',redata['最近24H报警信息'])
+      this.newAlarmData = redata.hasOwnProperty('最近24H报警信息') ? redata['最近24H报警信息'] : ['原数据']
       this.yuzhiData = redata['预制曲线']
       this.yuzhiMarkData = redata['预制曲线线段']
       // this.$refs.yuzhiCurve.markData = this.yuzhiMarkData

+ 16 - 5
src/views/modules_guAn/visualization/modules/EquipmentInfo.vue

@@ -111,6 +111,7 @@ export default {
         return [] // 使用工厂函数返回默认值
       }
     },
+    // alarmData,
     alarmData: {
       type: Array,
       default: function(){
@@ -161,7 +162,7 @@ export default {
       time2: '',
       inform1: '',
       inform2: '',
-      inform: [],
+      inform: ['暂无数据'],
       time: [],
       // 测试
       // inform: ['Data 1', 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6', 'Data 7', 'Data 8', 'Data 9'],
@@ -186,12 +187,21 @@ export default {
         var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };
         // this.information = hasAlarm ? newValue.tagname : '暂无数据'
         // this.alarmTime = hasAlarm ?  new Date(newValue.logtime.time).toLocaleDateString('zh-CN', options) : ''
-        this.inform = hasAlarm ? newValue.map(res => {
+        var nInform = this.inform
+        var nTime = this.time
+        // ['原数据']表示按照原来数据进行,数据并未改变;[]和其他有数据的情况进行赋值并重新获取方法
+        // console.log(hasAlarm.length === 1 && hasAlarm[0] === '原数据')
+        var isYuan = hasAlarm.length === 1 && hasAlarm[0] === '原数据'
+        this.inform = !isYuan ? newValue.map(res => {
           return res.tagname
-        }): ['暂无数据']
-        this.time = hasAlarm ? newValue.map(res => {
+        }): nInform
+        this.time = hasAlarm.length > 0 ? newValue.map(res => {
           return res.logtime
-        }): []
+        }): nTime
+        // console.log(789, this.inform)
+        if(!isYuan){
+          this.showData()
+        }
       },
       immediate: true,
       deep: true
@@ -229,6 +239,7 @@ export default {
       }
     },
     showData() {
+      // console.log(7891,this.inform)
       // 如果还有数据未显示
       if (this.counter < this.inform.length) {
         // 显示当前计数器指向的数据

+ 9 - 1
src/views/modules_guAn/visualization/modules/RealTimeCurve.vue

@@ -278,7 +278,9 @@ export default {
       var shidu = data.find(item => item.name === '湿度实值-实时')
       var fushe = data.find(item => item.name === '辐射强度值-实时')
       var time = data.find(item => item.name === '实时曲线-时间分布')
-      // console.log('1111',wendu,shidu,fushe,time)
+      var wenduZ = data.find(item => item.name === '当前温度值')
+      var shiduZ = data.find(item => item.name === '当前湿度值')
+      // console.log('1111',wendu,shidu,fushe,time,wenduZ,shiduZ)
       this.wenduData = wendu ? wendu.subList.map(res =>{
         return res.tagvalue
       }) : []
@@ -288,6 +290,12 @@ export default {
       this.timeData = wendu ? wendu.subList.map(res =>{
         return res.transtime
       }) : []
+      if(wenduZ || shiduZ){
+        this.wenduData.push(wenduZ.subList[0].tagvalue)
+        this.shiduData.push(shiduZ.subList[0].tagvalue)
+        this.timeData.push(wenduZ.subList[0].transtime)
+      }
+      // console.log('2222',this.wenduData,this.shiduData,this.timeData)
       // this.wenduData = wendu ? wendu.Values : []
       // this.shiduData = shidu ? shidu.Values : []
       // this.fusheData = fushe ? fushe.Values : []