-- ═══════════════════════════════════════════════════════════
-- 甲方履约 - 结单时间管理 菜单与权限
-- ═══════════════════════════════════════════════════════════

SET NAMES utf8mb4;

-- 1. 创建菜单
INSERT IGNORE INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
VALUES(2044, '甲方结单管理', 2040, 4, 'closeDate', 'bid/clientDelivery/closeDate', 1, 0, 'C', '0', '0', 'bid:clientdelivery:closeDate', 'date', 'admin', NOW());

-- 2. 给 admin 角色授权
INSERT IGNORE INTO sys_role_menu(role_id, menu_id) VALUES(1, 2044);

-- 3. 按钮权限
INSERT IGNORE INTO sys_menu(menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT '结单确认', menu_id, 1, '#', NULL, 1, 0, 'F', '0', '0', 'bid:clientdelivery:closeDate:edit', '#', 'admin', NOW()
FROM sys_menu WHERE perms = 'bid:clientdelivery:closeDate' AND menu_id = 2044;
