Merge pull request #12162 from dataease/pr@dev-v2@fix_chart

fix(图表): 修复图表复制字段无法保存的问题
This commit is contained in:
Junjun 2024-09-11 18:27:57 +08:00 committed by GitHub
commit 817e06d5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,13 +53,7 @@ import DatasetSelect from '@/views/chart/components/editor/dataset-select/Datase
import { useDraggable } from '@vueuse/core' import { useDraggable } from '@vueuse/core'
import { set, concat, keys } from 'lodash-es' import { set, concat, keys } from 'lodash-es'
import { PluginComponent } from '@/components/plugin' import { PluginComponent } from '@/components/plugin'
import { import { Field, getFieldByDQ, copyChartField, deleteChartField } from '@/api/chart'
Field,
getFieldByDQ,
copyChartField,
deleteChartField,
deleteChartFieldByChartId
} from '@/api/chart'
import ChartTemplateInfo from '@/views/chart/components/editor/common/ChartTemplateInfo.vue' import ChartTemplateInfo from '@/views/chart/components/editor/common/ChartTemplateInfo.vue'
import { XpackComponent } from '@/components/plugin' import { XpackComponent } from '@/components/plugin'
import { useEmbedded } from '@/store/modules/embedded' import { useEmbedded } from '@/store/modules/embedded'
@ -214,22 +208,15 @@ provide('quota', () => state.quota)
watch( watch(
[() => view.value['tableId']], [() => view.value['tableId']],
() => { () => {
fieldLoading.value = true getFields(props.view.tableId, props.view.id, props.view.type)
deleteChartFieldByChartId(props.view.id) const nodeId = view.value['tableId']
.then(() => { if (!!nodeId) {
getFields(props.view.tableId, props.view.id, props.view.type) cacheId = nodeId as unknown as string
const nodeId = view.value['tableId'] }
if (!!nodeId) { const node = datasetSelector?.value?.getNode(nodeId)
cacheId = nodeId as unknown as string if (node?.data) {
} curDatasetWeight.value = node.data.weight
const node = datasetSelector?.value?.getNode(nodeId) }
if (node?.data) {
curDatasetWeight.value = node.data.weight
}
})
.catch(() => {
fieldLoading.value = false
})
}, },
{ deep: true } { deep: true }
) )