From 0d0482a8fec5cfe8b4cce1f125f0baaecae080ee Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 29 Sep 2026 13:39:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=A4=E5=B1=82=E8=A1=A8?= =?UTF-8?q?=E5=A4=B4=E5=8F=B3=E4=BE=A7=E8=B7=A8=E8=A1=8C=E5=88=97=E7=9A=84?= =?UTF-8?q?=E8=BE=B9=E6=A1=86=E6=96=AD=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 基础样式 th:last-child 会去掉第二行最后一个单元格(入库金额)的右边框, 导致与右侧跨行的加权平均单价、定价状态之间缺少竖线、上下横线错位 - 按字段顺序给真正的最后一列打 data-directory-last-column 标记, 合并表头的其它表头单元格统一保留右边框 --- .../pages/partials/directory-table.blade.php | 14 ++++++++++++-- tests/Feature/Settings/NavigationTest.php | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/resources/views/business/pages/partials/directory-table.blade.php b/resources/views/business/pages/partials/directory-table.blade.php index 74047a0e..d9b09d89 100644 --- a/resources/views/business/pages/partials/directory-table.blade.php +++ b/resources/views/business/pages/partials/directory-table.blade.php @@ -26,6 +26,7 @@ // 字段配置里带 group 的目录表按 Excel 样式渲染两层合并表头:同组字段共用一个一级标题, // 未分组的列标题跨两行显示,列顺序固定为配置顺序。 $directoryHasGroupedHeader = collect($directoryFields)->contains(fn (array $field): bool => filled($field['group'] ?? null)); + $directoryLastFieldName = collect($directoryFields)->last()['name'] ?? null; $directoryIsPaginated = is_object($directoryRows) && method_exists($directoryRows, 'total'); $directoryTotal = $directoryIsPaginated ? $directoryRows->total() : (is_countable($directoryRows) ? count($directoryRows) : 0); $directoryCurrentPage = $directoryIsPaginated ? $directoryRows->currentPage() : 1; @@ -503,6 +504,15 @@ .directory-table[data-grouped-header] thead th[data-directory-group] { font-weight: 700; } + /* 两层表头里每一行的最后一个单元格不一定位于表格最右侧,基础样式的 + th:last-child 会连中间列的右边框一起去掉,右侧跨行一级标题就会断格。 + 这里按字段顺序给真正的最后一列打标记,只让它在表格右边缘不留边框。 */ + .directory-table[data-grouped-header] thead th { + border-right: 1px solid var(--vip-border, #d8d2c7); + } + .directory-table[data-grouped-header] thead th[data-directory-last-column] { + border-right: 0; + } .directory-table[data-grouped-header] th:first-child, .directory-table[data-grouped-header] td:first-child { min-width: 8rem; @@ -1340,7 +1350,7 @@ @foreach ($groupedHeaderRuns as $headerRun) @if ($headerRun['group'] === null) @foreach ($headerRun['fields'] as $field) - {{ $field['label'] }} + {{ $field['label'] }} @endforeach @else {{ $headerRun['group'] }} @@ -1379,7 +1389,7 @@ @foreach ($directoryFields as $field) @continue(!isset($field['group'])) - {{ $field['label'] }} + {{ $field['label'] }} @endforeach @endif diff --git a/tests/Feature/Settings/NavigationTest.php b/tests/Feature/Settings/NavigationTest.php index d5e8d6af..d122ea03 100644 --- a/tests/Feature/Settings/NavigationTest.php +++ b/tests/Feature/Settings/NavigationTest.php @@ -72,6 +72,9 @@ class NavigationTest extends FeatureTestCase ->assertSee('rowspan="2"', false) ->assertSee('colspan="5"', false) ->assertSee('colspan="3"', false) + // 两层表头里第二行的最后一个单元格不在表格最右侧,需要保留右边框, + // 否则右侧跨行一级标题列会和左侧分组列断格。 + ->assertSee('data-directory-last-column', false) // 工作表没有序号列,页面也不再渲染固定序号列。 ->assertDontSee('assertDontSee('