fix(接口测试): 修复接口定义页面tab页签混乱的问题

--bug=1014063 --user=宋天阳 【接口测试】执行接口定义的时候,接口名称标签显示错位
https://www.tapd.cn/55049933/s/1181853
This commit is contained in:
song-tianyang 2022-06-14 18:56:47 +08:00 committed by f2c-ci-robot[bot]
parent edb3a82b01
commit 7875aed28e
1 changed files with 12 additions and 33 deletions

View File

@ -693,43 +693,22 @@ export default {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
if (targetName === undefined || targetName === null) {
targetName = this.$t('api_test.definition.request.title');
}
let newTabName = getUUID();
let addNewTab = true;
if (action === 'SCHEDULE') {
//
this.apiTabs.forEach(tab => {
if (tab.title === targetName) {
addNewTab = 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
});
}
this.apiTabs.push({
title: targetName,
name: newTabName,
closable: true,
type: action,
api: api,
isCopy: api ? api.isCopy : false
});
if (action === "ADD") {
this.activeTab = "api";
}
this.$nextTick(() => {
this.apiDefaultTab = newTabName;
if (!addNewTab && action === "SCHEDULE") {
//tab
if (this.$refs.apiSchedules) {
this.$refs.apiSchedules.searchTaskList();
}
}
});
this.apiDefaultTab = newTabName;
},
debug(id) {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);