import { formatCount, formatDateTime, formatDecimal } from './model'; import type { BatchRow } from './types'; interface BatchTableProps { batches: BatchRow[]; batchFilter: string; onClearFilter: () => void; onSelectBatch: (batchId: string) => void; } export function BatchTable({ batches, batchFilter, onClearFilter, onSelectBatch }: BatchTableProps) { if (batches.length === 0) return null; return (
最近上传批次 {batchFilter && ( )}
{batches.map(batch => ( onSelectBatch(batch.batch_id)} className={`border-t border-slate-100 cursor-pointer transition-colors ${batchFilter === batch.batch_id ? 'bg-blue-50/40' : 'hover:bg-slate-50/60'}`} > ))}
导入时间 总数 内部 外部 电量(度) 费用(元) 批次
{formatDateTime(batch.imported_at, 19)} {formatCount(batch.records)} {formatCount(batch.internal_count)} {formatCount(batch.external_count)} {formatDecimal(batch.total_kwh, 1)} ¥{formatDecimal(batch.total_fee, 2)} {batch.batch_id.slice(0, 12)}
); }