fix(admin): replace scroll.x='max-content' with calculated fixed widths for all tables

This commit is contained in:
2026-07-06 16:39:53 +08:00
parent 8fc697e58f
commit 43ee4dc5d5
17 changed files with 23 additions and 27 deletions

View File

@@ -691,7 +691,7 @@ const AttendancePage: React.FC = () => {
columns={columns} columns={columns}
dataSource={records} dataSource={records}
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1100 }}
pagination={{ pagination={{
current: page, current: page,
pageSize, pageSize,

View File

@@ -392,7 +392,7 @@ const BillsPage: React.FC = () => {
</Space> </Space>
</div> </div>
<Table <Table
scroll={{ x: 'max-content' }} scroll={{ x: 1400 }}
columns={columns} columns={columns}
dataSource={filteredBills} dataSource={filteredBills}
rowKey="id" rowKey="id"

View File

@@ -231,7 +231,7 @@ const ClassesPage: React.FC = () => {
rowKey="id" rowKey="id"
loading={loading} loading={loading}
pagination={{ pageSize: 20 }} pagination={{ pageSize: 20 }}
scroll={{ x: 'max-content' }} scroll={{ x: 1100 }}
/> />
<Modal <Modal

View File

@@ -319,7 +319,7 @@ const ClassroomRentalsPage: React.FC = () => {
rowKey="id" rowKey="id"
loading={loading} loading={loading}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
scroll={{ x: 'max-content' }} scroll={{ x: 1200 }}
/> />
<Modal <Modal

View File

@@ -277,7 +277,7 @@ const ClassroomsPage: React.FC = () => {
</Space> </Space>
</div> </div>
<Table <Table
scroll={{ x: 'max-content' }} scroll={{ x: 1100 }}
columns={columns} columns={columns}
dataSource={filteredData} dataSource={filteredData}
rowKey="id" rowKey="id"

View File

@@ -345,7 +345,7 @@ const DepartmentsPage: React.FC = () => {
loading={membersLoading} loading={membersLoading}
pagination={false} pagination={false}
size="small" size="small"
scroll={{ x: 'max-content' }} scroll={{ x: 1000 }}
locale={{ emptyText: '暂无成员' }} locale={{ emptyText: '暂无成员' }}
/> />
</Card> </Card>

View File

@@ -414,7 +414,7 @@ const DepositsPage: React.FC = () => {
dataSource={filteredData} dataSource={filteredData}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1200 }}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
/> />
</> </>
@@ -429,7 +429,7 @@ const DepositsPage: React.FC = () => {
dataSource={pendingRefunds} dataSource={pendingRefunds}
rowKey="id" rowKey="id"
loading={pendingLoading} loading={pendingLoading}
scroll={{ x: 'max-content' }} scroll={{ x: 1200 }}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
/> />
), ),

View File

@@ -441,7 +441,7 @@ const ExpensesPage: React.FC = () => {
dataSource={filteredRoomExpenses} dataSource={filteredRoomExpenses}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1200 }}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
rowSelection={{ rowSelection={{
selectedRowKeys: selectedRoomKeys, selectedRowKeys: selectedRoomKeys,
@@ -591,7 +591,7 @@ const ExpensesPage: React.FC = () => {
dataSource={filteredPersonalExpenses} dataSource={filteredPersonalExpenses}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1200 }}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
rowSelection={{ rowSelection={{
selectedRowKeys: selectedPersonalKeys, selectedRowKeys: selectedPersonalKeys,

View File

@@ -451,7 +451,7 @@ const OccupanciesPage: React.FC = () => {
dataSource={filteredData} dataSource={filteredData}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1300 }}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
rowSelection={rowSelection} rowSelection={rowSelection}
/> />

View File

@@ -153,7 +153,7 @@ const OperationLogsPage: React.FC = () => {
dataSource={data} dataSource={data}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1100 }}
pagination={{ pagination={{
current: page, current: page,
total, total,

View File

@@ -225,7 +225,7 @@ const RolesPage: React.FC = () => {
dataSource={data} dataSource={data}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 900 }}
pagination={false} pagination={false}
/> />

View File

@@ -392,7 +392,7 @@ const RoomsPage: React.FC = () => {
columns={columns} columns={columns}
dataSource={filteredData} dataSource={filteredData}
rowKey="id" rowKey="id"
scroll={{ x: 'max-content' }} scroll={{ x: 1200 }}
loading={loading} loading={loading}
pagination={{ pageSize: 20, showTotal: (total) => `${total}` }} pagination={{ pageSize: 20, showTotal: (total) => `${total}` }}
rowClassName={(record) => (record.status === 'archived' ? 'archived-row' : '')} rowClassName={(record) => (record.status === 'archived' ? 'archived-row' : '')}

View File

@@ -668,13 +668,9 @@ const AttachmentsTab: React.FC<TabProps & { data: AttachmentRecord[] }> = ({ dat
<div> <div>
<Upload <Upload
showUploadList={false} showUploadList={false}
customRequest={async (options: { customRequest={async (options) => {
file: File | Blob;
onSuccess?: (body: unknown) => void;
onError?: (error: Error) => void;
}) => {
const formData = new FormData(); 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); setUploading(true);
try { try {
await api.post(`/archive/${studentId}/attachments`, formData, { await api.post(`/archive/${studentId}/attachments`, formData, {
@@ -684,9 +680,9 @@ const AttachmentsTab: React.FC<TabProps & { data: AttachmentRecord[] }> = ({ dat
options.onSuccess?.({}); options.onSuccess?.({});
onRefresh(); onRefresh();
} catch (e: unknown) { } catch (e: unknown) {
const err = e as { message?: string }; const msg = e instanceof Error ? e.message : '上传失败';
message.error(err?.message || '上传失败'); message.error(msg);
options.onError?.(err instanceof Error ? err : new Error('Upload failed')); options.onError?.(e instanceof Error ? e : new Error(msg));
} finally { } finally {
setUploading(false); setUploading(false);
} }

View File

@@ -430,7 +430,7 @@ const StudentsPage: React.FC = () => {
dataSource={data} dataSource={data}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 1200 }} scroll={{ x: 1300 }}
pagination={{ pageSize: 15, showTotal: (total) => `${total}` }} pagination={{ pageSize: 15, showTotal: (total) => `${total}` }}
rowClassName={(record: any) => (record.status === 'archived' ? 'archived-row' : '')} rowClassName={(record: any) => (record.status === 'archived' ? 'archived-row' : '')}
rowSelection={{ rowSelection={{

View File

@@ -187,7 +187,7 @@ const TeachersPage: React.FC = () => {
dataSource={data} dataSource={data}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 1200 }} scroll={{ x: 1300 }}
pagination={{ pagination={{
current: page, current: page,
pageSize: PAGE_SIZE, pageSize: PAGE_SIZE,

View File

@@ -186,7 +186,7 @@ const TenantsPage: React.FC = () => {
</PermissionButton> </PermissionButton>
</div> </div>
<Table <Table
scroll={{ x: 'max-content' }} scroll={{ x: 1000 }}
columns={columns} columns={columns}
dataSource={filteredData} dataSource={filteredData}
rowKey="id" rowKey="id"

View File

@@ -248,7 +248,7 @@ const UsersPage: React.FC = () => {
dataSource={data} dataSource={data}
rowKey="id" rowKey="id"
loading={loading} loading={loading}
scroll={{ x: 'max-content' }} scroll={{ x: 1000 }}
pagination={false} pagination={false}
/> />