20260913231607
This commit is contained in:
1 parent
f3ad727f1c
commit
c31329d387
179 files changed
+10846
-2684
No files matched your search
@@ -64,11 +64,13 @@ export const routes = [
|
||||
component: () => import('@/views/detail/DetailPage.vue'),
|
||||
meta: { title: '详情', cacheByKey: true },
|
||||
},
|
||||
// 模块中心:元数据驱动的配置页集合
|
||||
// 模块中心:元数据驱动的配置页集合(系统管理员专用,meta.adminOnly:
|
||||
// 路由守卫拦截非 g3soft,菜单管理「路由地址」下拉整体排除本组页面)
|
||||
// 分组节点(见上方「路由分组」注释:不写 component,子页写相对路径)
|
||||
{
|
||||
path: '/module',
|
||||
redirect: '/module/module-management',
|
||||
meta: { adminOnly: true },
|
||||
children: [
|
||||
// 模块管理:元数据驱动的模块配置中心(先静态路由,权限/动态菜单后续接入)
|
||||
{
|
||||
@@ -108,6 +110,8 @@ const EXCLUDED_PATHS = new Set(['/login'])
|
||||
/**
|
||||
* 收集可作为菜单入口的页面路由(递归展开布局容器与分组节点)。
|
||||
* 过滤规则:
|
||||
* - meta.adminOnly 的路由(系统管理员专用页,如模块中心)连同子树整体排除,
|
||||
* 系统页面不进业务菜单,「路由地址」下拉配不出第二入口;
|
||||
* - 含 children 的节点(布局容器 / 分组节点)不是最终页面,只向下递归;
|
||||
* - 含动态段(:id)或通配(*)的路由无法作为固定菜单入口;
|
||||
* - 登录页等独立布局页排除在外。
|
||||
@@ -118,6 +122,8 @@ const EXCLUDED_PATHS = new Set(['/login'])
|
||||
export function collectMenuRoutes(list = routes, parentPath = '') {
|
||||
const result = []
|
||||
for (const route of list || []) {
|
||||
// 系统管理员专用页面(meta.adminOnly):整体排除,不作为业务菜单入口
|
||||
if (route.meta?.adminOnly) continue
|
||||
const rawPath = route.path || ''
|
||||
// 绝对路径原样使用;相对路径(分组节点的 children)拼到父路径上
|
||||
const path = rawPath.startsWith('/') ? rawPath : joinPath(parentPath, rawPath)
|
||||
@@ -144,7 +150,7 @@ function joinPath(parentPath, childPath) {
|
||||
|
||||
/**
|
||||
* 菜单管理「路由地址」下拉选项:按路径排序,配合 Select 的本地包含匹配(like)筛选。
|
||||
* label 同时含路径与标题,输入 "/module" 或 "模块" 都能命中。
|
||||
* label 同时含路径与标题,输入路径片段或标题关键词都能命中。
|
||||
*/
|
||||
export const menuRouteOptions = collectMenuRoutes().toSorted((a, b) =>
|
||||
a.value.localeCompare(b.value, 'zh-Hans-CN'),
|
||||
|
||||
Reference in new issue
Block a user