feat: align frontend document and rule management flows
This commit is contained in:
+23
-15
@@ -60,17 +60,23 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
|
||||
if (routesResult.success && routesResult.data) {
|
||||
// 查找 '/settings' 路由及其子路由
|
||||
const settingsRoute = routesResult.data.find(route => route.path === '/settings');
|
||||
if (settingsRoute) {
|
||||
hasSettingsAccess = true;
|
||||
// 提取子路由信息(仅 path 和 title)
|
||||
if (settingsRoute.children && settingsRoute.children.length > 0) {
|
||||
settingsChildren = settingsRoute.children.map(child => ({
|
||||
path: child.path,
|
||||
title: child.title
|
||||
}));
|
||||
}
|
||||
}
|
||||
const settingsRoute = routesResult.data.find(route => route.path === '/settings');
|
||||
if (settingsRoute) {
|
||||
hasSettingsAccess = true;
|
||||
// 提取子路由信息(仅 path 和 title)
|
||||
if (settingsRoute.children && settingsRoute.children.length > 0) {
|
||||
settingsChildren = settingsRoute.children
|
||||
.map(child => ({
|
||||
path: child.path,
|
||||
title: child.title
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
if (a.path === '/rule-groups') return -1;
|
||||
if (b.path === '/rule-groups') return 1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否存在顶级路由 '/cross-checking'
|
||||
// 🔒 交叉评查访问控制:
|
||||
@@ -291,10 +297,12 @@ export default function Index() {
|
||||
}
|
||||
|
||||
// 跳转到第一个子路由
|
||||
const firstChildPath = loaderData.settingsChildren[0].path;
|
||||
console.log(`📌 [Index] 系统设置:跳转到第一个子路由 ${firstChildPath}`);
|
||||
navigate(firstChildPath);
|
||||
};
|
||||
const preferredSettingsPath =
|
||||
loaderData.settingsChildren.find((child: { path: string; title: string }) => child.path === '/rule-groups')?.path ||
|
||||
loaderData.settingsChildren[0].path;
|
||||
console.log(`📌 [Index] 系统设置:跳转到首选子路由 ${preferredSettingsPath}`);
|
||||
navigate(preferredSettingsPath);
|
||||
};
|
||||
|
||||
// 处理进入交叉评查
|
||||
const handleEnterCrossChecking = () => {
|
||||
|
||||
Reference in New Issue
Block a user