import Blur from '../../../components/Blur';
import type { VehicleListItem } from '../types';
type DetailsProps = { vehicles: VehicleListItem[] };
function InventoryVehicleDetails({ vehicles, kind }: DetailsProps & { kind: 'abnormal' | 'pending' }) {
const pending = kind === 'pending';
const labels = pending ? ['合同编号', '客户名称(已脱敏)'] : ['异动类型', '审批通过时间', '已异动时长', '具体工作', '申请人', '预计完成时间', '实际完成时间'];
const details = (vehicle: VehicleListItem) => pending
? [vehicle.pendingDelivery?.contractNo || '未提供', vehicle.pendingDelivery?.customerName || '未提供']
: [
vehicle.abnormalMove?.type || '未提供',
vehicle.abnormalMove?.approvalPassedAt ? new Date(vehicle.abnormalMove.approvalPassedAt).toLocaleString('zh-CN', { hour12: false }) : '审批时间缺失',
vehicle.abnormalMove?.elapsedDays != null ? `${vehicle.abnormalMove.elapsedDays.toFixed(1)} 天` : '无法计算',
vehicle.abnormalMove?.work || '未提供',
vehicle.abnormalMove?.applicant || '未提供',
vehicle.abnormalMove?.targetCompletionTime || '未提供',
vehicle.abnormalMove?.actualCompletionTime || (vehicle.abnormalMove?.status === '待结束' ? '未完成' : '未提供'),
];
if (vehicles.length === 0) return
暂无符合筛选条件的{pending ? '待交车' : '异动车辆'}
;
return <>
{pending ? '展示当前待交车任务的合同信息,客户名称已脱敏。' : '申请人取异动单创建人;未结束的异动显示“未完成”,缺失信息显示“未提供”。'}
{vehicles.map(vehicle =>
{vehicle.plateNumber || vehicle.vin || '—'}
{vehicle.brandLabel || '—'} · {vehicle.type} · {vehicle.location === '其他' ? '对接中' : vehicle.location}
{details(vehicle).map((value, index) =>
- {pending && index === 1 ? "客户(已脱敏)" : labels[index]}
- {value}
)}
)}
{['车牌', '品牌', '车型', '所在地', ...labels].map(label => | {label} | )}
{vehicles.map(vehicle =>
| {vehicle.plateNumber || vehicle.vin || '—'} |
{vehicle.brandLabel || '—'} |
{vehicle.type} |
{vehicle.location === '其他' ? '对接中' : vehicle.location} |
{details(vehicle).map((value, index) => {value} | )}
)}
>;
}
export function AbnormalVehicleDetails(props: DetailsProps) {
return ;
}
export function PendingVehicleDetails(props: DetailsProps) {
return ;
}