From 90ee92770b4b42dc837143f9735a4d35590c7ddc Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 16 Nov 2022 17:56:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E5=88=A0=E9=99=A4=E5=A4=B1=E6=95=88=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019659 --user=王孝刚 【接口测试】环境变量批量删除,没有变量名称的删不掉 https://www.tapd.cn/55049933/s/1296980 --- .../environment/commons/ApiScenarioVariables.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 0bd49e273c..44669f6e2f 100644 --- a/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue +++ b/framework/sdk-parent/frontend/src/components/environment/commons/ApiScenarioVariables.vue @@ -76,7 +76,7 @@ + @click="remove(scope.row)" v-if="isDisable(scope.row)"/> { let ids = this.$refs.variableTable.selectRows; ids.forEach(row => { - if (row.name) { - const index = this.variables.findIndex(d => d.name === row.name); - this.variables.splice(index, 1); + if (row.id) { + const index = this.variables.findIndex(d => d.id === row.id); + if (index !== this.variables.length - 1) { + this.variables.splice(index, 1); + } } }); this.sortParameters(); @@ -276,8 +278,9 @@ export default { openSetting(data) { this.$refs.apiVariableSetting.open(data); }, - isDisable: function (index) { - return this.items.length - 1 === index; + isDisable: function (row) { + const index = this.variables.findIndex(d => d.name === row.name); + return this.variables.length - 1 !== index; }, _handleBatchVars(data) { let params = data.split("\n");