diff --git a/src/App.vue b/src/App.vue index 71c6cc2..94cddcc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -54,7 +54,7 @@ const showOfflineDialog = (objid: string) => { connectAlarmReminder(() => {}); onAlarmReminderOvertime((device) => { - const objid = String(device?.objid ?? ''); + const objid = String(device?.monitorId ?? ''); if (!objid) { return; } diff --git a/src/utils/alarmReminder.js b/src/utils/alarmReminder.js index b34f693..e44c961 100644 --- a/src/utils/alarmReminder.js +++ b/src/utils/alarmReminder.js @@ -1,7 +1,7 @@ const websocketUrl = 'ws://119.45.202.115:7181/ws'; const deviceDataTime = {}; const overtime = 1000 * 60 * 10; -// const overtime = 1000; +const intervalTime = 1000 * 30; let alarmReminderSocket = null; let overtimeTimer = null; let overtimeCallback = null; @@ -34,7 +34,7 @@ const updateDeviceDataTime = (payload) => { deviceDataTime[monitorId] = { objid: String(objid), - time: Date.now() + time: Date.now() + overtime }; }; @@ -53,7 +53,7 @@ const startOvertimeTimer = () => { Object.keys(deviceDataTime).forEach((monitorId) => { const item = deviceDataTime[monitorId]; - if (!item || now - item.time <= overtime) { + if (!item || now <= item.time) { return; } @@ -61,7 +61,7 @@ const startOvertimeTimer = () => { monitorId, ...item }); - delete deviceDataTime[monitorId]; + item.time = now + intervalTime; }); }, 1000); }; @@ -116,4 +116,4 @@ export const closeAlarmReminder = () => { overtimeCallback = null; }; -export { websocketUrl, deviceDataTime, overtime }; +export { websocketUrl, deviceDataTime, overtime, intervalTime };