From 33292ca9b85e40868dc18ca44ade04e5c464f285 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Tue, 12 Nov 2024 09:17:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=98=85=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/lineApp.ts | 7 ++++--- src/drawApp/lineNetApp.ts | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/drawApp/lineApp.ts b/src/drawApp/lineApp.ts index 1073ca6..034a238 100644 --- a/src/drawApp/lineApp.ts +++ b/src/drawApp/lineApp.ts @@ -267,12 +267,12 @@ export function cancelSubscribe(lineApp: IGraphicApp) { if (lineId) { lineApp.unsubscribe(`/queue/line/${lineId}/device`); lineApp.unsubscribe(`/queue/line/${lineId}/train`); - const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations.forEach((destination) => { lineApp.unsubscribe(destination); }); } } +let monitorDestinations: string[] = []; function handleSubscribe(lineApp: IGraphicApp) { const lineStore = useLineStore(); const lineId = lineStore.lineId; @@ -327,7 +327,8 @@ function handleSubscribe(lineApp: IGraphicApp) { }); const lineNetStore = useLineNetStore(); const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations = getMonitorPath(userStore.roles).destinations; + monitorDestinations.forEach((destination) => { lineApp.subscribe({ destination, messageHandle: (message: Uint8Array) => { diff --git a/src/drawApp/lineNetApp.ts b/src/drawApp/lineNetApp.ts index e513184..ab23b88 100644 --- a/src/drawApp/lineNetApp.ts +++ b/src/drawApp/lineNetApp.ts @@ -151,11 +151,12 @@ export async function loadLineNetDatas(): Promise { export function cancelSubscribe(lineNetApp: IGraphicApp) { lineNetApp.unsubscribe('/queue/lineNet'); - const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations.forEach((destination) => { lineNetApp.unsubscribe(destination); }); } + +let monitorDestinations: string[] = []; export function handleSubscribe(lineNetApp: IGraphicApp) { const lineNetStore = useLineNetStore(); lineNetApp.enableWsMassaging({ @@ -175,7 +176,8 @@ export function handleSubscribe(lineNetApp: IGraphicApp) { }, }); const userStore = useUserStore(); - getMonitorPath(userStore.roles).destinations.forEach((destination) => { + monitorDestinations = getMonitorPath(userStore.roles).destinations; + monitorDestinations.forEach((destination) => { lineNetApp.subscribe({ destination, messageHandle: (message: Uint8Array) => {