From 50a146f922bd55d82281370990349be7fd9fc22e Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 29 Jan 2024 20:05:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9C=8B=E6=9D=BF=E6=8B=93=E6=89=91?= =?UTF-8?q?=E7=BD=91=E5=85=83=E7=8A=B6=E6=80=81=E7=A7=BB=E5=8A=A8index?= =?UTF-8?q?=E7=BB=9F=E4=B8=80ws?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../overview/components/Topology/index.vue | 31 --------- src/views/dashboard/overview/index.vue | 64 ++++++++++++++----- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/src/views/dashboard/overview/components/Topology/index.vue b/src/views/dashboard/overview/components/Topology/index.vue index 983ae936..907dec6f 100644 --- a/src/views/dashboard/overview/components/Topology/index.vue +++ b/src/views/dashboard/overview/components/Topology/index.vue @@ -14,9 +14,7 @@ import { notNeNodes, } from '../../hooks/useTopology'; import useI18n from '@/hooks/useI18n'; -import useWS from '../../hooks/useWS'; const { t } = useI18n(); -const { wsSend } = useWS(); /**图DOM节点实例对象 */ const graphG6Dom = ref(undefined); @@ -239,41 +237,12 @@ function fnGraphDataLoad(reload: boolean = false) { } else { handleRanderGraph(graphG6Dom.value, graphState.data); } - fnGetState(); // 获取网元状态 }); } -/**网元状态定时器 */ -const stateTimeout = ref(null); - -/**查询网元状态 */ -async function fnGetState() { - clearTimeout(stateTimeout.value); - // 获取节点状态 - for (const node of graphState.data.nodes) { - if (notNeNodes.includes(node.id)) continue; - const { neType, neId } = node.neInfo; - if (!neType || !neId) continue; - wsSend({ - requestId: `neState_${neType}_${neId}`, - type: 'ne_state', - data: { - neType: neType, - neId: neId, - }, - }); - } - - stateTimeout.value = setTimeout(() => fnGetState(), 10_000); -} - onMounted(() => { fnGraphDataLoad(false); }); - -onBeforeUnmount(() => { - clearTimeout(stateTimeout.value); -});