From 2a622aa1d67780b81f9edc422afb7ebeb119fb82 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 21 Mar 2024 10:10:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=93=E6=89=91=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=AE=9A=E6=97=B6=E5=99=A8=E6=94=B9=E8=B0=83?= =?UTF-8?q?=E5=BA=A6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../overview/components/NeResources/index.vue | 2 +- src/views/dashboard/overview/index.vue | 27 +++++++++---------- .../monitor/topologyArchitecture/index.vue | 14 +++++----- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/views/dashboard/overview/components/NeResources/index.vue b/src/views/dashboard/overview/components/NeResources/index.vue index 29db6913..03fca534 100644 --- a/src/views/dashboard/overview/components/NeResources/index.vue +++ b/src/views/dashboard/overview/components/NeResources/index.vue @@ -1,5 +1,5 @@ diff --git a/src/views/monitor/topologyArchitecture/index.vue b/src/views/monitor/topologyArchitecture/index.vue index 89e27c02..cbc33109 100644 --- a/src/views/monitor/topologyArchitecture/index.vue +++ b/src/views/monitor/topologyArchitecture/index.vue @@ -328,16 +328,18 @@ function fnGraphDataLoad(reload: boolean = false) { } else { handleRanderGraph(graphG6Dom.value, graphState.data); } - fnGetState(); // 获取网元状态 + fnGetState(); + interval10s.value = setInterval(() => { + fnGetState(); // 获取网元状态 + }, 10_000); }); } -/**网元状态定时器 */ -const stateTimeout = ref(null); +/**网元状态调度器 */ +const interval10s = ref(null); /**查询网元状态 */ async function fnGetState() { - clearTimeout(stateTimeout.value); // 获取节点状态 for (const node of graphState.data.nodes) { if (notNeNodes.includes(node.id)) continue; @@ -352,8 +354,6 @@ async function fnGetState() { }, }); } - - stateTimeout.value = setTimeout(() => fnGetState(), 30_000); } /**接收数据后回调 */ @@ -472,7 +472,7 @@ onMounted(() => { onBeforeUnmount(() => { ws.close(); - clearTimeout(stateTimeout.value); + clearInterval(interval10s.value); });