From 32c6607d509bdad51681af635eba69eab75a2fbc Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 10 Jan 2025 10:19:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E9=9B=86):=20=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=AD=97=E6=AE=B5=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=A0=A1=E9=AA=8C=E8=AE=A1=E7=AE=97=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E8=AF=AD=E6=B3=95=20#14332?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/locales/en.ts | 1 + core/core-frontend/src/locales/tw.ts | 1 + core/core-frontend/src/locales/zh-CN.ts | 1 + .../visualized/data/dataset/form/index.vue | 36 +++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 4e00d84497..147525c1a7 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -114,6 +114,7 @@ export default { client: 'Client' }, data_set: { + validation_succeeded: 'Field expression validation succeeded', to_nth_digits: 'Retain the Mth to Nth digits', the_column_permissions: 'Are you sure you want to delete column permissions?', last_n_digits: 'Retain the first M digits and the last N digits', diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index 262bc64417..57af6f9079 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -114,6 +114,7 @@ export default { client: '客戶端' }, data_set: { + validation_succeeded: '欄位表達式校驗成功', to_nth_digits: '保留第M至N位元', the_column_permissions: '確定刪除列權限嗎?', last_n_digits: '保留前M位元,後N位元', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 8cac0c879a..a954344007 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -115,6 +115,7 @@ export default { client: '客户端' }, data_set: { + validation_succeeded: '字段表达式校验成功', to_nth_digits: '保留第M至N位', the_column_permissions: '确定删除列权限吗?', last_n_digits: '保留前M位,后N位', 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 be8628400b..8ce369eba9 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 @@ -980,6 +980,41 @@ const setActiveName = (data: Table) => { activeName.value = data.tableName } +const verify = () => { + if (datasetPreviewLoading.value) return + calcEdit.value.formField.validate(val => { + if (val) { + calcEdit.value.setFieldForm() + if (!calcEdit.value.fieldForm.originName.trim()) { + ElMessage.error(t('data_set.cannot_be_empty_de_')) + return + } + const obj = cloneDeep(calcEdit.value.fieldForm) + const { deType, dateFormat, deExtractType } = obj + obj.dateFormat = deType === 1 ? dateFormat : '' + obj.dateFormatType = deType === 1 ? dateFormat : '' + obj.deTypeArr = deType === 1 && deExtractType === 0 ? [deType, dateFormat] : [deType] + const result = allfields.value.findIndex(ele => obj.id === ele.id) + const allfieldsCopy = cloneDeep(unref(allfields)) + if (result !== -1) { + allfieldsCopy.splice(result, 1, obj) + } else { + allfieldsCopy.push(obj) + } + const arr = [] + dfsNodeList(arr, datasetDrag.value.getNodeList()) + datasetPreviewLoading.value = true + getPreviewData({ union: arr, allFields: allfieldsCopy }) + .then(() => { + ElMessage.success(t('data_set.validation_succeeded')) + }) + .finally(() => { + datasetPreviewLoading.value = false + }) + } + }) +} + const isDragging = ref(false) const mousedownDrag = () => { @@ -2217,6 +2252,7 @@ const getDsIconName = data => {