From ed137a7cafe871c26ad6635682169147179ecf2d Mon Sep 17 00:00:00 2001 From: junjun Date: Wed, 11 Sep 2024 18:00:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=A4=8D=E5=88=B6=E5=AD=97=E6=AE=B5=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BF=9D=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/editor/index.vue | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/index.vue b/core/core-frontend/src/views/chart/components/editor/index.vue index 5e7d1d186c..dceae80d54 100644 --- a/core/core-frontend/src/views/chart/components/editor/index.vue +++ b/core/core-frontend/src/views/chart/components/editor/index.vue @@ -214,32 +214,25 @@ provide('quota', () => state.quota) watch( [() => view.value['tableId']], () => { - if (props.view.id) { - fieldLoading.value = true - deleteChartFieldByChartId(props.view.id) - .then(() => { - watchDs() - }) - .catch(() => { - fieldLoading.value = false - }) - } else { - watchDs() - } + fieldLoading.value = true + deleteChartFieldByChartId(props.view.id) + .then(() => { + getFields(props.view.tableId, props.view.id, props.view.type) + const nodeId = view.value['tableId'] + if (!!nodeId) { + cacheId = nodeId as unknown as string + } + const node = datasetSelector?.value?.getNode(nodeId) + if (node?.data) { + curDatasetWeight.value = node.data.weight + } + }) + .catch(() => { + fieldLoading.value = false + }) }, { deep: true } ) -const watchDs = () => { - getFields(props.view.tableId, props.view.id, props.view.type) - const nodeId = view.value['tableId'] - if (!!nodeId) { - cacheId = nodeId as unknown as string - } - const node = datasetSelector?.value?.getNode(nodeId) - if (node?.data) { - curDatasetWeight.value = node.data.weight - } -} const getFields = (id, chartId, type) => { if (id && chartId) { fieldLoading.value = true