fix: 拓扑状态刷新定时器改调度器
This commit is contained in:
@@ -27,12 +27,11 @@ function fnRanderData() {
|
|||||||
graphG6.value = randerGroph(t, graphG6Dom.value, graphG6Data);
|
graphG6.value = randerGroph(t, graphG6Dom.value, graphG6Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**网元状态定时器 */
|
/**网元状态调度器 */
|
||||||
const stateTimeout = ref<any>(null);
|
const interval10s = ref<any>(null);
|
||||||
|
|
||||||
/**查询网元状态 */
|
/**查询网元状态 */
|
||||||
async function fnGetState() {
|
async function fnGetState() {
|
||||||
clearTimeout(stateTimeout.value);
|
|
||||||
for (const node of graphG6Data.nodes) {
|
for (const node of graphG6Data.nodes) {
|
||||||
const ne = node.info;
|
const ne = node.info;
|
||||||
// if (ne.neType === 'OMC') continue;
|
// if (ne.neType === 'OMC') continue;
|
||||||
@@ -48,7 +47,6 @@ async function fnGetState() {
|
|||||||
graphG6.value.setItemState(neShape, 'neState', ne.serverState.online);
|
graphG6.value.setItemState(neShape, 'neState', ne.serverState.online);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stateTimeout.value = setTimeout(() => fnGetState(), 30_000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**查询全部网元数据列表 */
|
/**查询全部网元数据列表 */
|
||||||
@@ -149,6 +147,9 @@ function fnGetList(refresh: boolean = false) {
|
|||||||
}
|
}
|
||||||
fnRanderData();
|
fnRanderData();
|
||||||
fnGetState();
|
fnGetState();
|
||||||
|
interval10s.value = setInterval(() => {
|
||||||
|
fnGetState(); // 获取网元状态
|
||||||
|
}, 10_000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
clearTimeout(stateTimeout.value);
|
clearInterval(interval10s.value);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user