diff --git a/frontend/src/views/CreateTask.vue b/frontend/src/views/CreateTask.vue index 0a69da9..b6e0f08 100644 --- a/frontend/src/views/CreateTask.vue +++ b/frontend/src/views/CreateTask.vue @@ -174,7 +174,7 @@
{{ group.totalScore }}分 | - {{ group.totalHours }}小时 + {{ formatWorkHours(group.totalHours) }}
@@ -196,7 +196,7 @@ 总计: {{ totalPipelineScore }}分 | - {{ totalPipelineHours }}小时 + {{ formatWorkHours(Number(totalPipelineHours)) }} | {{ pipelineGroups.length }}个子任务组
@@ -1174,6 +1174,23 @@ const totalPipelineHours = computed(() => { return pipelineGroups.value.reduce((sum, group) => sum + group.totalHours, 0).toFixed(1) }) +// 格式化工时显示(8小时=1个工作日) +const formatWorkHours = (hours: number): string => { + if (hours === 0) return '0小时' + + const WORK_HOURS_PER_DAY = 8 + const days = Math.floor(hours / WORK_HOURS_PER_DAY) + const remainingHours = hours % WORK_HOURS_PER_DAY + + if (days === 0) { + return `${remainingHours}小时` + } else if (remainingHours === 0) { + return `${days}天` + } else { + return `${days}天${remainingHours}小时` + } +} + // 计算积分 const calculateScore = () => { // 计算已在computed中完成