diff --git a/apps/admin/src/components/StudentProfileContent/index.tsx b/apps/admin/src/components/StudentProfileContent/index.tsx index ac91a6c..2fc1780 100644 --- a/apps/admin/src/components/StudentProfileContent/index.tsx +++ b/apps/admin/src/components/StudentProfileContent/index.tsx @@ -321,7 +321,11 @@ const EnrollmentsTab: React.FC = ({ columns={columns} dataSource={data} rowKey="id" - pagination={{ pageSize: 15 }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50], + }} /> = ({ data, st columns={columns} dataSource={data} rowKey="id" - pagination={{ pageSize: 15 }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50], + }} /> = ({ dat columns={columns} dataSource={data} rowKey="id" - pagination={{ pageSize: 15 }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50], + }} style={{ marginTop: 16 }} /> diff --git a/apps/admin/src/pages/Bills/index.tsx b/apps/admin/src/pages/Bills/index.tsx index a1828ee..c4e1030 100644 --- a/apps/admin/src/pages/Bills/index.tsx +++ b/apps/admin/src/pages/Bills/index.tsx @@ -399,7 +399,12 @@ const BillsPage: React.FC = () => { dataSource={filteredBills} rowKey="id" loading={loading} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} locale={{ emptyText: }} rowSelection={{ selectedRowKeys: selectedRows, diff --git a/apps/admin/src/pages/Classes/detail.tsx b/apps/admin/src/pages/Classes/detail.tsx index 435b46b..985e2b7 100644 --- a/apps/admin/src/pages/Classes/detail.tsx +++ b/apps/admin/src/pages/Classes/detail.tsx @@ -527,7 +527,11 @@ const ClassDetailPage: React.FC = () => { columns={studentColumns} dataSource={students} rowKey="id" - pagination={{ pageSize: 20 }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + }} /> { columns={teacherColumns} dataSource={teachers} rowKey="id" - pagination={{ pageSize: 20 }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + }} /> { columns={scheduleColumns} dataSource={schedules} rowKey="id" - pagination={{ pageSize: 20 }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + }} /> ), diff --git a/apps/admin/src/pages/Classes/index.tsx b/apps/admin/src/pages/Classes/index.tsx index c1f7d6a..d574658 100644 --- a/apps/admin/src/pages/Classes/index.tsx +++ b/apps/admin/src/pages/Classes/index.tsx @@ -264,7 +264,11 @@ const ClassesPage: React.FC = () => { rowKey="id" loading={loading} locale={{ emptyText: }} - pagination={{ pageSize: 20 }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + }} scroll={{ x: 1100 }} /> diff --git a/apps/admin/src/pages/ClassroomRentals/index.tsx b/apps/admin/src/pages/ClassroomRentals/index.tsx index 08d7451..960aad4 100644 --- a/apps/admin/src/pages/ClassroomRentals/index.tsx +++ b/apps/admin/src/pages/ClassroomRentals/index.tsx @@ -436,7 +436,12 @@ const ClassroomRentalsPage: React.FC = () => { rowKey="id" loading={loading} locale={{ emptyText: }} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} scroll={{ x: 1200 }} /> { rowKey="id" loading={loading} locale={{ emptyText: }} - pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} /> { rowKey="id" loading={loading} scroll={{ x: 1200 }} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} locale={{ emptyText: }} /> diff --git a/apps/admin/src/pages/Expenses/index.tsx b/apps/admin/src/pages/Expenses/index.tsx index 30f241c..af903c1 100644 --- a/apps/admin/src/pages/Expenses/index.tsx +++ b/apps/admin/src/pages/Expenses/index.tsx @@ -452,7 +452,12 @@ const ExpensesPage: React.FC = () => { rowKey="id" loading={loading} scroll={{ x: 1200 }} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} locale={{ emptyText: }} rowSelection={{ selectedRowKeys: selectedRoomKeys, @@ -575,7 +580,12 @@ const ExpensesPage: React.FC = () => { rowKey="id" loading={loading} scroll={{ x: 1200 }} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} locale={{ emptyText: }} rowSelection={{ selectedRowKeys: selectedPersonalKeys, diff --git a/apps/admin/src/pages/Occupancies/index.tsx b/apps/admin/src/pages/Occupancies/index.tsx index 5344a0e..d57158a 100644 --- a/apps/admin/src/pages/Occupancies/index.tsx +++ b/apps/admin/src/pages/Occupancies/index.tsx @@ -495,7 +495,12 @@ const OccupanciesPage: React.FC = () => { loading={loading} locale={{ emptyText: }} scroll={{ x: 1300 }} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 条`, + }} rowSelection={rowSelection} /> { const [total, setTotal] = useState(0); const [loading, setLoading] = useState(false); const [page, setPage] = useState(1); + const [pageSize, setPageSize] = useState(20); const [filterModule, setFilterModule] = useState(); const [dateRange, setDateRange] = useState<[string, string] | null>(null); const fetchData = useCallback(async () => { setLoading(true); try { - const params: any = { page, pageSize: 20 }; + const params: any = { page, pageSize }; if (filterModule) params.module = filterModule; if (dateRange) { params.startDate = dateRange[0]; @@ -46,7 +47,7 @@ const OperationLogsPage: React.FC = () => { message.error(err?.message || '加载失败,请稍后重试'); } setLoading(false); - }, [page, filterModule, dateRange]); + }, [page, pageSize, filterModule, dateRange]); useEffect(() => { fetchData(); @@ -159,8 +160,13 @@ const OperationLogsPage: React.FC = () => { pagination={{ current: page, total, - pageSize: 20, - onChange: setPage, + pageSize, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + onChange: (nextPage, nextPageSize) => { + setPage(nextPage); + setPageSize(nextPageSize); + }, showTotal: (t) => `共 ${t} 条`, }} /> diff --git a/apps/admin/src/pages/Organizations/index.tsx b/apps/admin/src/pages/Organizations/index.tsx index 990ce27..0ba4775 100644 --- a/apps/admin/src/pages/Organizations/index.tsx +++ b/apps/admin/src/pages/Organizations/index.tsx @@ -235,7 +235,12 @@ const OrganizationsPage: React.FC = () => { loading={loading} locale={{ emptyText: }} scroll={{ x: 1100 }} - pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 个机构` }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + showTotal: (total) => `共 ${total} 个机构`, + }} /> { scroll={{ x: 1200 }} loading={loading} locale={{ emptyText: }} - pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 间` }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + showTotal: (total) => `共 ${total} 间`, + }} rowClassName={(record) => (record.status === 'archived' ? 'archived-row' : '')} rowSelection={{ selectedRowKeys, diff --git a/apps/admin/src/pages/Students/index.tsx b/apps/admin/src/pages/Students/index.tsx index 0eca35a..62d3dc8 100644 --- a/apps/admin/src/pages/Students/index.tsx +++ b/apps/admin/src/pages/Students/index.tsx @@ -577,7 +577,12 @@ const StudentsPage: React.FC = () => { loading={loading} locale={{ emptyText: }} scroll={{ x: 1410 }} - pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 人` }} + pagination={{ + defaultPageSize: 15, + showSizeChanger: true, + pageSizeOptions: [15, 30, 50, 100], + showTotal: (total) => `共 ${total} 人`, + }} rowClassName={(record: any) => (record.status === 'archived' ? 'archived-row' : '')} rowSelection={{ selectedRowKeys, diff --git a/apps/admin/src/pages/TeacherWorkspace/index.tsx b/apps/admin/src/pages/TeacherWorkspace/index.tsx index 6aa0476..96c70c5 100644 --- a/apps/admin/src/pages/TeacherWorkspace/index.tsx +++ b/apps/admin/src/pages/TeacherWorkspace/index.tsx @@ -146,7 +146,12 @@ const TeacherWorkspacePage: React.FC = () => { columns={classColumns} dataSource={data.assignedClasses} rowKey="classId" - pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 个班级` }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + showTotal: (total) => `共 ${total} 个班级`, + }} /> ) : ( @@ -160,7 +165,12 @@ const TeacherWorkspacePage: React.FC = () => { columns={scheduleColumns} dataSource={data.todaySchedules} rowKey="id" - pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 节` }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + showTotal: (total) => `共 ${total} 节`, + }} /> ) : ( @@ -174,7 +184,12 @@ const TeacherWorkspacePage: React.FC = () => { columns={studentColumns} dataSource={data.myStudents} rowKey="studentId" - pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 人` }} + pagination={{ + defaultPageSize: 20, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + showTotal: (total) => `共 ${total} 人`, + }} /> ) : ( diff --git a/apps/admin/src/pages/Teachers/index.tsx b/apps/admin/src/pages/Teachers/index.tsx index ef0d77a..a1a1807 100644 --- a/apps/admin/src/pages/Teachers/index.tsx +++ b/apps/admin/src/pages/Teachers/index.tsx @@ -46,13 +46,14 @@ const ROLE_TYPE_LABELS: Record = { academic_teacher: '教务老师', }; -const PAGE_SIZE = 20; +const DEFAULT_PAGE_SIZE = 20; const TeachersPage: React.FC = () => { const [data, setData] = useState([]); const [loading, setLoading] = useState(false); const [total, setTotal] = useState(0); const [page, setPage] = useState(1); + const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE); const [search, setSearch] = useState(''); const [profileModal, setProfileModal] = useState(null); const [form] = Form.useForm(); @@ -62,7 +63,7 @@ const TeachersPage: React.FC = () => { setLoading(true); try { const res = await api.get('/rbac/teachers', { - params: { search: search || undefined, page, pageSize: PAGE_SIZE }, + params: { search: search || undefined, page, pageSize }, }); setData(res.list); setTotal(res.total); @@ -70,7 +71,7 @@ const TeachersPage: React.FC = () => { // silent } setLoading(false); - }, [page, search]); + }, [page, pageSize, search]); useEffect(() => { fetchData(); @@ -199,9 +200,14 @@ const TeachersPage: React.FC = () => { scroll={{ x: 1300 }} pagination={{ current: page, - pageSize: PAGE_SIZE, + pageSize, total, - onChange: setPage, + showSizeChanger: true, + pageSizeOptions: [20, 50, 100], + onChange: (nextPage, nextPageSize) => { + setPage(nextPage); + setPageSize(nextPageSize); + }, showTotal: (t) => `共 ${t} 人`, }} expandable={{