staff_data/apps/web/src/routes/index.tsx

121 lines
2.6 KiB
TypeScript
Executable File

import {
createBrowserRouter,
IndexRouteObject,
Link,
NonIndexRouteObject,
useParams,
} from "react-router-dom";
import ErrorPage from "../app/error";
import LoginPage from "../app/login";
import HomePage from "../app/main/home/page";
import StaffMessage from "../app/main/staffpage/page";
import MainLayout from "../app/main/layout/MainLayout";
import DailyPage from "../app/main/daily/page";
import Dashboard from "../app/main/home/page";
import WeekPlanPage from "../app/main/plan/weekplan/page";
import StaffInformation from "../app/main/staffinformation/page";
import SettingPage from "../app/main/admin/deptsettingpage/settingpage";
import DeptSettingPage from "../app/main/admin/deptsettingpage/settingpage";
interface CustomIndexRouteObject extends IndexRouteObject {
name?: string;
breadcrumb?: string;
}
interface CustomIndexRouteObject extends IndexRouteObject {
name?: string;
breadcrumb?: string;
}
export interface CustomNonIndexRouteObject extends NonIndexRouteObject {
name?: string;
children?: CustomRouteObject[];
breadcrumb?: string;
handle?: {
crumb: (data?: any) => void;
};
}
export type CustomRouteObject =
| CustomIndexRouteObject
| CustomNonIndexRouteObject;
export const routes: CustomRouteObject[] = [
{
path: "/",
errorElement: <ErrorPage />,
handle: {
crumb() {
return <Link to={"/"}></Link>;
},
},
children: [
{
element: <MainLayout></MainLayout>,
children: [
{
index: true,
element:<Dashboard></Dashboard>,
},
{
path: "/staffinformation",
element: <StaffInformation></StaffInformation>,
},
{
path: "/staff",
element: <StaffMessage></StaffMessage>,
},
{
path: "/admin",
children: [
{
path: "department",
element: <DeptSettingPage></DeptSettingPage>,
},
]
},
{
path:"/plan",
children:[
{
path:"weekplan",
element:<WeekPlanPage></WeekPlanPage>
},
{
path:"monthplan",
element:<DailyPage></DailyPage>
}
]
},
{
path:"/daily",
element:<DailyPage></DailyPage>
},
{
path:"/assessment",
children:[
{
path:"positionassessment",
element:<DailyPage></DailyPage>
},
{
path:"commonassessment",
element:<DailyPage></DailyPage>
},
{
path:"sportsassessment",
element:<DailyPage></DailyPage>
}
]
},
],
},
],
},
{
path: "/login",
breadcrumb: "登录",
element: <LoginPage></LoginPage>,
},
];
export const router = createBrowserRouter(routes);