diff --git a/app/Models/Business/SystemizationTodo.php b/app/Models/Business/SystemizationTodo.php index 74c10b7a..195698d7 100644 --- a/app/Models/Business/SystemizationTodo.php +++ b/app/Models/Business/SystemizationTodo.php @@ -74,10 +74,24 @@ class SystemizationTodo extends Model return $this->isCompleted() ? self::STATUS_COMPLETED : self::STATUS_INCOMPLETE; } + public function displayProgress(): string + { + $progress = trim((string) $this->progress); + if ($progress === '') { + return ''; + } + + $normalized = (string) preg_replace('/[\s。.]+$/u', '', $progress); + + return $this->isCompleted() && $normalized === self::STATUS_COMPLETED + ? '' + : $progress; + } + public function reminder(): array { if ($this->isCompleted()) { - return ['label' => '已完成', 'tone' => 'muted']; + return ['label' => '—', 'tone' => 'muted']; } if ($this->due_date === null) { return ['label' => '时间待定', 'tone' => 'muted']; diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php index 243f61de..b488f337 100644 --- a/resources/views/business/pages/systemization-todos.blade.php +++ b/resources/views/business/pages/systemization-todos.blade.php @@ -394,6 +394,8 @@ $statusClass = $item->isCompleted() ? 'sys-todo-badge--completed' : 'sys-todo-badge--incomplete'; + $displayProgress = $item->displayProgress(); + $displayNotes = trim((string) $item->notes); $todoPayload = [ 'id' => $item->id, 'position' => (int) $item->item_sequence, @@ -496,17 +498,17 @@ {{ $item->reminder_label }} {{ $item->status_label }} - @if ($item->progress || $item->notes) - @if ($item->progress) + @if ($displayProgress !== '' || $displayNotes !== '') + @if ($displayProgress !== '')
完成情况 - {{ $item->progress }} + {{ $displayProgress }}
@endif - @if ($item->notes) + @if ($displayNotes !== '')
备注 - {{ $item->notes }} + {{ $displayNotes }}
@endif @else diff --git a/tests/Feature/Business/SystemizationTodosTest.php b/tests/Feature/Business/SystemizationTodosTest.php index 39341756..d1b1e8b8 100644 --- a/tests/Feature/Business/SystemizationTodosTest.php +++ b/tests/Feature/Business/SystemizationTodosTest.php @@ -466,6 +466,7 @@ class SystemizationTodosTest extends FeatureTestCase $completed->update([ 'status' => SystemizationTodo::STATUS_COMPLETED, 'completed_at' => '2026-10-22', + 'progress' => '已完成', ]); $legacy = $this->createTodo('收入', '提醒测试', '历史进行中事项', '2026-11-01', 5); $legacy->update(['status' => '进行中']); @@ -480,7 +481,8 @@ class SystemizationTodosTest extends FeatureTestCase $this->assertSame('danger', $items['逾期事项']->reminder_tone); $this->assertSame('今天到期', $items['今天到期事项']->reminder_label); $this->assertSame('剩余 4 天', $items['未来事项']->reminder_label); - $this->assertSame('已完成', $items['已完成事项']->reminder_label); + $this->assertSame('—', $items['已完成事项']->reminder_label); + $this->assertSame('', $items['已完成事项']->displayProgress()); $this->assertSame(SystemizationTodo::STATUS_INCOMPLETE, $items['历史进行中事项']->status_label); $incompleteTitles = $this->get(route('business.pages.show', [ @@ -504,6 +506,7 @@ class SystemizationTodosTest extends FeatureTestCase public function test_page_filters_by_date_and_merges_adjacent_category_and_section_cells(): void { + $this->travelTo(Carbon::parse('2026-10-26 12:00:00')); $this->loginAs(); $this->createTodo('1、收入', '1、平台收入核对', '1、收入事项 A', '2026-10-26', 1, '晨曦', '栎阳、秋香');