import { AppstoreOutlined, ContainerOutlined, DesktopOutlined, MailOutlined, MenuFoldOutlined, MenuUnfoldOutlined, PieChartOutlined, } from '@ant-design/icons'; import { Navigate } from 'react-router-dom'; import AuthLayout from '@/layouts/AuthLayout'; import Container from '@/layouts/Container'; import Login from '@/pages/login'; import Page404 from '@/pages/404'; import Home from '@/pages/sample/home'; import BasicForm from '@/pages/sample/form'; import BasicTable from '@/pages/sample/table'; import GuaranteeTaskList from '@/pages/guaranteeTask'; import GuaranteeTaskEdit from '@/pages/guaranteeTask/Edit'; import GuaranteeTaskPrint from '@/pages/guaranteeTask/print'; import GuaranteeTaskEvaluate from "@/pages/evaluate"; import GuaranteeTaskEvaluateList from "@/pages/evaluate/evaluateList"; import DishList from '@/pages/dish/list'; import DishEdit from '@/pages/dish/edit'; import PackageList from '@/pages/package/List'; import StockList from '@/pages/stock/list'; import StockEdit from '@/pages/stock/edit'; import StockInOut from '@/pages/stock/outAndIn'; import StockLog from '@/pages/stock/stockLog'; import StockClassificationList from '@/pages/stockClassification/list'; import StockClassificationEdit from '@/pages/stockClassification/edit'; import RotationChartList from '@/pages/rotationChart/list'; import RotationChartEdit from '@/pages/rotationChart/edit'; import RotationChartIntroduction from '@/pages/rotationChart/introduction'; import RotationChartIntroductionEdit from '@/pages/rotationChart/introduction/edit'; import Roles from '@/pages/roles/index'; import RegulationList from '@/regulation'; import RegulationEdit from '@/regulation/edit'; import UserList from '@/pages/user'; import UserEdit from '@/pages/user/Edit'; import PurchasePlanList from "@/pages/purchase/plan/list"; import PurchasePlanEdit from "@/pages/purchase/plan/edit"; import PurchaseBillEdit from "@/pages/purchase/bill/edit"; import PurchaseInStoreEdit from "@/pages/purchase/inStore/edit"; import EmergencyPlanList from "@/pages/cms/emergencyPlan/list"; import EmergencyPlanEdit from "@/pages/cms/emergencyPlan/edit"; import EmergencyPlanDetail from "@/pages/cms/emergencyPlan/detail"; import FilesList from "@/pages/cms/files/list"; import MessageList from '@/pages/message'; import MessageDetail from '@/pages/message/detail'; import StatisCharts from '@/pages/statis/charts'; /** * meta 用来扩展自定义数据数据 * { * title: 用于页面或者菜单的标题, 没有此字段, 菜单不会显示 * hideInMenu: 布尔值, 如果为 false, 菜单不会显示 * noLayout: 布尔值, 如果为 true, 将不会使用默认布局 * noSiderBar: 布尔值, 如果为 true, 将没有左侧菜单栏 * noFooter: 布尔值, 如果为 true, 将没有底部 footer * target: 字符串, 如果为 _blank, 将在新窗口打开 * } */ export const authRoutes = [ { path: "task", element: , meta: { title: "军供任务", icon: , }, children: [ { index: true, element: , }, { path: "guaranteeTask", element: , meta: { title: "任务通报", }, }, { path: "guaranteeTask/edit", element: , meta: { title: "任务配置", }, }, { path: "guaranteeTask/print", element: , meta: { hideInMenu: true, noLayout: true, target: "_blank", title: "任务执行", }, }, { path: "evaluate", element: , meta: { title: "任务评价", }, }, { path: "evaluate/list", element: , meta: { title: "任务评价", hideInMenu: true, }, }, ], }, { path: "material", element: , meta: { title: "物资管理", icon: , }, children: [ { index: true, element: , }, { path: "dish/list", element: , meta: { title: "菜肴管理", }, }, { path: "dish/edit", element: , meta: { hideInMenu: true, title: "菜肴维护", }, }, { path: "package/list", element: , meta: { title: "套餐管理", }, }, ], }, { path: "stock", element: , meta: { title: "库存管理", icon: , }, children: [ { index: true, element: , }, { path: "list", element: , meta: { title: "库存列表", }, }, { path: "add", element: , meta: { title: "库存维护", }, }, ], }, { path: "cms", element: , meta: { title: "公告文件", }, children: [ { index: true, element: , }, { path: "rotationChart/introduction", element: , meta: { title: "本站信息", }, }, { path: "rotationChart/list", element: , meta: { title: "公告内容", }, }, { path: "rotationChart/add", element: , meta: { title: "公告维护", }, }, { path: 'regulation', element: , meta: { title: "规章制度", }, }, { path: 'regulation/add', element: , meta: { hideInMenu: true, title: '规章制度维护', }, }, { path: "emergency-plan", element: , meta: { title: "应急预案", }, }, { path: "emergency-plan/edit", element: , meta: { title: "应急预案维护", hideInMenu: true, }, }, { path: "emergency-plan/detail", element: , meta: { title: "应急预案详情", hideInMenu: true, }, }, { path: "files", element: , meta: { title: "文件管理", }, }, ], }, { path: 'static', element: , meta: { title: '数据分析', noSiderBar: true, noFooter: true, }, }, { path: "system", element: , meta: { title: "系统管理", }, children: [ { index: true, element: , }, { path: "stockClassification/list", element: , meta: { title: "库存分类", }, }, { path: "stockClassification/edit", element: , meta: { title: "库存分类维护", hideInMenu: true, }, }, { path: "log", element: , meta: { title: "操作日志", }, }, { path: "roles", element: , meta: { title: "角色管理", }, }, { path: "user", element: , meta: { title: "用户管理", }, }, { path: "user/edit", element: , meta: { hideInMenu: true, title: "系统用户编辑", }, }, { path: "message", element: , meta: { title: "消息列表", }, }, { path: "message/detail", element: , meta: { title: "消息详情", hideInMenu: true, }, }, ], }, { path: "purchase", element: , meta: { title: "采购管理", }, children: [ { index: true, element: , }, { path: "plan/list", element: , meta: { title: "采购计划", }, }, { path: "plan/edit", element: , meta: { title: "采购计划维护", hideInMenu: true, }, }, { path: "bill/list", element: , meta: { title: "采购账单", }, }, { path: "bill/edit", element: , meta: { title: "采购账单维护", hideInMenu: true, }, }, { path: "inStore/list", element: , meta: { title: "采购入库", }, }, { path: "inStore/edit", element: , meta: { title: "采购入库维护", hideInMenu: true, }, }, ], }, ]; export const defaultRoutes = [ { path: "/", element: , children: [ { index: true, element: , }, { path: "home", element: , meta: { title: "首页", icon: , }, }, { path: "*", element: , }, ], }, { path: "/login", element: , }, { path: "*", element: , }, ]; export function mergeAuthRoutes (r1, r2) { const r = r1.slice(); const children = r1[0].children.slice(); r[0].children = children.concat(r2); return r; } // 全部路由 export const routes = mergeAuthRoutes(defaultRoutes, authRoutes); function getPath (parent = "/", current = "") { if (current.indexOf("/") === 0 || current.indexOf("http") === 0) return current; return `${parent}/${current}`.replace(/\/\//g, "/"); } // 路由数组, 一维数组 export const routeArr = (() => { const flatten = (routes, parentPath = "/") => { return routes.reduce((acc, route) => { const path = getPath(parentPath, route.path); const children = route.children ? flatten(route.children, path) : []; return acc.concat([{ ...route, path }].concat(children)); }, []); }; return flatten(routes); })();