From 40e11e0d671eb3bf09b06c63e3629e22040ed307 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 11 Nov 2024 17:49:53 +0800 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit a2ae99209f79e5d2884220a26e81ef621e329400 Author: joylink_zhaoerwei Date: Mon Nov 11 17:48:52 2024 +0800 订阅调整 --- src/pages/AlarmInfoList.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/pages/AlarmInfoList.vue b/src/pages/AlarmInfoList.vue index c6bf285..1b12774 100644 --- a/src/pages/AlarmInfoList.vue +++ b/src/pages/AlarmInfoList.vue @@ -395,7 +395,10 @@ onMounted(() => { tableRef.value.requestServerInteraction(); lineNetStore.alarmInfoListTable = tableRef.value; destinations.forEach((destination) => { - socket = webSocketConnect(destination, handler); + allSocketsAndDestinations.push({ + socket: webSocketConnect(destination, handler), + destination, + }); }); }); }); @@ -584,7 +587,10 @@ function openAlarmDialog(row: any) { }); } -let socket: StompMessagingClient | null = null; +let allSocketsAndDestinations: { + socket: StompMessagingClient; + destination: string; +}[] = []; let destinations: string[] = []; function handler(message: Uint8Array) { const storage = alert.NccAlertInfoMessage.deserialize(message); @@ -592,8 +598,8 @@ function handler(message: Uint8Array) { } onUnmounted(() => { - destinations.forEach((destination) => { - closeWebSocketConnect(socket, destination); + allSocketsAndDestinations.forEach((info) => { + closeWebSocketConnect(info.socket, info.destination); }); });