From 7b0364f018e59ac2a561c00e53e21e97747f4fb4 Mon Sep 17 00:00:00 2001 From: RubyLiu Date: Thu, 21 Dec 2023 11:46:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE=E5=87=BA=E7=8E=B0=E4=B8=A2=E5=80=BC?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/ApiScenarioVariables.vue | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue b/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue index a93cd86624..9177a6ee2d 100644 --- a/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue +++ b/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue @@ -110,7 +110,7 @@ maxlength="200" :placeholder="$t('api_test.variable_name')" show-word-limit - @change="change" + @change="change(scope.row)" /> @@ -365,7 +365,7 @@ export default { }); }, // 变量名 change - change: function () { + change: function (row) { let isNeedCreate = true; let removeIndex = -1; let repeatKey = ""; @@ -377,6 +377,9 @@ export default { repeatKey = item.name; } else { itemNames.add(item.name); + if(row && item.id === row.id) { + item.name = row.name; + } } // 检查空行 @@ -410,7 +413,7 @@ export default { scope: "api", }) ); - this.currentPage = Math.ceil(this.allData.length / this.pageSize); + this.currentPage = Math.ceil(this.items.length / this.pageSize); } // 重置并过滤数据 @@ -437,33 +440,33 @@ export default { data.type = "STRING"; } this.items.forEach((item) => { - if (item.name === data.name) { + if (item.id === data.id) { item.scope = value; item.type = data.type; item.value = data.value; } }); }, - changeVariableVal(data) { + changeVariableVal(row) { this.items.forEach((item) => { - if (item.name === data.name) { - item.value = data.value; + if (item.id === row.id) { + item.value = row.value; } }); }, // 备注修改 - descriptionChange(data) { + descriptionChange(row) { this.items.forEach((item) => { - if (item.name === data.name) { - item.description = data.description; + if (item.id === row.id) { + item.description = row.description; } }); }, // 启用禁用 - enableChange(data) { + enableChange(row) { this.items.forEach((item) => { - if (item.name === data.name) { - item.enable = data.enable; + if (item.id === row.id) { + item.enable = row.enable; } }); },