From ad67233bf9dd322d6f63fcce939f3aaa8044516a Mon Sep 17 00:00:00 2001 From: zhang1106 <849185023@qq.com> Date: Thu, 5 Feb 2026 08:34:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=AE=BE=E5=A4=87=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E7=AE=A1=E7=90=86):=20=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86=E5=8F=8A=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=8F=98=E6=9B=B4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现分页状态管理,支持当前页码和每页条数的动态变更 --- frontend/src/pages/DeviceFieldManagement.jsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/DeviceFieldManagement.jsx b/frontend/src/pages/DeviceFieldManagement.jsx index 07f17fa..676a65b 100644 --- a/frontend/src/pages/DeviceFieldManagement.jsx +++ b/frontend/src/pages/DeviceFieldManagement.jsx @@ -218,6 +218,14 @@ function DeviceFieldManagement() { const [modalVisible, setModalVisible] = useState(false); const [editingField, setEditingField] = useState(null); const [form] = Form.useForm(); + const [pagination, setPagination] = useState({ + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '50', '100'], + showSizeChanger: true, + showQuickJumper: true, + showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条 / 共 ${total} 条` + }); const fetchFields = async () => { try { @@ -434,11 +442,13 @@ function DeviceFieldManagement() { dataSource={fields} rowKey="fieldId" loading={loading} - pagination={{ - pageSize: 10, - showSizeChanger: true, - showQuickJumper: true, - showTotal: (total, range) => `第 ${range[0]}-${range[1]} 条 / 共 ${total} 条` + pagination={pagination} + onChange={(newPagination) => { + setPagination({ + ...pagination, + current: newPagination.current, + pageSize: newPagination.pageSize + }); }} scroll={{ x: 900 }} style={tableStyle}