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); } } }