diff --git a/index.html b/index.html
index 0c589ec..57e86fa 100644
--- a/index.html
+++ b/index.html
@@ -1,10 +1,10 @@
-
+
- Vite + React
+ 电科院材料所实验室仪器设备预约系统
diff --git a/package.json b/package.json
index 54211b9..ee94b9e 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "equip-reserve-frontend",
"private": true,
- "version": "1.0.0",
+ "version": "1.0.1",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/config/menuConfig.js b/src/config/menuConfig.js
index 004c546..c691869 100644
--- a/src/config/menuConfig.js
+++ b/src/config/menuConfig.js
@@ -1,5 +1,6 @@
import {
ApartmentOutlined,
+ ContainerOutlined,
DesktopOutlined,
ExperimentOutlined,
FileDoneOutlined,
@@ -14,13 +15,15 @@ const menuConfig = [
path: "/user/reserve",
label: "设备预约",
icon: DesktopOutlined,
- roles: ["USER"],
+ roles: ["USER", "LEADER", "DEVICE_ADMIN"],
+ order: 4,
},
{
path: "/user/my-reservation",
label: "我的预约",
- icon: UnorderedListOutlined,
- roles: ["USER"],
+ icon: ContainerOutlined,
+ roles: ["USER", "LEADER", "DEVICE_ADMIN"],
+ order: 5,
},
{
@@ -28,36 +31,43 @@ const menuConfig = [
label: "预约审批",
icon: FileDoneOutlined,
roles: ["LEADER", "DEVICE_ADMIN"],
+ order: 1,
},
{
path: "/my-approval",
label: "审批记录",
icon: UnorderedListOutlined,
roles: ["LEADER", "DEVICE_ADMIN"],
+ order: 2,
},
{
path: "/device-manage",
label: "设备管理",
icon: ExperimentOutlined,
roles: ["DEVICE_ADMIN"],
+ order: 3,
},
{
path: "/admin/user-manage",
label: "用户管理",
icon: UsergroupAddOutlined,
roles: ["ADMIN"],
+ order: 1,
},
{
label: "数据统计",
icon: PieChartOutlined,
+ order: 2,
children: [
{
path: "/admin/stats-device",
label: "设备统计",
+ order: 1,
},
{
path: "/admin/stats-reservation",
label: "使用人统计",
+ order: 2,
},
],
roles: ["ADMIN"],
@@ -67,12 +77,14 @@ const menuConfig = [
icon: ApartmentOutlined,
label: "团队管理",
roles: ["ADMIN"],
+ order: 3,
},
{
path: "/userdetail",
label: "个人信息",
icon: UserOutlined,
roles: ["USER", "LEADER", "DEVICE_ADMIN", "ADMIN"],
+ order: 999,
},
];
diff --git a/src/layouts/CommonLayout.jsx b/src/layouts/CommonLayout.jsx
index 6ef8a70..d8f8234 100644
--- a/src/layouts/CommonLayout.jsx
+++ b/src/layouts/CommonLayout.jsx
@@ -44,8 +44,18 @@ export default function CommonLayout() {
}
};
+ // 递归排序函数
+ const sortMenu = (menu) => {
+ return [...menu]
+ .sort((a, b) => (a.order ?? 999) - (b.order ?? 999))
+ .map((item) => ({
+ ...item,
+ children: item.children ? sortMenu(item.children) : undefined,
+ }));
+ };
+
const buildMenuItems = (menu) =>
- menu.map((item) => {
+ sortMenu(menu).map((item) => {
if (item.children) {
return {
key: item.label, // 可改为 item.path 但注意不冲突
diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx
index 31be108..3cfaaa8 100644
--- a/src/pages/Login.jsx
+++ b/src/pages/Login.jsx
@@ -22,7 +22,9 @@ export default function Login() {
return (
-
xxxx设备预约系统
+
+ 电科院材料所实验室仪器设备预约系统
+