diff --git a/src/views/entityExplorer/EntityGraph.vue b/src/views/entityExplorer/EntityGraph.vue index 3dbc448e..310125e9 100644 --- a/src/views/entityExplorer/EntityGraph.vue +++ b/src/views/entityExplorer/EntityGraph.vue @@ -813,7 +813,9 @@ export default { justUndo: 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.node = this.rootNode this.rightBox.mode = 'detail' @@ -1141,14 +1143,7 @@ export default { } nodes.push(...listNodes, ...entityNodes) - setTimeout(() => { - // 释放list节点,不再固定位置 - const listNodes = nodes.filter(n => n.type === nodeType.listNode) - listNodes.forEach(n => { - n.fx = null - n.fy = null - }) - }, 100) + this.releaseNodes(nodes,nodeType.listNode) } this.rightBox.node = rootNode return { @@ -1156,6 +1151,17 @@ export default { 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) { const { nodes } = this.graph.graphData() const node = nodes.find(n => n.id === nodeId)