fix(接口测试): 修复请求头删除报错
This commit is contained in:
parent
5927f0fc2b
commit
85e320910e
|
@ -1 +1 @@
|
||||||
Subproject commit c2dacf960cdb1ed35664bdd3432120b1203b73d8
|
Subproject commit cf6b06526324326a563d933e07118fac014a63b4
|
|
@ -5,7 +5,7 @@
|
||||||
</span>
|
</span>
|
||||||
<div class="kv-row" v-for="(item, index) in items" :key="index">
|
<div class="kv-row" v-for="(item, index) in items" :key="index">
|
||||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||||
<el-col v-if="isShowEnable" class="kv-checkbox">
|
<el-col class="kv-checkbox">
|
||||||
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
|
<input type="checkbox" v-if="!isDisable(index)" v-model="item.enable"
|
||||||
:disabled="isReadOnly"/>
|
:disabled="isReadOnly"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
show-word-limit/>
|
show-word-limit/>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-input :disabled="isReadOnly" v-model="item.value" size="small" @change="change"
|
<el-input :disabled="isReadOnly" v-model="item.value" size="small" @change="change"
|
||||||
:placeholder="valueText" show-word-limit/>
|
:placeholder="valueText" show-word-limit/>
|
||||||
|
@ -42,7 +43,6 @@
|
||||||
keyPlaceholder: String,
|
keyPlaceholder: String,
|
||||||
valuePlaceholder: String,
|
valuePlaceholder: String,
|
||||||
description: String,
|
description: String,
|
||||||
isShowEnable: Boolean,
|
|
||||||
items: Array,
|
items: Array,
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -52,7 +52,6 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// checkedValues: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -66,11 +65,6 @@
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
remove: function (index) {
|
remove: function (index) {
|
||||||
if (this.isShowEnable) {
|
|
||||||
// 移除勾选内容
|
|
||||||
let checkIndex = this.checkedValues.indexOf(this.items[index].uuid);
|
|
||||||
checkIndex != -1 ? this.checkedValues.splice(checkIndex, 1) : this.checkedValues;
|
|
||||||
}
|
|
||||||
// 移除整行输入控件及内容
|
// 移除整行输入控件及内容
|
||||||
this.items.splice(index, 1);
|
this.items.splice(index, 1);
|
||||||
this.$emit('change', this.items);
|
this.$emit('change', this.items);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<el-tabs v-model="activeName" :disabled="isReadOnly">
|
<el-tabs v-model="activeName" :disabled="isReadOnly">
|
||||||
<el-tab-pane :label="$t('api_test.scenario.variables')" name="parameters">
|
<el-tab-pane :label="$t('api_test.scenario.variables')" name="parameters">
|
||||||
<ms-api-scenario-variables :isShowEnable="true" :is-read-only="isReadOnly" :items="scenario.variables"
|
<ms-api-scenario-variables :is-read-only="isReadOnly" :items="scenario.variables"
|
||||||
:description="$t('api_test.scenario.kv_description')"/>
|
:description="$t('api_test.scenario.kv_description')"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
|
<el-tab-pane :label="$t('api_test.scenario.headers')" name="headers">
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
</span>
|
</span>
|
||||||
<div class="kv-row" v-for="(item, index) in items" :key="index">
|
<div class="kv-row" v-for="(item, index) in items" :key="index">
|
||||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||||
<el-col v-if="isShowEnable" class="kv-checkbox">
|
<el-col class="kv-checkbox">
|
||||||
<input type="checkbox" v-if="!isDisable(index)" @change="change" :value="item.uuid" v-model="checkedValues"
|
<input type="checkbox" v-if="!isDisable(index)" @change="change" :value="item.uuid" v-model="item.enable"
|
||||||
:disabled="isDisable(index) || isReadOnly"/>
|
:disabled="isDisable(index) || isReadOnly"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
@ -41,10 +41,6 @@
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
isShowEnable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
showVariable: {
|
showVariable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -52,16 +48,10 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
checkedValues: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
remove: function (index) {
|
remove: function (index) {
|
||||||
if (this.isShowEnable) {
|
|
||||||
// 移除勾选内容
|
|
||||||
let checkIndex = this.checkedValues.indexOf(this.items[index].uuid);
|
|
||||||
checkIndex != -1 ? this.checkedValues.splice(checkIndex, 1) : this.checkedValues;
|
|
||||||
}
|
|
||||||
this.items.splice(index, 1);
|
this.items.splice(index, 1);
|
||||||
this.$emit('change', this.items);
|
this.$emit('change', this.items);
|
||||||
},
|
},
|
||||||
|
@ -69,10 +59,6 @@
|
||||||
let isNeedCreate = true;
|
let isNeedCreate = true;
|
||||||
let removeIndex = -1;
|
let removeIndex = -1;
|
||||||
this.items.forEach((item, index) => {
|
this.items.forEach((item, index) => {
|
||||||
// 启用行赋值
|
|
||||||
if (this.isShowEnable) {
|
|
||||||
item.enable = this.checkedValues.indexOf(item.uuid) != -1 ? true : false;
|
|
||||||
}
|
|
||||||
if (!item.name && !item.value) {
|
if (!item.name && !item.value) {
|
||||||
// 多余的空行
|
// 多余的空行
|
||||||
if (index !== this.items.length - 1) {
|
if (index !== this.items.length - 1) {
|
||||||
|
@ -83,20 +69,11 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (isNeedCreate) {
|
if (isNeedCreate) {
|
||||||
// 往后台送入的复选框值布尔值
|
this.items.push(new KeyValue({enable: true}));
|
||||||
if (this.isShowEnable) {
|
|
||||||
this.items[this.items.length - 1].enable = true;
|
|
||||||
// v-model 选中状态
|
|
||||||
this.checkedValues.push(this.items[this.items.length - 1].uuid);
|
|
||||||
}
|
|
||||||
this.items.push(new KeyValue());
|
|
||||||
}
|
}
|
||||||
this.$emit('change', this.items);
|
this.$emit('change', this.items);
|
||||||
// TODO 检查key重复
|
// TODO 检查key重复
|
||||||
},
|
},
|
||||||
uuid: function () {
|
|
||||||
return (((1 + Math.random()) * 0x100000) | 0).toString(16).substring(1);
|
|
||||||
},
|
|
||||||
isDisable: function (index) {
|
isDisable: function (index) {
|
||||||
return this.items.length - 1 === index;
|
return this.items.length - 1 === index;
|
||||||
}
|
}
|
||||||
|
@ -104,15 +81,7 @@
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
if (this.items.length === 0) {
|
if (this.items.length === 0) {
|
||||||
this.items.push(new KeyValue());
|
this.items.push(new KeyValue({enable: true}));
|
||||||
}else if (this.isShowEnable) {
|
|
||||||
this.items.forEach((item, index) => {
|
|
||||||
let uuid = this.uuid();
|
|
||||||
item.uuid = uuid;
|
|
||||||
if (item.enable) {
|
|
||||||
this.checkedValues.push(uuid);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9
|
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
|
Loading…
Reference in New Issue