From d75cb483b9254a1122223676a69e9733d6a5f27a Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 7 Aug 2024 17:04:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E9=9B=86):=20=E5=B7=B2?= =?UTF-8?q?=E6=9C=89=E6=96=B0=E5=BB=BA=E8=AE=A1=E7=AE=97=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9B=86=E8=BF=9B=E8=A1=8C=E5=85=B3?= =?UTF-8?q?=E8=81=94=EF=BC=8C=E5=AD=97=E6=AE=B5=E5=85=A8=E9=80=89=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=88=B7=E6=96=B0=E6=95=B0=E6=8D=AE=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20#11263?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/dataset/form/DatasetUnion.vue | 90 +++++++++---------- .../visualized/data/dataset/form/index.vue | 54 ++++++----- 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/core/core-frontend/src/views/visualized/data/dataset/form/DatasetUnion.vue b/core/core-frontend/src/views/visualized/data/dataset/form/DatasetUnion.vue index 2d3858709f..83bf8d4c43 100644 --- a/core/core-frontend/src/views/visualized/data/dataset/form/DatasetUnion.vue +++ b/core/core-frontend/src/views/visualized/data/dataset/form/DatasetUnion.vue @@ -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 diff --git a/core/core-frontend/src/views/visualized/data/dataset/form/index.vue b/core/core-frontend/src/views/visualized/data/dataset/form/index.vue index b8fea14478..075edd5641 100644 --- a/core/core-frontend/src/views/visualized/data/dataset/form/index.vue +++ b/core/core-frontend/src/views/visualized/data/dataset/form/index.vue @@ -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 }