diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php index 4d84db70..62c78627 100644 --- a/resources/views/business/pages/systemization-todos.blade.php +++ b/resources/views/business/pages/systemization-todos.blade.php @@ -70,6 +70,9 @@ .sys-todo-table__inline-actions .sys-todo-table__inline-add { margin-top:.3rem; } .sys-todo-table__progress-notes { white-space:normal; } .sys-todo-table__progress-notes-content { display:flex; min-width:0; flex-direction:column; gap:.35rem; } + .sys-todo-table__people { white-space:normal; } + .sys-todo-table__people-list { display:grid; min-width:0; gap:.08rem; } + .sys-todo-table__person { display:block; min-width:0; line-height:1.45; overflow-wrap:anywhere; } .sys-todo-table__detail { display:grid; min-width:0; gap:.15rem; } .sys-todo-table__detail-label { color:#856632; font-size:.66rem; font-weight:600; } .sys-todo-table__detail-text { display:block; min-width:0; white-space:pre-line; overflow-wrap:anywhere; line-height:1.6; } @@ -389,6 +392,16 @@ (string) $value, )); }; + $personNames = static function (?string $value): array { + $parts = preg_split('/[、,,;;\/]+/u', trim((string) $value)) ?: []; + + return collect($parts) + ->map(static fn (string $name): string => trim($name)) + ->filter(static fn (string $name): bool => $name !== '' && $name !== '—') + ->unique() + ->values() + ->all(); + }; $sectionLabels = $items ->map(static fn ($groupItem): string => trim((string) $groupItem->section_display)) ->all(); @@ -586,8 +599,30 @@ @endif - {{ $item->owner ?: '—' }} - {{ $item->assignee ?: '—' }} + @php($ownerNames = $personNames($item->owner)) + + @if ($ownerNames === []) + — + @else + + @foreach ($ownerNames as $ownerName) + {{ $ownerName }} + @endforeach + + @endif + + @php($assigneeNames = $personNames($item->assignee)) + + @if ($assigneeNames === []) + — + @else + + @foreach ($assigneeNames as $assigneeName) + {{ $assigneeName }} + @endforeach + + @endif + {{ $item->start_date?->format('Y-m-d') ?: ($item->start_note ?: '—') }} {{ $item->due_date?->format('Y-m-d') ?: ($item->due_note ?: '—') }} {{ $item->reminder_label }} diff --git a/tests/Feature/Business/SystemizationTodosTest.php b/tests/Feature/Business/SystemizationTodosTest.php index 9b7b7213..3ed0d301 100644 --- a/tests/Feature/Business/SystemizationTodosTest.php +++ b/tests/Feature/Business/SystemizationTodosTest.php @@ -216,6 +216,47 @@ class SystemizationTodosTest extends FeatureTestCase ); } + public function test_multi_person_owners_and_assignees_render_one_name_per_line(): void + { + $this->loginAs(); + + $this->createTodo( + '收入', + '多人责任人展示', + '检查多人姓名换行', + '2026-11-30', + 1, + '晨曦、人参', + '人参、秋香、常仪', + ); + + $response = $this->get(route('business.pages.show', [ + 'section' => 'other', + 'page' => 'systemization-todos', + ]))->assertOk(); + $html = (string) $response->getContent(); + + $this->assertStringContainsString( + '', + $html, + ); + $this->assertMatchesRegularExpression( + '/\s*\s*' + . '晨曦<\/span>\s*' + . '人参<\/span>\s*' + . '<\/span>\s*<\/td>/s', + $html, + ); + $this->assertMatchesRegularExpression( + '/\s*\s*' + . '人参<\/span>\s*' + . '秋香<\/span>\s*' + . '常仪<\/span>\s*' + . '<\/span>\s*<\/td>/s', + $html, + ); + } + public function test_can_insert_a_todo_at_a_selected_sequence_and_shift_existing_items(): void { $this->loginAs();