From 7e6fd491b0b557cfca1201827bc62c7966dfce0b Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 7 May 2026 15:27:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(mileage):=20=E5=BD=93=E6=97=A5=E6=9C=AA?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=BD=86=E6=9C=89=E5=8E=86=E5=8F=B2=20totalK?= =?UTF-8?q?m=20=E7=9A=84=E8=BD=A6=E4=BB=8A=E6=97=A5=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=200=20=E4=B8=8D=E6=98=AF=E3=80=8C=E6=9C=AA?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 承接上一笔修复:兜底拿到 totalKm 后,今日里程也应该理解为 0(这车 在系统里有数据,只是今天没增量),而不是再贴「未对接」标签。 涉及: - MonitoringView 表格 + 卡片:dailyKm 显示与对应颜色 / amber 点 - xlsx-export「今日里程」列 判定改成 (isDataSynced || totalKm != null); isOnline / 在线-离线 标签不变(基于 dailyKm > 0,与本次语义无关)。 Co-Authored-By: Claude Opus 4.7 (1M context) --- src/modules/mileage/MonitoringView.tsx | 12 ++++++------ src/modules/mileage/xlsx-export.ts | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/mileage/MonitoringView.tsx b/src/modules/mileage/MonitoringView.tsx index fb517b8..78694ab 100644 --- a/src/modules/mileage/MonitoringView.tsx +++ b/src/modules/mileage/MonitoringView.tsx @@ -528,15 +528,15 @@ export default function MonitoringView() { {fullscreenVehicles.map((v) => ( -
+
{v.plate} {v.customer || '-'} {v.rentStatus || '-'} {v.department || '-'} - - {v.isDataSynced ? <>{Math.max(0, v.dailyKm || 0).toLocaleString()} km : 未对接} + + {(v.isDataSynced || v.totalKm != null) ? <>{Math.max(0, v.dailyKm || 0).toLocaleString()} km : 未对接} @@ -926,12 +926,12 @@ export default function MonitoringView() {
- {!v.isDataSynced && ( + {!v.isDataSynced && v.totalKm == null && (
)} -
- {v.isDataSynced ? <>{Math.max(0, v.dailyKm || 0).toLocaleString()} km : 未对接} +
+ {(v.isDataSynced || v.totalKm != null) ? <>{Math.max(0, v.dailyKm || 0).toLocaleString()} km : 未对接}
diff --git a/src/modules/mileage/xlsx-export.ts b/src/modules/mileage/xlsx-export.ts index 5b8de8e..dd413f2 100644 --- a/src/modules/mileage/xlsx-export.ts +++ b/src/modules/mileage/xlsx-export.ts @@ -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) : '未对接'; }