feat: 账号管理支持按账号名批量选号打标签,并支持复制账号名

This commit is contained in:
yml2213
2026-10-20 17:31:39 +08:00
parent c299f63537
commit c778ae9a09
8 changed files with 465 additions and 10 deletions
@@ -1,8 +1,10 @@
import type { TableProps } from 'antd';
import { Space, Button, Typography, Tag, Tooltip, Select, Popconfirm } from 'antd';
import { DeleteOutlined } from '@ant-design/icons';
import { CopyOutlined, DeleteOutlined } from '@ant-design/icons';
import type { NavigateFunction } from 'react-router-dom';
import type { AccountItem } from '../../../api/modules';
import { message } from '../../../utils/antdMessage';
import { copyTextToClipboard } from '../../../utils/clipboard';
import { formatTimeShort } from '../../../utils/time';
import {
type AccountSortKey,
@@ -86,15 +88,49 @@ export function buildAccountColumns({
ellipsis: true,
render: (username: string, record: AccountItem) => (
<Space direction="vertical" size={0} style={{ maxWidth: '100%' }}>
<Button
type="link"
size="small"
style={{ padding: 0, maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis' }}
title={username}
onClick={() => navigate(`/accounts/${record.id}`)}
<div
style={{
display: 'flex',
alignItems: 'center',
gap: 2,
maxWidth: '100%',
minWidth: 0,
}}
>
{username}
</Button>
<Button
type="link"
size="small"
style={{
padding: 0,
minWidth: 0,
flex: '0 1 auto',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
}}
title={username}
onClick={() => navigate(`/accounts/${record.id}`)}
>
{username}
</Button>
<Tooltip title="复制账号名">
<Button
type="text"
size="small"
aria-label="复制账号名"
icon={<CopyOutlined style={{ fontSize: 12, color: '#8c8c8c' }} />}
style={{ padding: 0, width: 18, height: 18, minWidth: 18, flex: 'none' }}
onClick={async () => {
try {
await copyTextToClipboard(username);
message.success('账号名已复制');
} catch {
message.error('复制失败');
}
}}
/>
</Tooltip>
</div>
<Text type="secondary" style={{ fontSize: 12 }}>
#{record.id}
</Text>