From 83f6bb4d5c4c8579b2bfe0eaeca91863b2eb6886 Mon Sep 17 00:00:00 2001 From: hanyuxia Date: Thu, 18 Jul 2024 10:05:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=9E=E4=BD=93=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E5=9B=BE=E4=BC=98=E5=8C=96:=E4=BF=AE=E6=94=B9=E6=94=B9?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9A=E9=87=8D=E7=BD=AE=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=90=8E=EF=BC=8Clist=E8=8A=82=E7=82=B9=E5=9B=BA=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/entityExplorer/EntityGraph.vue | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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)