From 9bb37afa8306fbb19b336e49fffd9199e3e7bfd0 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 28 Oct 2026 18:04:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E5=8C=96=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E8=B4=9F=E8=B4=A3=E4=BA=BA=E6=94=B9=E4=B8=BA=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/SystemizationTodos.php | 19 +++++++++++++- .../pages/systemization-todos.blade.php | 25 +++++++++++++------ .../Business/SystemizationTodosTest.php | 24 +++++++++++++++--- 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Business/SystemizationTodos.php b/app/Http/Controllers/Business/SystemizationTodos.php index b65e26a0..a4ef7f37 100644 --- a/app/Http/Controllers/Business/SystemizationTodos.php +++ b/app/Http/Controllers/Business/SystemizationTodos.php @@ -28,7 +28,23 @@ class SystemizationTodos extends Controller 'pending' => '时间待定', 'none' => '已完成', ]; - private const OWNER_OPTIONS = ['人参', '晨曦', '常仪', '待定']; + private const OWNER_OPTIONS = ['人参', '常仪', '晨曦', '待定']; + private const ASSIGNEE_OPTIONS = [ + '人参', + '苏木', + '李斯', + '周生辰', + '常仪', + '玉兔', + '山时', + '杳杳', + '林冲', + '惠兰', + '晨曦', + '栎阳', + '秋香', + '待定', + ]; private const COLUMN_WIDTHS_SETTING = 'business.systemization_todos.column_widths'; private const COLUMN_WIDTH_KEYS = [ 'type', @@ -108,6 +124,7 @@ class SystemizationTodos extends Controller 'todoContentOptions' => $this->contentOptions(), 'todoOwners' => collect(self::OWNER_OPTIONS), 'todoAssignees' => $todoAssignees, + 'todoAssigneeOptions' => collect(self::ASSIGNEE_OPTIONS), 'todoAssigneeOwners' => $this->assigneeOwnerMap($todoAssignees), 'todoStatuses' => SystemizationTodo::STATUSES, 'todoStatusOptions' => $statusOptions, diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php index 8f2b51b0..35bc3c39 100644 --- a/resources/views/business/pages/systemization-todos.blade.php +++ b/resources/views/business/pages/systemization-todos.blade.php @@ -1528,7 +1528,7 @@ if (persist) { persistColumnWidths(columnWidths); } - window.dispatchEvent(new Event('resize')); + scheduleScrollRailSync(); } function columnWidthsFromPreference(preference) { @@ -2577,6 +2577,8 @@ var pendingGridRefreshTimer = null; var uploadUrl = ''; var uploadRowId = ''; + var ownerOptions = @json($todoOwners->values()->all(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + var assigneeOptions = @json($todoAssigneeOptions->values()->all(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); var pasteFields = [ 'category', 'section', @@ -3058,15 +3060,24 @@ return; } var editor; - if (field === 'status') { + if (field === 'status' || field === 'owner' || field === 'assignee') { editor = document.createElement('select'); - ['未完成', '已完成'].forEach(function (value) { + var choices = field === 'status' + ? ['未完成', '已完成'] + : (field === 'owner' ? ownerOptions : assigneeOptions).slice(); + if (field === 'assignee') { + choices.unshift(''); + } + if (original !== '' && choices.indexOf(original) === -1) { + choices.unshift(original); + } + choices.forEach(function (value) { var option = document.createElement('option'); option.value = value; - option.textContent = value; + option.textContent = value || '未指定'; editor.appendChild(option); }); - editor.value = original || '未完成'; + editor.value = original || (field === 'assignee' ? '' : '待定'); } else if (field === 'title' || field === 'progress') { editor = document.createElement('textarea'); editor.rows = field === 'title' ? 2 : 3; @@ -3092,7 +3103,7 @@ cell.classList.add('is-dirty'); }); editor.addEventListener('change', function () { - if (field === 'status') closeEditor(true); + if (field === 'status' || field === 'owner' || field === 'assignee') closeEditor(true); }); editor.addEventListener('keydown', function (event) { if (event.key === 'Escape') { @@ -3463,7 +3474,7 @@ focusCell.focus({preventScroll: true}); } } - scheduleScrollRailSync(); + window.dispatchEvent(new Event('resize')); } function queueGridRefresh(grid, focus) { diff --git a/tests/Feature/Business/SystemizationTodosTest.php b/tests/Feature/Business/SystemizationTodosTest.php index 3a6de03b..936dd183 100644 --- a/tests/Feature/Business/SystemizationTodosTest.php +++ b/tests/Feature/Business/SystemizationTodosTest.php @@ -98,6 +98,9 @@ class SystemizationTodosTest extends FeatureTestCase ->assertSee('nextGridRefresh = payload.grid', false) ->assertSee('applyGridRefresh()', false) ->assertDontSee('reloadAfterSave', false) + ->assertSee('var ownerOptions =', false) + ->assertSee('var assigneeOptions =', false) + ->assertSee("field === 'status' || field === 'owner' || field === 'assignee'", false) ->assertSee("if (field === 'start_date' || field === 'due_date')", false) ->assertSee('sys-todo-grid-date-editor__pending', false) ->assertSee('window.CaiWuDatePicker.setup(wrapper)', false) @@ -400,10 +403,23 @@ class SystemizationTodosTest extends FeatureTestCase 'page' => 'systemization-todos', ]))->assertOk()->viewData('content'); - $this->assertSame( - ['人参', '晨曦', '常仪', '待定'], - $content['todoOwners']->all(), - ); + $this->assertSame(['人参', '常仪', '晨曦', '待定'], $content['todoOwners']->all()); + $this->assertSame([ + '人参', + '苏木', + '李斯', + '周生辰', + '常仪', + '玉兔', + '山时', + '杳杳', + '林冲', + '惠兰', + '晨曦', + '栎阳', + '秋香', + '待定', + ], $content['todoAssigneeOptions']->all()); $this->assertContains('人参', $content['todoAssignees']); $this->assertContains('周生辰', $content['todoAssignees']); $this->assertNotContains('人参 / 周生辰', $content['todoAssignees']);