a5726829 by lihua

关系网修改节点大小,并添加定位到标准管理

1 parent 486b7020
......@@ -210,7 +210,7 @@ const initGraph = () => {
const { item, target } = evt;
let model = item._cfg.model;
if (props.noContextMenu) {
return false;
// return false;
if (model && !model.isField) {
return true;
}
......@@ -320,15 +320,17 @@ const initGraph = () => {
graphRef.value = graph;
graph.node((node) => {
return {
size: node.isField ? 11 : 16,
id: node.guid as string,
label: handleLabelLength((node.isField ? node.metaStandardId : node.standardName) as string),
collapsed: node.children?.length ? false : true,
labelCfg: {
offset: 7,
offset: node.isField ? 4 : 7,
style: {
fontSize: 13,
fill: '#212121',
fontWeight: 500
fontWeight: 500,
cursor: 'pointer'
},
position: !node.isField ? 'left' : 'right', //只有字段是最后一层级,不需要展开
},
......
......@@ -8,7 +8,7 @@
<graphTopbar ref="topBarRef" @displaySwitchChange="displaySwitchChange" :isGraphDisplay="isGraphDisplay" />
</div>
<RelationNetwork v-show="graphTreeData?.guid && isGraphDisplay" ref="relationNetworkRef" :tree-data="graphTreeData"
:noContextMenu="true" @nodeItemClick="handleNodeItemClick">
:noContextMenu="true" @nodeItemClick="handleNodeItemClick" @contextMenu="handleContextMenu">
</RelationNetwork>
<Sankey v-show="!isGraphDisplay && (sankeyNames?.length || sankeyDataLoading)" v-loading="sankeyDataLoading"
:tree-data="sankeyData" :names="sankeyNames">
......@@ -139,6 +139,15 @@ const handleNodeItemClick = (graph, nodeItem) => {
})
}
const handleContextMenu = (model) => {
router.push({
name: 'metadataStandard',
query: {
standardGuid: model.guid
}
});
}
onBeforeMount(() => {
graphDataLoading.value = true
getMetaStandardTreeList(metaGuid.value).then((res: any) => {
......
......@@ -24,6 +24,8 @@ import StandardFieldsDialog from './components/standardFieldsDialog.vue'
const { proxy } = getCurrentInstance() as any;
const route = useRoute();
const cacheStore = useCatchStore()
const showFiledsPage = ref(false)
......@@ -76,8 +78,10 @@ function treeCustomClick (node, type) {
}).then(() => deleteTreeNode(node.data.guid))
}
}
function getTree (refresh = false) {
function getTree (refresh = false, initLocate = false) {
treeInfo.value.loading = true;
getMetaStandardTree().then((res:any) => {
treeInfo.value.loading = false;
if (res.code === proxy.$passCode) {
let data = res.data || []
data.forEach(item => {
......@@ -85,8 +89,10 @@ function getTree (refresh = false) {
item.level = 1
})
treeInfo.value.data = data
if (!initLocate) {
treeInfo.value.expandedKey = [data[0].guid]
treeInfo.value.currentNodeKey = data[0].guid
}
nodeClick(data[0])
}
})
......@@ -443,8 +449,16 @@ function batchDelete () {
})
}
/** 从关系网定位打开此页面,需定位到对应的树节点。 route.query.standardGuid */
onActivated(() => {
if (route.query.standardGuid) {
treeInfo.value.currentNodeKey = route.query.standardGuid as string;
}
})
onBeforeMount(() => {
getTree()
getTree(false, route.query.standardGuid != null)
})
const viewGraph = () => {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!