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