From fa2cfe32e16dd3508fd56f4a9da37374ab67a160 Mon Sep 17 00:00:00 2001 From: shanshi <3316401569@qq.com> Date: Fri, 13 Nov 2026 15:36:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=B4=A2=E5=8A=A1=E5=8F=B0=E8=B4=A6):=20?= =?UTF-8?q?=E9=93=B6=E8=A1=8C=E5=88=86=E7=B1=BB=E8=A1=A8=E6=A0=BC=E5=B1=85?= =?UTF-8?q?=E4=B8=AD=E5=B9=B6=E6=94=AF=E6=8C=81=E4=BD=99=E9=A2=9D=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=20(#1159)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 表格居中对齐\n- 余额列支持排序 --- .../pages/financial-ledger/ledger.blade.php | 37 +++++++++++++++++-- .../FinanceLedgerBankCategoryDialogTest.php | 4 +- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/resources/views/business/pages/financial-ledger/ledger.blade.php b/resources/views/business/pages/financial-ledger/ledger.blade.php index eadfc78b..f9329c6b 100644 --- a/resources/views/business/pages/financial-ledger/ledger.blade.php +++ b/resources/views/business/pages/financial-ledger/ledger.blade.php @@ -513,9 +513,11 @@ .ledger-available-note { margin:.7rem 0 0; padding:.55rem .65rem; border-radius:.4rem; background:var(--vip-content-accent-soft, #F7F0DE); color:var(--vip-content-muted, #595959); font-size:.64rem; line-height:1.55; } .ledger-available-dialog__footer { display:flex; justify-content:flex-end; padding:.75rem 1.1rem 1rem; border-top:1px solid #e8e3da; } .ledger-bank-category-table { width:100%; min-width:58rem; table-layout:fixed; border-collapse:collapse; font-variant-numeric:tabular-nums; } - .ledger-bank-category-table th, .ledger-bank-category-table td { padding:.55rem .6rem; border-right:1px solid #e8e3da; border-bottom:1px solid #e8e3da; font-size:.72rem; text-align:right; white-space:nowrap; } + .ledger-bank-category-table th, .ledger-bank-category-table td { padding:.55rem .6rem; border-right:1px solid #e8e3da; border-bottom:1px solid #e8e3da; font-size:.72rem; text-align:center; white-space:nowrap; } .ledger-bank-category-table th { background:var(--vip-content-accent-soft, #F7F0DE); color:var(--vip-content-muted, #595959); font-weight:600; } - .ledger-bank-category-table th:first-child, .ledger-bank-category-table td:first-child { text-align:left; } + .ledger-bank-category-sort { display:inline-flex; width:100%; align-items:center; justify-content:center; gap:.22rem; padding:0; border:0; background:transparent; color:inherit; font:inherit; font-weight:600; cursor:pointer; } + .ledger-bank-category-sort:hover, .ledger-bank-category-sort:focus-visible { color:var(--vip-content-accent-dark, #856632); outline:none; } + .ledger-bank-category-sort .material-icons-outlined { font-size:.9rem; } .ledger-bank-category-table th:last-child, .ledger-bank-category-table td:last-child { border-right:0; } .ledger-bank-category-table tbody tr:hover { background:#fbf8ef; } .ledger-bank-category-table tfoot td { border-top:1px solid var(--vip-border, #D8D2C7); border-bottom:0; background:#fcfaf5; font-weight:600; } @@ -1272,14 +1274,19 @@ 银企直连数量 非银企直联数量 合计数量 - 余额(万元) + + + 保留数量 不保留数量 @forelse ($bankCategoryBreakdown['categories'] as $category) - + {{ $category['bank_category'] }} {{ number_format((int) $category['direct_count']) }} {{ number_format((int) $category['non_direct_count']) }} @@ -3453,6 +3460,28 @@ bankCategoryDialog?.addEventListener('close', () => { bankCategoryTrigger?.setAttribute('aria-expanded', 'false'); }); + const bankCategorySort = bankCategoryDialog?.querySelector('[data-ledger-bank-category-sort="balance"]'); + bankCategorySort?.addEventListener('click', () => { + const tableBody = bankCategoryDialog?.querySelector('.ledger-bank-category-table tbody'); + if (!tableBody) return; + const direction = bankCategorySort.dataset.direction === 'desc' ? 'asc' : 'desc'; + const rows = Array.from(tableBody.querySelectorAll('tr[data-bank-category-balance]')); + rows.sort((left, right) => { + const leftValue = Number(left.dataset.bankCategoryBalance || 0); + const rightValue = Number(right.dataset.bankCategoryBalance || 0); + + return (leftValue <=> rightValue) * (direction === 'asc' ? 1 : -1); + }); + rows.forEach((row) => tableBody.appendChild(row)); + bankCategorySort.dataset.direction = direction; + bankCategorySort.closest('th')?.setAttribute('aria-sort', direction === 'asc' ? 'ascending' : 'descending'); + bankCategorySort.setAttribute( + 'aria-label', + direction === 'asc' ? '余额按从低到高排序' : '余额按从高到低排序', + ); + const icon = bankCategorySort.querySelector('[data-ledger-bank-category-sort-icon]'); + if (icon) icon.textContent = direction === 'asc' ? 'north' : 'south'; + }); const accountPanel = page.querySelector('#ledger-panel-accounts'); const accountEditToggle = page.querySelector('[data-ledger-edit-mode-toggle]'); diff --git a/tests/Feature/Business/FinanceLedgerBankCategoryDialogTest.php b/tests/Feature/Business/FinanceLedgerBankCategoryDialogTest.php index 28536e60..72b58d04 100644 --- a/tests/Feature/Business/FinanceLedgerBankCategoryDialogTest.php +++ b/tests/Feature/Business/FinanceLedgerBankCategoryDialogTest.php @@ -102,9 +102,11 @@ class FinanceLedgerBankCategoryDialogTest extends FeatureTestCase ->assertSee('data-ledger-bank-category-trigger', false) ->assertSee('银行分类数量') ->assertSee('table-layout:fixed', false) - ->assertSee('text-align:right; white-space:nowrap', false) + ->assertSee('text-align:center; white-space:nowrap', false) ->assertSee('border-right:1px solid #e8e3da', false) ->assertSee('', false) + ->assertSee('data-ledger-bank-category-sort="balance"', false) + ->assertSee('data-bank-category-balance="', false) ->assertSeeInOrder([ '招商银行', '1',