fix(assets): 区域车型分解新增「待交车」字段,并合入「其他」车型
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- typeBreakdown 之前只产 4.5T/18T/49T 且仅含 inventory 字段, 导致区域级 待交车 与车型级 待:N 不一致、操作中合计 != 区域合计 - 后端 getTypeBreakdown 计算 pending(status==='Pending'), 并把不属 4.5T/18T/49T 的车辆聚合为「其他」类型 - 前端区域 mobile/desktop 视图把「待:」从 inventory 改读 pending - 点击穿透的 category 也由 'Inventory' 改 'Pending' Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user