feat: (场景步骤) 请求参数增加复选框实现一键全选和反选 (#1529)

This commit is contained in:
Coooder-X 2021-03-05 17:28:14 +08:00 committed by GitHub
parent 7a251e2afb
commit 58d4c226b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 1 deletions

View File

@ -3,6 +3,15 @@
<span class="kv-description" v-if="description">
{{ description }}
</span>
<el-dropdown>
<span class="el-dropdown-link">
全选/反选<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="selectAll">全选</el-dropdown-item>
<el-dropdown-item @click.native="invertSelect">反选</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div class="kv-row item" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col class="kv-checkbox" v-if="isShowEnable">
@ -138,6 +147,16 @@
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},
selectAll() {
this.items.forEach(item => {
item.enable = true;
});
},
invertSelect() {
this.items.forEach(item => {
item.enable = !item.enable;
});
},
},
created() {
if (this.items.length === 0 || this.items[this.items.length - 1].name) {

View File

@ -3,7 +3,15 @@
<span class="kv-description" v-if="description">
{{ description }}
</span>
<el-dropdown>
<span class="el-dropdown-link">
全选/反选<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="selectAll">全选</el-dropdown-item>
<el-dropdown-item @click.native="invertSelect">反选</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div class="item kv-row" v-for="(item, index) in parameters" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col class="kv-checkbox" v-if="isShowEnable">
@ -220,6 +228,16 @@
item.contentType = 'text/plain';
}
},
selectAll() {
this.parameters.forEach(item => {
item.enable = true;
});
},
invertSelect() {
this.parameters.forEach(item => {
item.enable = !item.enable;
});
},
},
created() {
if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) {