feat: 更新根网管节点处理逻辑,支持无OMC情况
This commit is contained in:
@@ -64,10 +64,50 @@ function fnGetList(refresh: boolean = false) {
|
||||
Array.isArray(res.data) &&
|
||||
res.data.length > 0
|
||||
) {
|
||||
// 根网管
|
||||
let rootNodeInfo = { neName: 'OMC_001' };
|
||||
const nodes = [];
|
||||
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) {
|
||||
item.serverState = {};
|
||||
// 节点
|
||||
@@ -96,7 +136,6 @@ function fnGetList(refresh: boolean = false) {
|
||||
height: 60,
|
||||
},
|
||||
});
|
||||
!rootNodeInfo.neName && (rootNodeInfo = item);
|
||||
} else {
|
||||
nodes.push({
|
||||
id: item.neName,
|
||||
|
||||
Reference in New Issue
Block a user