|
|
|
@ -29,7 +29,7 @@ const [setup, use] = useInjectionState(() => {
|
|
|
|
|
if (routeName.startsWith('projectType-projectId-index-index-type-title-viewTitle') && tables.value.length) { |
|
|
|
|
const tab: TabItem = { type: route.params.type as TabType, title: route.params.title as string } |
|
|
|
|
|
|
|
|
|
const currentTable = tables.value.find((t) => t.title === tab.title) |
|
|
|
|
const currentTable = tables.value.find((t) => t.id === tab.title || t.title === tab.title) |
|
|
|
|
|
|
|
|
|
if (!currentTable) return -1 |
|
|
|
|
|
|
|
|
@ -37,6 +37,8 @@ const [setup, use] = useInjectionState(() => {
|
|
|
|
|
|
|
|
|
|
let index = tabs.value.findIndex((t) => t.id === tab.id) |
|
|
|
|
|
|
|
|
|
tab.title = currentTable.title |
|
|
|
|
|
|
|
|
|
if (index === -1) { |
|
|
|
|
tab.sortsState = tab.sortsState || new Map() |
|
|
|
|
tab.filterState = tab.filterState || new Map() |
|
|
|
@ -111,13 +113,9 @@ const [setup, use] = useInjectionState(() => {
|
|
|
|
|
function navigateToTab(tab: TabItem) { |
|
|
|
|
switch (tab.type) { |
|
|
|
|
case TabType.TABLE: |
|
|
|
|
return navigateTo( |
|
|
|
|
`/${projectType}/${route.params.projectId}/table/${tab?.title}${tab.viewTitle ? `/${tab.viewTitle}` : ''}`, |
|
|
|
|
) |
|
|
|
|
return navigateTo(`/${projectType}/${route.params.projectId}/table/${tab?.id}${tab.viewTitle ? `/${tab.viewTitle}` : ''}`) |
|
|
|
|
case TabType.VIEW: |
|
|
|
|
return navigateTo( |
|
|
|
|
`/${projectType}/${route.params.projectId}/view/${tab?.title}${tab.viewTitle ? `/${tab.viewTitle}` : ''}`, |
|
|
|
|
) |
|
|
|
|
return navigateTo(`/${projectType}/${route.params.projectId}/view/${tab?.id}${tab.viewTitle ? `/${tab.viewTitle}` : ''}`) |
|
|
|
|
case TabType.AUTH: |
|
|
|
|
return navigateTo(`/${projectType}/${route.params.projectId}/auth`) |
|
|
|
|
} |
|
|
|
@ -131,10 +129,10 @@ const [setup, use] = useInjectionState(() => {
|
|
|
|
|
|
|
|
|
|
Object.assign(tab, newTabItemProps) |
|
|
|
|
|
|
|
|
|
if (isActive && tab.title) |
|
|
|
|
if (isActive && tab.id) |
|
|
|
|
router.replace({ |
|
|
|
|
params: { |
|
|
|
|
title: tab.title, |
|
|
|
|
title: tab.id, |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|