diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java index c3710d73ee..ae059aadce 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java @@ -58,6 +58,11 @@ public class TestPlanTestCaseController { testPlanTestCaseService.editTestCaseBath(request); } + @PostMapping("/batch/delete") + public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){ + testPlanTestCaseService.deleteTestCaseBath(request); + } + @PostMapping("/delete/{id}") public int deleteTestCase(@PathVariable String id){ return testPlanTestCaseService.deleteTestCase(id); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index 3de8b19187..09dcbac6bb 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -113,4 +113,10 @@ public class TestPlanTestCaseService { request.setId(caseId); return extTestPlanTestCaseMapper.list(request).get(0); } + + public void deleteTestCaseBath(TestPlanCaseBatchRequest request) { + TestPlanTestCaseExample example = new TestPlanTestCaseExample(); + example.createCriteria().andIdIn(request.getIds()); + testPlanTestCaseMapper.deleteByExample(example); + } } diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue index da22379c28..b9b9e4f8b3 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseList.vue @@ -10,6 +10,7 @@ + @@ -261,6 +262,20 @@ } }); }, + handleDeleteBatch() { + this.$alert(this.$t('test_track.plan_view.confirm_cancel_relevance') + " ?", '', { + confirmButtonText: this.$t('commons.confirm'), + callback: (action) => { + if (action === 'confirm') { + this.$post('/test/plan/case/batch/delete', {ids: [...this.selectIds]}, () => { + this.selectIds.clear(); + this.$emit("refresh"); + this.$success(this.$t('commons.delete_success')); + }); + } + } + }); + }, _handleDelete(testCase) { let testCaseId = testCase.id; this.$post('/test/plan/case/delete/' + testCaseId, {}, () => { @@ -293,6 +308,8 @@ this.$refs.executorEdit.openExecutorEdit(); } else if (type === 'status'){ this.$refs.statusEdit.openStatusEdit(); + } else if (type === 'delete') { + this.handleDeleteBatch(); } }, searchMyTestCase() {