feat(测试跟踪): 测试用例批量编辑
This commit is contained in:
parent
5fb0fc59b7
commit
fdc9b1c2fe
|
@ -10,7 +10,7 @@
|
|||
>
|
||||
<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-select v-model="form.type" style="width: 80%" @change="changeType">
|
||||
<el-option label="用例等级" value="priority"/>
|
||||
<el-option label="类型" value="type"/>
|
||||
<el-option label="测试方式" value="method"/>
|
||||
|
@ -18,9 +18,13 @@
|
|||
</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 v-model="form.value" style="width: 80%" :filterable="filterable">
|
||||
<el-option v-for="(option, index) in options" :key="index" :value="option.id" :label="option.name">
|
||||
<!-- <div v-if="option.email">-->
|
||||
<!-- <span style="float: left">{{ option.name }}</span>-->
|
||||
<!-- <span style="float: right;color: #8492a6;">{{ option.email }}</span>-->
|
||||
<!-- </div>-->
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -35,12 +39,16 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../common/components/MsDialogFooter";
|
||||
import {WORKSPACE_ID} from "../../../../../common/js/constants";
|
||||
|
||||
export default {
|
||||
name: "BatchEdit",
|
||||
components: {
|
||||
MsDialogFooter
|
||||
},
|
||||
created() {
|
||||
this.getMaintainerOptions();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
|
@ -50,13 +58,32 @@
|
|||
type: {required: true, message: "请选择属性", trigger: ['blur','change']},
|
||||
value: {required: true, message: "请选择属性对应的值", trigger: ['blur','change']}
|
||||
},
|
||||
options: [],
|
||||
priorities: [
|
||||
{name: 'P0', id: 'P0'},
|
||||
{name: 'P1', id: 'P1'},
|
||||
{name: 'P2', id: 'P2'},
|
||||
{name: 'P3', id: 'P3'}
|
||||
],
|
||||
types: [
|
||||
{name: this.$t('commons.functional'), id: 'functional'},
|
||||
{name: this.$t('commons.performance'), id: 'performance'},
|
||||
{name: this.$t('commons.api'), id: 'api'}
|
||||
],
|
||||
methods: [
|
||||
{name: this.$t('test_track.case.manual'), id: 'manual'},
|
||||
{name: this.$t('test_track.case.auto'), id: 'auto'}
|
||||
],
|
||||
maintainers: [],
|
||||
filterable: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$emit("submit", this.form);
|
||||
this.$emit("batchEdit", this.form);
|
||||
this.dialogVisible = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -68,6 +95,33 @@
|
|||
},
|
||||
handleClose() {
|
||||
this.form = {};
|
||||
},
|
||||
changeType(val) {
|
||||
this.$set(this.form, "value", "");
|
||||
this.filterable = val === "maintainer";
|
||||
switch (val) {
|
||||
case "priority":
|
||||
this.options = this.priorities;
|
||||
break;
|
||||
case "type":
|
||||
this.options = this.types;
|
||||
break;
|
||||
case "method":
|
||||
this.options = this.methods;
|
||||
break;
|
||||
case "maintainer":
|
||||
|
||||
this.options = this.maintainers;
|
||||
break;
|
||||
default:
|
||||
this.options = [];
|
||||
}
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.maintainers = response.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
.show-more-btn-title {
|
||||
color: #696969;
|
||||
background-color: #C0C0C0;
|
||||
background-color: #e2e2e2;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
|
||||
</el-card>
|
||||
|
||||
<batch-edit ref="batchEdit"/>
|
||||
<batch-edit ref="batchEdit" @batchEdit="batchEdit"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -333,17 +333,19 @@
|
|||
this.$set(row, "showMore", false);
|
||||
this.selectRows.delete(row);
|
||||
} else {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
|
||||
// todo
|
||||
if (this.selectRows.size > 1) {
|
||||
Array.from(this.selectRows).forEach(row => {
|
||||
let arr = Array.from(this.selectRows);
|
||||
|
||||
// 选中1个以上的用例时显示更多操作
|
||||
if (this.selectRows.size === 1) {
|
||||
this.$set(arr[0], "showMore", false);
|
||||
} else if (this.selectRows.size === 2) {
|
||||
arr.forEach(row => {
|
||||
this.$set(row, "showMore", true);
|
||||
})
|
||||
} else if (this.selectRows.size === 1) {
|
||||
let arr = Array.from(this.selectRows);
|
||||
this.$set(arr[0], "showMore", false);
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
|
@ -391,6 +393,18 @@
|
|||
this.exportTestCase();
|
||||
}
|
||||
},
|
||||
batchEdit(form) {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
// todo 功能测试 的测试方式修改为 自动 时不通过
|
||||
// 测试类型为自动时不能修改为 功能测试
|
||||
this.$post('/test/case/batch/edit' , param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.refresh();
|
||||
});
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
|
|
Loading…
Reference in New Issue