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' import HomePage from './Home' 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 Spbjgl from "./Sbwh/Spbjgl"; import Zhfxkh from './Sbwh/Zhfxkh'; 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 Sbgzjl from "./Gcyx/WatchWarn/Sbgzjl"; import Jcsj from './WatchData/Jcsj'; import PoliceRecord from './WatchData/PoliceMangant/PoliceRecord' import PoliceRuleConfig from './WatchData/PoliceMangant/PoliceRuleConfig' import UserInfo from './SystemMangant/UserInfo1' import Dept from './SystemMangant/dept' import Role from './SystemMangant/role' import MenuM from './SystemMangant/menuM' import Bxjc from './SafeWatch/TransformWatch' import Sljc from './SafeWatch/SlWatch' import Yjjl from './SafeWatch/WarnRecord' import Yjgzpz from './SafeWatch/WarnRuleConfig' import Xjrw from "./Gcyx/xcxj/xjrw" import Xjwtcl from "./Gcyx/xcxj/xjwtcl" import Xjxpz from "./Gcyx/xcxj/xjxpz" import Dmgl from "./SafeWatch/Dmgl" import Cdgx from "./SafeWatch/cdgx" import Gzpz from './SafeWatch/Gzpz' import Spjbxx from './SystemMangant/spBasicInfo' import TestLine from './TestLine' // const HomePage = lazy(() => import('./Home')) const AppRouters: React.FC = () => { const dispatch = useDispatch() useEffect(() => { ;(window as any).__dispatch__ = dispatch return () => { delete (window as any).__dispatch__ } }, [dispatch]) let element = useRoutes([ { path: '/', element: }, { path: '/home', element: }, { path: '/mgr', element: , children: [ // { path: 'home', element: }, // 监测数据 { path: 'jcsj/jcsj', element: }, { path: 'jcsj/bjgl/bjjl', element: }, { path: 'jcsj/bjgl/bjgzpz', element: }, // 安全监测 { path: 'aqjc/bxjc', element: }, { path: 'aqjc/sljc', element: }, { path: 'aqjc/yjjl', element: }, { path: 'aqjc/yjgzpz', element: }, { path: 'aqjc/dmgl', element: }, { path: 'aqjc/dmcdglgl', element: }, { path: 'aqjc/gzpz', element: }, // 设备维护 { path: 'sbwh/wxyhgl/wxfabz', element: }, { path: 'sbwh/wxyhgl/ssgcjl', element: }, { path: 'sbwh/wxyhgl/whxmys', element: }, { path: 'sbwh/sbwzgl/cgtzgl', element: }, { path: 'sbwh/sbwzgl/kchsgl', element: }, { path: 'sbwh/sbwzgl/bpbjgl', element: }, { path: 'sbwh/sbwzgl/zhfxkh', element: }, // 工程运行 { path: 'gcyx/xxcx/jbqk', element: }, { path: 'gcyx/xxcx/yxqk', element: }, { path: 'gcyx/xxcx/tjbb', element: }, { path: 'gcyx/xxcx/czrz', element: }, { path: 'gcyx/jsyj/sbgzjl', element: }, { path: 'gcyx/xcxj/xcrw', element: }, { path: 'gcyx/xcxj/xjwtcl', element: }, { path: 'gcyx/xcxj/xjxpz', element: }, // 系统管理 { path: 'xtgl/yhxx', element: }, { path: 'xtgl/bmgl', element: }, { path: 'xtgl/jsgl', element: }, { path: 'xtgl/cdgl', element: }, { path: 'xtgl/spjbxx', element: }, // 测试曲线 { path: 'testLine/testLine', element: }, ], }, { path: '/login', element: }, ]) return element } export default AppRouters