Browse Source

fix: 修复告警弹窗异常

kindring 1 year ago
parent
commit
11857b80aa

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -773,7 +773,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 				int x2 = alarm.getIntValue("x2");
 				int y2 = alarm.getIntValue("y2");
 				String itemArithmetic = alarm.getString("arithmetic");
-				String similarity = String.valueOf(alarm.getDoubleValue("similarity"));
+				String similarity = alarm.getString("similarity");
 				String scoreStr = alarm.getString("score");
 				logger.info("Uid={}", uid);
 				if (uid != null && !uid.equals("-1")) {

+ 11 - 2
web_src/src/layout/UiHeader.vue

@@ -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)
         }