fix(接口定义): 修复场景变量批量添加未覆盖的缺陷
--bug=1016048 --user=王孝刚 【接口测试】批量添加场景变量,同名变量没覆盖 https://www.tapd.cn/55049933/s/1228204
This commit is contained in:
parent
68b1c3a187
commit
d29e1854fe
|
@ -352,10 +352,20 @@ export default {
|
|||
batchSaveParameter(data) {
|
||||
if (data) {
|
||||
let keyValues = this._handleBatchVars(data);
|
||||
keyValues.forEach(item => {
|
||||
item.type = 'CONSTANT';
|
||||
this.addParameters(item);
|
||||
keyValues.forEach(keyValue => {
|
||||
let isAdd = true;
|
||||
keyValue.id = getUUID();
|
||||
this.variables.forEach(item => {
|
||||
if (item.name === keyValue.name) {
|
||||
item.value = keyValue.value;
|
||||
isAdd = false;
|
||||
}
|
||||
})
|
||||
if (isAdd) {
|
||||
this.variables.splice(this.variables.length, 0, keyValue);
|
||||
}
|
||||
});
|
||||
this.sortParameters();
|
||||
}
|
||||
},
|
||||
handleClick(command) {
|
||||
|
@ -462,13 +472,11 @@ export default {
|
|||
return;
|
||||
}
|
||||
let repeatKey = "";
|
||||
if (!this.showDelete) {
|
||||
this.variables.forEach((item, index) => {
|
||||
if (item.name === this.editData.name) {
|
||||
repeatKey = item.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.variables.forEach((item) => {
|
||||
if (item.name === this.editData.name) {
|
||||
repeatKey = item.name;
|
||||
}
|
||||
});
|
||||
if (repeatKey !== "") {
|
||||
this.$warning(this.$t('api_test.scenario.variables') + "【" + repeatKey + "】" + this.$t('load_test.param_is_duplicate'));
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue