forked from github/dataease
fix(数据集): 已有新建计算字段的数据集进行关联,字段全选后,刷新数据会报错 #11263
This commit is contained in:
parent
be7a9e74b9
commit
d75cb483b9
@ -363,34 +363,32 @@ const confirmEditUnion = () => {
|
||||
}, [])
|
||||
|
||||
if (!!idArr.length) {
|
||||
ElMessageBox.confirm(
|
||||
`${t('data_set.field')}${allfields.value
|
||||
ElMessageBox.confirm('字段选择', {
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
tip: `${t('data_set.field')}: ${allfields.value
|
||||
.filter(ele => [...new Set(idArr)].includes(ele.id) && ele.extField !== 2)
|
||||
.map(ele => ele.name)
|
||||
.join(',')}${t('data_set.want_to_continue')}`,
|
||||
{
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
showClose: false,
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
delUpdateDsFields(currentNode.value.id, state.nodeList)
|
||||
const [fir] = state.nodeList
|
||||
if (fir.isShadow) {
|
||||
delete fir.isShadow
|
||||
}
|
||||
closeEditUnion()
|
||||
nextTick(() => {
|
||||
emits('updateAllfields')
|
||||
})
|
||||
.join(',')}, 未被勾选, 与其相关的计算字段将被删除,确认删除?`,
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
showClose: false,
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
delUpdateDsFields(currentNode.value.id, state.nodeList)
|
||||
const [fir] = state.nodeList
|
||||
if (fir.isShadow) {
|
||||
delete fir.isShadow
|
||||
}
|
||||
closeEditUnion()
|
||||
nextTick(() => {
|
||||
emits('updateAllfields')
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -449,32 +447,26 @@ const handleCommand = (ele, command) => {
|
||||
return pre
|
||||
}, [])
|
||||
fakeDelId = []
|
||||
|
||||
if (!!idArr.length) {
|
||||
ElMessageBox.confirm(
|
||||
`${t('field.want_to_continue')}${allfields.value
|
||||
.filter(ele => [...new Set(idArr)].includes(ele.id) && ele.extField !== 2)
|
||||
.map(ele => ele.name)
|
||||
.join(',')}${t('data_set.want_to_continue')}`,
|
||||
{
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
showClose: false,
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
delNode(ele.id, state.nodeList)
|
||||
nextTick(() => {
|
||||
emits('addComplete')
|
||||
emits('updateAllfields')
|
||||
})
|
||||
}
|
||||
ElMessageBox.confirm(`确定要删除 ${ele.tableName} 吗`, {
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
tip: '删除后,被关联的表或sql片段将被删除,与其相关的计算字段也将被删除。',
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
showClose: false,
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
delNode(ele.id, state.nodeList)
|
||||
nextTick(() => {
|
||||
emits('addComplete')
|
||||
emits('updateAllfields')
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -531,6 +523,10 @@ const dfsNodeFieldBack = (list, { originName, datasetTableId }) => {
|
||||
})
|
||||
}
|
||||
|
||||
const dfsNodeFieldBackReal = ele => {
|
||||
dfsNodeFieldBack(state.nodeList, ele)
|
||||
}
|
||||
|
||||
const menuList = [
|
||||
{
|
||||
svgName: 'icon_text-box_outlined',
|
||||
@ -1014,7 +1010,7 @@ defineExpose({
|
||||
getNodeList,
|
||||
setStateBack,
|
||||
notConfirm,
|
||||
dfsNodeFieldBack,
|
||||
dfsNodeFieldBackReal,
|
||||
initState,
|
||||
setChangeStatus,
|
||||
crossDatasources
|
||||
|
@ -467,8 +467,20 @@ const delFieldByIdFake = (arr, fakeAllfields) => {
|
||||
}
|
||||
|
||||
const deleteField = item => {
|
||||
ElMessageBox.confirm(t('dataset.confirm_delete'), {
|
||||
let tip = ''
|
||||
const idArr = allfields.value.reduce((pre, next) => {
|
||||
if (next.extField !== 2) return pre
|
||||
const idMap = next.originName.match(/\[(.+?)\]/g) || []
|
||||
const result = idMap.map(itm => {
|
||||
return itm.slice(1, -1)
|
||||
})
|
||||
pre = [...result, ...pre]
|
||||
return pre
|
||||
}, [])
|
||||
tip = idArr.includes(item.id) ? `如果该字段被删除,与其相关的计算字段将被删除,确认删除?` : ''
|
||||
ElMessageBox.confirm(`确认删除字段 ${item.name} 吗`, {
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
tip,
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
confirmButtonType: 'danger',
|
||||
@ -478,7 +490,7 @@ const deleteField = item => {
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
delFieldById([item.id])
|
||||
datasetDrag.value.dfsNodeFieldBack(datasetDrag.value.getNodeList(), item)
|
||||
datasetDrag.value.dfsNodeFieldBackReal(item)
|
||||
ElMessage({
|
||||
message: t('chart.delete_success'),
|
||||
type: 'success'
|
||||
@ -855,30 +867,28 @@ const confirmEditUnion = () => {
|
||||
return pre
|
||||
}, [])
|
||||
|
||||
ElMessageBox.confirm(
|
||||
`${t('data_set.field')}${allfields.value
|
||||
ElMessageBox.confirm('字段选择', {
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
tip: `${t('data_set.field')}: ${allfields.value
|
||||
.filter(ele => [...new Set(idArr)].includes(ele.id) && ele.extField !== 2)
|
||||
.map(ele => ele.name)
|
||||
.join(',')}${t('data_set.want_to_continue')}`,
|
||||
{
|
||||
confirmButtonText: t('dataset.confirm'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
showCancelButton: true,
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
showClose: false,
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
datasetDrag.value.setStateBack(top, bottom)
|
||||
setFieldAll()
|
||||
editUnion.value = false
|
||||
addComplete()
|
||||
datasetDrag.value.setChangeStatus(to, from)
|
||||
}
|
||||
.join(',')}, 未被勾选, 与其相关的计算字段将被删除,确认删除?`,
|
||||
confirmButtonType: 'danger',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
showClose: false,
|
||||
callback: (action: Action) => {
|
||||
if (action === 'confirm') {
|
||||
datasetDrag.value.setStateBack(top, bottom)
|
||||
setFieldAll()
|
||||
editUnion.value = false
|
||||
addComplete()
|
||||
datasetDrag.value.setChangeStatus(to, from)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user