fix: 删除银行分类余额列 (#1206)

This commit is contained in:
shanshi 2026-11-16 18:00:15 +08:00
parent 125c6cb003
commit c4157ed7d5
2 changed files with 19 additions and 50 deletions

View File

@ -609,9 +609,6 @@
.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: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-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; }
@ -1655,7 +1652,7 @@
<header class="ledger-available-dialog__header">
<div>
<h3 class="ledger-available-dialog__title" id="ledger-bank-category-title">银行分类数量</h3>
<p class="ledger-available-dialog__help">按当前查询时间段、公司和账户简称筛选统计;余额取所选时间段期末余额。</p>
<p class="ledger-available-dialog__help">按当前查询时间段、公司和账户简称筛选统计。</p>
</div>
<button class="ledger-available-dialog__close" type="button" aria-label="关闭银行分类数量" data-ledger-bank-category-close>
<span class="material-icons-outlined" aria-hidden="true">close</span>
@ -1665,13 +1662,12 @@
<div class="ledger-table-wrap">
<table class="ledger-bank-category-table">
<colgroup>
<col style="width:14%">
<col style="width:14%">
<col style="width:14%">
<col style="width:13%">
<col style="width:17%">
<col style="width:14%">
<col style="width:14%">
<col style="width:18%">
<col style="width:16%">
<col style="width:18%">
<col style="width:16%">
<col style="width:16%">
<col style="width:16%">
</colgroup>
<thead>
<tr>
@ -1679,29 +1675,22 @@
<th scope="col">银企直连数量</th>
<th scope="col">非银企直联数量</th>
<th scope="col">合计数量</th>
<th scope="col" aria-sort="none">
<button class="ledger-bank-category-sort" type="button" data-ledger-bank-category-sort="balance" aria-label="余额按从高到低排序" title="点击按余额排序">
余额(万元)
<span class="material-icons-outlined" data-ledger-bank-category-sort-icon aria-hidden="true">unfold_more</span>
</button>
</th>
<th scope="col">保留数量</th>
<th scope="col">不保留数量</th>
</tr>
</thead>
<tbody>
@forelse ($bankCategoryBreakdown['categories'] as $category)
<tr data-bank-category-balance="{{ (float) $category['balance'] }}">
<tr>
<td>{{ $category['bank_category'] }}</td>
<td>{{ number_format((int) $category['direct_count']) }}</td>
<td>{{ number_format((int) $category['non_direct_count']) }}</td>
<td>{{ number_format((int) $category['total_count']) }}</td>
<td>{{ $moneyWan($category['balance']) }}</td>
<td>{{ number_format((int) $category['retained_count']) }}</td>
<td>{{ number_format((int) $category['unretained_count']) }}</td>
</tr>
@empty
<tr><td colspan="7" class="center">当前筛选没有账户数据。</td></tr>
<tr><td colspan="6" class="center">当前筛选没有账户数据。</td></tr>
@endforelse
</tbody>
<tfoot>
@ -1710,7 +1699,6 @@
<td>{{ number_format((int) ($bankCategoryBreakdown['totals']['direct_count'] ?? 0)) }}</td>
<td>{{ number_format((int) ($bankCategoryBreakdown['totals']['non_direct_count'] ?? 0)) }}</td>
<td>{{ number_format((int) ($bankCategoryBreakdown['totals']['total_count'] ?? 0)) }}</td>
<td>{{ $moneyWan($bankCategoryBreakdown['totals']['balance'] ?? 0) }}</td>
<td>{{ number_format((int) ($bankCategoryBreakdown['totals']['retained_count'] ?? 0)) }}</td>
<td>{{ number_format((int) ($bankCategoryBreakdown['totals']['unretained_count'] ?? 0)) }}</td>
</tr>
@ -4011,29 +3999,6 @@
progressTabs.forEach((tab) => {
tab.addEventListener('click', () => activateProgressTab(tab.dataset.ledgerProgressTab));
});
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]');
const accountAddCompanyButton = page.querySelector('[data-ledger-add-company]');

View File

@ -91,7 +91,7 @@ class FinanceLedgerBankCategoryDialogTest extends FeatureTestCase
]);
}
public function test_account_count_opens_bank_category_dialog_with_period_balances_and_keep_counts(): void
public function test_account_count_opens_bank_category_dialog_with_counts_and_keep_status(): void
{
$response = $this->loginAs()->get($this->pageUrl([
'flows_from' => '2026-10-01',
@ -105,25 +105,29 @@ class FinanceLedgerBankCategoryDialogTest extends FeatureTestCase
->assertSee('text-align:center; white-space:nowrap', false)
->assertSee('border-right:1px solid #e8e3da', false)
->assertSee('<colgroup>', false)
->assertSee('data-ledger-bank-category-sort="balance"', false)
->assertSee('(leftValue - rightValue)', false)
->assertSee('data-bank-category-balance="', false)
->assertDontSee('data-ledger-bank-category-sort="balance"', false)
->assertDontSee('(leftValue - rightValue)', false)
->assertDontSee('data-bank-category-balance="', false)
->assertSeeInOrder([
'招商银行',
'1',
'0',
'1',
'0.11',
'1',
'0',
'工商银行',
'1',
'1',
'2',
'0.55',
'1',
'1',
]);
$html = $response->getContent();
$this->assertMatchesRegularExpression(
'/<table class="ledger-bank-category-table">.*?<thead>\s*<tr>(?:\s*<th scope="col">[^<]+<\/th>){6}\s*<\/tr>\s*<\/thead>/s',
$html,
);
}
public function test_fund_overview_opens_combined_period_and_current_balance_dialog(): void