fix: 冻结供应商负数预警关键列

隐藏公司主体名称并冻结供应商简称及之前的列。
Co-authored-by: 苏木 <594326199@qq.com>
Co-committed-by: 苏木 <594326199@qq.com>
This commit is contained in:
苏木 2026-10-28 14:21:03 +08:00 committed by sumu
parent 32669b4bc9
commit c8e24f5866
2 changed files with 94 additions and 11 deletions

View File

@ -1,6 +1,10 @@
@php
$rows = $negativeAlertRows ?? null;
$fields = $negativeAlertFields ?? [];
$visibleFields = array_values(array_filter(
$fields,
static fn (array $field): bool => ($field['name'] ?? '') !== 'company',
));
$months = $negativeAlertMonths ?? [];
$month = $negativeAlertMonth ?? '';
$supplierQuery = $negativeAlertSupplier ?? '';
@ -176,6 +180,7 @@
max-height: min(62vh, 620px);
overflow: auto;
scrollbar-gutter: stable;
position: relative;
}
.supplier-negative-alert-data-page table {
@ -199,6 +204,61 @@
white-space: nowrap;
}
.supplier-negative-alert-data-page th[data-fixed-column],
.supplier-negative-alert-data-page td[data-fixed-column] {
position: sticky;
z-index: 3;
overflow: hidden;
background: var(--vip-surface, #FFFFFF);
text-overflow: ellipsis;
}
.supplier-negative-alert-data-page th[data-fixed-column] {
z-index: 5;
background: var(--vip-content-accent-soft, #F7F0DE);
}
.supplier-negative-alert-data-page th[data-fixed-column="index"],
.supplier-negative-alert-data-page td[data-fixed-column="index"] {
left: 0;
width: 52px;
min-width: 52px;
max-width: 52px;
}
.supplier-negative-alert-data-page th[data-fixed-column="summary_month"],
.supplier-negative-alert-data-page td[data-fixed-column="summary_month"] {
left: 52px;
width: 88px;
min-width: 88px;
max-width: 88px;
}
.supplier-negative-alert-data-page th[data-fixed-column="checker"],
.supplier-negative-alert-data-page td[data-fixed-column="checker"] {
left: 140px;
width: 90px;
min-width: 90px;
max-width: 90px;
}
.supplier-negative-alert-data-page th[data-fixed-column="settlement_method"],
.supplier-negative-alert-data-page td[data-fixed-column="settlement_method"] {
left: 230px;
width: 180px;
min-width: 180px;
max-width: 180px;
}
.supplier-negative-alert-data-page th[data-fixed-column="supplier"],
.supplier-negative-alert-data-page td[data-fixed-column="supplier"] {
left: 410px;
width: 130px;
min-width: 130px;
max-width: 130px;
box-shadow: 2px 0 4px rgba(23, 23, 23, 0.08);
}
.supplier-negative-alert-data-page td {
padding: 10px 12px;
border-bottom: 1px solid #EFEAE0;
@ -210,6 +270,10 @@
background: #FFFDF7;
}
.supplier-negative-alert-data-page tbody tr:hover td[data-fixed-column] {
background: #FFFDF7;
}
.supplier-negative-alert-data-page td.is-number {
font-variant-numeric: tabular-nums;
text-align: right;
@ -358,9 +422,14 @@
<table>
<thead>
<tr>
<th>序号</th>
@foreach ($fields as $field)
<th @class(['is-number' => ($field['type'] ?? '') === 'number'])>
<th data-fixed-column="index">序号</th>
@foreach ($visibleFields as $field)
<th
@if (in_array($field['name'], ['summary_month', 'checker', 'settlement_method', 'supplier'], true))
data-fixed-column="{{ $field['name'] }}"
@endif
@class(['is-number' => ($field['type'] ?? '') === 'number'])
>
{{ $field['label'] }}
</th>
@endforeach
@ -369,8 +438,8 @@
<tbody>
@foreach ($rows as $index => $row)
<tr>
<td>{{ ($rows->firstItem() ?? 1) + $index }}</td>
@foreach ($fields as $field)
<td data-fixed-column="index">{{ ($rows->firstItem() ?? 1) + $index }}</td>
@foreach ($visibleFields as $field)
@php
$value = $row->{$field['name']} ?? null;
$isNumber = ($field['type'] ?? '') === 'number';
@ -378,10 +447,15 @@
&& is_numeric($value)
&& (float) $value < 0;
@endphp
<td @class([
'is-number' => $isNumber,
'is-negative' => $isNegativeBalance,
])>
<td
@if (in_array($field['name'], ['summary_month', 'checker', 'settlement_method', 'supplier'], true))
data-fixed-column="{{ $field['name'] }}"
@endif
@class([
'is-number' => $isNumber,
'is-negative' => $isNegativeBalance,
])
>
@if ($value === null || $value === '')
-
@elseif ($isNumber && is_numeric($value))

View File

@ -79,8 +79,17 @@ class NegativeAlertPagesTest extends FeatureTestCase
PayablesFinalRegistry::SECTION_SUPPLIER,
'supplier-payables-report',
);
preg_match_all('/<th(?:\s|>)/', (string) $response->getContent(), $headers);
$this->assertCount(count($fields) + 1, $headers[0]);
$html = (string) $response->getContent();
preg_match_all('/<th(?:\s|>)/', $html, $headers);
$this->assertCount(count($fields), $headers[0]);
$this->assertStringNotContainsString('供应商公司主体名称', $html);
$this->assertStringNotContainsString('测试供应商有限公司', $html);
preg_match_all('/<th[^>]*data-fixed-column="([^"]+)"/', $html, $fixedHeaders);
$this->assertSame(
['index', 'summary_month', 'checker', 'settlement_method', 'supplier'],
$fixedHeaders[1],
);
$this->loginAs()
->get(route('business.pages.show', [