const ROLES = ['admin', 'analyst', 'user', 'guest']; const DEFAULT_PLANNING_ROLES = { admin: true, analyst: true, user: true, guest: false }; const DEFAULT_SYSTEM_ROLES = { admin: true, analyst: false, user: false, guest: false }; const buildPlanningPage = ({ pageKey, pageName, path, allowSubPaths = false }) => ({ pageKey, pageName, path, category: 'planning', defaultRoles: DEFAULT_PLANNING_ROLES, departmentDefaultAllowed: false, ...(allowSubPaths ? { allowSubPaths: true } : {}), }); const SIDEBAR_PAGES = [ buildPlanningPage({ pageKey: 'ops_b_incentive', pageName: '激励看板', path: '/planning/operation/ops-b-incentive' }), buildPlanningPage({ pageKey: 'dashboard_preview', pageName: '仪表盘(开发预览)', path: '/planning/dev-style-preview', }), buildPlanningPage({ pageKey: 'marketing_events', pageName: '营销活动', path: '/planning/operation/marketing-events', allowSubPaths: true, }), buildPlanningPage({ pageKey: 'promotion_module', pageName: '推广模块', path: '/planning/operation/promotion-module' }), buildPlanningPage({ pageKey: 'new_product_test', pageName: '新品测款', path: '/planning/operation/new-product-test' }), buildPlanningPage({ pageKey: 'product_analysis', pageName: '商品分析', path: '/planning/operation/product-analysis' }), buildPlanningPage({ pageKey: 'modular_stock_monitor', pageName: '模块化库存监控 · 配件库存监控', path: '/planning/operation/modular-stock-monitor', }), buildPlanningPage({ pageKey: 'mkh_bom', pageName: '模块化库存监控 · MKH-BOM资料', path: '/planning/operation/mkh-bom-data', }), buildPlanningPage({ pageKey: 'work_orders', pageName: '工单待办', path: '/planning/operation/work-orders' }), buildPlanningPage({ pageKey: 'stock_sales_analysis', pageName: '大货库存监控 · 库存动销分析', path: '/planning/operation/stock-sales-analysis', }), buildPlanningPage({ pageKey: 'picking_bin_sales_analysis', pageName: '大货库存监控 · 拣选库位动销分析', path: '/planning/operation/picking-bin-sales-analysis', }), { pageKey: 'settings', pageName: '系统设置', path: '/settings', category: 'system', defaultRoles: DEFAULT_SYSTEM_ROLES, departmentDefaultAllowed: false, }, ]; const SIDEBAR_PAGE_MAP = SIDEBAR_PAGES.reduce((acc, page) => { acc[page.pageKey] = page; return acc; }, {}); module.exports = { ROLES, SIDEBAR_PAGES, SIDEBAR_PAGE_MAP, };