From 7a9909c0c9c690085f4ca2540baddb7e4c2da5d8 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 5 Dec 2022 17:17:49 +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=E5=9C=BA=E6=99=AF=E5=88=A0=E9=99=A4=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E7=9A=84case=EF=BC=8C=E5=88=AB=E7=9A=84=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=E7=9A=84=E6=96=AD=E8=A8=80=E5=92=8C=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E7=BD=AE=E6=93=8D=E4=BD=9C=E4=B9=9F=E8=A2=AB=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020598 --user=王孝刚 [接口测试] #20354批量勾选一个场景里面的多个case,做批量删除,会把剩余case的后置脚本和断言清空(特殊场景) https://www.tapd.cn/55049933/s/1313090 --- .../automation/scenario/EditApiScenario.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue b/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue index 734f264d73..c9d998b734 100644 --- a/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue +++ b/api-test/frontend/src/business/automation/scenario/EditApiScenario.vue @@ -2332,6 +2332,12 @@ export default { } return []; }, + getAllCheckedNodes() { + if (this.$refs.stepTree) { + return this.$refs.stepTree.getCheckedNodes(); + } + return []; + }, checkALevelChecked() { let resourceIds = []; if (this.$refs.stepTree) { @@ -2404,7 +2410,7 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - this.getAllResourceIds().forEach((item) => { + this.getAllCheckedNodes().forEach((item) => { this.recursionDelete(item, this.scenarioDefinition); }); this.sort(); @@ -2417,14 +2423,15 @@ export default { }, }); }, - recursionDelete(resourceId, nodes) { + recursionDelete(item, nodes) { for (let i in nodes) { if (nodes[i]) { - if (resourceId === nodes[i].resourceId) { + //复制的case的断言的resourceId是一样的,所以要加上parentIndex做唯一标识 + if (item.resourceId === nodes[i].resourceId && item.parentIndex === nodes[i].parentIndex) { nodes.splice(i, 1); } else { if (nodes[i].hashTree != undefined && nodes[i].hashTree.length > 0) { - this.recursionDelete(resourceId, nodes[i].hashTree); + this.recursionDelete(item, nodes[i].hashTree); } } }