Преглед на файлове

feat: 设备补货单模块移入库存管理,由后端菜单控制

- seed_menu.sql: 新增 505「设备补货单」→506「补货单列表」→507「补货单详情」
  作为「库存管理」的子菜单
- 删除 replenishmentOrder.ts 静态路由,避免重复
- 更新 detail.vue/index.vue 中的硬编码路径
- 提供 migrate_replenishment_to_inventory.sql 用于已有数据库迁移

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline преди 1 седмица
родител
ревизия
87d40b3597

+ 23 - 0
docs/database/migrate_replenishment_to_inventory.sql

@@ -0,0 +1,23 @@
+-- 将「设备补货单」模块添加到「库存管理」下
+-- 对应移除前端静态路由 replenishmentOrder.ts
+
+-- 添加菜单
+INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive)
+VALUES (505, 500, 0, '设备补货单', 'ReplenishmentOrder', '/inventory/replenishment-order', '', 4, 'ep:shopping-cart', 1, 0, '/inventory/replenishment-order/list', 1)
+ON DUPLICATE KEY UPDATE parent_id=500, title='设备补货单', path='/inventory/replenishment-order', `rank`=4;
+
+INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent)
+VALUES (506, 505, 0, '补货单列表', 'ReplenishmentOrderList', '/inventory/replenishment-order/list', 'replenishment-order/index', 1, 1, 0)
+ON DUPLICATE KEY UPDATE parent_id=505, title='补货单列表', path='/inventory/replenishment-order/list', component='replenishment-order/index', `rank`=1;
+
+INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent)
+VALUES (507, 505, 0, '补货单详情', 'ReplenishmentOrderDetail', '/inventory/replenishment-order/detail', 'replenishment-order/detail', 2, 0, 0)
+ON DUPLICATE KEY UPDATE parent_id=505, title='补货单详情', path='/inventory/replenishment-order/detail', component='replenishment-order/detail', `rank`=2;
+
+-- 为超级管理员角色分配菜单
+INSERT INTO t_role_menu (role_id, menu_id, create_time) VALUES (1, 505, NOW()) ON DUPLICATE KEY UPDATE role_id=1;
+INSERT INTO t_role_menu (role_id, menu_id, create_time) VALUES (1, 506, NOW()) ON DUPLICATE KEY UPDATE role_id=1;
+INSERT INTO t_role_menu (role_id, menu_id, create_time) VALUES (1, 507, NOW()) ON DUPLICATE KEY UPDATE role_id=1;
+
+-- 如果之前菜单 id=505/506/507 已被其他数据占用,先查询确认:
+-- SELECT id, parent_id, title, path FROM t_menu WHERE id IN (505, 506, 507);

+ 9 - 1
docs/database/seed_menu.sql

@@ -68,6 +68,14 @@ INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `ran
 INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
 (503, 500, 0, '上货记录', 'StockRecords', '/inventory/records', '', 3, 1, 0);
 
+INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, icon, show_link, show_parent, `redirect`, keep_alive) VALUES
+(505, 500, 0, '设备补货单', 'ReplenishmentOrder', '/inventory/replenishment-order', '', 4, 'ep:shopping-cart', 1, 0, '/inventory/replenishment-order/list', 1);
+
+INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
+(506, 505, 0, '补货单列表', 'ReplenishmentOrderList', '/inventory/replenishment-order/list', 'replenishment-order/index', 1, 1, 0);
+INSERT INTO t_menu (id, parent_id, menu_type, title, name, path, component, `rank`, show_link, show_parent) VALUES
+(507, 505, 0, '补货单详情', 'ReplenishmentOrderDetail', '/inventory/replenishment-order/detail', 'replenishment-order/detail', 2, 0, 0);
+
 -- =====================================================
 -- 6. 客户管理 (Customer) - rank 6
 -- =====================================================
@@ -177,7 +185,7 @@ INSERT INTO t_role_menu (id, role_id, menu_id) VALUES
 (90003, 1, 200), (90004, 1, 201), (90005, 1, 202),
 (90006, 1, 300), (90007, 1, 301), (90008, 1, 302), (90009, 1, 303), (90010, 1, 304),
 (90011, 1, 400), (90012, 1, 401), (90013, 1, 402),
-(90014, 1, 500), (90015, 1, 501), (90016, 1, 502), (90017, 1, 503),
+(90014, 1, 500), (90015, 1, 501), (90016, 1, 502), (90017, 1, 503), (90053, 1, 505), (90054, 1, 506), (90055, 1, 507),
 (90018, 1, 600), (90019, 1, 601),
 (90020, 1, 700), (90021, 1, 701), (90022, 1, 702), (90023, 1, 703), (90024, 1, 704), (90025, 1, 705), (90026, 1, 706), (90027, 1, 707),
 (90028, 1, 800), (90029, 1, 801), (90030, 1, 802), (90031, 1, 803), (90032, 1, 804),

+ 0 - 33
haha-admin-web/src/router/modules/replenishmentOrder.ts

@@ -1,33 +0,0 @@
-// RouteConfigsTable is globally declared in types/router.d.ts
-export default {
-  path: "/replenishment-order",
-  redirect: "/replenishment-order/list",
-  meta: {
-    icon: "ep:shopping-cart",
-    title: "设备补货单",
-    rank: 12,
-    roles: ["admin"]
-  },
-  children: [
-    {
-      path: "/replenishment-order/list",
-      name: "ReplenishmentOrderList",
-      component: () =>
-        import("@/views/replenishment-order/index.vue"),
-      meta: {
-        icon: "ep:list",
-        title: "补货单列表"
-      }
-    },
-    {
-      path: "/replenishment-order/detail",
-      name: "ReplenishmentOrderDetail",
-      component: () =>
-        import("@/views/replenishment-order/detail.vue"),
-      meta: {
-        title: "补货单详情",
-        showLink: false
-      }
-    }
-  ]
-} satisfies RouteConfigsTable;

+ 1 - 1
haha-admin-web/src/views/replenishment-order/detail.vue

@@ -45,7 +45,7 @@ async function loadData() {
 }
 
 function goBack() {
-  router.push({ path: "/replenishment-order/list" });
+  router.push({ path: "/inventory/replenishment-order/list" });
 }
 
 onMounted(() => {

+ 1 - 1
haha-admin-web/src/views/replenishment-order/index.vue

@@ -45,7 +45,7 @@ function handleCreate() {
 
 function handleViewDetail(row) {
   router.push({
-    path: "/replenishment-order/detail",
+    path: "/inventory/replenishment-order/detail",
     query: { id: row.id }
   });
 }