fix(auth): 完善权限控制与强制改密流程
This commit is contained in:
@@ -3,11 +3,13 @@ import { computed } from 'vue'
|
||||
import { RouterLink, useRouter } from 'vue-router'
|
||||
|
||||
import { useLoginStore } from '@/stores/login'
|
||||
import { mockFlags } from '@/utils/mock-flags'
|
||||
|
||||
interface MenuItem {
|
||||
path: string
|
||||
label: string
|
||||
permission?: string
|
||||
available?: boolean
|
||||
}
|
||||
|
||||
interface MenuGroup {
|
||||
@@ -22,22 +24,30 @@ const menuGroups: MenuGroup[] = [
|
||||
{
|
||||
label: '工作台',
|
||||
items: [
|
||||
{ path: '/workbench/home', label: '首页' },
|
||||
{ path: '/workbench/signing', label: '签署工作台' },
|
||||
{ path: '/workbench/home', label: '首页', permission: 'sign:task:query' },
|
||||
{ path: '/workbench/signing', label: '签署工作台', permission: 'sign:task:query' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '管理',
|
||||
items: [
|
||||
{ path: '/management/documents', label: '文档库管理' },
|
||||
{ path: '/management/reports', label: '报表分析' },
|
||||
{
|
||||
path: '/management/documents',
|
||||
label: '文档库管理',
|
||||
permission: 'sign:template:query',
|
||||
},
|
||||
{
|
||||
path: '/management/reports',
|
||||
label: '报表分析',
|
||||
permission: 'report:signing:query',
|
||||
},
|
||||
{ path: '/management/users', label: '用户与权限', permission: 'system:user:query' },
|
||||
{
|
||||
path: '/management/document-permissions',
|
||||
label: '文档权限',
|
||||
permission: 'sign:template:permission:query',
|
||||
},
|
||||
{ path: '/management/settings', label: '系统设置' },
|
||||
{ path: '/management/settings', label: '系统设置', available: mockFlags.settings },
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -47,7 +57,9 @@ const visibleMenuGroups = computed(() =>
|
||||
.map((group) => ({
|
||||
...group,
|
||||
items: group.items.filter(
|
||||
(item) => !item.permission || loginStore.hasPermission(item.permission),
|
||||
(item) =>
|
||||
item.available !== false &&
|
||||
(!item.permission || loginStore.hasPermission(item.permission)),
|
||||
),
|
||||
}))
|
||||
.filter((group) => group.items.length),
|
||||
|
||||
Reference in New Issue
Block a user