Эх сурвалжийг харах

fix: 修复父级菜单权限过滤导致菜单大面积不显示

hasMenuPermission 使用 includes 做精确匹配,但父级菜单的 meta.perm
是逗号分隔的多个权限(如 "washDevice.list,washStation.list,..."),
用户的 permList 中只有单个权限字符串,永远匹配不上。
改为按逗号拆分后再逐个判断,任意一个命中即显示菜单。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline 1 долоо хоног өмнө
parent
commit
811b2ad203

+ 6 - 2
admin-web/src/router/frontEnd.ts

@@ -151,8 +151,12 @@ export function hasRoles(roles: any, route: any) {
 }
 
 export function hasMenuPermission(permList: any, route: any) {
-	if (route.meta && route.meta.perm) return permList.includes(route.meta.perm);
-	else return true;
+	if (route.meta && route.meta.perm) {
+		const perms = String(route.meta.perm).split(',').map((p: string) => p.trim()).filter((p: string) => p.length > 0);
+		if (perms.length === 0) return true;
+		return perms.some((perm: string) => permList.includes(perm));
+	}
+	return true;
 }
 
 /**