批量删除测试用例

This commit is contained in:
chenjianxing 2020-05-16 15:06:24 +08:00
parent df3f4ad784
commit a4ab4e238b
5 changed files with 40 additions and 6 deletions

View File

@ -91,4 +91,9 @@ public class TestCaseController {
testCaseService.editTestCaseBath(request);
}
@PostMapping("/batch/delete")
public void deleteTestCaseBath(@RequestBody TestCaseBatchRequest request){
testCaseService.deleteTestCaseBath(request);
}
}

View File

@ -273,4 +273,10 @@ public class TestCaseService {
testCaseExample);
}
public void deleteTestCaseBath(TestCaseBatchRequest request) {
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdIn(request.getIds());
testCaseMapper.deleteByExample(example);
}
}

View File

@ -11,7 +11,8 @@
</template>
<template v-slot:button>
<ms-table-button icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/>
<ms-table-button icon="el-icon-right" :content="$t('test_track.case.move')" @click="moveToNode"/>
<ms-table-button icon="el-icon-right" :content="$t('test_track.case.move')" @click="handleBatch('move')"/>
<ms-table-button icon="el-icon-delete" :content="'删除用例'" @click="handleBatch('delete')"/>
<!--<test-case-export/>-->
</template>
</ms-table-header>
@ -204,7 +205,7 @@
this.$emit('testCaseCopy', testCase);
},
handleDelete(testCase) {
this.$alert(this.$t('test_track.case.delete_confirm') + testCase.name + "", '', {
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
@ -213,6 +214,20 @@
}
});
},
handleDeleteBatch() {
this.$alert(this.$t('test_track.case.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$post('/test/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/case/delete/' + testCaseId, {}, () => {
@ -247,8 +262,16 @@
importTestCase() {
this.$refs.testCaseImport.open();
},
moveToNode() {
handleBatch(type){
if (this.selectIds.size < 1) {
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
return;
}
if (type === 'move'){
this.$emit('moveToNode', this.selectIds);
} else if (type === 'delete'){
this.handleDeleteBatch();
}
},
filter(filters) {
_filter(filters, this.condition);

View File

@ -332,7 +332,7 @@ export default {
input_type: "Please select type",
input_method: "Please select method",
input_prerequisite: "Please select prerequisite",
delete_confirm: "Confirm delete test case: ",
delete_confirm: "Confirm delete test case",
import: {
import: "Import test case",
case_import: "Import test case",

View File

@ -332,7 +332,7 @@ export default {
input_type: "请选择用例类型",
input_method: "请选择测试方式",
input_prerequisite: "请输入前置条件",
delete_confirm: "确认删除测试用例: ",
delete_confirm: "确认删除测试用例",
import: {
import: "导入用例",
case_import: "导入测试用例",