fix(web): unify list tables with fixed header, fixed actions and pagination

This commit is contained in:
2026-09-28 15:20:55 +08:00
parent 630a4feab1
commit 7ed542df4f
9 changed files with 90 additions and 9 deletions
@@ -8,6 +8,7 @@ import { PlusOutlined, ReloadOutlined } from '@ant-design/icons';
import type { ColumnsType } from 'antd/es/table';
import { remove, creatorUpdate, creatorGet } from '@/services/api';
import { conflictMessage, dateTime } from '@/utils/helpers';
import { fixedRight, tablePagination, tableScroll } from '@/utils/table';
// 仅用 antd 默认组件:Table/Tag/Modal/Popconfirm/Select(tags)。
interface Row {
@@ -113,7 +114,7 @@ export default function AccountManagementList() {
{
title: '标签',
dataIndex: 'tags',
render: (tags?: string[]) => (tags?.length ? tags.map((tag) => <Tag key={tag}>{tag}</Tag>) : <Typography.Text type="secondary">未设置</Typography.Text>) },
render: (tags?: string[]) => (tags?.length ? <Flex wrap="wrap" gap={4}>{tags.map((tag) => <Tag key={tag}>{tag}</Tag>)}</Flex> : <Typography.Text type="secondary">未设置</Typography.Text>) },
{
title: '状态',
dataIndex: 'status',
@@ -129,6 +130,7 @@ export default function AccountManagementList() {
title: '操作',
key: 'actions',
align: 'right',
...fixedRight<Row>({}),
render: (_, account) => (
<Space wrap>
<Button type="text" size="small" onClick={() => openTags(account)}>
@@ -169,7 +171,9 @@ export default function AccountManagementList() {
columns={columns}
dataSource={rows}
loading={pending}
pagination={false}
sticky
pagination={tablePagination()}
scroll={tableScroll(960)}
locale={{ emptyText: '暂无自有账号。' }}
/>
<Modal
@@ -6,6 +6,7 @@ import type { ColumnsType } from 'antd/es/table';
import { CloudUploadOutlined, ReloadOutlined } from '@ant-design/icons';
import { getList, remove, creatorAction, creatorUpdate } from '@/services/api';
import { conflictMessage, dateTime } from '@/utils/helpers';
import { fixedRight, tablePagination, tableScroll } from '@/utils/table';
interface CompetitorRow {
id: string;
@@ -180,6 +181,7 @@ export default function MonitoringAccountList() {
title: '操作',
key: 'actions',
align: 'right',
...fixedRight<CompetitorRow>({}),
render: (_, account) => (
<Space wrap>
<Button type="text" size="small" onClick={() => openTags(account)}>编辑标签</Button>
@@ -218,9 +220,10 @@ export default function MonitoringAccountList() {
columns={columns}
dataSource={rows}
loading={pending}
pagination={false}
sticky
pagination={tablePagination()}
locale={{ emptyText: '暂无监控账号。' }}
scroll={{ x: 1100 }}
scroll={tableScroll(1100)}
/>
<Modal
open={Boolean(tagTarget)}