fix(duty): show duty schedule on portal home launcher

Register /duty frontend route module, add portal top-module order, and fix sys_menu as L1 directory with schedule leaf plus role grants.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-15 16:04:33 +08:00
1 parent a1321c145c
commit 4c23ff9f61
5 files changed
+135 -6

No files matched your search

@@ -60,7 +60,28 @@ CREATE TABLE IF NOT EXISTS `duty_assignment` (
KEY `idx_tenant` (`tenant_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='值班占位(指定或抢班)';
-- 菜单:挂在 Web 虚拟根(parent_id=2,menu_name=Web端)下「值班排班」
-- 菜单:一级「值班管理」+ 叶子「值班排班」(门户首页按一级模块出卡片)
INSERT INTO `sys_menu` (
`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`,
`is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`,
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
) VALUES (
'DUTY000000000000000000000000000',
'值班管理',
'2',
'M',
'/duty',
'/index/index',
NULL,
1, '1', '1', 'shanxia2.0', 85,
'值班一级模块(门户首页分区)',
'system', '', NOW(), NULL, NOW(), 0
)
ON DUPLICATE KEY UPDATE
`menu_name`=VALUES(`menu_name`),
`component`=VALUES(`component`),
`path`=VALUES(`path`);
INSERT INTO `sys_menu` (
`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`,
`is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`,
@@ -68,17 +89,18 @@ INSERT INTO `sys_menu` (
) VALUES (
'DUTY000000000000000000000000001',
'值班排班',
'2',
'DUTY000000000000000000000000000',
'C',
'duty-schedule',
'schedule',
'/duty/schedule/index',
'duty:schedule:list',
1, '1', '1', 'shanxia2.0', 90,
1, '1', '1', 'shanxia2.0', 1,
'日历排班与公开抢班链接',
'system', '', NOW(), NULL, NOW(), 0
)
ON DUPLICATE KEY UPDATE
`menu_name`=VALUES(`menu_name`),
`parent_id`=VALUES(`parent_id`),
`component`=VALUES(`component`),
`perms`=VALUES(`perms`),
`path`=VALUES(`path`);
@@ -0,0 +1,75 @@
-- backend/scripts/migrate_20260815_duty_menu_portal_fix.sql
-- 修复:值班菜单改为一级目录 /duty + 叶子 schedule,才能出现在门户首页启动器
-- 1) 一级目录「值班管理」
INSERT INTO `sys_menu` (
`id`, `menu_name`, `parent_id`, `menu_type`, `path`, `component`, `perms`,
`is_frame`, `visible`, `status`, `tenant_no`, `order_num`, `remark`,
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
) VALUES (
'DUTY000000000000000000000000000',
'值班管理',
'2',
'M',
'/duty',
'/index/index',
NULL,
1, '1', '1', 'shanxia2.0', 85,
'值班一级模块(门户首页分区)',
'system', '', NOW(), NULL, NOW(), 0
)
ON DUPLICATE KEY UPDATE
`menu_name`=VALUES(`menu_name`),
`parent_id`=VALUES(`parent_id`),
`menu_type`=VALUES(`menu_type`),
`path`=VALUES(`path`),
`component`=VALUES(`component`),
`visible`=VALUES(`visible`),
`status`=VALUES(`status`);
-- 2) 叶子「值班排班」挂到值班管理下
UPDATE `sys_menu`
SET
`parent_id` = 'DUTY000000000000000000000000000',
`menu_type` = 'C',
`path` = 'schedule',
`component` = '/duty/schedule/index',
`perms` = 'duty:schedule:list',
`visible` = '1',
`status` = '1',
`order_num` = 1,
`update_time` = NOW()
WHERE `id` = 'DUTY000000000000000000000000001';
-- 3) 给「超级管理员」「管理员」授权(若已有则忽略)
INSERT INTO `sys_role_menu` (
`id`, `role_id`, `menu_id`, `tenant_no`, `order_num`, `remark`,
`create_by`, `create_dept_id`, `create_time`, `update_by`, `update_time`, `del_flag`
)
SELECT
REPLACE(UUID(), '-', ''),
r.id,
m.menu_id,
'shanxia2.0',
NULL,
'duty portal',
'system',
'',
NOW(),
NULL,
NOW(),
0
FROM `sys_role` r
JOIN (
SELECT 'DUTY000000000000000000000000000' AS menu_id
UNION ALL
SELECT 'DUTY000000000000000000000000001'
) m
WHERE r.del_flag = 0
AND r.role_name IN ('超级管理员', '管理员')
AND NOT EXISTS (
SELECT 1 FROM `sys_role_menu` rm
WHERE rm.role_id = r.id
AND rm.menu_id = m.menu_id
AND IFNULL(rm.del_flag, 0) = 0
);