From ee2c03e1ebdc75f724b73f46b28066a86116d651 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Wed, 1 Nov 2023 17:03:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=87=E6=8D=A2=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=97=B6=E6=95=B0=E6=8D=AE=E9=9B=86=E5=8A=A0=E8=BD=BD=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/dataset-select/DatasetSelect.vue | 23 ----------------- .../views/chart/components/editor/index.vue | 25 ++++++++++++++++++- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/dataset-select/DatasetSelect.vue b/core/core-frontend/src/views/chart/components/editor/dataset-select/DatasetSelect.vue index 1cfc8131a2..379f34814f 100644 --- a/core/core-frontend/src/views/chart/components/editor/dataset-select/DatasetSelect.vue +++ b/core/core-frontend/src/views/chart/components/editor/dataset-select/DatasetSelect.vue @@ -173,33 +173,10 @@ const dsClick = (data: Tree) => { } //选中赋值 _modelValue.value = data.id - getFields(data.id, props.viewId) //关闭弹窗 datasetSelectorPopover.value?.hide() } } -const getFields = (id, chartId) => { - if (id && chartId) { - getFieldByDQ(id, chartId) - .then(res => { - state.value.dimension = (res.dimensionList as unknown as Field[]) || [] - state.value.quota = (res.quotaList as unknown as Field[]) || [] - state.value.dimensionData = JSON.parse(JSON.stringify(state.value.dimension)) - state.value.quotaData = JSON.parse(JSON.stringify(state.value.quota)) - }) - .catch(() => { - state.value.dimension = [] - state.value.quota = [] - state.value.dimensionData = [] - state.value.quotaData = [] - }) - } else { - state.value.dimension = [] - state.value.quota = [] - state.value.dimensionData = [] - state.value.quotaData = [] - } -} const _popoverShow = ref(false) function onPopoverShow() { _popoverShow.value = true 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 f578dc4317..693f9c8c09 100644 --- a/core/core-frontend/src/views/chart/components/editor/index.vue +++ b/core/core-frontend/src/views/chart/components/editor/index.vue @@ -49,6 +49,7 @@ import chartViewManager from '@/views/chart/components/js/panel' import DatasetSelect from '@/views/chart/components/editor/dataset-select/DatasetSelect.vue' import { useDraggable } from '@vueuse/core' import { set, concat, keys } from 'lodash-es' +import { Field, getFieldByDQ } from '@/api/chart' const snapshotStore = snapshotStoreWithOut() const dvMainStore = dvMainStoreWithOut() @@ -146,6 +147,7 @@ const state = reactive({ watch( [() => view.value['tableId']], () => { + getFields(props.view.tableId, props.view.id) const nodeId = view.value['tableId'] if (!!nodeId) { cacheId = nodeId as unknown as string @@ -157,7 +159,28 @@ watch( }, { deep: true } ) - +const getFields = (id, chartId) => { + if (id && chartId) { + getFieldByDQ(id, chartId) + .then(res => { + state.dimension = (res.dimensionList as unknown as Field[]) || [] + state.quota = (res.quotaList as unknown as Field[]) || [] + state.dimensionData = JSON.parse(JSON.stringify(state.dimension)) + state.quotaData = JSON.parse(JSON.stringify(state.quota)) + }) + .catch(() => { + state.dimension = [] + state.quota = [] + state.dimensionData = [] + state.quotaData = [] + }) + } else { + state.dimension = [] + state.quota = [] + state.dimensionData = [] + state.quotaData = [] + } +} watch( [() => state.searchField], newVal => {