feat(frontend): 审批与系统设置模块页面接入及业务列表调整

This commit is contained in:
liuwenxin committed 2026-10-16 09:32:12 +08:00
1 parent 8ef26e22fb
commit 74f1ef1cf9
15 files changed
+1215 -28

No files matched your search

+35 -8
View File
@@ -12,6 +12,9 @@ declare module 'vue-router' {
title?: string
/** 仅管理员可访问 —— 菜单隐藏 + 守卫兜底(直接输 URL 会被弹回首页) */
requiresAdmin?: boolean
/** 任一角色可访问(与 requiresAdmin 互斥使用;admin 须显式列入)——
* 菜单按角色过滤 + 守卫兜底,用于审批等职能页面 */
allowedRoles?: string[]
/** 是否出现在侧边菜单(默认 true);false 用于排除登录页等 */
menu?: boolean
/** 菜单分组名(同名聚合为一个子菜单);不设则为顶层菜单项 */
@@ -64,49 +67,67 @@ const routes: RouteRecordRaw[] = [
component: () => import('@/views/system/params/index.vue'),
meta: { title: '计提参数', group: '系统管理', requiresAdmin: true, order: 6 },
},
{
path: '/system/settings',
name: 'system-settings',
component: () => import('@/views/system/settings/index.vue'),
meta: { title: '公司信息', group: '系统管理', requiresAdmin: true, order: 7 },
},
{
// 审批管理:管理员/财务/领导可见(营销后勤待权限清单答复后放开)
path: '/system/approvals',
name: 'system-approvals',
component: () => import('@/views/system/approvals/index.vue'),
meta: {
title: '审批管理',
group: '系统管理',
allowedRoles: [ROLE_ADMIN, 'finance', 'leader'],
order: 8,
},
},
{
path: '/system/logs',
name: 'system-logs',
component: () => import('@/views/system/logs/index.vue'),
meta: { title: '日志查询', group: '系统管理', requiresAdmin: true, order: 7 },
meta: { title: '日志查询', group: '系统管理', requiresAdmin: true, order: 9 },
},
{
// 基础数据属业务操作:登录即可访问,不设 requiresAdmin(对照后端 api/v1/base)
path: '/base/personnel',
name: 'base-personnel',
component: () => import('@/views/base/personnel/index.vue'),
meta: { title: '人员管理', group: '基础数据', order: 8 },
meta: { title: '人员管理', group: '基础数据', order: 10 },
},
{
path: '/base/products',
name: 'base-products',
component: () => import('@/views/base/products/index.vue'),
meta: { title: '产品管理', group: '基础数据', order: 9 },
meta: { title: '产品管理', group: '基础数据', order: 11 },
},
{
path: '/base/customers',
name: 'base-customers',
component: () => import('@/views/base/customers/index.vue'),
meta: { title: '客户管理', group: '基础数据', order: 10 },
meta: { title: '客户管理', group: '基础数据', order: 12 },
},
{
// 业务数据组一律为业务操作:登录即可访问,不设 requiresAdmin
path: '/business/businesses',
name: 'business-businesses',
component: () => import('@/views/business/businesses/index.vue'),
meta: { title: '业务管理', group: '业务数据', order: 11 },
meta: { title: '业务管理', group: '业务数据', order: 13 },
},
{
path: '/business/shipments',
name: 'business-shipments',
component: () => import('@/views/business/shipments/index.vue'),
meta: { title: '发货管理', group: '业务数据', order: 12 },
meta: { title: '发货管理', group: '业务数据', order: 14 },
},
{
path: '/business/receipts',
name: 'business-receipts',
component: () => import('@/views/business/receipts/index.vue'),
meta: { title: '回款管理', group: '业务数据', order: 13 },
meta: { title: '回款管理', group: '业务数据', order: 15 },
},
{
// 业务数据组首个页面:评级计算器是打分工具,不影响绩效金额,
@@ -114,7 +135,7 @@ const routes: RouteRecordRaw[] = [
path: '/business/rating',
name: 'business-rating',
component: () => import('@/views/business/rating/index.vue'),
meta: { title: '客户评级计算器', group: '业务数据', order: 14 },
meta: { title: '客户评级计算器', group: '业务数据', order: 16 },
},
],
},
@@ -163,6 +184,12 @@ router.beforeEach(async (to) => {
return { path: '/dashboard' }
}
// 职能页面(审批等):任一角色命中即可进;菜单隐藏之外的第二道防线
if (to.meta.allowedRoles && !to.meta.allowedRoles.some((role) => userStore.roles.includes(role))) {
ElMessage.error('无权访问该页面')
return { path: '/dashboard' }
}
return true
})