fix(接口定义): 修复场景变量批量添加未覆盖的缺陷
--bug=1016048 --user=王孝刚 【接口测试】批量添加场景变量,同名变量没覆盖 https://www.tapd.cn/55049933/s/1228204
This commit is contained in:
parent
b04409a456
commit
569a4f539f
|
@ -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) => {
|
||||
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