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'); }); } });