diff --git a/ruoyi-ui/src/views/ccdiProject/index.vue b/ruoyi-ui/src/views/ccdiProject/index.vue index da5f28c0..1794f28f 100644 --- a/ruoyi-ui/src/views/ccdiProject/index.vue +++ b/ruoyi-ui/src/views/ccdiProject/index.vue @@ -250,6 +250,16 @@ export default { if (this.reAnalyzeLoadingMap[projectKey]) { return } + try { + await this.$modal.confirm( + `确认对项目“${row.projectName}”重新分析吗?重新分析将重新计算项目标签。` + ) + } catch (confirmError) { + if (confirmError === "cancel" || confirmError === "close") { + return + } + throw confirmError + } this.$set(this.reAnalyzeLoadingMap, projectKey, true) try { await rebuildProjectTags({ projectId: row.projectId }) diff --git a/ruoyi-ui/tests/unit/project-list-reanalyze-flow.test.js b/ruoyi-ui/tests/unit/project-list-reanalyze-flow.test.js index f7411fa3..ab8ea8ef 100644 --- a/ruoyi-ui/tests/unit/project-list-reanalyze-flow.test.js +++ b/ruoyi-ui/tests/unit/project-list-reanalyze-flow.test.js @@ -12,6 +12,27 @@ assert( "重新分析应调用真实重打标接口" ); +assert( + pageSource.includes("await this.$modal.confirm("), + "重新分析前应先弹出确认框" +); + +assert( + pageSource.includes("确认对项目“${row.projectName}”重新分析吗?重新分析将重新计算项目标签。"), + "确认弹窗文案应覆盖项目名称和重新计算标签提醒" +); + +assert( + pageSource.includes('confirmError === "cancel"') || + pageSource.includes("confirmError === 'cancel'"), + "取消确认时应直接结束,不继续提交" +); + +assert( + /await this\.\$modal\.confirm\([\s\S]*?this\.\$set\(this\.reAnalyzeLoadingMap,\s*projectKey,\s*true\)/.test(pageSource), + "只有确认后才允许进入按钮 loading" +); + assert( pageSource.includes('this.$modal.msgSuccess("已开始重新分析")') || pageSource.includes("this.$modal.msgSuccess('已开始重新分析')"),