ykzz-web/src/views/AppRouters.tsx

67 lines
2.3 KiB
TypeScript
Raw Normal View History

2024-12-10 10:28:55 +08:00
import React, { lazy, useEffect } from 'react'
import { useDispatch } from 'react-redux'
import { Navigate, useRoutes } from 'react-router'
import DashboardLayout from '../components/DashboardLayout'
import { Dispatch } from '../models/store'
import LoginPage from './Login/index1'
2024-12-11 17:56:03 +08:00
import Whfabz from "./Sbwh/Whfabz";
import Ssgcjl from "./Sbwh/Ssgcjl";
import Whxmys from "./Sbwh/Whxmys";
import Cgtzgl from "./Sbwh/Cgtzgl";
import Kchsgl from "./Sbwh/Kchsgl";
import BasicSituation from "./Gcyx/InformationSearch/BasicSituation";
import RunSituation from "./Gcyx/InformationSearch/RunSituation";
import StaticTable from "./Gcyx/InformationSearch/StaticTable";
import OperateLog from "./Gcyx/InformationSearch/OperateLog";
import Jcsj from './WatchData/Jcsj'
import PoliceRecord from './WatchData/PoliceMangant/PoliceRecord'
import PoliceRuleConfig from './WatchData/PoliceMangant/PoliceRuleConfig'
2024-12-10 10:28:55 +08:00
const HomePage = lazy(() => import('./Home'))
const AppRouters: React.FC = () => {
const dispatch = useDispatch<Dispatch>()
useEffect(() => {
;(window as any).__dispatch__ = dispatch
return () => {
delete (window as any).__dispatch__
}
}, [dispatch])
let element = useRoutes([
{ path: '/', element: <LoginPage /> },
2024-12-12 17:53:28 +08:00
{ path: '/home', element: <HomePage /> },
2024-12-10 10:28:55 +08:00
{
path: '/mgr',
element: <DashboardLayout />,
children: [
2024-12-12 17:53:28 +08:00
// { path: 'home', element: <HomePage /> },
2024-12-11 17:56:03 +08:00
// 监测数据
{ path: 'jcsj/jcsj', element: <Jcsj /> },
{ path: 'jcsj/bjgl/bjjl', element: <PoliceRecord /> },
{ path: 'jcsj/bjgl/bjgzpz', element: <PoliceRuleConfig /> },
2024-12-10 10:28:55 +08:00
2024-12-11 17:56:03 +08:00
// 设备维护
{ path: 'sbwh/wxyhgl/wxfabz', element: <Whfabz /> },
{ path: 'sbwh/wxyhgl/ssgcjl', element: <Ssgcjl /> },
{ path: 'sbwh/wxyhgl/whxmys', element: <Whxmys /> },
{ path: 'sbwh/sbwzgl/cgtzgl', element: <Cgtzgl /> },
{ path: 'sbwh/sbwzgl/kchsgl', element: <Kchsgl /> },
// 工程运行
{ path: 'gcyx/xxcx/jbqk', element: <BasicSituation /> },
{ path: 'gcyx/xxcx/yxqk', element: <RunSituation /> },
{ path: 'gcyx/xxcx/tjbb', element: <StaticTable /> },
{ path: 'gcyx/xxcx/czrz', element: <OperateLog /> },
2024-12-10 10:28:55 +08:00
],
},
{ path: '/login', element: <LoginPage /> },
])
return element
}
export default AppRouters