From b9b510e73acc0a232ec80d291a7acbe38d1d1a6f Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 25 Sep 2024 16:15:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=92=8C=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=93=8D=E4=BD=9C=E6=97=B6=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20loading=20=E6=8F=90=E7=A4=BA=20#12289?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/common/DeResourceTree.vue | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/core/core-frontend/src/views/common/DeResourceTree.vue b/core/core-frontend/src/views/common/DeResourceTree.vue index 82c77826cd..6410708517 100644 --- a/core/core-frontend/src/views/common/DeResourceTree.vue +++ b/core/core-frontend/src/views/common/DeResourceTree.vue @@ -260,6 +260,8 @@ const afterTreeInit = () => { }) } +const copyLoading = ref(false) + const emit = defineEmits(['nodeClick']) const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => { @@ -291,29 +293,36 @@ const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => { id: data.id, pid: targetPid || '0' } - copyResource(params).then(data => { - const baseUrl = - curCanvasType.value === 'dataV' - ? `#/dvCanvas?opt=copy&pid=${params.pid}&dvId=${data.data}` - : `#/dashboard?opt=copy&pid=${params.pid}&resourceId=${data.data}` - if (isEmbedded.value) { - embeddedStore.clearState() - embeddedStore.setPid(params.pid as string) - embeddedStore.setOpt('copy') - if (curCanvasType.value === 'dataV') { - embeddedStore.setDvId(data.data) - } else { - embeddedStore.setResourceId(data.data) + + copyLoading.value = true + + copyResource(params) + .then(data => { + const baseUrl = + curCanvasType.value === 'dataV' + ? `#/dvCanvas?opt=copy&pid=${params.pid}&dvId=${data.data}` + : `#/dashboard?opt=copy&pid=${params.pid}&resourceId=${data.data}` + if (isEmbedded.value) { + embeddedStore.clearState() + embeddedStore.setPid(params.pid as string) + embeddedStore.setOpt('copy') + if (curCanvasType.value === 'dataV') { + embeddedStore.setDvId(data.data) + } else { + embeddedStore.setResourceId(data.data) + } + useEmitt().emitter.emit( + 'changeCurrentComponent', + curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'DashboardEditor' + ) + return } - useEmitt().emitter.emit( - 'changeCurrentComponent', - curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'DashboardEditor' - ) - return - } - const newWindow = window.open(baseUrl, '_blank') - initOpenHandler(newWindow) - }) + const newWindow = window.open(baseUrl, '_blank') + initOpenHandler(newWindow) + }) + .finally(() => { + copyLoading.value = false + }) } else { resourceGroupOpt.value.optInit(nodeType, data, cmd, ['copy'].includes(cmd)) } @@ -593,7 +602,7 @@ defineExpose({ - +