This commit is contained in:
@@ -2,6 +2,7 @@ import type { MonitoringVehicle } from './types';
|
||||
import type { VehicleRecentDay } from './api';
|
||||
|
||||
export function monitoringMileageValue(vehicle: MonitoringVehicle): number | string {
|
||||
if (vehicle.periodMileageKm !== undefined) return vehicle.periodMileageKm ?? '—';
|
||||
if (vehicle.mileageAnomaly) return '数据异常';
|
||||
if (!vehicle.isDataSynced) return '—';
|
||||
return Math.max(0, vehicle.dailyKm || 0);
|
||||
@@ -22,3 +23,8 @@ export function recentMileageStats(days: VehicleRecentDay[]) {
|
||||
totalDays: days.length,
|
||||
};
|
||||
}
|
||||
|
||||
export function mileageQualityLabel(vehicle: MonitoringVehicle): string | null {
|
||||
if (!vehicle.qualityStatus) return null;
|
||||
return `${vehicle.validDays ?? 0}天有效 · ${vehicle.missingDays ?? 0}天缺失 · ${vehicle.anomalyDays ?? 0}天异常`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user