fix(供应商负数预警):精简付款列并压缩备注宽度 (#1592)

Co-authored-by: 苏木 <594326199@qq.com>
Co-committed-by: 苏木 <594326199@qq.com>
This commit is contained in:
苏木 2026-12-01 09:16:56 +08:00 committed by sumu
parent 5767e574e5
commit 288b2ae95b
2 changed files with 47 additions and 3 deletions

View File

@ -3,7 +3,11 @@
$fields = $negativeAlertFields ?? [];
$visibleFields = array_values(array_filter(
$fields,
static fn (array $field): bool => ($field['name'] ?? '') !== 'company',
static fn (array $field): bool => ! in_array(
$field['name'] ?? '',
['company', 'to_corporate', 'to_private', 'cashier_paid', 'private_reason'],
true,
),
));
$months = $negativeAlertMonths ?? [];
$month = $negativeAlertMonth ?? '';
@ -506,6 +510,17 @@
color: var(--sna-danger);
}
.supplier-negative-alert-data-page .sna-remarks-cell {
display: -webkit-box;
width: 14rem;
max-width: 14rem;
overflow: hidden;
white-space: normal;
overflow-wrap: anywhere;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.supplier-negative-alert-data-page .sna-workflow-feedback {
margin: 0;
padding: 10px 12px;
@ -863,6 +878,8 @@
<span class="sna-reason-status" data-sna-reason-status aria-live="polite">修改后失焦自动保存</span>
</div>
</div>
@elseif ($field['name'] === 'remarks' && $value !== null && $value !== '')
<span class="sna-remarks-cell" title="{{ $value }}">{{ $value }}</span>
@elseif ($field['name'] === 'handling_result')
<div class="sna-handling-result">
@if ($value !== null && $value !== '')

View File

@ -198,8 +198,8 @@ class NegativeAlertPagesTest extends FeatureTestCase
);
$html = (string) $response->getContent();
preg_match_all('/<th(?:\s|>)/', $html, $headers);
// 序号 + 隐藏主体名称后的原字段 + 最晚出账单时间 + 动态匹配的采购 + 处理结果。
$this->assertCount(count($fields) + 3, $headers[0]);
// 序号 + 业务字段(隐藏主体及4个付款列)+ 最晚出账单时间 + 采购 + 处理结果。
$this->assertCount(count($fields) - 1, $headers[0]);
preg_match_all('/<th[^>]*>(.*?)<\/th>/s', $html, $headerMatches);
$labels = array_map(
static fn (string $label): string => trim(html_entity_decode(strip_tags($label), ENT_QUOTES | ENT_HTML5, 'UTF-8')),
@ -543,6 +543,33 @@ class NegativeAlertPagesTest extends FeatureTestCase
->assertDontSeeText('九月负余额供应商');
}
public function test_supplier_negative_alert_hides_payment_columns_and_compacts_remarks(): void
{
$this->saveSupplierPayable('layout:1', '列布局供应商', '-88.00', '2026-10', [
'remarks' => "第一行备注\n第二行备注",
'to_corporate' => '11.00',
'to_private' => '22.00',
'cashier_paid' => '33.00',
'private_reason' => '不应展示',
]);
$this->loginAs()
->get(route('business.pages.show', [
'section' => 'negative-alerts',
'page' => 'supplier-negative-alert',
'tab' => 'alert',
'month' => '2026-10',
]))
->assertOk()
->assertDontSeeText('对公打款金额')
->assertDontSeeText('对私打款金额')
->assertDontSeeText('已销账金额')
->assertDontSeeText('对私原因')
->assertSee('class="sna-remarks-cell"', false)
->assertSee('title="第一行备注', false)
->assertSee('-webkit-line-clamp: 2', false);
}
public function test_supplier_negative_alert_filters_by_checker_settlement_and_purchaser(): void
{
$this->saveSupplierPayable('filter:target', '目标供应商', '-50.00', '2026-09', [