fix(ui): 统一表格筛选分页和用量明细,升级 ESLint
This commit is contained in:
+174
-131
@@ -67,7 +67,13 @@ import { partnerScope, createPartnerTransport } from './partnerScope';
|
||||
import { tierStatus } from './listFilters';
|
||||
import { Button, DatePicker, Empty, Select, Spin, Tag, Typography } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import { Plus, RefreshCw } from '../../components/common/icons/ActionIcons';
|
||||
import {
|
||||
Download,
|
||||
History,
|
||||
Link,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
} from '../../components/common/icons/ActionIcons';
|
||||
import { API } from '../../helpers';
|
||||
import * as XLSX from 'xlsx';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
@@ -208,7 +214,7 @@ function TierSummary({ items }) {
|
||||
rowKey='id'
|
||||
size='small'
|
||||
dataSource={groups}
|
||||
pagination={false}
|
||||
pagination={groups.length ? { pageSize: 10 } : false}
|
||||
columns={[
|
||||
{ title: t('客户'), dataIndex: 'customer' },
|
||||
{ title: t('分佣档位'), dataIndex: 'tier' },
|
||||
@@ -232,7 +238,7 @@ function PaymentTable({ payments, admin = false }) {
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={payments}
|
||||
pagination={false}
|
||||
pagination={payments.length ? { pageSize: 10 } : false}
|
||||
empty={emptyState(t('暂无付款记录'))}
|
||||
columns={[
|
||||
{ title: t('打款日期'), dataIndex: 'paid_at', render: formatDateTime },
|
||||
@@ -280,7 +286,7 @@ function AdminStatementDetail({
|
||||
<Button onClick={onBack} type='text'>
|
||||
{t('返回账单列表')}
|
||||
</Button>
|
||||
<div className='commission-detail-actions'>
|
||||
<div className='commission-detail-actions console-list-tool-actions'>
|
||||
{(status === 'estimated' || status === 'checking') && (
|
||||
<Button
|
||||
icon={<RefreshCw size={16} />}
|
||||
@@ -297,7 +303,9 @@ function AdminStatementDetail({
|
||||
(status === 'estimated' || status === 'checking') && (
|
||||
<Button onClick={onFee}>{t('录入手续费')}</Button>
|
||||
)}
|
||||
<Button onClick={onExport}>{t('导出明细')}</Button>
|
||||
<Button icon={<Download size={16} />} onClick={onExport}>
|
||||
{t('导出明细')}
|
||||
</Button>
|
||||
{status === 'pending_confirmation' && (
|
||||
<Button onClick={onDeadline}>{t('修改确认截止日期')}</Button>
|
||||
)}
|
||||
@@ -440,9 +448,7 @@ function AdminStatementDetail({
|
||||
rowKey='id'
|
||||
columns={itemColumns}
|
||||
dataSource={items}
|
||||
pagination={{
|
||||
pageSize: 10,
|
||||
}}
|
||||
pagination={items.length ? { pageSize: 10 } : false}
|
||||
scroll={{ x: 1800 }}
|
||||
empty={emptyState(t('暂无计费明细'))}
|
||||
/>
|
||||
@@ -458,7 +464,7 @@ function AdminStatementDetail({
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={operations}
|
||||
pagination={false}
|
||||
pagination={operations.length ? { pageSize: 10 } : false}
|
||||
empty={emptyState(t('暂无操作记录'))}
|
||||
columns={[
|
||||
{
|
||||
@@ -514,7 +520,7 @@ function AdminStatementDetail({
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={adjustments}
|
||||
pagination={false}
|
||||
pagination={adjustments.length ? { pageSize: 10 } : false}
|
||||
empty={emptyState(t('暂无调整单'))}
|
||||
columns={[
|
||||
...AdjustmentColumns(t, money),
|
||||
@@ -886,7 +892,7 @@ function AdminPage() {
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('查看详情')}
|
||||
{t('详情')}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
@@ -1151,62 +1157,84 @@ function AdminPage() {
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 155,
|
||||
width: 300,
|
||||
render: (_, row) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
row.status === 'protected' && {
|
||||
key: 'extend',
|
||||
label: t('延期'),
|
||||
onClick: () =>
|
||||
setOperation({ kind: 'assignment-extend', row }),
|
||||
},
|
||||
[
|
||||
'protected',
|
||||
'protected_extended',
|
||||
'pending_conversion',
|
||||
].includes(row.status) && {
|
||||
key: 'convert',
|
||||
label: t('转正'),
|
||||
onClick: () =>
|
||||
setOperation({ kind: 'assignment-convert', row }),
|
||||
},
|
||||
row.status === 'pending_conversion' && {
|
||||
key: 'reject',
|
||||
label: t('驳回'),
|
||||
onClick: () =>
|
||||
setOperation({ kind: 'assignment-reject', row }),
|
||||
},
|
||||
row.status === 'formal' && {
|
||||
key: 'transfer',
|
||||
label: t('转移'),
|
||||
onClick: () =>
|
||||
setOperation({ kind: 'assignment-transfer', row }),
|
||||
},
|
||||
[
|
||||
'formal',
|
||||
'protected',
|
||||
'protected_extended',
|
||||
'pending_conversion',
|
||||
].includes(row.status) && {
|
||||
key: 'terminate',
|
||||
label: t('终止'),
|
||||
danger: true,
|
||||
onClick: () =>
|
||||
setOperation({ kind: 'assignment-terminate', row }),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div className='commission-row-actions'>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() =>
|
||||
setOperation({ kind: 'assignment-history', row })
|
||||
}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('历史')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
{row.status === 'protected' && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
setOperation({ kind: 'assignment-extend', row })
|
||||
}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('延期')}
|
||||
</Button>
|
||||
)}
|
||||
{[
|
||||
'protected',
|
||||
'protected_extended',
|
||||
'pending_conversion',
|
||||
].includes(row.status) && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
setOperation({ kind: 'assignment-convert', row })
|
||||
}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('转正')}
|
||||
</Button>
|
||||
)}
|
||||
{row.status === 'pending_conversion' && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
setOperation({ kind: 'assignment-reject', row })
|
||||
}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('驳回')}
|
||||
</Button>
|
||||
)}
|
||||
{row.status === 'formal' && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
setOperation({ kind: 'assignment-transfer', row })
|
||||
}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('转移')}
|
||||
</Button>
|
||||
)}
|
||||
{[
|
||||
'formal',
|
||||
'protected',
|
||||
'protected_extended',
|
||||
'pending_conversion',
|
||||
].includes(row.status) && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
setOperation({ kind: 'assignment-terminate', row })
|
||||
}
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
>
|
||||
{t('终止')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -1472,6 +1500,88 @@ function AdminPage() {
|
||||
);
|
||||
XLSX.writeFile(workbook, `commission-${key}-${month}.xlsx`);
|
||||
};
|
||||
const listToolbarActions = (
|
||||
<>
|
||||
<Button icon={<RefreshCw size={16} />} onClick={load}>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
{active === 'partners' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOperation({ kind: 'partner-create' });
|
||||
setError('');
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('新建伙伴档案')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'assignments' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOperation({ kind: 'assignment-create' });
|
||||
setError('');
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('建立保护归属')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'tiers' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOperation({ kind: 'tier-create' });
|
||||
setError('');
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('新增档位')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'adjustments' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={() => {
|
||||
setAdjustmentStatementId(null);
|
||||
setAdjustmentPicker(true);
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('新增调整单')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'tiers' && (
|
||||
<>
|
||||
<Button
|
||||
icon={<Link size={16} />}
|
||||
onClick={() => setOperation({ kind: 'tier-binding' })}
|
||||
>
|
||||
{t('绑定等级档位')}
|
||||
</Button>
|
||||
<Button
|
||||
icon={<History size={16} />}
|
||||
onClick={() => setOperation({ kind: 'tier-history' })}
|
||||
>
|
||||
{t('绑定历史')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{active === 'bills' && (
|
||||
<Button icon={<Download size={16} />} onClick={exportStatements}>
|
||||
{t('导出 Excel')}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
const tableFor = (key) =>
|
||||
key === 'tiers' ? (
|
||||
<LatestTierPanel
|
||||
@@ -1479,6 +1589,7 @@ function AdminPage() {
|
||||
columns={columns.tiers}
|
||||
onExport={(rows) => exportRows('tiers', rows)}
|
||||
refreshToken={data}
|
||||
toolbarActions={listToolbarActions}
|
||||
/>
|
||||
) : (
|
||||
<ListPanel
|
||||
@@ -1490,6 +1601,7 @@ function AdminPage() {
|
||||
searchableText={rowText}
|
||||
onExport={(rows) => exportRows(key, rows)}
|
||||
context={listContext}
|
||||
toolbarActions={listToolbarActions}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
@@ -1532,80 +1644,11 @@ function AdminPage() {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<Button icon={<RefreshCw size={16} />} onClick={load}>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
{active === 'partners' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOperation({ kind: 'partner-create' });
|
||||
setError('');
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('新建伙伴档案')}
|
||||
{(active === 'overview' || selectedStatement) && (
|
||||
<Button icon={<RefreshCw size={16} />} onClick={load}>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'assignments' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOperation({ kind: 'assignment-create' });
|
||||
setError('');
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('建立保护归属')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'tiers' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setOperation({ kind: 'tier-create' });
|
||||
setError('');
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('新增档位')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'adjustments' && (
|
||||
<Button
|
||||
icon={<Plus size={16} />}
|
||||
onClick={() => {
|
||||
setAdjustmentStatementId(null);
|
||||
setAdjustmentPicker(true);
|
||||
}}
|
||||
type='primary'
|
||||
>
|
||||
{t('新增调整单')}
|
||||
</Button>
|
||||
)}
|
||||
{active === 'tiers' && (
|
||||
<>
|
||||
<Button
|
||||
onClick={() => setOperation({ kind: 'tier-binding' })}
|
||||
>
|
||||
{t('绑定等级档位')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setOperation({ kind: 'tier-history' })}
|
||||
>
|
||||
{t('绑定历史')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{active === 'bills' && !selectedStatement && (
|
||||
<Button onClick={exportStatements}>{t('导出 Excel')}</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{error && (
|
||||
|
||||
Reference in New Issue
Block a user