From 412a2433bfaeacfe89b2bdcea2b689c668575fd5 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 11 Nov 2026 18:48:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A1=BE=E5=AE=B6=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=94=AF=E6=8C=81=E5=88=97=E5=AE=BD=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/kuka_posting.php | 70 +++++ .../pages/partials/directory-table.blade.php | 282 +++++++++++++++++- .../posting-data/kuka-basic-data.blade.php | 2 + .../Business/KukaPostingBasePageTest.php | 3 + 4 files changed, 355 insertions(+), 2 deletions(-) diff --git a/config/kuka_posting.php b/config/kuka_posting.php index 403f0a76..381c82f7 100644 --- a/config/kuka_posting.php +++ b/config/kuka_posting.php @@ -132,4 +132,74 @@ return [ ['name' => 'item_number', 'source' => '货号', 'label' => '货号'], ['name' => 'material', 'source' => '材质', 'label' => '材质'], ], + 'field_widths' => [ + 'internal_order_no' => 120, + 'marked_labels' => 340, + 'after_sales_order_no' => 120, + 'order_type' => 100, + 'online_order_no' => 190, + 'order_status' => 105, + 'shipping_warehouse' => 150, + 'operations_cloud_warehouse' => 140, + 'distributor' => 130, + 'owner_distribution' => 130, + 'store_name' => 170, + 'buyer_account' => 190, + 'seller_remark' => 260, + 'order_date' => 165, + 'shipping_date' => 165, + 'payment_date' => 165, + 'receipt_confirm_date' => 165, + 'province' => 90, + 'city' => 100, + 'district' => 100, + 'shipping_company' => 130, + 'shipping_tracking_no' => 190, + 'after_sales_company' => 130, + 'after_sales_tracking_no' => 190, + 'receiver_name' => 110, + 'after_sales_registered_at' => 165, + 'after_sales_confirmed_at' => 165, + 'receiving_warehouse' => 150, + 'after_sales_category' => 120, + 'problem_type' => 130, + 'product_code' => 200, + 'original_online_order_no' => 190, + 'style_code' => 150, + 'product_category' => 160, + 'product_short_name' => 280, + 'color_spec' => 170, + 'brand' => 140, + 'cost_source' => 140, + 'sales_quantity' => 100, + 'shipped_quantity' => 100, + 'actual_shipping_amount' => 120, + 'sales_amount' => 120, + 'paid_amount' => 120, + 'payable_amount' => 120, + 'sale_price' => 110, + 'current_return_quantity' => 120, + 'current_actual_return_quantity' => 120, + 'current_return_amount' => 130, + 'current_actual_return_amount' => 130, + 'freight_income' => 110, + 'freight_income_allocated' => 130, + 'whole_order_freight_expense' => 140, + 'freight_expense' => 110, + 'discount_amount' => 110, + 'order_weight' => 110, + 'supplier' => 130, + 'salesperson' => 110, + 'product_status' => 110, + 'refund_status' => 110, + 'buyer_paid' => 120, + 'merchant_received' => 120, + 'flag' => 80, + 'platform_subsidy_amount' => 130, + 'product_name' => 280, + 'supplier_product_code' => 170, + 'specification_model' => 190, + 'item_number' => 150, + 'material' => 210, + ], ]; diff --git a/resources/views/business/pages/partials/directory-table.blade.php b/resources/views/business/pages/partials/directory-table.blade.php index bf576c75..2e22b754 100644 --- a/resources/views/business/pages/partials/directory-table.blade.php +++ b/resources/views/business/pages/partials/directory-table.blade.php @@ -1,5 +1,7 @@ @php $showDirectoryIntro = $showDirectoryIntro ?? true; + $enableColumnResize = $enableColumnResize ?? false; + $columnWidths = is_array($columnWidths ?? null) ? $columnWidths : []; $directoryRows = $rows ?? collect(); $directoryFields = $directory['fields'] ?? []; $isInventoryReportPage = ($page['slug'] ?? '') === 'inventory-report'; @@ -707,6 +709,12 @@ font-variant-numeric: tabular-nums; } + .directory-table[data-directory-resizable] { + width: max-content; + min-width: 100%; + table-layout: fixed; + } + .directory-table th, .directory-table td { min-width: 8rem; @@ -719,6 +727,58 @@ white-space: nowrap; } + .directory-table[data-directory-resizable] th, + .directory-table[data-directory-resizable] td { + min-width: 0; + height: 2.65rem; + padding: 0.55rem 0.75rem; + } + .directory-table[data-directory-resizable] th { + padding-right: 1.1rem; + } + .directory-table[data-directory-resizable] td { + overflow: hidden; + text-overflow: ellipsis; + } + .directory-table-column-resizer { + position: absolute; + top: 0; + right: 0; + z-index: 5; + width: 0.65rem; + height: 100%; + cursor: col-resize; + touch-action: none; + } + .directory-table-column-resizer::after { + position: absolute; + top: 22%; + bottom: 22%; + left: calc(50% - 0.5px); + width: 1px; + background: transparent; + content: ""; + transition: width 120ms ease, background-color 120ms ease; + } + .directory-table-column-resizer:hover::after, + .directory-table-column-resizer.is-active::after, + .directory-table-column-resizer:focus-visible::after { + width: 2px; + background: var(--vip-content-accent-dark, #856632); + } + .directory-table-column-resizer:focus-visible { + outline: 2px solid rgba(133, 102, 50, 0.24); + outline-offset: -2px; + } + body.is-resizing-directory-column, + body.is-resizing-directory-column * { + cursor: col-resize !important; + user-select: none; + } + @media (prefers-reduced-motion: reduce) { + .directory-table-column-resizer::after { transition: none; } + } + .directory-table th:first-child, .directory-table td:first-child { min-width: 3.5rem; @@ -3278,11 +3338,15 @@ @if($isInventoryReportPage) data-directory-table-key="total" @endif @if($directoryHasGroupedHeader) data-grouped-header="true" data-finance-table-native @endif @if($directoryUsesFieldQuery) data-columns-ready="true" @endif + @if($enableColumnResize && ! $directoryHasGroupedHeader) + data-directory-resizable="true" + data-directory-default-column-widths="{{ json_encode((object) $columnWidths, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) }}" + @endif > @unless ($directoryHasGroupedHeader) - {{ $directory['index_label'] ?? '序号' }} + {{ $directory['index_label'] ?? '序号' }} @endunless @if ($directoryHasGroupedHeader) @php @@ -3308,7 +3372,7 @@ @endforeach @else @foreach ($directoryFields as $field) - + @if ($directoryUsesFieldQuery) @php $isSorted = request('sort') === $field['name']; @@ -5002,4 +5066,218 @@ }); })(); + + @endonce diff --git a/resources/views/business/pages/posting-data/kuka-basic-data.blade.php b/resources/views/business/pages/posting-data/kuka-basic-data.blade.php index bb6ff630..3abc9e27 100644 --- a/resources/views/business/pages/posting-data/kuka-basic-data.blade.php +++ b/resources/views/business/pages/posting-data/kuka-basic-data.blade.php @@ -255,5 +255,7 @@ 'page' => $page, 'upstreamError' => $error, 'showDirectoryIntro' => false, + 'enableColumnResize' => true, + 'columnWidths' => config('kuka_posting.field_widths', []), ]) diff --git a/tests/Feature/Business/KukaPostingBasePageTest.php b/tests/Feature/Business/KukaPostingBasePageTest.php index ebe5b607..b534d32c 100644 --- a/tests/Feature/Business/KukaPostingBasePageTest.php +++ b/tests/Feature/Business/KukaPostingBasePageTest.php @@ -47,6 +47,9 @@ class KukaPostingBasePageTest extends FeatureTestCase ->assertDontSeeText('来源文件:') ->assertDontSeeText('基础数据 · 字段结构') ->assertDontSeeText('已从共享业务镜像读取 12 条数据') + ->assertSee('data-directory-resizable="true"', false) + ->assertSee('data-directory-column-resize', false) + ->assertSee('directory-column-widths', false) ->assertSeeText('KUKA-00') ->assertSeeText('SKU-00') ->assertDontSeeText('KUKA-01')