根据不同账号 显示的首页优化 规划界面 悬浮显示 状态信息 全局急停状态统一 割刀 根据新方案对接 两个状态 任务路线 显示为 抽拉式一行一个 xbox组件优化数据发送,重构数据

This commit is contained in:
mmc
2026-11-14 18:23:27 +08:00
parent f057e0b72c
commit 831e1086d3
12 changed files with 566 additions and 382 deletions

View File

@@ -172,6 +172,31 @@ export default function AppLayout() {
return () => clearInterval(timer);
}, [userInfo, timezone, dateFormat]);
// 当前账号没有默认首页(/ 或 /overview)权限时,自动跳转到第一个有权限的菜单页面
useEffect(() => {
if (!Array.isArray(menuList) || menuList.length === 0) return;
const pathname = location.pathname;
if (pathname !== '/' && pathname !== '/overview') return;
const leafPaths: string[] = [];
const collect = (items: any[]) => {
items.forEach(item => {
if (item.children && item.children.length > 0) {
collect(item.children);
} else if (typeof item.key === 'string' && item.key.startsWith('/') && !item.key.startsWith('/menu/')) {
leafPaths.push(item.key);
}
});
};
collect(menuList);
const hasHomePermission = leafPaths.includes('/') || leafPaths.includes('/overview');
const firstPath = leafPaths[0];
if (!hasHomePermission && firstPath && firstPath !== pathname) {
navigate(firstPath, { replace: true });
}
}, [menuList, location.pathname, navigate]);
useEffect(() => {
setTime(nowInTz(timezone, dateFormat));
}, [timezone, dateFormat]);