From f1aa5c00f777cb0d4cf6c8071b116c749c00d57e Mon Sep 17 00:00:00 2001 From: chenxi Date: Sun, 20 Sep 2026 12:55:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=BF=9B=E9=94=80=E5=AD=98?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=BC=94=E7=A4=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Business/Pages.php | 24 ++++++++++++++ config/business_navigation.php | 30 ++++++++++++++--- config/inventory_report_demo.php | 32 +++++++++++++++++++ .../pages/partials/directory-table.blade.php | 11 +++++-- tests/Feature/Settings/NavigationTest.php | 13 +++++++- 5 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 config/inventory_report_demo.php diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index 4b1ba6fc..cf8c957e 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -381,6 +381,10 @@ class Pages extends Controller $tabColumn = null; $upstreamError = null; + if (($section['slug'] ?? null) === 'product-inventory' && ($page['slug'] ?? null) === 'inventory-report') { + $rows = $this->inventoryReportDemoRows(); + } + if ($page && $content === null) { $descriptor = TableRegistry::describe( $section['slug'], @@ -481,6 +485,26 @@ class Pages extends Controller ]; } + private function inventoryReportDemoRows(): LengthAwarePaginator + { + $columns = config('inventory_report_demo.columns', []); + $rows = collect(config('inventory_report_demo.rows', [])) + ->map(fn (array $row): array => array_combine($columns, $row)); + $perPage = 50; + $currentPage = max(1, request()->integer('page', 1)); + + return new LengthAwarePaginator( + $rows->forPage($currentPage, $perPage)->values(), + $rows->count(), + $perPage, + $currentPage, + [ + 'path' => request()->url(), + 'query' => request()->query(), + ], + ); + } + private function isStoreReceivingAccountPage(string $section, string $page): bool { return $section === 'fund-management' && $page === 'store-receiving-accounts'; diff --git a/config/business_navigation.php b/config/business_navigation.php index ad7c2ab8..d51c89b9 100644 --- a/config/business_navigation.php +++ b/config/business_navigation.php @@ -307,10 +307,32 @@ $navigation = [ 'title' => '进销存报表', 'directory' => [ 'icon' => 'inventory', - 'status' => '字段待定义', - 'description' => '进销存报表页面入口已建立,待确认报表字段和数据来源后接入正式数据。', - 'empty' => '进销存报表字段和数据来源尚未定义。', - 'fields' => [], + 'status' => '演示数据', + 'description' => '按进销存报表模板展示货主、仓库、商品及库存变动数据。', + 'empty' => '暂无进销存演示数据。', + 'fields' => [ + ['name' => 'owner', 'label' => '货主'], + ['name' => 'month', 'label' => '月份', 'kind' => 'date'], + ['name' => 'warehouse_provider', 'label' => '仓储方'], + ['name' => 'warehouse', 'label' => '仓库'], + ['name' => 'product_code', 'label' => '商品编码'], + ['name' => 'category', 'label' => '分类'], + ['name' => 'opening_quantity', 'label' => '期初数量', 'kind' => 'integer'], + ['name' => 'closing_quantity', 'label' => '期末数量', 'kind' => 'integer'], + ['name' => 'processing_in', 'label' => '加工进仓', 'kind' => 'integer'], + ['name' => 'processing_out', 'label' => '加工出仓', 'kind' => 'integer'], + ['name' => 'purchase_in', 'label' => '采购进仓', 'kind' => 'integer'], + ['name' => 'purchase_return', 'label' => '采购退货', 'kind' => 'integer'], + ['name' => 'other_in', 'label' => '其它进仓', 'kind' => 'integer'], + ['name' => 'other_return', 'label' => '其它退货', 'kind' => 'integer'], + ['name' => 'sales_out', 'label' => '销售出仓', 'kind' => 'integer'], + ['name' => 'sales_return', 'label' => '销售退货', 'kind' => 'integer'], + ['name' => 'stocktake', 'label' => '盘点', 'kind' => 'integer'], + ['name' => 'transfer_out', 'label' => '调拨出', 'kind' => 'integer'], + ['name' => 'transfer_in', 'label' => '调拨入', 'kind' => 'integer'], + ['name' => 'opening', 'label' => '期初', 'kind' => 'integer'], + ['name' => 'other_out', 'label' => '其它出库', 'kind' => 'integer'], + ], ], ], ], diff --git a/config/inventory_report_demo.php b/config/inventory_report_demo.php new file mode 100644 index 00000000..97e8beea --- /dev/null +++ b/config/inventory_report_demo.php @@ -0,0 +1,32 @@ + [ + 'owner', 'month', 'warehouse_provider', 'warehouse', 'product_code', 'category', + 'opening_quantity', 'closing_quantity', 'processing_in', 'processing_out', + 'purchase_in', 'purchase_return', 'other_in', 'other_return', 'sales_out', + 'sales_return', 'stocktake', 'transfer_out', 'transfer_in', 'opening', 'other_out', + ], + 'rows' => [ + ['常州简尚家居有限公司', '2026-09-01', '简尚-崔桥工厂仓', '简尚-崔桥工厂仓主仓', '100006981661', '住宅家具 - 书桌', 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '简尚-横林二仓', '客退临时上架仓', '110886Z15', null, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '121630-49', '其他 - 配件', -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '简尚-崔桥工厂仓', '简尚-崔桥工厂仓主仓', '121640', '住宅家具 - 门厅/玄关柜/玄关架', 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135150-13', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '简尚-分销部专用仓', '简尚-分销部专用仓主仓', '135580', '住宅家具 - 餐边柜', 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-1', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-12', '其他 - 配件', -3, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-13', '其他 - 配件', -3, -4, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-14', '其他 - 配件', -4, -5, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-15', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-16', '其他 - 配件', -1, -3, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-17', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-18', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-19', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-21', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-26', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-28', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '常州简尚家居有限公司', '配件单仓', '135590-33', '其他 - 配件', -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ['常州简尚家居有限公司', '2026-09-01', '简尚-分销部崔桥专用仓', '简尚-分销部崔桥专用仓主仓', '135600', '住宅家具 - 餐边柜', 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ], +]; diff --git a/resources/views/business/pages/partials/directory-table.blade.php b/resources/views/business/pages/partials/directory-table.blade.php index 70f37587..ffb0a6eb 100644 --- a/resources/views/business/pages/partials/directory-table.blade.php +++ b/resources/views/business/pages/partials/directory-table.blade.php @@ -369,6 +369,11 @@ {{ $upstreamError }} + @elseif (($directory['status'] ?? null) === '演示数据' && $directoryTotal > 0) +
+ + 已按附件模板导入 {{ $directoryTotal }} 条演示数据,当前页面为只读展示。 +
@elseif ($directoryTotal > 0)
@@ -472,7 +477,7 @@ # @foreach ($directoryFields as $field) - {{ $field['label'] }} + {{ $field['label'] }} @endforeach @@ -496,11 +501,13 @@ $display = substr((string) $value, 0, 10); } elseif ($kind === 'number' && is_numeric($value)) { $display = number_format((float) $value, 2); + } elseif ($kind === 'integer' && is_numeric($value)) { + $display = number_format((int) $value); } elseif ($kind === 'boolean' && $value !== null && $value !== '') { $display = in_array($value, [true, 1, '1', '是', '✔'], true) ? '是' : '否'; } @endphp - + @if (($page['slug'] ?? '') === 'store-accounts' && $field['name'] === 'password_configured') {{ filled($display) ? $display : '—' }} @if ($value === false) diff --git a/tests/Feature/Settings/NavigationTest.php b/tests/Feature/Settings/NavigationTest.php index ce6690d6..2cc4bf9f 100644 --- a/tests/Feature/Settings/NavigationTest.php +++ b/tests/Feature/Settings/NavigationTest.php @@ -31,7 +31,18 @@ class NavigationTest extends FeatureTestCase ])) ->assertOk() ->assertSeeText('进销存报表') - ->assertSeeText('进销存报表字段和数据来源尚未定义。'); + ->assertSeeTextInOrder([ + '货主', '月份', '仓储方', '仓库', '商品编码', '分类', + '期初数量', '期末数量', '加工进仓', '加工出仓', '采购进仓', + '采购退货', '其它进仓', '其它退货', '销售出仓', '销售退货', + '盘点', '调拨出', '调拨入', '期初', '其它出库', + ]) + ->assertSeeText('已按附件模板导入 20 条演示数据') + ->assertSeeText('常州简尚家居有限公司') + ->assertSeeText('100006981661') + ->assertSeeText('2026-09-01') + ->assertSeeText('住宅家具 - 门厅/玄关柜/玄关架') + ->assertDontSeeText('进销存报表字段和数据来源尚未定义。'); } public function testGroupedNavigationKeepsRestrictedPagePermissions(): void -- 2.47.2