778ef458 by lihua

fix: 解决关系网问题

1 parent 09d852e0
......@@ -230,7 +230,7 @@ const initGraph = () => {
container: container,
width,
height,
// animate: false,
// animate: false,
plugins: [contextMenu, tooltip.value],
fitCenter: true,
fitView: true,
......@@ -247,6 +247,11 @@ const initGraph = () => {
}
const data = item.getModel();
data.collapsed = collapsed;
setTimeout(() => {
graph.focusItem(item, true, {
duration: 400 // 动画时长为500ms
});
}, 500)
return true;
},
shouldBegin: (e) => {
......@@ -472,7 +477,9 @@ const bindEvents = () => {
}
});
lastSelectNode.value = item;
detailInfo.value.guid = model.guid;
detailInfo.value = {};
// detailInfo.value.guid = model.guid;
detailInfoLabel.value = model.label || {};
updateTooltipPosition(evt);
detailLoading.value = true;
......
......@@ -7,8 +7,8 @@
<div className='g6-component-topbar'>
<graphTopbar ref="topBarRef" @displaySwitchChange="displaySwitchChange" :isGraphDisplay="isGraphDisplay" />
</div>
<RelationNetwork v-show="graphTreeData?.guid && isGraphDisplay" ref="relationNetworkRef" :tree-data="graphTreeData" :noContextMenu="true"
@nodeItemClick="handleNodeItemClick">
<RelationNetwork v-show="graphTreeData?.guid && isGraphDisplay" ref="relationNetworkRef" :tree-data="graphTreeData"
:noContextMenu="true" @nodeItemClick="handleNodeItemClick">
</RelationNetwork>
<Sankey v-show="!isGraphDisplay && (sankeyNames?.length || sankeyDataLoading)" v-loading="sankeyDataLoading"
:tree-data="sankeyData" :names="sankeyNames">
......@@ -112,8 +112,8 @@ const handleNodeItemClick = (graph, nodeItem) => {
nodeItem.getModel().collapsed = false;
parentData.collapsed = false;
graph.updateItem(nodeItem, {
...nodeItem.getModel(),
collapsed: false
...nodeItem.getModel(),
collapsed: false
});
graph.layout();
setTimeout(() => {
......@@ -128,6 +128,9 @@ const handleNodeItemClick = (graph, nodeItem) => {
graph.layout();
graph.setMinZoom(0.5);
graph.setMaxZoom(5);
graph.focusItem(nodeItem, true, {
duration: 400 // 动画时长为500ms
});
}, 500);
} else {
parentData.isLoading = false;
......@@ -144,20 +147,20 @@ onBeforeMount(() => {
const data = res.data || [];
let resultData = data?.[0] || {};
if (!resultData?.children?.length && resultData.isHaveData == 'Y') {
graphDataLoading.value = true;
getMetaStandardField(resultData.guid).then((res: any) => {
graphDataLoading.value = false;
if (res?.code == proxy.$passCode) {
resultData.children = res.data || [];
graphTreeData.value = resultData;
graphDataLoading.value = true;
getMetaStandardField(resultData.guid).then((res: any) => {
graphDataLoading.value = false;
if (res?.code == proxy.$passCode) {
resultData.children = res.data || [];
graphTreeData.value = resultData;
} else {
graphTreeData.value = resultData;
ElMessage.error(res.msg);
}
});
} else {
graphTreeData.value = resultData;
ElMessage.error(res.msg);
}
});
} else {
graphTreeData.value = resultData;
}
}
} else {
ElMessage.error(res.msg);
}
......
......@@ -204,6 +204,9 @@ const handleNodeItemClick = (graph, nodeItem) => {
graph.layout();
graph.setMinZoom(0.5);
graph.setMaxZoom(5);
graph.focusItem(nodeItem, true, {
duration: 500 // 动画时长为500ms
});
}, 500);
} else {
parentData.isLoading = false;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!