fix: 实体关系图优化:重置初始化拓展图动画随机展示问题修改

This commit is contained in:
hanyuxia
2024-07-09 10:16:04 +08:00
parent 7f3cb9b71d
commit 3fa14fb69f

View File

@@ -88,6 +88,15 @@ export default {
try { try {
const initialData = await this.generateInitialData() const initialData = await this.generateInitialData()
this.initialData = _.cloneDeep(initialData) // 初始化数据 this.initialData = _.cloneDeep(initialData) // 初始化数据
this.initForceGraph(initialData) // 初始化拓展图
} catch (e) {
console.error(e)
this.$message.error(this.errorMsgHandler(e))
} finally {
this.rightBox.loading = false
}
},
initForceGraph(initialData) {
let hoverNode = null let hoverNode = null
const canvasHeight = document.body.clientHeight - 100 const canvasHeight = document.body.clientHeight - 100
this.graph = ForceGraph()(document.getElementById('entityGraph')) this.graph = ForceGraph()(document.getElementById('entityGraph'))
@@ -589,12 +598,6 @@ export default {
} }
} }
}) })
} catch (e) {
console.error(e)
this.$message.error(this.errorMsgHandler(e))
} finally {
this.rightBox.loading = false
}
}, },
getTempNodeAngle (nodeCount, i) { getTempNodeAngle (nodeCount, i) {
switch (nodeCount) { switch (nodeCount) {
@@ -703,7 +706,7 @@ export default {
justUndo: false, justUndo: false,
justRedo: false justRedo: false
} }
this.graph.graphData(_.cloneDeep(this.initialData)).centerAt(0, 0).zoom(0.9999) this.initForceGraph(_.cloneDeep(this.initialData)) // 初始化拓展图
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'