From 299cf3705435e8c387f812b96e43214660bc8edb Mon Sep 17 00:00:00 2001 From: sky121113 Date: Wed, 25 Feb 2026 14:04:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=85=A8=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1=E5=81=B4=E9=82=8A=E6=AC=84=E6=8D=B2=E8=BB=B8=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在所有報表與管理頁面的 router.get 調用中加入 preserveScroll: true。 受影響模組包括: - 財務管理 (會計報表、公用事業費) - 庫存管理 (庫存查詢、倉庫管理、進貨、調整、調撥) - 生產管理 (工單管理、配方管理) - 採購管理 (採購單) - 銷售與發貨管理 (銷售單、發貨單、匯入管理) - 系統管理 (使用者、角色、操作紀錄) --- resources/js/Pages/Accounting/Report.tsx | 4 ++-- resources/js/Pages/Admin/ActivityLog/Index.tsx | 6 +++--- resources/js/Pages/Admin/Role/Index.tsx | 2 +- resources/js/Pages/Admin/User/Index.tsx | 2 +- resources/js/Pages/Integration/SalesOrders/Index.tsx | 6 +++--- resources/js/Pages/Inventory/Adjust/Index.tsx | 1 + resources/js/Pages/Inventory/GoodsReceipt/Index.tsx | 4 ++-- resources/js/Pages/Inventory/StockQuery/Index.tsx | 1 + resources/js/Pages/Inventory/Transfer/Index.tsx | 1 + resources/js/Pages/Production/Index.tsx | 7 +++---- resources/js/Pages/Production/Recipe/Index.tsx | 7 +++---- resources/js/Pages/PurchaseOrder/Index.tsx | 4 ++-- resources/js/Pages/Sales/Import/Index.tsx | 4 ++-- resources/js/Pages/ShippingOrder/Index.tsx | 4 ++-- resources/js/Pages/StoreRequisition/Index.tsx | 1 + resources/js/Pages/UtilityFee/Index.tsx | 6 +++--- resources/js/Pages/Warehouse/Index.tsx | 2 +- 17 files changed, 32 insertions(+), 30 deletions(-) diff --git a/resources/js/Pages/Accounting/Report.tsx b/resources/js/Pages/Accounting/Report.tsx index 764bd8e..68b3ce8 100644 --- a/resources/js/Pages/Accounting/Report.tsx +++ b/resources/js/Pages/Accounting/Report.tsx @@ -92,7 +92,7 @@ export default function AccountingReport({ records, summary, filters }: PageProp date_end: dateEnd, per_page: perPage, }, - { preserveState: true } + { preserveState: true, preserveScroll: true } ); }; @@ -105,7 +105,7 @@ export default function AccountingReport({ records, summary, filters }: PageProp date_end: dateEnd, per_page: value, }, - { preserveState: true } + { preserveState: true, preserveScroll: true } ); }; diff --git a/resources/js/Pages/Admin/ActivityLog/Index.tsx b/resources/js/Pages/Admin/ActivityLog/Index.tsx index 0ef4a07..87d686e 100644 --- a/resources/js/Pages/Admin/ActivityLog/Index.tsx +++ b/resources/js/Pages/Admin/ActivityLog/Index.tsx @@ -81,7 +81,7 @@ export default function ActivityLogIndex({ activities, filters, subject_types, u causer_id: causer === 'all' ? undefined : causer, page: 1 // Reset to first page on filter }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; @@ -97,7 +97,7 @@ export default function ActivityLogIndex({ activities, filters, subject_types, u router.get( route('activity-logs.index'), { per_page: perPage, sort_by: filters.sort_by, sort_order: filters.sort_order }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; @@ -131,7 +131,7 @@ export default function ActivityLogIndex({ activities, filters, subject_types, u router.get( route('activity-logs.index'), { ...filters, sort_by: newSortBy, sort_order: newSortOrder }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; diff --git a/resources/js/Pages/Admin/Role/Index.tsx b/resources/js/Pages/Admin/Role/Index.tsx index 399aa29..37038b3 100644 --- a/resources/js/Pages/Admin/Role/Index.tsx +++ b/resources/js/Pages/Admin/Role/Index.tsx @@ -96,7 +96,7 @@ export default function RoleIndex({ roles, filters = {} }: Props) { router.get( route('roles.index'), { ...filters, sort_by: newSortBy, sort_order: newSortOrder }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; diff --git a/resources/js/Pages/Admin/User/Index.tsx b/resources/js/Pages/Admin/User/Index.tsx index 241acf1..27931a2 100644 --- a/resources/js/Pages/Admin/User/Index.tsx +++ b/resources/js/Pages/Admin/User/Index.tsx @@ -164,7 +164,7 @@ export default function UserIndex({ users, roles, filters }: Props) { router.get( route('users.index'), { ...filters, sort_by: newSortBy, sort_order: newSortOrder }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; diff --git a/resources/js/Pages/Integration/SalesOrders/Index.tsx b/resources/js/Pages/Integration/SalesOrders/Index.tsx index c1dc593..a490c56 100644 --- a/resources/js/Pages/Integration/SalesOrders/Index.tsx +++ b/resources/js/Pages/Integration/SalesOrders/Index.tsx @@ -109,7 +109,7 @@ export default function SalesOrderIndex({ orders, filters }: Props) { router.get( route("integration.sales-orders.index"), { ...filters, search, page: 1 }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; @@ -118,7 +118,7 @@ export default function SalesOrderIndex({ orders, filters }: Props) { router.get( route("integration.sales-orders.index"), { ...filters, per_page: value, page: 1 }, - { preserveState: false, replace: true } + { preserveState: false, replace: true, preserveScroll: true } ); }; @@ -159,7 +159,7 @@ export default function SalesOrderIndex({ orders, filters }: Props) { router.get( route("integration.sales-orders.index"), { ...filters, source: v || undefined, page: 1 }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ) } options={sourceOptions} diff --git a/resources/js/Pages/Inventory/Adjust/Index.tsx b/resources/js/Pages/Inventory/Adjust/Index.tsx index ba4ff81..2ddbfef 100644 --- a/resources/js/Pages/Inventory/Adjust/Index.tsx +++ b/resources/js/Pages/Inventory/Adjust/Index.tsx @@ -102,6 +102,7 @@ export default function Index({ docs, warehouses, filters }: { docs: DocsPaginat router.get(route('inventory.adjust.index'), params as any, { preserveState: true, replace: true, + preserveScroll: true, }); }, 300), [] diff --git a/resources/js/Pages/Inventory/GoodsReceipt/Index.tsx b/resources/js/Pages/Inventory/GoodsReceipt/Index.tsx index eb82cc8..a9613d1 100644 --- a/resources/js/Pages/Inventory/GoodsReceipt/Index.tsx +++ b/resources/js/Pages/Inventory/GoodsReceipt/Index.tsx @@ -69,7 +69,7 @@ export default function GoodsReceiptIndex({ receipts, filters, warehouses }: Pro date_start: dateStart || undefined, date_end: dateEnd || undefined, per_page: perPage, - }, { preserveState: true, replace: true }); + }, { preserveState: true, replace: true, preserveScroll: true }); }; const handleReset = () => { @@ -80,7 +80,7 @@ export default function GoodsReceiptIndex({ receipts, filters, warehouses }: Pro setDateEnd(''); setDateRangeType('custom'); setPerPage('10'); - router.get(route('goods-receipts.index'), {}, { preserveState: false }); + router.get(route('goods-receipts.index'), {}, { preserveState: false, preserveScroll: true }); }; const handleDateRangeChange = (type: string) => { diff --git a/resources/js/Pages/Inventory/StockQuery/Index.tsx b/resources/js/Pages/Inventory/StockQuery/Index.tsx index e77c4ef..2bcd737 100644 --- a/resources/js/Pages/Inventory/StockQuery/Index.tsx +++ b/resources/js/Pages/Inventory/StockQuery/Index.tsx @@ -139,6 +139,7 @@ export default function StockQueryIndex({ router.get(route("inventory.stock-query.index"), cleaned, { preserveState: true, replace: true, + preserveScroll: true, }); }; diff --git a/resources/js/Pages/Inventory/Transfer/Index.tsx b/resources/js/Pages/Inventory/Transfer/Index.tsx index 22e461d..281b540 100644 --- a/resources/js/Pages/Inventory/Transfer/Index.tsx +++ b/resources/js/Pages/Inventory/Transfer/Index.tsx @@ -71,6 +71,7 @@ export default function Index({ warehouses, orders, filters }: any) { router.get(route('inventory.transfer.index'), params, { preserveState: true, replace: true, + preserveScroll: true, }); }, 500), [] diff --git a/resources/js/Pages/Production/Index.tsx b/resources/js/Pages/Production/Index.tsx index 9860d8f..cbda4b6 100644 --- a/resources/js/Pages/Production/Index.tsx +++ b/resources/js/Pages/Production/Index.tsx @@ -82,12 +82,11 @@ export default function ProductionIndex({ productionOrders, filters }: Props) { status: status === 'all' ? undefined : status, per_page: perPage, }, - { preserveState: true, replace: true } + { preserveState: true, replace: true, preserveScroll: true } ); }; - const handlePerPageChange = (value: string) => { setPerPage(value); router.get( @@ -135,7 +134,7 @@ export default function ProductionIndex({ productionOrders, filters }: Props) {