|
@@ -67,6 +67,7 @@ export default {
|
|
|
unreadAlarmCount: 0,
|
|
|
showFireAlarm: [],
|
|
|
// 刷新时间
|
|
|
+ timer: null,
|
|
|
refreshTime: 10 * 1000,
|
|
|
requestInProgress: false,
|
|
|
editUser: false,
|
|
@@ -171,8 +172,14 @@ export default {
|
|
|
this.requestInProgress = true;
|
|
|
let [err,res] = await handle(this.$axios.get('ai/unread'));
|
|
|
this.requestInProgress = false;
|
|
|
- setTimeout(() => {
|
|
|
+ if(this.timer)
|
|
|
+ {
|
|
|
+ clearTimeout(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
this.fetchAlarmCount();
|
|
|
+ this.timer = null;
|
|
|
}, this.refreshTime);
|
|
|
if(err){
|
|
|
return console.error(err);
|
|
@@ -184,17 +191,19 @@ export default {
|
|
|
if (this.unreadAlarmCount < 0) {
|
|
|
return
|
|
|
}
|
|
|
+ let isAdd = false;
|
|
|
// 寻找火情信息, 并进行去重
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
let alarmIndex = this.showFireAlarm.findIndex(item => item.alarmId === arr[i].alarmId);
|
|
|
// 判断是否有火情内容
|
|
|
if (alarmIndex === -1 && arr[i].arithmetic.includes(arithmeticEnum.fire.val)) {
|
|
|
this.showFireAlarm.push(arr[i]);
|
|
|
+ isAdd = true;
|
|
|
// 显示
|
|
|
}
|
|
|
}
|
|
|
// 有识别到火情, 则统一进行弹窗
|
|
|
- if(this.showFireAlarm.length){
|
|
|
+ if(isAdd){
|
|
|
this.fireAlarm(this.showFireAlarm.length - 1)
|
|
|
}
|
|
|
|