fix: 实体关系图优化:修改改问题:重置节点后,list节点固定

This commit is contained in:
hanyuxia
2024-07-18 10:05:12 +08:00
parent 8b0e90a3ff
commit 83f6bb4d5c

View File

@@ -813,7 +813,9 @@ export default {
justUndo: false, justUndo: false,
justRedo: false justRedo: false
} }
this.initForceGraph(_.cloneDeep(this.initialData)) // 初始化拓展图 let initData = _.cloneDeep(this.initialData)
this.releaseNodes(initData.nodes,nodeType.listNode)
this.initForceGraph(initData) // 初始化拓展图
this.rightBox.show = true this.rightBox.show = true
this.rightBox.node = this.rootNode this.rightBox.node = this.rootNode
this.rightBox.mode = 'detail' this.rightBox.mode = 'detail'
@@ -1141,14 +1143,7 @@ export default {
} }
nodes.push(...listNodes, ...entityNodes) nodes.push(...listNodes, ...entityNodes)
setTimeout(() => { this.releaseNodes(nodes,nodeType.listNode)
// 释放list节点,不再固定位置
const listNodes = nodes.filter(n => n.type === nodeType.listNode)
listNodes.forEach(n => {
n.fx = null
n.fy = null
})
}, 100)
} }
this.rightBox.node = rootNode this.rightBox.node = rootNode
return { return {
@@ -1156,6 +1151,17 @@ export default {
links links
} }
}, },
//释放节点
releaseNodes(allNodes,nodeType) {
setTimeout(() => {
// 释放list节点,不再固定位置
const filterNodes = allNodes.filter(n => n.type === nodeType)
filterNodes.forEach(n => {
n.fx = null
n.fy = null
})
}, 100)
},
async expandList (nodeId) { async expandList (nodeId) {
const { nodes } = this.graph.graphData() const { nodes } = this.graph.graphData()
const node = nodes.find(n => n.id === nodeId) const node = nodes.find(n => n.id === nodeId)