From 8ba46d9272744366bff054c92d6158fccefc1cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Thu, 2 Mar 2023 10:20:48 +0800 Subject: [PATCH] :sparkles: Feature: now prompts if there are duplicate file names --- src/renderer/manage/pages/bucketPage.vue | 35 ++++++++++++++++++------ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/renderer/manage/pages/bucketPage.vue b/src/renderer/manage/pages/bucketPage.vue index a5db105..1dd55e5 100644 --- a/src/renderer/manage/pages/bucketPage.vue +++ b/src/renderer/manage/pages/bucketPage.vue @@ -1254,7 +1254,7 @@ https://www.baidu.com/img/bd_logo1.png" @close="() => { isSingleRename = false isRenameIncludeExt = false - }" + }" > -
+
matchedFiles.filter((item2: any) => item2.newName === item.newName).length > 1).length let successCount = 0 let failCount = 0 const error = new Error('error') @@ -2648,13 +2649,31 @@ async function BatchRename () { }) }) } - const promiseList = [] as any[] - for (let i = 0; i < matchedFiles.length; i++) { - promiseList.push(renamefunc(matchedFiles[i])) + if (duplicateFilesNum > 0) { + ElMessageBox.confirm(`检测到有${duplicateFilesNum}个文件名重复,是否继续?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const promiseList = [] as any[] + for (let i = 0; i < matchedFiles.length; i++) { + promiseList.push(renamefunc(matchedFiles[i])) + } + Promise.allSettled(promiseList).then(() => { + ElMessage.success(`重命名成功${successCount}个,失败${failCount}个`) + }) + }).catch(() => { + ElMessage.info('已取消') + }) + } else { + const promiseList = [] as any[] + for (let i = 0; i < matchedFiles.length; i++) { + promiseList.push(renamefunc(matchedFiles[i])) + } + Promise.allSettled(promiseList).then(() => { + ElMessage.success(`重命名成功${successCount}个,失败${failCount}个`) + }) } - Promise.allSettled(promiseList).then(() => { - ElMessage.success(`重命名成功${successCount}个,失败${failCount}个`) - }) } function handelBatchCopyInfo () {