From 59f4641d17128283d34636d68c51d547f2635ccb Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Wed, 27 Dec 2023 11:37:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE):=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E5=AD=97=E6=AE=B5=E8=BF=87=E6=BB=A4=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E6=8C=87=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/chart/components/editor/index.vue | 59 ++++++++----------- 1 file changed, 26 insertions(+), 33 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 0879d27b94..847a17701c 100644 --- a/core/core-frontend/src/views/chart/components/editor/index.vue +++ b/core/core-frontend/src/views/chart/components/editor/index.vue @@ -187,13 +187,6 @@ const getFields = (id, chartId) => { state.quotaData = [] } } -watch( - [() => state.searchField], - newVal => { - fieldFilter(newVal[0]) - }, - { deep: true } -) const chartStyleShow = computed(() => { return view.value.type !== 'richText' @@ -263,39 +256,39 @@ const queryList = computed(() => { }) const quotaData = computed(() => { + let result = JSON.parse(JSON.stringify(state.quota)) if (view.value?.type === 'table-info') { - return state.quota?.filter(item => item.id !== '-1') + result = result?.filter(item => item.id !== '-1') } - return state.quota + if (state.searchField) { + result = result.filter(item => + item.name.toLowerCase().includes(state.searchField.toLowerCase()) + ) + } + return result }) -provide('quotaData', quotaData) +const dimensionData = computed(() => { + let result = JSON.parse(JSON.stringify(state.dimensionData)) + if (state.searchField) { + result = result.filter(item => + item.name.toLowerCase().includes(state.searchField.toLowerCase()) + ) + } + return result +}) +const realQuota = computed(() => { + let result = JSON.parse(JSON.stringify(state.quota)) + if (view.value?.type === 'table-info') { + result = result?.filter(item => item.id !== '-1') + } + return result +}) +provide('quotaData', realQuota) const startToMove = (e, item) => { e.dataTransfer.setData('dimension', JSON.stringify({ ...item, datasetId: view.value.tableId })) } -const fieldFilter = val => { - if (val && val !== '') { - state.dimensionData = JSON.parse( - JSON.stringify( - state.dimension.filter(ele => { - return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) - }) - ) - ) - state.quotaData = JSON.parse( - JSON.stringify( - state.quota.filter(ele => { - return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase()) - }) - ) - ) - } else { - state.dimensionData = JSON.parse(JSON.stringify(state.dimension)) - state.quotaData = JSON.parse(JSON.stringify(state.quota)) - } -} - const dimensionItemChange = () => { recordSnapshotInfo('calcData') // do dimensionItemChange @@ -1853,7 +1846,7 @@ const onRefreshChange = val => {