style(接口测试): 修复接口测试首页swagger跳转的问题

--bug=1015399 --user=宋天阳 【接口测试】首页-运行中的定时任务,swagger定时任务跳转后没有显示定时任务tab
https://www.tapd.cn/55049933/s/1215835
This commit is contained in:
song-tianyang 2022-07-29 19:02:32 +08:00 committed by 建国
parent 294dbdb82a
commit 134e781f7c
3 changed files with 309 additions and 262 deletions

View File

@ -220,6 +220,7 @@ export default {
if (!params) {
return;
}
if (params instanceof String) {
let paramArr = params.split("edit:");
if (paramArr.length !== 2) {
return;
@ -244,6 +245,7 @@ export default {
}
}
});
}
},
initModules(row, projectId) {
this.$get("/api/automation/module/list/" + projectId, response => {

View File

@ -354,7 +354,7 @@ export default {
};
},
activated() {
this.selectNodeIds = [];
this.$nextTick(() => {
let routeParamObj = this.$route.params.paramObj;
if (routeParamObj) {
let dataRange = routeParamObj.dataSelectRange;
@ -374,7 +374,7 @@ export default {
if (item !== undefined) {
let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") {
this.handleTabsEdit(this.$t('api_test.api_import.timing_synchronization'), 'SCHEDULE');
this.openSwaggerScheduleTab();
this.param = item;
}
}
@ -393,12 +393,13 @@ export default {
if (item !== undefined) {
let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") {
this.handleTabsEdit(this.$t('api_test.api_import.timing_synchronization'), 'SCHEDULE');
this.openSwaggerScheduleTab();
this.param = item;
}
}
}
}
});
},
watch: {
currentProtocol() {
@ -463,6 +464,22 @@ export default {
}
},
methods: {
openSwaggerScheduleTab() {
//
let scheduleTabName = "";
if (this.apiTabs) {
this.apiTabs.forEach(tab => {
if (tab.type === 'SCHEDULE') {
scheduleTabName = tab.name;
}
});
}
if (scheduleTabName === "") {
this.handleTabsEdit(this.$t('api_test.api_import.timing_synchronization'), 'SCHEDULE');
} else {
this.apiDefaultTab = scheduleTabName;
}
},
setEnvironment(data) {
if (data) {
this.useEnvironment = data.id;
@ -733,7 +750,7 @@ export default {
if (routeParamObj) {
let dataRange = routeParamObj.dataSelectRange;
let dataType = routeParamObj.dataType;
if (dataRange) {
if (dataRange && dataRange instanceof String) {
let selectParamArr = dataRange.split("edit:");
if (selectParamArr.length === 2) {
let scenarioId = selectParamArr[1];
@ -747,7 +764,7 @@ export default {
} else {
let dataRange = this.$route.params.dataSelectRange;
let dataType = this.$route.params.dataType;
if (dataRange) {
if (dataRange && dataRange instanceof String) {
let selectParamArr = dataRange.split("edit:");
if (selectParamArr.length === 2) {
let scenarioId = selectParamArr[1];

View File

@ -146,11 +146,13 @@ export default {
},
methods: {
initProtocol() {
if(this.$route.params.type){
//
let isRedirectPage = this.isRedirect();
if (this.$route.params.type) {
this.condition.protocol = this.$route.params.type;
this.$emit('protocolChange', this.condition.protocol);
this.list();
}else if (!this.isRelevance) {
} else if (!this.isRelevance && !isRedirectPage) {
//
this.$get('/api/module/getUserDefaultApiType/', response => {
this.condition.protocol = response.data;
@ -162,6 +164,32 @@ export default {
this.list();
}
},
isRedirect() {
let isRedirectPage = false;
let routeParamObj = this.$route.params.paramObj;
if (routeParamObj) {
if (routeParamObj.dataSelectRange) {
let item = JSON.parse(JSON.stringify(routeParamObj.dataSelectRange)).param;
if (item !== undefined) {
let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") {
isRedirectPage = true;
}
}
}
} else {
if (this.$route.params.dataSelectRange) {
let item = JSON.parse(JSON.stringify(this.$route.params.dataSelectRange)).param;
if (item !== undefined) {
let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") {
isRedirectPage = true;
}
}
}
}
return isRedirectPage;
},
filter() {
this.$refs.nodeTree.filter(this.condition.filterText);
},
@ -268,7 +296,7 @@ export default {
this.$emit('refreshTable');
},
}
}
}
</script>
<style scoped>