import React from 'react'; import {createRoot} from 'react-dom/client'; import {App, ConfigProvider} from 'antd'; import ManagementPages from '../src/ManagementPages'; import '../src/styles.css'; import '../src/quality-table.css'; const page=new URLSearchParams(location.search).get('page') as 'rules'|'mappings'|'masterData'|'tasks'|'access'|'sources' || 'rules'; const longText='本条说明完整保留,按照当前生效规则先汇总同阶段的重量分量,再计算合格率;来源字段、扣减项目、空值处理和零分母处理均与当前查询一致。'; const definition={schemaVersion:'preview',sourceFields:{},rowRules:[],metricRules:{},masterData:{departments:[],groups:[],products:[],projectGroups:[]}}; const rule={id:'rule-preview',name:'原计算规则名称',status:'ACTIVE',createdAt:'2026-10-21T05:57:31Z',definition}; const mapping={id:'mapping-preview',name:'原基础数据名称',status:'ACTIVE',createdAt:'2026-10-21T08:38:49Z',definition}; const json=(value:unknown)=>new Response(JSON.stringify(value),{headers:{'Content-Type':'application/json'}}); window.fetch=async target=>{ const path=new URL(String(target),location.origin).pathname; if(path==='/api/filter-fields')return json(['客户代码','坯料生产单位'].map((label,index)=>({key:`preview_${index}`,label,blackColumn:label,brightColumn:label,enabled:true,allowEmpty:true,sortOrder:index}))); if(path==='/api/filter-fields/columns')return json({black:['客户代码','坯料生产单位'],bright:['客户代码','坯料生产单位']}); if(path==='/api/tasks/overview')return json({items:[{id:'task-1',sourceKind:'TASK',type:'IMPORT',status:'RUNNING',createdAt:'2026-10-30T00:00:00Z',processed:600,total:1000,progress:60},{id:'task-2',sourceKind:'TASK',type:'IMPORT',status:'FAILED',createdAt:'2026-10-29T23:00:00Z',errorMessage:longText}]}); if(path==='/api/metric-dictionary')return json({items:['黑片合格率','亮片合格率','综合合格率'].map((name,index)=>({code:`METRIC_${index}`,name,description:index===1?'按当前范围计算':longText,unit:'RATE',dimensions:['期间','产业部','业务分组','产品','项目组'],enabled:true,formulaStatus:'CURRENT',currentFormula:'blackGood / blackTotal;运算空值=PROPAGATE;零分母=ONE;空结果=ONE',aliases:[]}))}); if(path==='/api/sources/upload-options')return json({currentReleaseId:'preview',targets:[],fields:{black:[],bright:[]},scopes:['ALL'],currentSourceIds:['source-1','source-2'],currentSourcesComplete:true}); if(path==='/api/sources')return json({items:[{id:'source-1',sourceFile:'2026年9月黑片质量数据汇总表_汽车交通产业部_完整来源及客户代码与检验备注.xlsx',stage:'black',year:2026,month:9,status:'IMPORTED',sizeBytes:123456},{id:'source-2',sourceFile:'2026年9月亮片.xlsx',stage:'bright',year:2026,month:9,status:'IMPORTED',sizeBytes:234567}]}); if(path==='/api/releases')return json({items:[],currentReleaseId:'preview'}); if(path==='/api/rules')return json({items:[rule]}); if(path==='/api/mappings')return json({items:[mapping]}); if(path==='/api/rules/schema')return json({schemaVersion:'preview',sourceFields:{black:{platingWeight:'送电镀重量',shipmentWeight:'黑片出货重量',responsibilityScrap:'责废总重量',materialScrap:'料废重量',externalScrap:'外废重量',issueLocation:'发料地点',inspectionNote:'检验备注'},bright:{goodWeight:'合格重量',scrapWeight:'检包入废品库重量'}},rowTargets:{},defaultDefinition:definition}); if(path==='/api/data-workflow/status')return json({mode:'TEST',simplified:true,currentReleaseId:'preview',activeRule:rule,activeMapping:mapping,capabilities:{canApplyRule:true,canApplyMapping:true}}); if(path.includes('reference'))return json({departments:[],groups:[],products:[],projectGroups:[],groupDepartments:{}}); return json({items:[]}); }; createRoot(document.getElementById('root')!).render(
false} onNavigate={()=>{}} />
);