同步已上线的智能分析执行协议、来源查询、图表报告与管理页面配套代码。 补齐数据库迁移、运行依赖和回归测试,保留原有指标计算口径。 统一午夜黑及其他主题的控件细节、中文和业务数字字体。 排除本地业务数据、凭据、预览、发布与验收产物。 验证:生产构建通过,320项前端回归通过;本轮仅同步Git,不再次部署。
29 lines
3.1 KiB
TypeScript
29 lines
3.1 KiB
TypeScript
// Isolated browser acceptance with simulated data; never calls the business API.
|
|
const stage = { qualifiedWeight: 42243.6, scrapWeight: 372.2, totalWeight: 42615.8, rate: .991265, headquartersScrapWeight: 25.6, rateWithoutHeadquartersScrap: .9918, defects: [{ name: '裂纹', weight: 230.1, rate: .0054 }, { name: '缺角', weight: 142.1, rate: .0033 }] };
|
|
const products = ['62.8X36.8X51', '30X8.4X1.6+T', '16.33X15.5X3.75+T', ...Array.from({length:15},(_,i)=>`产品规格-${i+4}`)];
|
|
const rows = products.map((product,i)=>({ key: String(i), label: product, department:'工业电机产业部', group:'工业电机-VCM', product, compositeRate:.9751,black:{...stage,qualifiedWeight:38582.1},bright:stage,coverage:{blackRows:5,brightRows:5} }));
|
|
const json = (value: unknown) => new Response(JSON.stringify(value), {headers:{'Content-Type':'application/json'}});
|
|
window.fetch = async (target) => {
|
|
const url = new URL(String(target), location.origin);
|
|
if(url.pathname==='/api/auth/me')return json({user:{id:'local-fixture',username:'admin',displayName:'admin',roles:['SYSTEM_ADMIN'],departments:[],groups:[]}});
|
|
if(url.pathname==='/api/workspace/state')return json({authRevision:'fixture',dataRevision:'fixture'});
|
|
if(url.pathname==='/api/options')return json({years:[2026],departments:['工业电机产业部'],groups:['工业电机-VCM'],groupDepartments:{'工业电机-VCM':'工业电机产业部'},products,projectGroupStatus:'READY',projectGroups:[],releases:[{id:'fixture-release',name:'本地验收',status:'PUBLISHED'}]});
|
|
if(url.pathname==='/api/filter-fields')return json([]);
|
|
if(url.pathname==='/api/metrics') {
|
|
const view=url.searchParams.get('view');
|
|
const product=url.searchParams.get('product');
|
|
let visible=product?rows.filter(r=>r.product===product):rows;
|
|
if(view==='department')visible=[{...rows[0],key:'工业电机产业部',label:'工业电机产业部'}];
|
|
if(view==='group')visible=[{...rows[0],key:'工业电机-VCM',label:'工业电机-VCM'}];
|
|
return json({release:{id:'fixture-release',name:'本地验收',status:'PUBLISHED'},context:{},summary:rows[0],rows:visible,trend:Array.from({length:9},(_,i)=>({...rows[0],key:`month-${i+1}`,month:i+1,period:`2026-${String(i+1).padStart(2,'0')}`})),defects:{black:stage.defects,bright:stage.defects},coverage:{sourceMonths:[{year:2026,month:9,blackRows:90,brightRows:90}],rawRows:180,includedRows:180,excludedBlankRows:0,unmappedRows:0,projectGroupUnconfiguredRows:0,missingStages:[]}});
|
|
}
|
|
if(url.pathname==='/api/analysis/defects')return json({rows:[],kind:'fine_defect_top',sourceRows:0,releaseId:'fixture-release'});
|
|
if(url.pathname==='/api/records')return json({rows:[{id:'fixture-1',month:9,raw:{'产品规格':products[0],'重量':42},normalized:{},components:{}}],page:1,pageSize:20,total:1});
|
|
return json({items:[]});
|
|
};
|
|
const originalGet = Storage.prototype.getItem;
|
|
const originalSet = Storage.prototype.setItem;
|
|
Storage.prototype.getItem = function(key) { return key === 'quality-workbench-theme' ? 'light' : originalGet.call(this, key); };
|
|
Storage.prototype.setItem = function(key, value) { if(key !== 'quality-workbench-theme') originalSet.call(this, key, value); };
|
|
await import('../src/main');
|