From 4cc4589d8d99013eeeb63b90d6ffd5e9e8ca026a Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Mon, 26 Oct 2026 13:43:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=8F=B7=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=B9=B6=E5=AE=9A=E4=BD=8D=E5=88=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=20(#586)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/SystemizationTodos.php | 31 ++++++++++++++----- .../pages/systemization-todos.blade.php | 12 ++++++- .../Business/SystemizationTodosTest.php | 30 +++++++++++++++--- 3 files changed, 60 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Business/SystemizationTodos.php b/app/Http/Controllers/Business/SystemizationTodos.php index 256d7621..80d8b7fc 100644 --- a/app/Http/Controllers/Business/SystemizationTodos.php +++ b/app/Http/Controllers/Business/SystemizationTodos.php @@ -102,6 +102,13 @@ class SystemizationTodos extends Controller ->orderBy('sort_order') ->orderBy('id') ->get(); + if ($filters['sequence'] > 0) { + $items = $items + ->filter(static fn (SystemizationTodo $todo): bool => + (int) $todo->category_sequence === $filters['sequence'] + ) + ->values(); + } $base = SystemizationTodo::query(); $categories = SystemizationTodo::query() @@ -176,7 +183,7 @@ class SystemizationTodos extends Controller $todo = SystemizationTodo::query()->create($data); $this->storeAttachments($request, $todo); - return $this->backToPage('待办事项已新增。'); + return $this->backToPage('待办事项已新增并定位。', 'success', $todo); } public function update(Request $request, SystemizationTodo $todo): RedirectResponse @@ -204,7 +211,7 @@ class SystemizationTodos extends Controller $todo->update($data); $this->storeAttachments($request, $todo); - return $this->backToPage('待办事项已更新。'); + return $this->backToPage('待办事项已更新并定位。', 'success', $todo); } public function destroy(SystemizationTodo $todo): RedirectResponse @@ -273,6 +280,7 @@ class SystemizationTodos extends Controller 'assignees' => $this->peopleFilter('assignee'), 'start_date' => $this->normalizeDateFilter(request('start_date')), 'due_date' => $this->normalizeDateFilter(request('due_date')), + 'sequence' => max(0, (int) request('sequence', 0)), 'keyword' => trim((string) request('keyword', '')), ]; } @@ -371,13 +379,22 @@ class SystemizationTodos extends Controller } } - private function backToPage(string $message, string $type = 'success'): RedirectResponse + private function backToPage( + string $message, + string $type = 'success', + ?SystemizationTodo $focus = null, + ): RedirectResponse { + $parameters = [ + 'section' => 'other', + 'page' => 'systemization-todos', + ]; + if ($focus) { + $parameters['highlight'] = $focus->id; + } + return redirect() - ->route('business.pages.show', [ - 'section' => 'other', - 'page' => 'systemization-todos', - ]) + ->route('business.pages.show', $parameters) ->with($type === 'success' ? 'success' : 'error', $message); } } diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php index 656d300f..04a9438d 100644 --- a/resources/views/business/pages/systemization-todos.blade.php +++ b/resources/views/business/pages/systemization-todos.blade.php @@ -44,6 +44,7 @@ .sys-todo-table td { padding:.72rem .6rem; border-bottom:1px solid #eee7da; background:#fff; color:#2f2a23; line-height:1.6; vertical-align:top; } .sys-todo-table tbody tr { cursor:pointer; } .sys-todo-table tbody tr:hover td { background:#fdfbf6; } + .sys-todo-table tbody tr.is-highlighted td { background:#fff4cf !important; } .sys-todo-table tbody tr:focus-visible { outline:2px solid var(--sys-gold); outline-offset:-2px; } .sys-todo-table__index-cell { width:3.6rem; min-width:3.6rem; text-align:center; } .sys-todo-table__index { color:#6d5630; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; } @@ -198,6 +199,7 @@ @endforeach + @php $selectedOwners = $todoOwners->filter( static fn (string $owner): bool => in_array($owner, $todoFilters['owners'], true) @@ -309,6 +311,7 @@ } $lastItem = $items->last(); $lastSectionLabel = $items->isNotEmpty() ? ($sectionLabels[$items->count() - 1] ?? '') : ''; + $highlightId = max(0, (int) request('highlight', 0)); @endphp