From 303be6026e55abd06af8ad704df404f588535c3d Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 8 Nov 2023 15:48:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E7=9A=84=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../visualized/data/datasource/form/index.vue | 4 +-- .../visualized/data/datasource/index.vue | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/index.vue b/core/core-frontend/src/views/visualized/data/datasource/form/index.vue index 43e66ff474..ff8f3f98e6 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/index.vue @@ -381,7 +381,7 @@ const saveDS = () => { const validate = detail.value.submitForm() validate(val => { if (val) { - if (editDs.value) { + if (editDs.value && form.id) { let options = { confirmButtonType: 'danger', type: 'warning', @@ -478,7 +478,7 @@ const drawTitle = computed(() => { if (creator && id && currentDsType.value == 'Excel') { return editType === 1 ? '追加数据' : '替换数据' } - return editDs.value ? t('datasource.modify') : '创建数据源' + return editDs.value ? (!form.id ? '复制数据源' : t('datasource.modify')) : '创建数据源' }) const beforeClose = () => { diff --git a/core/core-frontend/src/views/visualized/data/datasource/index.vue b/core/core-frontend/src/views/visualized/data/datasource/index.vue index 7b0b1b2d7d..5714104ade 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/index.vue @@ -424,6 +424,7 @@ const handleNodeClick = data => { createTime, creator, type, + pid, configuration, syncSetting, apiConfigurationStr, @@ -440,6 +441,7 @@ const handleNodeClick = data => { } Object.assign(nodeInfo, { name, + pid, description, fileName, size, @@ -534,6 +536,13 @@ const handleEdit = async data => { datasourceEditor.value.init(nodeInfo) } +const handleCopy = async data => { + await handleNodeClick(data) + nodeInfo.id = '' + nodeInfo.name = '复制数据源' + datasourceEditor.value.init(nodeInfo) +} + const handleDatasourceTree = (cmd: string, data?: Tree) => { if (cmd === 'datasource') { createDatasource(data) @@ -543,6 +552,10 @@ const handleDatasourceTree = (cmd: string, data?: Tree) => { } } const operation = (cmd: string, data: Tree, nodeType: string) => { + if (cmd === 'copy') { + handleCopy(data) + return + } if (cmd === 'delete') { let options = { confirmButtonText: t('common.sure'), @@ -633,6 +646,18 @@ onMounted(() => { datasourceEditor.value.init(null, null) } }) + +const getMenuList = (val: boolean) => { + return !val + ? menuList + : [ + { + label: t('common.copy'), + svgName: 'icon_copy_filled', + command: 'copy' + } + ].concat(menuList) +}