Selaa lähdekoodia

提交设备详情

wangming 1 kuukausi sitten
vanhempi
commit
aa1f8028e9
1 muutettua tiedostoa jossa 12 lisäystä ja 7 poistoa
  1. 12 7
      src/pagesA/deviceDetail/deviceDetail.vue

+ 12 - 7
src/pagesA/deviceDetail/deviceDetail.vue

@@ -1012,14 +1012,19 @@ export default {
 
         if (this.mqttData) {
             this.mqttData.on("message", (topic, message) => {
-                console.log("topic", topic, message);
-                const match = topic.match(/^\/dev\/(.+)\/tracker_targets$/);
-                if (!match) {
+                const dataMatch = topic.match(/^\/dev\/(.+)\/tracker_targets$/);
+                const cmdMatch = topic.match(/^\/mps\/wx_(.+)\/notice$/);
+                if (dataMatch) {
+                    if (dataMatch[1] === clientId) {
+                        this.handleMessage(topic, message, clientId);
+                    } else {
+                        console.log(
+                            "非本页面 clientId 的点位消息,忽略:",
+                            topic
+                        );
+                    }
+                } else if (cmdMatch) {
                     this.$refs.alarmModel.hanOtherMessage(topic, message);
-                    return;
-                }
-                if (match[1] == clientId) {
-                    this.handleMessage(topic, message, clientId);
                 }
             });
         }