From 60966fb6e3f5ce9b53a212075c09bc90f3b7fceb Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 8 Nov 2023 14:50:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=AF=E6=8C=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=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/dataset/form/index.vue | 16 +++++++------ .../views/visualized/data/dataset/index.vue | 23 ++++++++++++++++++- 2 files changed, 31 insertions(+), 8 deletions(-) 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 1ed96e772d..0f39f2fa33 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 @@ -71,7 +71,6 @@ const editUnion = ref(false) const datasetDrag = ref() const datasetName = ref('未命名数据集') const tabActive = ref('preview') -const originName = ref('') const activeName = ref('') const dataSource = ref('') const searchTable = ref('') @@ -567,23 +566,26 @@ const getTableName = async (datasourceId, tableName) => { const initEdite = () => { const { id, datasourceId, tableName } = route.query + const { id: copyId } = route.params if (datasourceId) { dataSource.value = datasourceId as string getTableName(datasourceId as string, tableName) } - if (!id) return + if (!id && !copyId) return loading.value = true - getDatasetDetails(id) + getDatasetDetails(copyId || id) .then(res => { let arr = [] const { id, pid, name } = res || {} nodeInfo = { id, pid, - name + name: copyId ? '复制数据集' : name } - datasetName.value = name - originName.value = name + if (copyId) { + nodeInfo.id = '' + } + datasetName.value = nodeInfo.name allfields.value = res.allFields || [] dfsUnion(arr, res.union || []) const [fir] = res.union as { currentDs: { datasourceId: string } }[] @@ -868,7 +870,7 @@ const datasetSave = () => { } const union = [] dfsNodeList(union, datasetDrag.value.nodeList) - const { pid } = route.query + const pid = route.query.pid || nodeInfo.pid if (!union.length) { ElMessage.error('数据集不能为空') return diff --git a/core/core-frontend/src/views/visualized/data/dataset/index.vue b/core/core-frontend/src/views/visualized/data/dataset/index.vue index 68e58dd4c4..2448dc9845 100644 --- a/core/core-frontend/src/views/visualized/data/dataset/index.vue +++ b/core/core-frontend/src/views/visualized/data/dataset/index.vue @@ -320,6 +320,15 @@ const handleClick = (tabName: TabPaneName) => { } const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => { + if (cmd === 'copy') { + router.push({ + name: 'dataset-form', + params: { + id: data.id + } + }) + return + } if (cmd === 'delete') { let options = { confirmButtonType: 'danger', @@ -417,6 +426,18 @@ const filterNode = (value: string, data: BusiTreeNode) => { if (!value) return true return data.name?.toLocaleLowerCase().includes(value.toLocaleLowerCase()) } + +const getMenuList = (val: boolean) => { + return !val + ? menuList + : [ + { + label: t('common.copy'), + svgName: 'icon_copy_filled', + command: 'copy' + } + ].concat(menuList) +}