/** 任務顯示組件 */ const TaskDisplay = ({ task, onCancel }) => { if (!task) return null; const getStatusColor = (status) => { switch (status) { case 'running': return 'bg-blue-100 text-blue-800'; case 'completed': return 'bg-green-100 text-green-800'; case 'cancelled': return 'bg-gray-100 text-gray-800'; case 'failed': return 'bg-red-100 text-red-800'; default: return 'bg-yellow-100 text-yellow-800'; } }; const getStatusText = (status) => { switch (status) { case 'pending': return '等待執行'; case 'running': return '執行中'; case 'completed': return '已完成'; case 'cancelled': return '已取消'; case 'failed': return '執行失敗'; default: return status; } }; const canCancel = task.status === 'pending' || task.status === 'running'; // 判斷任務類型(默認為台鐵以保持向後兼容) const isHSR = task.task_type === 'hsr'; // 遮罩身分證字號(只顯示前後各2位) const maskNationalId = (nationalId) => { if (!nationalId || nationalId.length < 4) { return nationalId; } return `${nationalId.substring(0, 2)}****${nationalId.substring(nationalId.length - 2)}`; }; return (