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 0e1255fbe6
commit 735f5d0f83
3 changed files with 309 additions and 262 deletions

View File

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

View File

@ -354,7 +354,7 @@ export default {
}; };
}, },
activated() { activated() {
this.selectNodeIds = []; this.$nextTick(() => {
let routeParamObj = this.$route.params.paramObj; let routeParamObj = this.$route.params.paramObj;
if (routeParamObj) { if (routeParamObj) {
let dataRange = routeParamObj.dataSelectRange; let dataRange = routeParamObj.dataSelectRange;
@ -374,7 +374,7 @@ export default {
if (item !== undefined) { if (item !== undefined) {
let type = item.taskGroup.toString(); let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") { if (type === "SWAGGER_IMPORT") {
this.handleTabsEdit(this.$t('api_test.api_import.timing_synchronization'), 'SCHEDULE'); this.openSwaggerScheduleTab();
this.param = item; this.param = item;
} }
} }
@ -393,12 +393,13 @@ export default {
if (item !== undefined) { if (item !== undefined) {
let type = item.taskGroup.toString(); let type = item.taskGroup.toString();
if (type === "SWAGGER_IMPORT") { if (type === "SWAGGER_IMPORT") {
this.handleTabsEdit(this.$t('api_test.api_import.timing_synchronization'), 'SCHEDULE'); this.openSwaggerScheduleTab();
this.param = item; this.param = item;
} }
} }
} }
} }
});
}, },
watch: { watch: {
currentProtocol() { currentProtocol() {
@ -463,6 +464,22 @@ export default {
} }
}, },
methods: { 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) { setEnvironment(data) {
if (data) { if (data) {
this.useEnvironment = data.id; this.useEnvironment = data.id;
@ -733,7 +750,7 @@ export default {
if (routeParamObj) { if (routeParamObj) {
let dataRange = routeParamObj.dataSelectRange; let dataRange = routeParamObj.dataSelectRange;
let dataType = routeParamObj.dataType; let dataType = routeParamObj.dataType;
if (dataRange) { if (dataRange && dataRange instanceof String) {
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];
@ -747,7 +764,7 @@ export default {
} else { } else {
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) { if (dataRange && dataRange instanceof String) {
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];

View File

@ -146,11 +146,13 @@ export default {
}, },
methods: { methods: {
initProtocol() { initProtocol() {
//
let isRedirectPage = this.isRedirect();
if (this.$route.params.type) { if (this.$route.params.type) {
this.condition.protocol = this.$route.params.type; this.condition.protocol = this.$route.params.type;
this.$emit('protocolChange', this.condition.protocol); this.$emit('protocolChange', this.condition.protocol);
this.list(); this.list();
}else if (!this.isRelevance) { } else if (!this.isRelevance && !isRedirectPage) {
// //
this.$get('/api/module/getUserDefaultApiType/', response => { this.$get('/api/module/getUserDefaultApiType/', response => {
this.condition.protocol = response.data; this.condition.protocol = response.data;
@ -162,6 +164,32 @@ export default {
this.list(); 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() { filter() {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);
}, },