feat(mileage): 点击车辆卡片展示近 15 日行驶里程明细
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 后端新增 GET /api/mileage/vehicle/:plate/recent,返回近 N 天 + 今日的每日里程
- 缺失日补全为 dailyKm=0 + isDataSynced=false
- 前端新增 VehicleDetailModal:头部信息、合计/日均/有数据天 KPI、近 N 日柱状图、每日明细列表
- 移动端从底部弹起;缺失日柱条置灰,明细行标注「未对接」
- 卡片点击改为打开弹窗(不再复制车牌)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-29 16:16:54 +08:00
parent f9c6155ea7
commit 7ca8ef24dc
5 changed files with 283 additions and 4 deletions

View File

@@ -61,3 +61,17 @@ export async function fetchTrend(targetId?: number, days = 7): Promise<TrendPoin
params.set('days', String(days));
return fetchJson<TrendPoint[]>(`${BASE}/trend?${params.toString()}`);
}
export interface VehicleRecentDay {
date: string;
dailyKm: number;
isDataSynced: boolean;
}
export async function fetchVehicleRecent(plate: string, days = 15): Promise<{ plate: string; days: VehicleRecentDay[] }> {
const params = new URLSearchParams();
params.set('days', String(days));
return fetchJson<{ plate: string; days: VehicleRecentDay[] }>(
`${BASE}/vehicle/${encodeURIComponent(plate)}/recent?${params.toString()}`
);
}