import { CircleGauge, Route, TrendingUp, Truck, Warehouse } from 'lucide-react'; import { MetricTile } from '../../../components/ui/surface'; import type { DailyMileageReport } from '../api'; import { deltaLabel, fmtKm } from './utils'; interface ReportOverviewProps { report: DailyMileageReport; highMileageRate: number; } function MobileDailyOverview({ report, highMileageRate }: ReportOverviewProps) { const operatingRate = (report.totals.operatingCount / Math.max(1, report.totals.vehicleCount)) * 100; const stats = [ { label: '运营车辆', value: report.totals.operatingCount, unit: '台', detail: `${report.totals.vehicleCount} 台考核车辆 · ${operatingRate.toFixed(1)}%`, icon: Truck, tone: 'text-emerald-600 bg-emerald-50', }, { label: '库存车辆', value: report.totals.inventoryCount, unit: '台', detail: `产生 ${fmtKm(report.totals.inventoryMileage)} km`, icon: Warehouse, tone: 'text-rose-600 bg-rose-50', }, { label: '运营单车均值', value: fmtKm(report.totals.averageOperatingMileage), unit: 'km/台', detail: `运营里程 ${fmtKm(report.totals.operatingMileage)} km`, icon: CircleGauge, tone: 'text-slate-600 bg-slate-100', }, { label: '高里程车辆', value: report.totals.highMileageCount, unit: '台', detail: `${highMileageRate.toFixed(1)}% · 低里程 ${report.totals.lowMileageCount} 台`, icon: TrendingUp, tone: 'text-blue-600 bg-blue-50', }, ]; return (
当日总里程
{fmtKm(report.totals.dailyMileage)} km
= 0 ? 'bg-emerald-50' : 'bg-rose-50'}`}>
较前一日
= 0 ? 'text-emerald-600' : 'text-rose-600'}`}> {deltaLabel(report.totals.dayOverDayDelta, report.totals.dayOverDayRate)}
{stats.map((stat, index) => { const Icon = stat.icon; return (
{stat.label}
{stat.value} {stat.unit}
{stat.detail}
); })}
); } export default function ReportOverview({ report, highMileageRate }: ReportOverviewProps) { return ( <>
0 ? 'rose' : 'amber'} compact />
); }