import { Calendar, Fuel, RefreshCw, Truck } from 'lucide-react'; import type { CustomerType, DateQuickPick } from '../types'; import { QUICK_PICK_OPTIONS, type RangeMode } from './model'; interface DailyRangeControlsProps { pick: RangeMode; dateRange: { start: string; end: string }; customer: CustomerType; stations?: { id: number; name: string }[]; selectedStationId?: number | null; updatedAt?: string | null; loading?: boolean; onQuickPick: (pick: DateQuickPick) => void; onCustomPick: () => void; onDateRangeChange: (field: 'start' | 'end', value: string) => void; onCustomerChange: (customer: CustomerType) => void; onStationChange?: (stationId: number | null) => void; onRefresh?: () => void; } export default function DailyRangeControls({ pick, dateRange, customer, stations = [], selectedStationId = null, updatedAt, loading = false, onQuickPick, onCustomPick, onDateRangeChange, onCustomerChange, onStationChange, onRefresh, }: DailyRangeControlsProps) { return ( {QUICK_PICK_OPTIONS.map(option => ( onQuickPick(option.id)} className={`h-7 rounded px-3 text-[12px] font-medium transition-colors ${ pick === option.id ? 'bg-white font-semibold text-blue-600 shadow-sm' : 'text-slate-500 hover:text-slate-800' }`} > {option.label} ))} 自定义 onDateRangeChange('start', value)} /> onDateRangeChange('end', value)} /> {onStationChange ? ( onStationChange(event.target.value === '' ? null : Number(event.target.value))} className="min-w-0 flex-1 bg-transparent text-[12px] font-semibold text-slate-700 outline-none" > 请选择加氢站 {stations.map((station, index) => ( {station.name} ))} ) : null} {(['lingniu', 'external'] as const).map(option => ( onCustomerChange(option)} className={`inline-flex h-8 items-center gap-1.5 rounded px-3 text-[12px] font-medium transition-colors ${ customer === option ? 'bg-white font-semibold text-blue-600 shadow-sm' : 'text-slate-500 hover:text-slate-800' }`} > {option === 'external' ? '外部车辆' : '羚牛车辆'} ))} {updatedAt ? {updatedAt} : null} {onRefresh ? ( 刷新 ) : null} ); } function DateField({ label, value, onChange }: { label: string; value: string; onChange: (value: string) => void }) { return ( {label} onChange(event.target.value)} className="h-7 min-w-[112px] bg-transparent font-mono text-[11px] font-semibold text-slate-700 outline-none" /> ); }