fix(接口测试): 修复首页跳转swagger定时同步任务时没有默认打开定时同步页签的问题

--bug=1005166 --user=宋天阳 【接口定义】首页跳转swagger定时同步显示【+github#14476】
https://www.tapd.cn/55049933/s/1177205
This commit is contained in:
song-tianyang 2022-06-09 13:22:40 +08:00 committed by f2c-ci-robot[bot]
parent f120e85230
commit 35cdf32cef
2 changed files with 42 additions and 17 deletions

View File

@ -44,7 +44,8 @@
right-content="CASE" right-content="CASE"
> >
<template v-slot:version> <template v-slot:version>
<version-select v-xpack :project-id="projectId" :version-id="trashVersion" @changeVersion="changeVersion"/> <version-select v-xpack :project-id="projectId" :version-id="trashVersion"
@changeVersion="changeVersion"/>
</template> </template>
<!-- 列表集合 --> <!-- 列表集合 -->
<ms-api-list <ms-api-list
@ -422,8 +423,8 @@ export default {
let workspaceId = this.$route.params.workspaceId; let workspaceId = this.$route.params.workspaceId;
if (workspaceId) { if (workspaceId) {
sessionStorage.setItem(WORKSPACE_ID, workspaceId); sessionStorage.setItem(WORKSPACE_ID, workspaceId);
}else { } else {
if(this.$route.query.workspaceId){ if (this.$route.query.workspaceId) {
workspaceId = this.$route.query.workspaceId; workspaceId = this.$route.query.workspaceId;
sessionStorage.setItem(WORKSPACE_ID, workspaceId); sessionStorage.setItem(WORKSPACE_ID, workspaceId);
} }
@ -431,7 +432,7 @@ export default {
let projectId = this.$route.params.projectId; let projectId = this.$route.params.projectId;
if (projectId) { if (projectId) {
sessionStorage.setItem(PROJECT_ID, projectId); sessionStorage.setItem(PROJECT_ID, projectId);
}else { } else {
if (this.$route.query.projectId) { if (this.$route.query.projectId) {
projectId = this.$route.query.projectId; projectId = this.$route.query.projectId;
sessionStorage.setItem(PROJECT_ID, this.$route.query.projectId); sessionStorage.setItem(PROJECT_ID, this.$route.query.projectId);
@ -496,7 +497,7 @@ export default {
}, },
addTab(tab) { addTab(tab) {
if (tab.name === 'add') { if (tab.name === 'add') {
this.result = this.$get('/project_application/get/config/' + this.projectId +"/API_QUICK_MENU", res => { this.result = this.$get('/project_application/get/config/' + this.projectId + "/API_QUICK_MENU", res => {
let projectData = res.data; let projectData = res.data;
if (projectData && projectData.apiQuickMenu === 'api') { if (projectData && projectData.apiQuickMenu === 'api') {
this.handleTabAdd("ADD"); this.handleTabAdd("ADD");
@ -692,22 +693,43 @@ export default {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }
if (targetName === undefined || targetName === null) {
targetName = this.$t('api_test.definition.request.title');
}
let newTabName = getUUID(); let newTabName = getUUID();
this.apiTabs.push({ let addNewTab = true;
title: targetName, if (action === 'SCHEDULE') {
name: newTabName, //
closable: true, this.apiTabs.forEach(tab => {
type: action, if (tab.title === targetName) {
api: api, addNewTab = false;
isCopy: api ? api.isCopy : false newTabName = tab.name;
}); }
});
}
if (addNewTab) {
if (targetName === undefined || targetName === null) {
targetName = this.$t('api_test.definition.request.title');
}
this.apiTabs.push({
title: targetName,
name: newTabName,
closable: true,
type: action,
api: api,
isCopy: api ? api.isCopy : false
});
}
if (action === "ADD") { if (action === "ADD") {
this.activeTab = "api"; this.activeTab = "api";
} }
this.apiDefaultTab = newTabName; this.$nextTick(() => {
this.apiDefaultTab = newTabName;
if(!addNewTab && action === "SCHEDULE") {
//tab
if(this.$refs.apiSchedules){
this.$refs.apiSchedules.searchTaskList();
}
}
});
}, },
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);

View File

@ -335,6 +335,9 @@ export default {
this.clear(); this.clear();
}); });
}, },
searchTaskList(){
this.$refs.taskList.search();
},
intervalValidate() { intervalValidate() {
if (this.getIntervalTime() < 1 * 60 * 1000) { if (this.getIntervalTime() < 1 * 60 * 1000) {
return false; return false;