|
|
@ -23,14 +23,16 @@ export interface SystemCodeOption { |
|
|
iframeUrl?: string; |
|
|
iframeUrl?: string; |
|
|
/** 当设置了 fullscreenRoute 时,切换到该选项会以全屏 Vue 路由展示 */ |
|
|
/** 当设置了 fullscreenRoute 时,切换到该选项会以全屏 Vue 路由展示 */ |
|
|
fullscreenRoute?: string; |
|
|
fullscreenRoute?: string; |
|
|
|
|
|
/** 切换到该系统后默认跳转的路由路径 */ |
|
|
|
|
|
defaultRoute?: string; |
|
|
} |
|
|
} |
|
|
/** 404 兜底路由名称,方便动态移除和重新添加 */ |
|
|
/** 404 兜底路由名称,方便动态移除和重新添加 */ |
|
|
export const CATCH_ALL_ROUTE_NAME = 'CatchAll404'; |
|
|
export const CATCH_ALL_ROUTE_NAME = 'CatchAll404'; |
|
|
//http://10.132.108.3:85/loginByUserId
|
|
|
//http://10.132.108.3:85/loginByUserId
|
|
|
export const systemCodeOptions: SystemCodeOption[] = [ |
|
|
export const systemCodeOptions: SystemCodeOption[] = [ |
|
|
{ label: '首页', value: 'planindex', icon: 'HomeFilled', iframeUrl: 'Same-origin/loginByUserId' }, |
|
|
{ label: '首页', value: 'planindex', icon: 'HomeFilled', fullscreenRoute: '/home' }, |
|
|
{ label: '执法监督码', value: 'supervisionCode', icon: 'Document' }, |
|
|
{ label: '执法监督码', value: 'supervisionCode', icon: 'Document', defaultRoute: '/statistics/administrative/enterprise-enforcement' }, |
|
|
{ label: '后台管理', value: 'authService', icon: 'Setting' } |
|
|
{ label: '后台管理', value: 'authService', icon: 'Setting', defaultRoute: '/system-setting/menu' } |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
export const usePermissionStore = defineStore('permission', () => { |
|
|
export const usePermissionStore = defineStore('permission', () => { |
|
|
@ -220,6 +222,11 @@ export const usePermissionStore = defineStore('permission', () => { |
|
|
// 重新添加404兜底路由,确保放在所有动态路由之后
|
|
|
// 重新添加404兜底路由,确保放在所有动态路由之后
|
|
|
router.addRoute({ name: CATCH_ALL_ROUTE_NAME, path: '/:pathMatch(.*)*', component: () => import('@/views/error/404.vue') }); |
|
|
router.addRoute({ name: CATCH_ALL_ROUTE_NAME, path: '/:pathMatch(.*)*', component: () => import('@/views/error/404.vue') }); |
|
|
console.log('[路由调试] switchSystemCode 完成, 当前路由列表 =', router.getRoutes().map((r) => ({ name: r.name, path: r.path }))); |
|
|
console.log('[路由调试] switchSystemCode 完成, 当前路由列表 =', router.getRoutes().map((r) => ({ name: r.name, path: r.path }))); |
|
|
|
|
|
|
|
|
|
|
|
// 跳转到默认路由
|
|
|
|
|
|
if (option?.defaultRoute) { |
|
|
|
|
|
await router.push(option.defaultRoute); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -236,15 +243,16 @@ export const usePermissionStore = defineStore('permission', () => { |
|
|
currentSystemCode.value = 'planindex'; |
|
|
currentSystemCode.value = 'planindex'; |
|
|
sessionStorage.setItem(SYSTEM_CODE_KEY, 'planindex'); |
|
|
sessionStorage.setItem(SYSTEM_CODE_KEY, 'planindex'); |
|
|
const defaultOption = systemCodeOptions.find((o) => o.value === 'planindex'); |
|
|
const defaultOption = systemCodeOptions.find((o) => o.value === 'planindex'); |
|
|
iframeMode.value = defaultOption?.iframeUrl ? true : false; |
|
|
iframeMode.value = !!(defaultOption?.iframeUrl || defaultOption?.fullscreenRoute); |
|
|
iframeUrl.value = defaultOption?.iframeUrl ? buildIframeUrl(defaultOption.iframeUrl) : ''; |
|
|
iframeUrl.value = defaultOption?.iframeUrl ? buildIframeUrl(defaultOption.iframeUrl) : ''; |
|
|
|
|
|
fullscreenRoute.value = defaultOption?.fullscreenRoute || ''; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** 根据后端返回的路由数据,动态过滤可见的系统分类选项(首页始终显示) */ |
|
|
/** 根据后端返回的路由数据,动态过滤可见的系统分类选项(首页始终显示) */ |
|
|
const visibleSystemCodeOptions = computed(() => { |
|
|
const visibleSystemCodeOptions = computed(() => { |
|
|
return systemCodeOptions.filter((option) => { |
|
|
return systemCodeOptions.filter((option) => { |
|
|
// 首页(有 iframeUrl 的)始终显示
|
|
|
// 首页(有 iframeUrl 或 fullscreenRoute 的)始终显示
|
|
|
if (option.iframeUrl) return true; |
|
|
if (option.iframeUrl || option.fullscreenRoute) return true; |
|
|
// 其他选项:只有当后端路由中存在匹配的 systemCode 时才显示
|
|
|
// 其他选项:只有当后端路由中存在匹配的 systemCode 时才显示
|
|
|
return allRouteDataCache.value.some((route: any) => route.systemCode === option.value); |
|
|
return allRouteDataCache.value.some((route: any) => route.systemCode === option.value); |
|
|
}); |
|
|
}); |
|
|
|