feat(测试跟踪): 批量编辑用例组件

This commit is contained in:
shiziyuan9527 2020-08-04 14:58:55 +08:00
parent efdc8e59c4
commit 52f6d4f336
6 changed files with 96 additions and 4 deletions

View File

@ -0,0 +1,78 @@
<template>
<div>
<el-dialog
title="批量编辑用例"
:visible.sync="dialogVisible"
width="25%"
class="batch-edit-dialog"
:destroy-on-close="true"
@close="handleClose"
>
<el-form :model="form" label-position="right" label-width="150px" size="medium" ref="form" :rules="rules">
<el-form-item :label="$t('test_track.case.batch_update', [size])" prop="type">
<el-select v-model="form.type" style="width: 80%">
<el-option label="用例等级" value="priority"/>
<el-option label="类型" value="type"/>
<el-option label="测试方式" value="method"/>
<el-option label="维护人" value="maintainer"/>
</el-select>
</el-form-item>
<el-form-item label="更新后属性值为" prop="value">
<el-select v-model="form.value" style="width: 80%">
<el-option label="值1" value="value1"/>
<el-option label="值2" value="value2"/>
</el-select>
</el-form-item>
</el-form>
<template v-slot:footer>
<ms-dialog-footer
@cancel="dialogVisible = false"
@confirm="submit('form')"/>
</template>
</el-dialog>
</div>
</template>
<script>
import MsDialogFooter from "../../../common/components/MsDialogFooter";
export default {
name: "BatchEdit",
components: {
MsDialogFooter
},
data() {
return {
dialogVisible: false,
form: {},
size: 0,
rules: {
type: {required: true, message: "请选择属性", trigger: ['blur','change']},
value: {required: true, message: "请选择属性对应的值", trigger: ['blur','change']}
},
}
},
methods: {
submit(form) {
this.$refs[form].validate((valid) => {
if (valid) {
this.$emit("submit", this.form);
} else {
return false;
}
});
},
open() {
this.dialogVisible = true;
this.size = this.$parent.selectRows.size;
},
handleClose() {
this.form = {};
}
}
}
</script>
<style scoped>
</style>

View File

@ -49,8 +49,8 @@
.show-more-btn {
width: 20px;
height: 30px;
line-height: 30px;
height: 25px;
line-height: 25px;
background-color: #FFF;
}

View File

@ -119,6 +119,8 @@
:total="total"/>
</el-card>
<batch-edit ref="batchEdit"/>
</div>
</template>
@ -139,6 +141,7 @@
import {_filter, _sort} from "../../../../../common/js/utils";
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
import ShowMoreBtn from "./ShowMoreBtn";
import BatchEdit from "./BatchEdit";
export default {
name: "TestCaseList",
@ -149,7 +152,14 @@
MethodTableItem,
TypeTableItem,
PriorityTableItem,
MsCreateBox, TestCaseImport, TestCaseExport, MsTablePagination, NodeBreadcrumb, MsTableHeader, ShowMoreBtn
MsCreateBox,
TestCaseImport,
TestCaseExport,
MsTablePagination,
NodeBreadcrumb,
MsTableHeader,
ShowMoreBtn,
BatchEdit
},
data() {
return {
@ -326,6 +336,7 @@
this.selectRows.add(row);
}
// todo
if (this.selectRows.size > 1) {
Array.from(this.selectRows).forEach(row => {
this.$set(row, "showMore", true);
@ -393,7 +404,7 @@
this.initTableData();
},
handleClickStop() {
console.log("click stop");
this.$refs.batchEdit.open();
}
}
}

View File

@ -528,6 +528,7 @@ export default {
relate_test: "Relate test",
relate_test_not_find: 'The associated test does not exist, please check the test case',
batch_handle: 'Batch processing (select {0} item)',
batch_update: 'Update the attributes of {0} cases',
import: {
import: "Import test case",
case_import: "Import test case",

View File

@ -528,6 +528,7 @@ export default {
relate_test: "关联测试",
relate_test_not_find: '关联的测试不存在,请检查用例',
batch_handle: '批量处理 (选中{0}项)',
batch_update: '更新{0}个用例的属性',
import: {
import: "导入用例",
case_import: "导入测试用例",

View File

@ -527,6 +527,7 @@ export default {
relate_test: "關聯測試",
relate_test_not_find: '關聯的測試不存在,請檢查用例',
batch_handle: '批量處理 (選中{0}項)',
batch_update: '更新{0}個用例的屬性',
import: {
import: "導入用例",
case_import: "導入測試用例",