fix(ui): 统一表格筛选分页和用量明细,升级 ESLint
This commit is contained in:
@@ -20,6 +20,10 @@ import { formatUserReference } from '../../helpers/safeDisplay';
|
||||
|
||||
import { Trans } from 'react-i18next';
|
||||
import {
|
||||
Ban as ActionBan,
|
||||
ShieldCheck as ActionShieldCheck,
|
||||
CalendarClock as ActionCalendarClock,
|
||||
Pencil as ActionPencil,
|
||||
Plus as ActionPlus,
|
||||
CreditCard as ActionCreditCard,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
@@ -29,7 +33,6 @@ import {
|
||||
ConsoleListTable,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import ConsoleCollection from '../../components/console/ConsoleCollection';
|
||||
import { TableRowActions } from '../../components/common/table/TableToolbar';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import { createCardProPagination } from '../../helpers/utils';
|
||||
import { Button as AntButton } from 'antd';
|
||||
@@ -46,6 +49,7 @@ import {
|
||||
Input,
|
||||
InputNumber,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Select,
|
||||
Space,
|
||||
Tag,
|
||||
@@ -424,52 +428,70 @@ const Subscription = () => {
|
||||
{
|
||||
title: t('操作'),
|
||||
key: 'actions',
|
||||
width: 140,
|
||||
width: 300,
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
admin && {
|
||||
key: 'edit',
|
||||
label: t('编辑'),
|
||||
onClick: () => openEdit(r),
|
||||
},
|
||||
admin &&
|
||||
r.status !== 'canceled' &&
|
||||
r.status !== 'banned' && {
|
||||
key: 'extend',
|
||||
label: t('延长'),
|
||||
onClick: () => openExtend(r),
|
||||
},
|
||||
admin &&
|
||||
r.status === 'active' && {
|
||||
key: 'grant',
|
||||
label: t('补发'),
|
||||
onClick: () =>
|
||||
Modal.confirm({
|
||||
title: t('确认手动补发今日额度?'),
|
||||
onOk: () => doGrant(r),
|
||||
}),
|
||||
},
|
||||
admin &&
|
||||
r.status === 'banned' && {
|
||||
key: 'unban',
|
||||
label: t('解封'),
|
||||
onClick: () => openUnban(r),
|
||||
},
|
||||
admin &&
|
||||
r.status !== 'banned' && {
|
||||
key: 'ban',
|
||||
label: t('封禁'),
|
||||
danger: true,
|
||||
onClick: () => openBan(r),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Button type='link' size='small' onClick={() => openDetail(r)}>
|
||||
<Space spacing={4} wrap>
|
||||
<Button size='small' theme='borderless' onClick={() => openDetail(r)}>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
{admin && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionBan size={12} />}
|
||||
onClick={() => openBan(r)}
|
||||
>
|
||||
{t('封禁')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ActionShieldCheck size={12} />}
|
||||
onClick={() => openUnban(r)}
|
||||
>
|
||||
{t('解封')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status !== 'canceled' && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionCalendarClock size={12} />}
|
||||
onClick={() => openExtend(r)}
|
||||
>
|
||||
{t('延长')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionPencil size={12} />}
|
||||
onClick={() => openEdit(r)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'active' && (
|
||||
<Popconfirm
|
||||
title={t('确认手动补发今日额度?')}
|
||||
onConfirm={() => doGrant(r)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Sparkles size={12} />}
|
||||
>
|
||||
{t('补发')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -493,7 +515,6 @@ const Subscription = () => {
|
||||
placeholder={t('搜索用户名/昵称/订单号')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('用户ID')} id='subscription-user-id'>
|
||||
@@ -609,14 +630,14 @@ const Subscription = () => {
|
||||
{admin && (
|
||||
<div className='console-list-tool-actions'>
|
||||
<Button
|
||||
icon={<ActionCreditCard size={14} />}
|
||||
icon={<ActionCreditCard size={16} />}
|
||||
onClick={() => navigate('/console/setting?tab=membership')}
|
||||
>
|
||||
{t('会员管理')}
|
||||
</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<ActionPlus size={14} />}
|
||||
icon={<ActionPlus size={16} />}
|
||||
onClick={openCreate}
|
||||
>
|
||||
{t('新建会员')}
|
||||
@@ -634,7 +655,6 @@ const Subscription = () => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
showSizeChanger: false,
|
||||
isMobile,
|
||||
t,
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user