修复bug
This commit is contained in:
@@ -5,7 +5,6 @@ import {
|
||||
ClipboardList,
|
||||
Database,
|
||||
Download,
|
||||
FileCheck2,
|
||||
KeyRound,
|
||||
Settings,
|
||||
ShieldCheck,
|
||||
@@ -21,6 +20,7 @@ export interface AdminNavigationNode {
|
||||
iconColor?: string
|
||||
path?: string
|
||||
permission?: string
|
||||
permissionAnyOf?: string[]
|
||||
/** Set to true to remove a prototype module from the sidebar without deleting its route. */
|
||||
hidden?: boolean
|
||||
children?: AdminNavigationNode[]
|
||||
@@ -41,8 +41,7 @@ export const adminNavigation: AdminNavigationNode[] = [
|
||||
icon: Building2,
|
||||
iconColor: '#52c41a',
|
||||
children: [
|
||||
{ key: 'customers-list', title: '客户列表', icon: Building2, path: '/customers', permission: 'platform:customer:list' },
|
||||
{ key: 'enterprise-reviews', title: '企业审核', icon: FileCheck2, path: '/customers/reviews', permission: 'platform:customer:review' },
|
||||
{ key: 'customers-list', title: '客户列表', icon: Building2, path: '/customers', permission: 'platform:customer:list', permissionAnyOf: ['platform:customer:review'] },
|
||||
// { key: 'warehouse-tier-fee', title: '海外仓阶梯费用', icon: Building2, path: '/prototype/customer-management/warehouse-tier-fee' },
|
||||
],
|
||||
},
|
||||
@@ -258,7 +257,13 @@ export function filterAdminNavigation(
|
||||
const children = filterAdminNavigation(node.children, permissionCodes)
|
||||
return children.length ? [{ ...node, children }] : []
|
||||
}
|
||||
if (!node.path || (node.permission && !permissionCodes.has(node.permission))) return []
|
||||
const alternativePermissions = node.permissionAnyOf ?? []
|
||||
const requiresPermission = Boolean(node.permission || alternativePermissions.length)
|
||||
const hasPermission = !requiresPermission || Boolean(
|
||||
(node.permission && permissionCodes.has(node.permission))
|
||||
|| alternativePermissions.some((permission) => permissionCodes.has(permission)),
|
||||
)
|
||||
if (!node.path || !hasPermission) return []
|
||||
return [{ ...node }]
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user