diff --git a/resources/views/business/pages/financial-operations/non-store-accounts.blade.php b/resources/views/business/pages/financial-operations/non-store-accounts.blade.php index 9db03e8c..6cebd3cb 100644 --- a/resources/views/business/pages/financial-operations/non-store-accounts.blade.php +++ b/resources/views/business/pages/financial-operations/non-store-accounts.blade.php @@ -3086,7 +3086,21 @@ filterSearch.addEventListener('input', showFilterOptions); filterSearch.addEventListener('keydown', (event) => { if (event.key !== 'Enter' || !activeFilter) return; + if (event.isComposing || event.keyCode === 229) return; event.preventDefault(); + const normalizedQuery = filterSearch.value.trim().toLocaleLowerCase('zh-CN'); + if (normalizedQuery !== '') { + const matchingValues = activeFilter.values.filter( + (value) => value.toLocaleLowerCase('zh-CN').includes(normalizedQuery), + ); + if (matchingValues.length === 0) return; + activeFilter.selection = new Set(matchingValues); + activeFilter.state.filter = matchingValues.length === activeFilter.values.length + ? null + : new Set(matchingValues); + activeFilter.applyTable(); + filterCount.textContent = `全部账户 · 已选 ${activeFilter.selection.size} / ${activeFilter.values.length}`; + } activeFilter.applyServer(); }); sortButtons.forEach((button) => { diff --git a/tests/Feature/Business/NonStoreAccountMonitorTest.php b/tests/Feature/Business/NonStoreAccountMonitorTest.php index 07d48666..d85c46af 100644 --- a/tests/Feature/Business/NonStoreAccountMonitorTest.php +++ b/tests/Feature/Business/NonStoreAccountMonitorTest.php @@ -444,6 +444,18 @@ class NonStoreAccountMonitorTest extends FeatureTestCase $this->assertStringNotContainsString('分页占位公司001', $tableMatch[0]); $this->assertStringContainsString('全部账户 · 已选', $html); $this->assertStringContainsString('data-nsm-filter-key="account_display_short"', $html); + $this->assertStringContainsString( + 'const matchingValues = activeFilter.values.filter(', + $html, + ); + $this->assertStringContainsString( + 'activeFilter.selection = new Set(matchingValues);', + $html, + ); + $this->assertStringContainsString( + 'if (event.isComposing || event.keyCode === 229) return;', + $html, + ); $this->assertSame(1, preg_match( '/const serverColumnFilterValues = (.*?);\s*const serverColumnFilters/s', $html,