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:36:23 +08:00 committed by wxg0103
parent 20cd69ce5b
commit c722084d0e
2 changed files with 17 additions and 5 deletions

View File

@ -41,16 +41,16 @@
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
<el-switch v-model="data.enable" class="enable-switch" size="mini"
:disabled="(data.disabled && !data.root) || !showVersion || isDeleted"/>
:disabled="(data.disabled && !data.root && !data.isCopy) || !showVersion || isDeleted"/>
</el-tooltip>
<el-button v-if="showVersion && showCopy" size="mini" icon="el-icon-copy-document" 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" size="mini" icon="el-icon-delete" type="danger" 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"
:data="data"
@ -203,9 +203,9 @@ export default {
},
isMoreButton() {
if (this.data.type === 'ConstantTimer' || this.data.type === 'Assertions') {
return (!this.innerStep || this.showBtn && (!this.data.disabled || this.data.root) && this.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1);
return (!this.innerStep || this.showBtn && (!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.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1);
return (this.showBtn && (!this.data.disabled || this.data.root || this.isDeleted || this.data.isCopy) && this.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1);
},
},
methods: {

View File

@ -126,6 +126,10 @@ export default {
this.scenario.root = this.node.parent.parent ? false : 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, MsSqlBasisParameters, MsTcpBasisParameters, MsDubboBasisParameters, MsApiRequestForm},
data() {
@ -240,6 +244,14 @@ export default {
this.loading = false
})
},
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);
}
}
},
recursive(arr, id, disabled) {
for (let i in arr) {
arr[i].disabled = disabled;