Explorar o código

报警信息数据对接

wyh hai 1 ano
pai
achega
6c7bdc2872

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

@@ -255,7 +255,10 @@ export default {
       if(this.isFullWebSocket){
         this.curveModelData = redata['设备历史值']
       }
-      this.newAlarmData = redata['最新一条报警信息']
+      // 旧版本
+      // this.newAlarmData = redata['最新一条报警信息']
+      // 新版本
+      this.newAlarmData = redata['最近24H报警信息']
       this.yuzhiData = redata['预制曲线']
       this.yuzhiMarkData = redata['预制曲线线段']
       // this.$refs.yuzhiCurve.markData = this.yuzhiMarkData

+ 15 - 6
src/views/modules_guAn/visualization/modules/EquipmentInfo.vue

@@ -112,9 +112,9 @@ export default {
       }
     },
     alarmData: {
-      type: Object,
+      type: Array,
       default: function(){
-        return {} // 使用工厂函数返回默认值
+        return [] // 使用工厂函数返回默认值
       }
     }
   },
@@ -161,8 +161,11 @@ export default {
       time2: '',
       inform1: '',
       inform2: '',
-      inform: ['Data 1', 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6', 'Data 7', 'Data 8', 'Data 9'],
-      time: ['time 1', 'time 2', 'time 3', 'time 4', 'time 5', 'time 6', 'time 7', 'time 8', 'time 9'],
+      inform: [],
+      time: [],
+      // 测试
+      // inform: ['Data 1', 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6', 'Data 7', 'Data 8', 'Data 9'],
+      // time: ['time 1', 'time 2', 'time 3', 'time 4', 'time 5', 'time 6', 'time 7', 'time 8', 'time 9'],
       counter: 0
     }
   },
@@ -181,8 +184,14 @@ export default {
         console.log(777777,newValue, oldValue)
         var hasAlarm = newValue
         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.information = hasAlarm ? newValue.tagname : '暂无数据'
+        // this.alarmTime = hasAlarm ?  new Date(newValue.logtime.time).toLocaleDateString('zh-CN', options) : ''
+        this.inform = hasAlarm ? newValue.map(res => {
+          return res.tagname
+        }): ['暂无数据']
+        this.time = hasAlarm ? newValue.map(res => {
+          return res.logtime
+        }): []
       },
       immediate: true,
       deep: true