fix(接口测试): 修复复制的场景中引用的case有时不能操作的缺陷

--bug=1020393 --user=王孝刚 [接口测试]场景A中复制场景B,场景B中引用的case有时候能编辑有时候不能。
https://www.tapd.cn/55049933/s/1307855
This commit is contained in:
wxg0103 2022-11-29 18:37:30 +08:00 committed by wxg0103
parent dd78428f0a
commit de41ba9f33
2 changed files with 17 additions and 4 deletions

View File

@ -91,7 +91,7 @@
circle
@click="copyRow"
style="padding: 5px"
:disabled="(data.disabled && !data.root) || !showVersion || isDeleted" />
:disabled="(data.disabled && !data.root && !data.isCopy) || !showVersion || isDeleted" />
<el-button
v-show="isSingleButton"
@ -101,7 +101,7 @@
style="padding: 5px"
circle
@click="remove"
:disabled="(data.disabled && !data.root) || !showVersion || isDeleted" />
:disabled="(data.disabled && !data.root && !data.isCopy) || !showVersion || isDeleted" />
<step-extend-btns
style="display: contents"
@ -267,14 +267,14 @@ export default {
return (
!this.innerStep ||
(this.showBtn &&
(!this.data.disabled || this.data.root) &&
(!this.data.disabled || this.data.root || this.data.isCopy) &&
this.showVersion &&
this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1)
);
}
return (
this.showBtn &&
(!this.data.disabled || this.data.root || this.isDeleted) &&
(!this.data.disabled || this.data.root || this.isDeleted || this.data.isCopy) &&
this.showVersion &&
this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1
);

View File

@ -158,6 +158,10 @@ export default {
this.scenario.disabled = true;
this.recursive(this.scenario.hashTree, this.scenario.projectId, true);
}
if (this.scenario.id && this.scenario.referenced === 'Copy' && !this.scenario.isCopy && !this.scenario.disabled) {
this.scenario.isCopy = true;
this.recursiveCopy(this.scenario.hashTree);
}
},
components: {
ApiBaseComponent,
@ -283,6 +287,7 @@ export default {
recursive(arr, id, disabled) {
for (let i in arr) {
arr[i].disabled = disabled;
arr[i].isCopy = false;
arr[i].projectId = this.calcProjectId(arr[i].projectId, id);
//
let typeArray = ['JDBCPostProcessor', 'JDBCSampler', 'JDBCPreProcessor'];
@ -298,6 +303,14 @@ export default {
}
}
},
recursiveCopy(arr) {
for (let i in arr) {
arr[i].isCopy = true;
if (arr[i].hashTree && arr[i].hashTree.length > 0) {
this.recursiveCopy(arr[i].hashTree);
}
}
},
calcProjectId(projectId, parentId) {
if (!projectId) {
return parentId ? parentId : getCurrentProjectID();