feat: 更新根网管节点处理逻辑,支持无OMC情况

This commit is contained in:
TsMask
2025-10-15 11:42:27 +08:00
parent 26cf7fa560
commit 323da55c9d

View File

@@ -64,10 +64,50 @@ function fnGetList(refresh: boolean = false) {
Array.isArray(res.data) && Array.isArray(res.data) &&
res.data.length > 0 res.data.length > 0
) { ) {
// 根网管
let rootNodeInfo = { neName: 'OMC_001' };
const nodes = []; const nodes = [];
const edges = []; const edges = [];
// 根网管
let rootNodeInfo = {
neName: 'ROOT',
serverState: {
online: true,
},
};
// 处理没有OMC的情况
const omcFilter = res.data.filter(v => v.neType === 'OMC');
if (omcFilter.length === 1) {
rootNodeInfo.neName = omcFilter[0].neName;
} else {
nodes.unshift({
id: rootNodeInfo.neName,
label: rootNodeInfo.neName,
info: rootNodeInfo,
labelCfg: {
position: 'bottom',
offset: 8,
style: {
fill: '#fff',
fontSize: 14,
},
},
size: 60,
icon: {
x: -30,
y: -30,
// 可更换为其他图片地址
img: parseBasePath('/svg/service_db.svg'),
width: 60,
height: 60,
},
});
edges.push({
source: rootNodeInfo.neName,
target: rootNodeInfo.neName,
label: `${rootNodeInfo.neName}-${rootNodeInfo.neName}`,
});
}
for (const item of res.data) { for (const item of res.data) {
item.serverState = {}; item.serverState = {};
// 节点 // 节点
@@ -96,7 +136,6 @@ function fnGetList(refresh: boolean = false) {
height: 60, height: 60,
}, },
}); });
!rootNodeInfo.neName && (rootNodeInfo = item);
} else { } else {
nodes.push({ nodes.push({
id: item.neName, id: item.neName,