fix(接口测试): 修复场景删除复制的case,别的步骤的断言和前后置操作也被删除的缺陷

--bug=1020598 --user=王孝刚 [接口测试]
#20354批量勾选一个场景里面的多个case,做批量删除,会把剩余case的后置脚本和断言清空(特殊场景)
https://www.tapd.cn/55049933/s/1313090
This commit is contained in:
wxg0103 2022-12-05 17:17:49 +08:00 committed by f2c-ci-robot[bot]
parent 127a973af6
commit 62b492e468
1 changed files with 11 additions and 4 deletions

View File

@ -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) {
//caseresourceIdparentIndex
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);
}
}
}