修改日志

boardTest
suixy 2 weeks ago
parent 06ecbcc11e
commit ed77186749

@ -112,13 +112,22 @@ export default {
}
return value;
})
console.log('收到全局WebSocket数据:', data)
// console.log('WebSocket:', data)
if (data.deviceParam) {
// 线
this.$bus.$emit('websocket-device-data', data)
}
this.isOnline[data.deviceParam.monitorId] = new Date().getTime()
console.log(data.deviceParam.monitorId)
if (data.monitorId && data.monitorId.toString().length === 9 && data.monitorId.toString()[0] === '9') {
let str1 = data.monitorId.toString()
let str2 = str1.slice(1)
let startStr = str2.slice(0, 4);
let endStr = str2.slice(4);
let key = 'E' + startStr + '_' + endStr;
this.isOnline[key] = new Date().getTime()
this.selectOffLineDevice()
}
@ -300,7 +309,7 @@ export default {
if (alarmData.deviceParam) {
//
if (alarmData.deviceParam.temperature &&
(alarmData.deviceParam.temperature > 50 || alarmData.deviceParam.temperature < -20)) {
(alarmData.deviceParam.temperature > 50 || alarmData.deviceParam.temperature < -20)) {
priority += 10 //
}
@ -369,7 +378,7 @@ export default {
},
saveLo(e) {
let localStorageData = localStorage.getItem('ERROR')
let data = {}
let data = []
if (localStorageData) {
data = JSON.parse(localStorageData)
}
@ -378,18 +387,18 @@ export default {
},
selectOffLineDevice() {
Object.keys(this.isOnline).forEach(key => {
// console.log(key, new Date().getTime() - this.isOnline[key])
if (new Date().getTime() - this.isOnline[key] > (1000 * 60 * 60)) {
console.log('error', key, parseTime(new Date().getTime()))
this.saveLo(key)
this.$confirm(`设备${key}已离线`, '设备离线', {
cancelButtonText: '关闭',
showConfirmButton: false,
type: 'error'
})
this.isOnline[key] = new Date().getTime()
// console.log(key, new Date().getTime() - this.isOnline[key])
if (new Date().getTime() - this.isOnline[key] > (1000 * 60 * 60)) {
console.log('error', key, parseTime(new Date().getTime()))
this.saveLo(key)
this.$confirm(`设备${key}已离线`, '设备离线', {
cancelButtonText: '关闭',
showConfirmButton: false,
type: 'error'
})
this.isOnline[key] = new Date().getTime()
}
}
}
)
}
}

Loading…
Cancel
Save