From 8d5f2f138dbbaa158a7298d87d7333c9bd865ff2 Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Wed, 18 Mar 2026 16:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9A=E9=9A=90=E8=97=8F?= =?UTF-8?q?=20ROI=20=E8=8F=9C=E5=8D=95=E9=A1=B9=EF=BC=8CROI=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B7=B2=E6=95=B4=E5=90=88=E5=88=B0=E6=91=84=E5=83=8F?= =?UTF-8?q?=E5=A4=B4=E7=AE=A1=E7=90=86=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/web-antd/src/store/auth.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index dcef71175..4c4995c21 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -137,12 +137,31 @@ export const useAuthStore = defineStore('auth', () => { // userStore userStore.setUserInfo(authPermissionInfo.user); userStore.setUserRoles(authPermissionInfo.roles); - // accessStore - accessStore.setAccessMenus(authPermissionInfo.menus); + // accessStore - 隐藏不需要的菜单项(保留路由,仅侧边栏不显示) + const processedMenus = hideMenuItems(authPermissionInfo.menus); + accessStore.setAccessMenus(processedMenus); accessStore.setAccessCodes(authPermissionInfo.permissions); return authPermissionInfo; } + /** 递归标记菜单为隐藏(visible=false),保留路由可直接访问 */ + function hideMenuItems(menus: any[]): any[] { + // 需要从侧边栏隐藏的菜单路径(ROI 区域配置已整合到摄像头管理中) + const hiddenPaths = new Set(['roi']); + const hiddenNameKeywords = ['ROI', 'roi']; + return menus.map((menu) => { + const shouldHide = + hiddenPaths.has(menu.path) || + (menu.name && + hiddenNameKeywords.some((kw: string) => menu.name.includes(kw))); + return { + ...menu, + visible: shouldHide ? false : menu.visible, + children: menu.children ? hideMenuItems(menu.children) : menu.children, + }; + }); + } + function $reset() { loginLoading.value = false; }