fix: 拓扑图节点排除LAN

This commit is contained in:
TsMask
2024-01-30 15:58:53 +08:00
parent 15ab2908be
commit 4d1b3d6a90
3 changed files with 25 additions and 21 deletions

View File

@@ -15,6 +15,8 @@ export const notNeNodes = [
'lan5',
'lan6',
'lan7',
'LAN',
'NR',
];
/**图状态 */
@@ -114,9 +116,10 @@ export function neStateParse(neType: string, data: Record<string, any>) {
const neS = nodes.find((n: any) => n.id === edgeSource);
const neT = nodes.find((n: any) => n.id === edgeTarget);
// console.log(neS, edgeSource, neT, edgeTarget);
// 通过 ID 查询节点实例
const item = graphG6.value.findById(edge.id);
if (neS && neT && item) {
if (neS && neT) {
// 通过 ID 查询节点实例
// const item = graphG6.value.findById(edge.id);
// console.log(
// `${edgeSource} - ${edgeTarget}`,
// neS.neState.online && neT.neState.online
@@ -136,16 +139,16 @@ export function neStateParse(neType: string, data: Record<string, any>) {
// });
// 设置状态
graphG6.value.setItemState(
item,
edge.id,
'line-dash',
neS.neState.online && neT.neState.online
);
}
if (neS && notNeNodes.includes(edgeTarget)) {
graphG6.value.setItemState(item, 'line-dash', neT.neState.online);
graphG6.value.setItemState(edge.id, 'line-path', neS.neState.online);
}
if (neT && notNeNodes.includes(edgeSource)) {
graphG6.value.setItemState(item, 'line-dash', neT.neState.online);
graphG6.value.setItemState(edge.id, 'line-path', neT.neState.online);
}
}
}