mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 04:28:51 +08:00
fix(接口测试): 修复引用场景步骤可以编辑问题
--bug=1017578 --user=赵勇 【接口测试】场景编辑-引用的场景步骤可编辑 https://www.tapd.cn/55049933/s/1262018
This commit is contained in:
parent
a3fee1ea50
commit
f1ea7c2263
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -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();
|
||||
|
||||
//默认最大化
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user