From a61be15844013b0356a7aa754dc06d110f9d2e77 Mon Sep 17 00:00:00 2001 From: zhoule Date: Thu, 9 May 2024 18:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BA=8B=E4=BB=B6=E7=9B=91?= =?UTF-8?q?=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JiHeExpressway/components/HeaderMenu/WarningList.vue | 6 ++++++ .../pages/Home/components/Dialogs/PerceiveEvent/index.vue | 2 ++ .../Home/components/Dialogs/TrafficIncidents/index.vue | 3 +++ .../pages/control/event/event/EventDetailDialog/index.vue | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/HeaderMenu/WarningList.vue b/ruoyi-ui/src/views/JiHeExpressway/components/HeaderMenu/WarningList.vue index 4b6bff56..dbd28147 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/HeaderMenu/WarningList.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/HeaderMenu/WarningList.vue @@ -68,8 +68,14 @@ export default { computed: { }, mounted() { + //添加全局事件监听 + this.$root.$on('refresh-event', this.getMainData); this.getMainData(); }, + beforeDestroy() { + // 在实例销毁前移除事件监听,防止内存泄漏 + this.$root.$off('refresh-event', this.getMainData); + }, methods: { onChangeTab(tab, event) { console.log(tab, event); diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/PerceiveEvent/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/PerceiveEvent/index.vue index 5d3ba978..9a59b27b 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/PerceiveEvent/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/PerceiveEvent/index.vue @@ -227,6 +227,8 @@ export default { }, "special" ); + //触发全局监听事件 + this.$root.$emit('refresh-event'); // markerClusterIns.setData(); }); }); diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue index 6a100d88..61307ba5 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/TrafficIncidents/index.vue @@ -168,7 +168,10 @@ export default { else this.$message.error(result?.msg); this.$emit('traffic-relieve', this.data); + //触发全局监听事件 + this.$root.$emit('refresh-event'); }); + }) .catch(() => { }); }, diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue index ed9b1bec..42fad4a7 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue @@ -262,6 +262,8 @@ export default { else Message.error(result?.msg); this.modelVisible = false; this.$emit("queryData", true); + //触发全局监听事件 + this.$root.$emit('delete-event'); }); } else { request({ @@ -272,6 +274,8 @@ export default { else Message.error(result?.msg); this.modelVisible = false; this.$emit("queryData", true); + //触发全局监听事件 + this.$root.$emit('delete-event'); }); } });