From 569a4f539fb4aa98cd54bc3e486ac1a3a64d536f Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 19 Aug 2022 18:24:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E5=8F=98=E9=87=8F=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E6=B7=BB=E5=8A=A0=E6=9C=AA=E8=A6=86=E7=9B=96=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016048 --user=王孝刚 【接口测试】批量添加场景变量,同名变量没覆盖 https://www.tapd.cn/55049933/s/1228204 --- .../scenario/variable/VariableList.vue | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index 2f37b8fd16..d28c214ca1 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -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;