const fs = require('fs'); const path = require('path'); const file = path.join(process.cwd(), 'MES_Manage_View_V20', '元利项目详细用户使用说明书.md'); const text = fs.readFileSync(file, 'utf8'); const names = { '404.vue': '404 页面', PunctualWork: '及时开工异常', CraftMaintain: '产品结构维护', Devicedata: '设备采集数据', DeviceDataHistory: '设备历史数据', DeviceInformation: '设备信息维护', DeviceRealData: '设备实时数据', InstallMakePlan: '装配排产', InstallMakePlanDo: '装配已排产', PlannOrderClose: '生产订单关闭', PlanShell: '计划外壳跟踪', priorityinstall: '装配优先级调整', SelfMakePlan: '机加排产', SelfMakePlando: '机加待排产', SelfMakePlandone: '机加已排产', PartDrawing: '零件图纸维护', PartDrawlook: '零件图纸查看', ProcedureManagement: '工序维护', ProcessDrawing: '工艺图纸维护', ProcessesDevelop: '工艺开发', ProcessInquiry: '工艺查询', ProcessProduct: '生产工艺维护', ProcurementDrawlook: '采购图纸查看', ProductionOrder: '生产订单', AbnormalControl: '异常管控', AssemblePlanTrack: '装配计划跟踪', AssembleStatus: '装配状态', AssembleTaskManage: '装配任务管理', AssembleTasksSum: '装配任务汇总', AssemblyCenter: '装配中心', DeviceStatus: '设备状态', MachiningCenter: '机加中心', OutsourceMange: '外协管理', OutsourceSheet: '外协报表', PersonnelBinding: '人员绑定', PickingTask: '拣配任务', ProductionPlanTrack: '生产计划跟踪', ProductionTaskManage: '生产任务管理', ProductionTasksSum: '生产任务汇总', SaleOutsourceMange: '销售外协管理', ShiftManagement: '班次管理', Timesheet: '工时报表', Urgent: '加急任务', Workhours: '工时查询', 'index - 副本.vue': '工时校验(副本)', WorkHoursCheck: '工时校验', WorkhoursEdit: '工时编辑', 'final.vue': '终检', 'firstSpecial.vue': '首检', 'materialReturn.vue': '原材料退库检', 'OtherInbound.vue': '其他入库检', 'processReceive.vue': '序检收检', 'processSpecial.vue': '过程特殊检验', 'purchaseIncoming.vue': '采购入库检', 'salesReturn.vue': '销售退货检', QualityCenter: '质量中心', QualityDetails: '质检明细', 'index copy.vue': '质量标准查询(副本)', QualityStandardQuery: '质量标准查询', Unqualified: '不合格品处理', saleorderstatus: '销售订单状态', MenuManagement: '菜单管理', OperationLog: '操作日志', OrgManagement: '组织管理', PersonnelManagement: '人员管理', SystemRrolemaintenance: '系统角色维护', WorkstationManagement: '工位管理', dashboard: '首页看板', 'AppMain.vue': '内容区域', 'index.js': '布局组件索引', 'Navbar.vue': '顶部导航', Sidebar: '侧边栏', 'Item.vue': '侧边栏菜单项', 'SidebarItem.vue': '侧边栏菜单节点', 'TagsView.vue': '标签页导航', 'Layout.vue': '系统布局', 'ResizeHandler.js': '窗口自适应', login: '系统登录' }; const updated = text.replace(/^### (21\.\d+) (.+)$/gm, (match, num, oldName) => { const nextName = names[oldName.trim()]; return nextName ? `### ${num} ${nextName}` : match; }); fs.writeFileSync(file, updated, 'utf8'); const missing = [...text.matchAll(/^### (21\.\d+) (.+)$/gm)] .map(m => m[2].trim()) .filter(name => !names[name]); if (missing.length) { console.log(`missing mappings: ${[...new Set(missing)].join(', ')}`); } console.log('chapter 21 titles renamed');