From 43ee4dc5d5627f065e2423ce0b3b8216eb2f27d2 Mon Sep 17 00:00:00 2001 From: wangziqi Date: Mon, 6 Jul 2026 16:39:53 +0800 Subject: [PATCH] fix(admin): replace scroll.x='max-content' with calculated fixed widths for all tables --- apps/admin/src/pages/Attendance/index.tsx | 2 +- apps/admin/src/pages/Bills/index.tsx | 2 +- apps/admin/src/pages/Classes/index.tsx | 2 +- apps/admin/src/pages/ClassroomRentals/index.tsx | 2 +- apps/admin/src/pages/Classrooms/index.tsx | 2 +- apps/admin/src/pages/Departments/index.tsx | 2 +- apps/admin/src/pages/Deposits/index.tsx | 4 ++-- apps/admin/src/pages/Expenses/index.tsx | 4 ++-- apps/admin/src/pages/Occupancies/index.tsx | 2 +- apps/admin/src/pages/OperationLogs/index.tsx | 2 +- apps/admin/src/pages/Roles/index.tsx | 2 +- apps/admin/src/pages/Rooms/index.tsx | 2 +- apps/admin/src/pages/StudentProfile/index.tsx | 14 +++++--------- apps/admin/src/pages/Students/index.tsx | 2 +- apps/admin/src/pages/Teachers/index.tsx | 2 +- apps/admin/src/pages/Tenants/index.tsx | 2 +- apps/admin/src/pages/Users/index.tsx | 2 +- 17 files changed, 23 insertions(+), 27 deletions(-) diff --git a/apps/admin/src/pages/Attendance/index.tsx b/apps/admin/src/pages/Attendance/index.tsx index 85b0d68..be6bd79 100644 --- a/apps/admin/src/pages/Attendance/index.tsx +++ b/apps/admin/src/pages/Attendance/index.tsx @@ -691,7 +691,7 @@ const AttendancePage: React.FC = () => { columns={columns} dataSource={records} loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1100 }} pagination={{ current: page, pageSize, diff --git a/apps/admin/src/pages/Bills/index.tsx b/apps/admin/src/pages/Bills/index.tsx index cbfb8fe..b373bf8 100644 --- a/apps/admin/src/pages/Bills/index.tsx +++ b/apps/admin/src/pages/Bills/index.tsx @@ -392,7 +392,7 @@ const BillsPage: React.FC = () => { { rowKey="id" loading={loading} pagination={{ pageSize: 20 }} - scroll={{ x: 'max-content' }} + scroll={{ x: 1100 }} /> { rowKey="id" loading={loading} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} - scroll={{ x: 'max-content' }} + scroll={{ x: 1200 }} /> {
{ loading={membersLoading} pagination={false} size="small" - scroll={{ x: 'max-content' }} + scroll={{ x: 1000 }} locale={{ emptyText: '暂无成员' }} /> diff --git a/apps/admin/src/pages/Deposits/index.tsx b/apps/admin/src/pages/Deposits/index.tsx index aa8a7cd..18f4f88 100644 --- a/apps/admin/src/pages/Deposits/index.tsx +++ b/apps/admin/src/pages/Deposits/index.tsx @@ -414,7 +414,7 @@ const DepositsPage: React.FC = () => { dataSource={filteredData} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1200 }} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} /> @@ -429,7 +429,7 @@ const DepositsPage: React.FC = () => { dataSource={pendingRefunds} rowKey="id" loading={pendingLoading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1200 }} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} /> ), diff --git a/apps/admin/src/pages/Expenses/index.tsx b/apps/admin/src/pages/Expenses/index.tsx index 512340a..95f8de3 100644 --- a/apps/admin/src/pages/Expenses/index.tsx +++ b/apps/admin/src/pages/Expenses/index.tsx @@ -441,7 +441,7 @@ const ExpensesPage: React.FC = () => { dataSource={filteredRoomExpenses} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1200 }} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} rowSelection={{ selectedRowKeys: selectedRoomKeys, @@ -591,7 +591,7 @@ const ExpensesPage: React.FC = () => { dataSource={filteredPersonalExpenses} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1200 }} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} rowSelection={{ selectedRowKeys: selectedPersonalKeys, diff --git a/apps/admin/src/pages/Occupancies/index.tsx b/apps/admin/src/pages/Occupancies/index.tsx index d9b1c1a..03e17c7 100644 --- a/apps/admin/src/pages/Occupancies/index.tsx +++ b/apps/admin/src/pages/Occupancies/index.tsx @@ -451,7 +451,7 @@ const OccupanciesPage: React.FC = () => { dataSource={filteredData} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1300 }} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 条` }} rowSelection={rowSelection} /> diff --git a/apps/admin/src/pages/OperationLogs/index.tsx b/apps/admin/src/pages/OperationLogs/index.tsx index 1fe7dc1..3da2a36 100644 --- a/apps/admin/src/pages/OperationLogs/index.tsx +++ b/apps/admin/src/pages/OperationLogs/index.tsx @@ -153,7 +153,7 @@ const OperationLogsPage: React.FC = () => { dataSource={data} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1100 }} pagination={{ current: page, total, diff --git a/apps/admin/src/pages/Roles/index.tsx b/apps/admin/src/pages/Roles/index.tsx index c7b9b91..14fd063 100644 --- a/apps/admin/src/pages/Roles/index.tsx +++ b/apps/admin/src/pages/Roles/index.tsx @@ -225,7 +225,7 @@ const RolesPage: React.FC = () => { dataSource={data} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 900 }} pagination={false} /> diff --git a/apps/admin/src/pages/Rooms/index.tsx b/apps/admin/src/pages/Rooms/index.tsx index aecdc70..ee29241 100644 --- a/apps/admin/src/pages/Rooms/index.tsx +++ b/apps/admin/src/pages/Rooms/index.tsx @@ -392,7 +392,7 @@ const RoomsPage: React.FC = () => { columns={columns} dataSource={filteredData} rowKey="id" - scroll={{ x: 'max-content' }} + scroll={{ x: 1200 }} loading={loading} pagination={{ pageSize: 20, showTotal: (total) => `共 ${total} 间` }} rowClassName={(record) => (record.status === 'archived' ? 'archived-row' : '')} diff --git a/apps/admin/src/pages/StudentProfile/index.tsx b/apps/admin/src/pages/StudentProfile/index.tsx index 6386cc8..3caf4c8 100644 --- a/apps/admin/src/pages/StudentProfile/index.tsx +++ b/apps/admin/src/pages/StudentProfile/index.tsx @@ -668,13 +668,9 @@ const AttachmentsTab: React.FC = ({ dat
void; - onError?: (error: Error) => void; - }) => { + customRequest={async (options) => { const formData = new FormData(); - formData.append('file', options.file instanceof File ? options.file : new File([options.file], 'attachment')); + formData.append('file', options.file instanceof File ? options.file : new File([options.file as Blob], 'attachment')); setUploading(true); try { await api.post(`/archive/${studentId}/attachments`, formData, { @@ -684,9 +680,9 @@ const AttachmentsTab: React.FC = ({ dat options.onSuccess?.({}); onRefresh(); } catch (e: unknown) { - const err = e as { message?: string }; - message.error(err?.message || '上传失败'); - options.onError?.(err instanceof Error ? err : new Error('Upload failed')); + const msg = e instanceof Error ? e.message : '上传失败'; + message.error(msg); + options.onError?.(e instanceof Error ? e : new Error(msg)); } finally { setUploading(false); } diff --git a/apps/admin/src/pages/Students/index.tsx b/apps/admin/src/pages/Students/index.tsx index 6bd09e3..e4610e0 100644 --- a/apps/admin/src/pages/Students/index.tsx +++ b/apps/admin/src/pages/Students/index.tsx @@ -430,7 +430,7 @@ const StudentsPage: React.FC = () => { dataSource={data} rowKey="id" loading={loading} - scroll={{ x: 1200 }} + scroll={{ x: 1300 }} pagination={{ pageSize: 15, showTotal: (total) => `共 ${total} 人` }} rowClassName={(record: any) => (record.status === 'archived' ? 'archived-row' : '')} rowSelection={{ diff --git a/apps/admin/src/pages/Teachers/index.tsx b/apps/admin/src/pages/Teachers/index.tsx index 0fb49ff..dd658ae 100644 --- a/apps/admin/src/pages/Teachers/index.tsx +++ b/apps/admin/src/pages/Teachers/index.tsx @@ -187,7 +187,7 @@ const TeachersPage: React.FC = () => { dataSource={data} rowKey="id" loading={loading} - scroll={{ x: 1200 }} + scroll={{ x: 1300 }} pagination={{ current: page, pageSize: PAGE_SIZE, diff --git a/apps/admin/src/pages/Tenants/index.tsx b/apps/admin/src/pages/Tenants/index.tsx index 5edcee2..84e2f43 100644 --- a/apps/admin/src/pages/Tenants/index.tsx +++ b/apps/admin/src/pages/Tenants/index.tsx @@ -186,7 +186,7 @@ const TenantsPage: React.FC = () => {
{ dataSource={data} rowKey="id" loading={loading} - scroll={{ x: 'max-content' }} + scroll={{ x: 1000 }} pagination={false} />