fix(财务台账): 账户简称表头筛选支持手动输入 #467
@ -123,7 +123,7 @@
|
||||
],
|
||||
'transactions' => [
|
||||
['txn_date', '日期', 'date', ['options' => $transactionDateHeaderOptions]],
|
||||
['effective_account_short', '账户简称', 'enum', ['options' => $transactionAccountHeaderOptions]],
|
||||
['effective_account_short', '账户简称', 'searchable-enum', ['options' => $transactionAccountHeaderOptions]],
|
||||
['detail', '明细', 'text'],
|
||||
['source', '来源', 'enum', ['options' => $sourceLabels]],
|
||||
['income', '收入', 'number', ['headerClass' => 'num', 'align' => 'end']],
|
||||
|
||||
@ -20,9 +20,11 @@
|
||||
? ($direction === 'desc' ? 'arrow_downward' : 'arrow_upward')
|
||||
: ($isFiltered ? 'filter_alt' : 'unfold_more');
|
||||
$ariaSort = ! $isSorted ? 'none' : ($direction === 'desc' ? 'descending' : 'ascending');
|
||||
$filterListId = 'ledger-header-options-' . $tabKey . '-' . $column;
|
||||
$filterPlaceholder = match ($filterType) {
|
||||
'date' => '选择日期',
|
||||
'number' => '输入精确数值',
|
||||
'searchable-enum' => '输入或点选' . $label,
|
||||
default => '输入筛选值',
|
||||
};
|
||||
@endphp
|
||||
@ -61,7 +63,25 @@
|
||||
@endforeach
|
||||
<label class="ledger-header-filter__field">
|
||||
<span>筛选</span>
|
||||
@if ($options !== [])
|
||||
@if ($filterType === 'searchable-enum' && $options !== [])
|
||||
<input
|
||||
type="search"
|
||||
name="{{ $filterValueParameter }}"
|
||||
value="{{ $isFiltered ? $activeFilterValue : '' }}"
|
||||
placeholder="{{ $filterPlaceholder }}"
|
||||
list="{{ $filterListId }}"
|
||||
autocomplete="off"
|
||||
role="combobox"
|
||||
aria-autocomplete="list"
|
||||
aria-label="{{ $label }}筛选值"
|
||||
data-ledger-header-searchable-filter
|
||||
>
|
||||
<datalist id="{{ $filterListId }}">
|
||||
@foreach ($options as $optionValue => $optionLabel)
|
||||
<option value="{{ $optionValue }}" label="{{ $optionLabel }}">{{ $optionLabel }}</option>
|
||||
@endforeach
|
||||
</datalist>
|
||||
@elseif ($options !== [])
|
||||
<select name="{{ $filterValueParameter }}" aria-label="{{ $label }}筛选值">
|
||||
<option value="">全部</option>
|
||||
@foreach ($options as $optionValue => $optionLabel)
|
||||
|
||||
@ -132,7 +132,12 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
|
||||
|
||||
$this->assertSame(63, preg_match_all('/<details\b[^>]*data-ledger-header-details/', $html));
|
||||
$this->assertSame(63, preg_match_all('/<span\b[^>]*data-ledger-header-label/', $html));
|
||||
$this->assertSame(3, preg_match_all('/<select name="transactions_filter_value"/', $html));
|
||||
$this->assertSame(2, preg_match_all('/<select name="transactions_filter_value"/', $html));
|
||||
$this->assertSame(1, preg_match_all('/<input\b[^>]*name="transactions_filter_value"[^>]*list="ledger-header-options-transactions-effective_account_short"/', $html));
|
||||
$this->assertStringContainsString(
|
||||
'<datalist id="ledger-header-options-transactions-effective_account_short">',
|
||||
$html
|
||||
);
|
||||
$this->assertStringContainsString('<option value="账户甲"', $html);
|
||||
$this->assertStringContainsString('<option value="2026-10-18"', $html);
|
||||
$this->assertStringContainsString('data-transaction-column-storage-key', $html);
|
||||
@ -215,6 +220,14 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase
|
||||
->assertSee('APR-乙')
|
||||
->assertDontSee('APR-甲');
|
||||
|
||||
$this->loginAs()->get($this->pageUrl([
|
||||
'transactions_filter_column' => 'effective_account_short',
|
||||
'transactions_filter_value' => '乙',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertSee('乙笔流水')
|
||||
->assertDontSee('甲笔流水');
|
||||
|
||||
$this->loginAs()->get($this->pageUrl([
|
||||
'mapping_filter_column' => 'mapping_status',
|
||||
'mapping_filter_value' => 'unmapped',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user