From d66b75beea2b7d9e630ebb19dc2fa380d67eb152 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 6 Jan 2026 21:01:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E6=97=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E4=B8=BA=E5=B7=A5=E4=BD=9C=E6=97=A5=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=EF=BC=888=E5=B0=8F=E6=97=B6=3D1=E5=A4=A9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/CreateTask.vue | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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中完成