From a2ae99209f79e5d2884220a26e81ef621e329400 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 11 Nov 2024 17:48:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=98=85=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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); }); });