From 852be254138fcd4b26614e0ee395ce858e71dae0 Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Wed, 18 Mar 2026 17:20:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9A=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E8=8F=9C=E5=8D=95=E3=80=8C=E5=91=8A=E8=AD=A6=E6=B1=87?= =?UTF-8?q?=E6=80=BB=E3=80=8D=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=E3=80=8C?= =?UTF-8?q?=E5=91=8A=E8=AD=A6=E7=9C=8B=E6=9D=BF=E3=80=8D?= 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 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index 4c4995c21..9cf7883e4 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -137,8 +137,8 @@ export const useAuthStore = defineStore('auth', () => { // userStore userStore.setUserInfo(authPermissionInfo.user); userStore.setUserRoles(authPermissionInfo.roles); - // accessStore - 隐藏不需要的菜单项(保留路由,仅侧边栏不显示) - const processedMenus = hideMenuItems(authPermissionInfo.menus); + // accessStore - 隐藏不需要的菜单项 + 重命名菜单 + const processedMenus = renameMenuItems(hideMenuItems(authPermissionInfo.menus)); accessStore.setAccessMenus(processedMenus); accessStore.setAccessCodes(authPermissionInfo.permissions); return authPermissionInfo; @@ -162,6 +162,23 @@ export const useAuthStore = defineStore('auth', () => { }); } + /** 递归重命名菜单项 */ + function renameMenuItems(menus: any[]): any[] { + const renameMap: Record = { + '摄像头告警汇总': '告警看板', + '告警汇总': '告警看板', + }; + return menus.map((menu) => { + const newName = menu.name && renameMap[menu.name]; + return { + ...menu, + name: newName || menu.name, + meta: newName && menu.meta ? { ...menu.meta, title: newName } : menu.meta, + children: menu.children ? renameMenuItems(menu.children) : menu.children, + }; + }); + } + function $reset() { loginLoading.value = false; }