fix(mileage): 当日未对接但有历史 totalKm 的车今日里程显示 0 不是「未对接」
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

承接上一笔修复:兜底拿到 totalKm 后,今日里程也应该理解为 0(这车
在系统里有数据,只是今天没增量),而不是再贴「未对接」标签。

涉及:
- MonitoringView 表格 + 卡片:dailyKm 显示与对应颜色 / amber 点
- xlsx-export「今日里程」列

判定改成 (isDataSynced || totalKm != null);
isOnline / 在线-离线 标签不变(基于 dailyKm > 0,与本次语义无关)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-05-07 15:27:23 +08:00
parent 1c57eb4a58
commit 7e6fd491b0
2 changed files with 8 additions and 8 deletions

View File

@@ -18,10 +18,10 @@ function statusLabel(v: MonitoringVehicle): string {
function mileageCell(v: MonitoringVehicle, kind: 'today' | 'total'): string | number {
if (kind === 'today') {
if (!v.isDataSynced) return '未对接';
// 当日未对接但有历史累计,视作今日 0只有完全无数据才标「未对接」
if (!v.isDataSynced && v.totalKm == null) return '未对接';
return Math.max(0, Math.round(v.dailyKm || 0));
}
// 累计里程:当日未对接也允许使用历史兜底值
return v.totalKm != null ? Math.round(v.totalKm) : '未对接';
}