fix(mileage): 累计里程展示不再被「未对接」状态盖掉
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
后端 cache 已用 fetchLatestPgTotalMileageMap 在当日 source=NONE 时 回填该车 ln_vehicle_day_total_pg 最近一条 total_mileage,但前端 表格 / 卡片 / Excel 都用 isDataSynced && totalKm != null 判定, 未对接车被锁回「未对接」文案。 调整为: - 今日里程仍按 isDataSynced 显示「未对接」(今天确实没增量) - 累计里程只看 totalKm 是否为 null,未对接但有历史值的车现在能显示 实测 粤A03423F:source=NONE / dailyKm=0 / totalKm=9205.6 原来「总: 未对接」→ 现在显示 9205.6 km Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -541,7 +541,7 @@ export default function MonitoringView() {
|
|||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-2 text-right">
|
<td className="px-3 py-2 text-right">
|
||||||
<span className={`text-xs font-mono font-bold ${v.isDataSynced ? 'text-slate-300' : 'text-slate-600'}`}>
|
<span className={`text-xs font-mono font-bold ${v.isDataSynced ? 'text-slate-300' : 'text-slate-600'}`}>
|
||||||
{v.isDataSynced && v.totalKm != null ? <>{v.totalKm.toLocaleString()} <span className="text-[8px] text-slate-500">km</span></> : <span className="text-[8px] text-amber-500/50">未对接</span>}
|
{v.totalKm != null ? <>{v.totalKm.toLocaleString()} <span className="text-[8px] text-slate-500">km</span></> : <span className="text-[8px] text-amber-500/50">未对接</span>}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -937,7 +937,7 @@ export default function MonitoringView() {
|
|||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
<span className="text-[7px] font-black text-slate-400/60 bg-slate-100 w-3 h-3 rounded flex items-center justify-center leading-none">总</span>
|
<span className="text-[7px] font-black text-slate-400/60 bg-slate-100 w-3 h-3 rounded flex items-center justify-center leading-none">总</span>
|
||||||
<span className="text-[8px] font-bold text-slate-300">
|
<span className="text-[8px] font-bold text-slate-300">
|
||||||
{v.isDataSynced && v.totalKm != null ? `${v.totalKm.toLocaleString()} km` : '未对接'}
|
{v.totalKm != null ? `${v.totalKm.toLocaleString()} km` : '未对接'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ function statusLabel(v: MonitoringVehicle): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mileageCell(v: MonitoringVehicle, kind: 'today' | 'total'): string | number {
|
function mileageCell(v: MonitoringVehicle, kind: 'today' | 'total'): string | number {
|
||||||
|
if (kind === 'today') {
|
||||||
if (!v.isDataSynced) return '未对接';
|
if (!v.isDataSynced) return '未对接';
|
||||||
if (kind === 'today') return Math.max(0, Math.round(v.dailyKm || 0));
|
return Math.max(0, Math.round(v.dailyKm || 0));
|
||||||
|
}
|
||||||
|
// 累计里程:当日未对接也允许使用历史兜底值
|
||||||
return v.totalKm != null ? Math.round(v.totalKm) : '未对接';
|
return v.totalKm != null ? Math.round(v.totalKm) : '未对接';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user