feat: 流程详情页打开后,关闭跳回对应的列表页
This commit is contained in:
@ -184,7 +184,7 @@ export const useMultipleTabStore = defineStore({
|
||||
}
|
||||
},
|
||||
|
||||
async closeTab(tab: RouteLocationNormalized, router: Router) {
|
||||
async closeTab(tab: RouteLocationNormalized, router: Router, backTo: String) {
|
||||
const close = (route: RouteLocationNormalized) => {
|
||||
const { fullPath, meta: { affix } = {} } = route;
|
||||
if (affix) {
|
||||
@ -207,6 +207,7 @@ export const useMultipleTabStore = defineStore({
|
||||
let toTarget: RouteLocationRaw = {};
|
||||
|
||||
const index = this.tabList.findIndex((item) => item.path === path);
|
||||
const backToIndex = backTo ? this.tabList.findIndex((item) => item.path === backTo) : -1;
|
||||
|
||||
// If the current is the leftmost tab
|
||||
if (index === 0) {
|
||||
@ -224,6 +225,11 @@ export const useMultipleTabStore = defineStore({
|
||||
const page = this.tabList[index - 1];
|
||||
toTarget = getToTarget(page);
|
||||
}
|
||||
|
||||
if (backToIndex >= 0) {
|
||||
const tabPage = this.tabList[backToIndex];
|
||||
toTarget = getToTarget(tabPage);
|
||||
}
|
||||
close(currentRoute.value);
|
||||
await replace(toTarget);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user