fix(接口测试): 修复引用场景步骤可以编辑问题

--bug=1017578 --user=赵勇 【接口测试】场景编辑-引用的场景步骤可编辑 https://www.tapd.cn/55049933/s/1262018
This commit is contained in:
fit2-zhao 2022-10-14 17:08:43 +08:00 committed by fit2-zhao
parent a3fee1ea50
commit f1ea7c2263
5 changed files with 46 additions and 31 deletions

View File

@ -157,7 +157,7 @@ export default {
// /
'request.environmentId': function () {
if (!this.scenarioId) {
this.initDataSource(undefined, undefined, this.request.targetDataSourceName);
this.setStep(undefined, undefined, this.request.targetDataSourceName);
}
},
},
@ -197,7 +197,7 @@ export default {
let id = this.request.projectId ? this.request.projectId : this.projectId;
this.result = getEnvironmentByProjectId(id).then(response => {
this.environments = response.data;
let targetDataSourceName = undefined;
let targetDataSourceName = this.request.targetDataSourceName;
this.environments.forEach(environment => {
parseEnvironment(environment);
//
@ -272,6 +272,21 @@ export default {
openEnvironmentConfig() {
this.$refs.environmentConfig.open(getCurrentProjectID());
},
setStep(envId, currentEnvironment, targetDataSourceName) {
let envs = this.environments.filter(item => this.request && item.id === this.request.environmentId);
if (envs && envs.length === 0) {
let id = this.request.projectId ? this.request.projectId : this.projectId;
this.result = getEnvironmentByProjectId(id).then(response => {
this.environments = response.data;
this.environments.forEach(environment => {
parseEnvironment(environment);
})
this.initDataSource(envId, currentEnvironment, targetDataSourceName);
});
} else {
this.initDataSource(envId, currentEnvironment, targetDataSourceName);
}
},
initDataSource(envId, currentEnvironment, targetDataSourceName) {
this.databaseConfigsOptions = [];
if (envId) {

View File

@ -263,7 +263,7 @@ export default {
}
}
if (arr[i].hashTree && arr[i].hashTree.length > 0) {
this.recursive(arr[i].hashTree, arr[i].projectId);
this.recursive(arr[i].hashTree, arr[i].projectId, disabled);
}
}
},

View File

@ -499,7 +499,8 @@ export default {
this.getEnv();
},
mounted() {
this.init();
//
this.initForwardData();
//
if (this.$route.query.caseId) {
this.activeDom = 'middle';
@ -799,19 +800,17 @@ export default {
debug(id) {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
},
init() {
initForwardData() {
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
if (dataRange && typeof dataRange === 'string') {
if (dataRange && typeof dataRange === 'string' && dataType === 'api') {
let selectParamArr = dataRange.split("edit:");
if (selectParamArr.length === 2) {
let scenarioId = selectParamArr[1];
if (dataType === 'api') {
getDefinitionById(scenarioId).then((response) => {
this.defaultProtocol = response.data.protocol;
this.editApi(response.data);
});
}
getDefinitionById(scenarioId).then((response) => {
this.defaultProtocol = response.data.protocol;
this.editApiModule(response.data);
});
}
}
},

View File

@ -252,7 +252,9 @@ export default {
}
this.visible = true;
this.api = api;
this.currentApi = api;
if(this.currentApi && api) {
Object.assign(this.currentApi, api);
}
this.addCase();
//

View File

@ -1,24 +1,14 @@
<template>
<div v-if="isShow">
<el-button-group v-if="isShowChangeButton">
<el-tooltip class="item" effect="dark" content="接口列表" placement="left">
<el-button plain style="width: 44px;height: 32px;padding: 5px 8px;" :class="{active: isApiListEnable}"
@click="apiChange('api')">API
</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="用例列表" placement="right">
<el-button plain class="case-button" style="width: 44px;height: 32px;padding: 1px;"
:class="{active: !isApiListEnable}" @click="caseChange('case')">CASE
</el-button>
</el-tooltip>
<el-button plain class="ms-relevance-api-btn" :class="{active: isApiListEnable}" @click="apiChange('api')">
API
</el-button>
<el-button plain class="ms-relevance-case-btn" :class="{active: !isApiListEnable}" @click="caseChange('case')">
CASE
</el-button>
</el-button-group>
<slot name="version"></slot>
<slot></slot>
</div>
</template>
@ -58,8 +48,17 @@ export default {
color: #FFFFFF;
}
.case-button {
border-left: solid 1px #6d317c;
.ms-relevance-api-btn {
width: 44px;
height: 32px;
padding: 5px 8px;
}
.ms-relevance-case-btn {
width: 44px;
height: 32px;
padding: 1px;
}
</style>