refactor(接口自动化): 修改全选

This commit is contained in:
q4speed 2020-12-02 18:23:26 +08:00
parent 02a5eb9570
commit 7ee2374b00
2 changed files with 30 additions and 15 deletions

View File

@ -6,15 +6,10 @@
</template>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="select" @select="select">
<el-table-column width="100">
<template v-slot:header="{row}">
<el-dropdown id="select" size="small" split-button @command="handleCommand">
<el-checkbox @change="selectAllChange"></el-checkbox>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="table">{{ $t('api_test.automation.scenario.select_table') }}</el-dropdown-item>
<el-dropdown-item command="all">{{ $t('api_test.automation.scenario.select_all') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-table-column type="selection"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="{row}">
<show-more-btn :is-show="isSelect(row)" :buttons="buttons" :size="selection.length"/>
</template>
</el-table-column>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')" width="200"
@ -56,10 +51,11 @@
<script>
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
export default {
name: "MsApiScenarioList",
components: {MsTablePagination, MsTableHeader},
components: {ShowMoreBtn, MsTablePagination, MsTableHeader},
props: {
currentProject: Object,
currentModule: Object,
@ -69,13 +65,21 @@ export default {
result: {},
condition: {},
selectAll: false,
selection: [],
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
buttons: [
{
name: this.$t('api_test.automation.batch_add_plan'), handleClick: this.handleBatchAddCase
}, {
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
}
],
}
},
watch:{
watch: {
currentProject() {
this.search();
},
@ -118,12 +122,23 @@ export default {
this.selectAll = true;
break
}
},
handleBatchAddCase() {
},
handleBatchExecute() {
},
selectAllChange() {
this.handleCommand("table");
},
select(selection) {
console.log(selection)
this.selection = selection.map(s => s.id);
console.log(this.selection)
},
isSelect(row) {
console.log(this.selection.includes(row.id))
return this.selection.includes(row.id)
},
edit(row) {
@ -160,7 +175,5 @@ export default {
</script>
<style scoped>
#select >>> .el-button-group > .el-button:first-child {
padding: 7px 15px;
}
</style>

View File

@ -561,6 +561,8 @@ export default {
execute: "执行",
copy: "复制",
remove: "删除",
batch_add_plan: "批量添加到测试计划",
batch_execute: "批量执行",
scenario: {
principal: "责任人",
select_principal: "请选择责任人",