From 554b1b5318712843e2991f3760cb1d8344d9c982 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 26 Jul 2024 09:21:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/utils/canvasUtils.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index 99795ad1ee..b178c3cd05 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -8,6 +8,7 @@ import componentList, { import eventBus from '@/utils/eventBus' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { + appCanvasNameCheck, decompression, dvNameCheck, findById, @@ -24,6 +25,7 @@ import { } from '@/views/chart/components/editor/util/chart' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { deepCopy } from '@/utils/utils' +import { ElMessage } from 'element-plus-secondary' const dvMainStore = dvMainStoreWithOut() const { curBatchOptComponents, dvInfo, canvasStyleData, componentData, canvasViewInfo, appData } = storeToRefs(dvMainStore) @@ -355,6 +357,20 @@ export async function canvasSave(callBack) { watermarkInfo: null } + let dsNameCheck = 'success' + if (appData.value) { + await appCanvasNameCheck({ + datasetFolderPid: canvasInfo.datasetFolderPid, + datasetFolderName: canvasInfo.datasetFolderName + }).then(rsp => { + dsNameCheck = rsp.data + }) + } + if (dsNameCheck === 'repeat') { + ElMessage.error('数据集名称已存在') + return + } + const method = dvInfo.value.id && dvInfo.value.optType !== 'copy' ? updateCanvas : saveCanvas if (method === updateCanvas) { await dvNameCheck({