fix: 修正系统化待办人员筛选并调整查询按钮 #693

Merged
yueyang merged 1 commits from feature/yueyang-systemization-filter-ui into main 2026-10-27 16:39:18 +08:00
3 changed files with 33 additions and 3 deletions

View File

@ -811,7 +811,10 @@ class SystemizationTodos extends Controller
->whereNotNull($column)
->where($column, '<>', '')
->pluck($column)
->flatMap(static fn (string $value): array => array_map('trim', preg_split('/[、,,]/u', $value) ?: []))
->flatMap(static fn (string $value): array => array_map(
'trim',
preg_split('/[、,,;;\/]+/u', $value) ?: [],
))
->filter()
->unique()
->sort()

View File

@ -379,7 +379,7 @@
</label>
<label class="sys-todo-filter__keyword">关键词<input type="search" name="keyword" value="{{ $todoFilters['keyword'] }}" placeholder="事项、内容、责任人、进展或备注"></label>
<div class="sys-todo-filter__actions">
<button type="submit" class="sys-todo-page__button sys-todo-page__button--primary">筛选</button>
<button type="submit" class="sys-todo-page__button sys-todo-page__button--primary">查询</button>
<a class="sys-todo-page__button" href="{{ request()->url() }}">重置</a>
</div>
</form>
@ -1231,7 +1231,7 @@
function splitPeople(value) {
return String(value || '')
.split(/[、,,]/)
.split(/[、,,;;\/]+/)
.map(function (person) { return person.trim(); })
.filter(Boolean);
}

View File

@ -36,6 +36,7 @@ class SystemizationTodosTest extends FeatureTestCase
->assertSeeText('待定')
->assertSee('name="reminder"', false)
->assertSeeText('全部提醒')
->assertSee('>查询</button>', false)
->assertSeeText('完成情况 / 备注')
->assertSeeText('提醒')
->assertSee('data-sys-todo-default-start-date', false)
@ -257,6 +258,32 @@ class SystemizationTodosTest extends FeatureTestCase
);
}
public function test_people_filter_splits_slash_separated_names(): void
{
$this->loginAs();
$this->createTodo(
'收入',
'筛选责任人拆分',
'核对斜杠分隔的多人姓名',
'2026-11-30',
1,
'人参 / 周生辰',
'人参 / 周生辰',
);
$content = $this->get(route('business.pages.show', [
'section' => 'other',
'page' => 'systemization-todos',
]))->assertOk()->viewData('content');
foreach (['todoOwners', 'todoAssignees'] as $key) {
$this->assertContains('人参', $content[$key]);
$this->assertContains('周生辰', $content[$key]);
$this->assertNotContains('人参 / 周生辰', $content[$key]);
}
}
public function test_can_insert_a_todo_at_a_selected_sequence_and_shift_existing_items(): void
{
$this->loginAs();