mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 13:09:28 +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 () {
|
'request.environmentId': function () {
|
||||||
if (!this.scenarioId) {
|
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;
|
let id = this.request.projectId ? this.request.projectId : this.projectId;
|
||||||
this.result = getEnvironmentByProjectId(id).then(response => {
|
this.result = getEnvironmentByProjectId(id).then(response => {
|
||||||
this.environments = response.data;
|
this.environments = response.data;
|
||||||
let targetDataSourceName = undefined;
|
let targetDataSourceName = this.request.targetDataSourceName;
|
||||||
this.environments.forEach(environment => {
|
this.environments.forEach(environment => {
|
||||||
parseEnvironment(environment);
|
parseEnvironment(environment);
|
||||||
// 找到原始环境和数据源名称
|
// 找到原始环境和数据源名称
|
||||||
@ -272,6 +272,21 @@ export default {
|
|||||||
openEnvironmentConfig() {
|
openEnvironmentConfig() {
|
||||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
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) {
|
initDataSource(envId, currentEnvironment, targetDataSourceName) {
|
||||||
this.databaseConfigsOptions = [];
|
this.databaseConfigsOptions = [];
|
||||||
if (envId) {
|
if (envId) {
|
||||||
|
@ -263,7 +263,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arr[i].hashTree && arr[i].hashTree.length > 0) {
|
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();
|
this.getEnv();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
// 从场景路由进编辑页面
|
||||||
|
this.initForwardData();
|
||||||
// 通知过来的数据跳转到编辑
|
// 通知过来的数据跳转到编辑
|
||||||
if (this.$route.query.caseId) {
|
if (this.$route.query.caseId) {
|
||||||
this.activeDom = 'middle';
|
this.activeDom = 'middle';
|
||||||
@ -799,19 +800,17 @@ export default {
|
|||||||
debug(id) {
|
debug(id) {
|
||||||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
||||||
},
|
},
|
||||||
init() {
|
initForwardData() {
|
||||||
let dataRange = this.$route.params.dataSelectRange;
|
let dataRange = this.$route.params.dataSelectRange;
|
||||||
let dataType = this.$route.params.dataType;
|
let dataType = this.$route.params.dataType;
|
||||||
if (dataRange && typeof dataRange === 'string') {
|
if (dataRange && typeof dataRange === 'string' && dataType === 'api') {
|
||||||
let selectParamArr = dataRange.split("edit:");
|
let selectParamArr = dataRange.split("edit:");
|
||||||
if (selectParamArr.length === 2) {
|
if (selectParamArr.length === 2) {
|
||||||
let scenarioId = selectParamArr[1];
|
let scenarioId = selectParamArr[1];
|
||||||
if (dataType === 'api') {
|
getDefinitionById(scenarioId).then((response) => {
|
||||||
getDefinitionById(scenarioId).then((response) => {
|
this.defaultProtocol = response.data.protocol;
|
||||||
this.defaultProtocol = response.data.protocol;
|
this.editApiModule(response.data);
|
||||||
this.editApi(response.data);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -252,7 +252,9 @@ export default {
|
|||||||
}
|
}
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.currentApi = api;
|
if(this.currentApi && api) {
|
||||||
|
Object.assign(this.currentApi, api);
|
||||||
|
}
|
||||||
this.addCase();
|
this.addCase();
|
||||||
|
|
||||||
//默认最大化
|
//默认最大化
|
||||||
|
@ -1,24 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="isShow">
|
<div v-if="isShow">
|
||||||
|
|
||||||
<el-button-group v-if="isShowChangeButton">
|
<el-button-group v-if="isShowChangeButton">
|
||||||
|
<el-button plain class="ms-relevance-api-btn" :class="{active: isApiListEnable}" @click="apiChange('api')">
|
||||||
<el-tooltip class="item" effect="dark" content="接口列表" placement="left">
|
API
|
||||||
<el-button plain style="width: 44px;height: 32px;padding: 5px 8px;" :class="{active: isApiListEnable}"
|
</el-button>
|
||||||
@click="apiChange('api')">API
|
<el-button plain class="ms-relevance-case-btn" :class="{active: !isApiListEnable}" @click="caseChange('case')">
|
||||||
</el-button>
|
CASE
|
||||||
</el-tooltip>
|
</el-button>
|
||||||
|
|
||||||
<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-group>
|
</el-button-group>
|
||||||
|
|
||||||
<slot name="version"></slot>
|
<slot name="version"></slot>
|
||||||
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -58,8 +48,17 @@ export default {
|
|||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
.case-button {
|
.ms-relevance-api-btn {
|
||||||
border-left: solid 1px #6d317c;
|
width: 44px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 5px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-relevance-case-btn {
|
||||||
|
width: 44px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user