fix(图表): 修复图表复制字段无法保存的问题

This commit is contained in:
junjun 2024-09-11 18:00:00 +08:00
parent a45381e6e8
commit ed137a7caf

View File

@ -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