From 85e27fb1aae151fc4fbaecb28f0939c39b2cb275 Mon Sep 17 00:00:00 2001 From: junjun Date: Wed, 12 Jun 2024 14:05:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= 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, 23 insertions(+), 16 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 7fd175654a..59c0a4c2a7 100644 --- a/core/core-frontend/src/views/chart/components/editor/index.vue +++ b/core/core-frontend/src/views/chart/components/editor/index.vue @@ -197,25 +197,32 @@ provide('filedList', () => filedList.value) watch( [() => view.value['tableId']], () => { - fieldLoading.value = true - deleteChartFieldByChartId(props.view.id) - .then(() => { - getFields(props.view.tableId, props.view.id) - 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 - }) + if (props.view.id) { + fieldLoading.value = true + deleteChartFieldByChartId(props.view.id) + .then(() => { + watchDs() + }) + .catch(() => { + fieldLoading.value = false + }) + } else { + watchDs() + } }, { deep: true } ) +const watchDs = () => { + getFields(props.view.tableId, props.view.id) + 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) => { if (id && chartId) { fieldLoading.value = true