diff --git a/components/dashboard/network-timeline.tsx b/components/dashboard/network-timeline.tsx index 5d3adf2..9b1a802 100644 --- a/components/dashboard/network-timeline.tsx +++ b/components/dashboard/network-timeline.tsx @@ -945,14 +945,99 @@ ${task.status === 'IN_PROGRESS' ? `进度: ${task.progress}%` : ''}`} title="等待开始" /> )} + + {/* 智能百分比文字显示 - 只在主任务且有足够空间时显示 */} + {(() => { + const barWidth = (task.executionTime / maxTime) * 100; + const showPercentage = task.level === 0 && barWidth > 6; // 主任务且宽度足够 + + if (!showPercentage) return null; + + const getPercentageText = () => { + switch (task.status) { + case 'IN_PROGRESS': + return `${task.progress}%`; + case 'COMPLETED': + return '100%'; + case 'FAILED': + return `${task.progress}%`; + case 'PENDING': + return '0%'; + default: + return ''; + } + }; + + const percentageText = getPercentageText(); + if (!percentageText) return null; + + // 根据进度条宽度和进度值决定文字位置 + const progressWidth = task.status === 'IN_PROGRESS' ? task.progress : + task.status === 'COMPLETED' ? 100 : + task.status === 'FAILED' ? Math.max(task.progress, 15) : 8; + + const shouldCenterInProgress = task.status === 'IN_PROGRESS' && progressWidth > 30; + const shouldCenterInBar = (task.status === 'COMPLETED') || + (task.status === 'FAILED' && progressWidth > 25); + + return ( +