diff --git a/src/modules/assets/AssetsModule.tsx b/src/modules/assets/AssetsModule.tsx index f304dcd..2d44df6 100644 --- a/src/modules/assets/AssetsModule.tsx +++ b/src/modules/assets/AssetsModule.tsx @@ -2189,7 +2189,7 @@ export default function AssetsModule() { setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type}` })}>{tb.total} setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Operating', source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type} - 正在运营` })}>{tb.operating} - { setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Inventory', source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type} - 库存` }); }}>{tb.inventory} + { setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Pending', source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type} - 待交车` }); }}>{tb.pending} {tb.customers.slice(0, 2).join(', ')} ))} @@ -2251,9 +2251,9 @@ export default function AssetsModule() { setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, vehicleType: tb.type, category: 'Inventory', source: 'region', title: `区域运营统计 - ${r.region} - ${tb.type} - 库存` })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, vehicleType: tb.type, category: 'Pending', source: 'region', title: `区域运营统计 - ${r.region} - ${tb.type} - 待交车` })} > - 待:{tb.inventory} + 待:{tb.pending} diff --git a/src/modules/assets/types.ts b/src/modules/assets/types.ts index 1d679a1..425fec2 100644 --- a/src/modules/assets/types.ts +++ b/src/modules/assets/types.ts @@ -152,6 +152,7 @@ export interface RegionTypeBreakdown { total: number; operating: number; inventory: number; + pending: number; customers: string[]; } diff --git a/src/server/routes/vehicles.ts b/src/server/routes/vehicles.ts index 2836923..8c83895 100644 --- a/src/server/routes/vehicles.ts +++ b/src/server/routes/vehicles.ts @@ -793,11 +793,21 @@ app.get('/region-stats', async (c) => { cityMap.get(city)!.push(v); } - const getTypeBreakdown = (vList: Vehicle[]) => - ['4.5T', '18T', '49T'].map((type) => { - const tv = vList.filter((v) => v.type === type); - return { type, total: tv.length, operating: tv.filter((v) => v.status === 'Operating').length, inventory: tv.filter((v) => v.status === 'Inventory').length, customers: Array.from(new Set(tv.map((v) => v.customerName).filter(Boolean))) as string[] }; - }).filter((t) => t.total > 0); + const getTypeBreakdown = (vList: Vehicle[]) => { + const KNOWN = ['4.5T', '18T', '49T'] as const; + const make = (label: string, tv: Vehicle[]) => ({ + type: label, + total: tv.length, + operating: tv.filter((v) => v.status === 'Operating').length, + inventory: tv.filter((v) => v.status === 'Inventory').length, + pending: tv.filter((v) => v.status === 'Pending').length, + customers: Array.from(new Set(tv.map((v) => v.customerName).filter(Boolean))) as string[], + }); + const known = KNOWN.map((type) => make(type, vList.filter((v) => v.type === type))); + const other = vList.filter((v) => !KNOWN.includes(v.type as typeof KNOWN[number])); + if (other.length > 0) known.push(make('其他', other)); + return known.filter((t) => t.total > 0); + }; const regionOrder = ['华东', '华南', '华北', '华中', '西南', '西北', '其他']; const result = regionOrder