修改ws处理

boardTest
suixy 2 weeks ago
parent d43b114bc0
commit 3cc15a98e8

@ -121,23 +121,20 @@ export default {
console.log(data.deviceParam.monitorId) console.log(data.deviceParam.monitorId)
if (data.monitorId && data.monitorId.toString().length === 9 && (data.monitorId.toString()[0] === '9' )) { if (typeof data.monitorId === 'number' && !Number.isNaN(data.monitorId)) {
let str1 = data.monitorId.toString() if (data.monitorId && data.monitorId.toString().length === 9 && (data.monitorId.toString()[0] === '9')) {
let str2 = str1.slice(1) let str1 = data.monitorId.toString()
let startStr = str2.slice(0, 4); let str2 = str1.slice(1)
let endStr = str2.slice(4); let startStr = str2.slice(0, 4);
let key = 'E' + startStr + '_' + endStr; let endStr = str2.slice(4);
this.isOnline[key] = new Date().getTime() let key = 'E' + startStr + '_' + endStr;
this.selectOffLineDevice() this.isOnline[key] = new Date().getTime()
} this.selectOffLineDevice()
if (data.monitorId && data.monitorId.toString().length === 9 && ( data.monitorId.toString()[0] === 'E')) { }
let str1 = data.monitorId.toString() } else {
let str2 = str1.slice(1) let str1 = data.monitorId.slice(-10)
let startStr = str2.slice(0, 4); this.isOnline[str1] = new Date().getTime()
let endStr = str2.slice(5); this.selectOffLineDevice()
let key = 'E' + startStr + '_' + endStr;
this.isOnline[key] = new Date().getTime()
this.selectOffLineDevice()
} }
if (data.isFlag === 1 && data.alarmRules && data.alarmContents) { if (data.isFlag === 1 && data.alarmRules && data.alarmContents) {
@ -398,7 +395,6 @@ export default {
Object.keys(this.isOnline).forEach(key => { Object.keys(this.isOnline).forEach(key => {
// console.log(key, new Date().getTime() - this.isOnline[key]) // console.log(key, new Date().getTime() - this.isOnline[key])
if (new Date().getTime() - this.isOnline[key] > (1000 * 60 * 60)) { if (new Date().getTime() - this.isOnline[key] > (1000 * 60 * 60)) {
console.log('error', key, parseTime(new Date().getTime()))
this.saveLo(key) this.saveLo(key)
this.$confirm(`设备${key}已离线`, '设备离线', { this.$confirm(`设备${key}已离线`, '设备离线', {
cancelButtonText: '关闭', cancelButtonText: '关闭',

Loading…
Cancel
Save