From 6202c76ba9070b7287c51fbb6f3fc2eaa9def8d2 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:42:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=80=E7=BC=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/relationship/consanguinity.vue | 38 +++--- .../src/views/system/relationship/index.vue | 125 ++---------------- 2 files changed, 35 insertions(+), 128 deletions(-) diff --git a/frontend/src/views/system/relationship/consanguinity.vue b/frontend/src/views/system/relationship/consanguinity.vue index 17a03e77ef..bbdaa7e480 100644 --- a/frontend/src/views/system/relationship/consanguinity.vue +++ b/frontend/src/views/system/relationship/consanguinity.vue @@ -11,10 +11,6 @@ import { } from '@/api/chart/chart.js' export default { props: { - current: { - type: Object, - default: () => {} - }, chartSize: { type: Object, default: () => {} @@ -23,6 +19,8 @@ export default { data() { return { measureText: null, + current: {}, + activeId: '', treeData: [], myChart: null, datasourcePanel: { @@ -43,8 +41,11 @@ export default { } }, methods: { - getChartData(id) { - switch (this.current.queryType) { + getChartData(current) { + this.current = {...current} + const { queryType, num: id } = current + this.activeId = id + switch (queryType) { case 'datasource': this.getDatasourceRelationship(id) break @@ -68,9 +69,14 @@ export default { }, getDatasetRelationship(id) { getDatasetRelationship(id).then((res) => { + const { id, name } = res.data + res.data.id = this.current.num + res.data.name = this.current.label + res.data.type = this.current.queryType const arr = res.data ? [res.data] : [] + this.current = { num: id, label: name, queryType: 'datasource' } this.treeData = [] - this.dfsTree(arr, this.current.num) + this.dfsTree(arr, id) this.initEchart() }) }, @@ -89,12 +95,14 @@ export default { this.dfsTreeFlip(subRelation, { id, name }) } else if (type === 'dataset') { this.treeData.push({ id, name, type, pid: this.current.num }) - this.treeData.push({ - id: obj.id, - name: obj.name, - type: 'datasource', - pid: id - }) + if (obj.id) { + this.treeData.push({ + id: obj.id, + name: obj.name, + type: 'datasource', + pid: id + }) + } } }) }, @@ -374,7 +382,7 @@ export default { ], //相对位置 z2: 10, style: { - text: api.value(5), //data中取值 + text: isNaN(api.value(5)) ? data.find(ele => ele[4] === api.value(4))[5] : api.value(5), //data中取值 color: '#1F2329', x: 5, y: 5 @@ -405,7 +413,7 @@ export default { ), style: { ...api.style(), - fill: api.value(4) === that.current.num ? '#c2d4ff' : 'none', + fill: api.value(4) === that.activeId ? '#c2d4ff' : 'none', stroke: '#3370FF' } } diff --git a/frontend/src/views/system/relationship/index.vue b/frontend/src/views/system/relationship/index.vue index b6b0aae437..49a3c4b8ff 100644 --- a/frontend/src/views/system/relationship/index.vue +++ b/frontend/src/views/system/relationship/index.vue @@ -50,14 +50,14 @@