-- ============================================================================
-- 添加"甲方报价"菜单到智慧报价模块
-- 说明：
--   1. 在智慧报价模块下添加"甲方报价"菜单（目录）
--   2. 添加"甲方报价历史"菜单（菜单）
--   3. 添加"甲方报价单详情"隐藏路由
-- ============================================================================

-- 1. 添加甲方报价目录菜单（parent_id = 2000 智慧报价）
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2060, '甲方报价', 2000, 5, 'clientquote', NULL, NULL, 1, 0, 'M', '0', '0', NULL, 'el-icon-document-copy', 'admin', NOW(), 'admin', NOW(), '甲方报价管理模块');

-- 2. 添加甲方报价历史页面菜单
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2061, '甲方报价历史', 2060, 1, 'history', 'bid/clientquote/history/index', NULL, 1, 0, 'C', '0', '0', 'bid:clientquote:history', 'el-icon-document-copy', 'admin', NOW(), 'admin', NOW(), '甲方报价历史记录');

-- 3. 添加甲方报价单详情隐藏路由（路径为 /quotemgr/clientquote/detail）
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2062, '甲方报价单详情', 2060, 2, 'detail', 'bid/clientquote/detail', NULL, 1, 0, 'C', '1', '0', 'bid:clientquote:detail', NULL, 'admin', NOW(), 'admin', NOW(), '甲方报价单详情编辑页');

-- 4. 添加甲方报价列表页（给现有的 clientquote/index.vue）
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2063, '甲方报价列表', 2060, 3, 'index', 'bid/clientquote/index', NULL, 1, 0, 'C', '0', '0', 'bid:clientquote:list', NULL, 'admin', NOW(), 'admin', NOW(), '甲方报价列表');

-- ============================================================================
-- 添加权限按钮
-- ============================================================================

-- 甲方报价历史：查询
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2064, '查询', 2061, 1, '#', NULL, NULL, 1, 0, 'F', '0', '0', 'bid:clientquote:query', '#', 'admin', NOW(), 'admin', NOW(), '');

-- 甲方报价历史：新增
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2065, '新增', 2061, 2, '#', NULL, NULL, 1, 0, 'F', '0', '0', 'bid:clientquote:add', '#', 'admin', NOW(), 'admin', NOW(), '');

-- 甲方报价历史：修改
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2066, '修改', 2061, 3, '#', NULL, NULL, 1, 0, 'F', '0', '0', 'bid:clientquote:edit', '#', 'admin', NOW(), 'admin', NOW(), '');

-- 甲方报价历史：删除
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
VALUES (2067, '删除', 2061, 4, '#', NULL, NULL, 1, 0, 'F', '0', '0', 'bid:clientquote:remove', '#', 'admin', NOW(), 'admin', NOW(), '');

-- ============================================================================
-- 分配菜单给管理员角色 (role_id = 1)
-- ============================================================================
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT 1, menu_id FROM sys_menu WHERE menu_id BETWEEN 2060 AND 2067
AND NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = sys_menu.menu_id);
