fix: 修改接口自动化、接口定义的导入参数全选按钮,修复选框不显示 (#1635)

* feat(测试跟踪): 测试用例下载模版增加标签列

* fix(接口定义): 扩大请求头键长度

* fix: 修改接口自动化、接口定义的导入参数全选按钮,修复选框不显示
This commit is contained in:
Coooder-X 2021-03-15 20:43:01 +08:00 committed by GitHub
parent 0a19204418
commit 7f8a453035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 27 deletions

View File

@ -3,21 +3,14 @@
<span class="kv-description" v-if="description">
{{ description }}
</span>
<el-dropdown>
<span class="el-dropdown-link">
{{ $t('api_test.select_or_invert') }} <i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="selectAll">{{ $t('api_test.select_all') }}</el-dropdown-item>
<el-dropdown-item @click.native="invertSelect">{{ $t('api_test.invert_select') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-row>
<el-checkbox v-model="isSelectAll" v-if="items.length > 1"/>
</el-row>
<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">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
<el-checkbox v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/>
</el-col>
<span style="margin-left: 10px" v-else></span>
@ -59,7 +52,7 @@
valuePlaceholder: String,
isShowEnable: {
type: Boolean,
default: false
default: true
},
description: String,
items: Array,
@ -73,6 +66,7 @@
return {
keyValues: [],
loading: false,
isSelectAll: true
}
},
computed: {
@ -83,7 +77,15 @@
return this.valuePlaceholder || this.$t("api_test.value");
}
},
watch: {
isSelectAll: function(to, from) {
if(from == false && to == true) {
this.selectAll();
} else if(from == true && to == false) {
this.invertSelect();
}
}
},
methods: {
moveBottom(index) {
if (this.items.length < 2 || index === this.items.length - 2) {
@ -154,7 +156,7 @@
},
invertSelect() {
this.items.forEach(item => {
item.enable = !item.enable;
item.enable = false;
});
},
},

View File

@ -3,19 +3,13 @@
<span class="kv-description" v-if="description">
{{ description }}
</span>
<el-dropdown>
<span class="el-dropdown-link">
{{ $t('api_test.select_or_invert') }} <i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="selectAll">{{ $t('api_test.select_all') }}</el-dropdown-item>
<el-dropdown-item @click.native="invertSelect">{{ $t('api_test.invert_select') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-row>
<el-checkbox v-model="isSelectAll" v-if="parameters.length > 1"/>
</el-row>
<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">
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
<el-checkbox v-if="!isDisable(index)" v-model="item.enable"
:disabled="isReadOnly"/>
</el-col>
<span style="margin-left: 10px" v-else></span>
@ -131,8 +125,18 @@
return {
currentItem: null,
requireds: REQUIRED,
isSelectAll: true,
}
},
watch: {
isSelectAll: function(to, from) {
if(from == false && to == true) {
this.selectAll();
} else if(from == true && to == false) {
this.invertSelect();
}
},
},
computed: {
keyText() {
return this.keyPlaceholder || this.$t("api_test.key");
@ -191,7 +195,7 @@
// TODO key
},
isDisable: function (index) {
return this.parameters.length - 1 === index;
return this.parameters.length - 1 == index;
},
querySearch(queryString, cb) {
let suggestions = this.suggestions;
@ -235,7 +239,7 @@
},
invertSelect() {
this.parameters.forEach(item => {
item.enable = !item.enable;
item.enable = false;
});
},
},

View File

@ -142,7 +142,7 @@ export default {
status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
},
httpForm: {environmentId: "", tags: []},
isShowEnable: false,
isShowEnable: true,
maintainerOptions: [],
currentModule: {},
reqOptions: REQ_METHOD,