fix(ui): 统一表格筛选分页和用量明细,升级 ESLint
This commit is contained in:
@@ -25,7 +25,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 React, { useEffect, useState, useCallback } from 'react';
|
||||
@@ -40,7 +39,14 @@ import {
|
||||
Spin,
|
||||
Typography,
|
||||
} from '@/components/ui';
|
||||
import { Search } from 'lucide-react';
|
||||
import {
|
||||
Search,
|
||||
Eye as ActionEye,
|
||||
Check as ActionCheck,
|
||||
X as ActionX,
|
||||
Ban as ActionBan,
|
||||
RotateCw as ActionRotateCw,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { API, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
INVOICE_STATUS,
|
||||
@@ -307,53 +313,78 @@ const AdminInvoice = () => {
|
||||
{
|
||||
title: t('操作'),
|
||||
key: 'actions',
|
||||
width: 140,
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
render: (_, record) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
record.status === INVOICE_STATUS.PENDING && {
|
||||
key: 'approve',
|
||||
label: t('通过'),
|
||||
onClick: () => {
|
||||
setApproveId(record.id);
|
||||
setApproveVisible(true);
|
||||
},
|
||||
},
|
||||
record.status === INVOICE_STATUS.PENDING && {
|
||||
key: 'reject',
|
||||
label: t('拒绝'),
|
||||
danger: true,
|
||||
onClick: () => {
|
||||
setRejectId(record.id);
|
||||
setRejectVisible(true);
|
||||
},
|
||||
},
|
||||
record.status === INVOICE_STATUS.FAILED && {
|
||||
key: 'retry',
|
||||
label: t('重试'),
|
||||
onClick: () => handleRetry(record.id),
|
||||
},
|
||||
[
|
||||
INVOICE_STATUS.APPROVED,
|
||||
INVOICE_STATUS.INVOICING,
|
||||
INVOICE_STATUS.FAILED,
|
||||
].includes(record.status) && {
|
||||
key: 'cancel',
|
||||
label: t('取消'),
|
||||
danger: true,
|
||||
onClick: () => handleFailCancel(record.id),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div className='flex items-center gap-1 flex-wrap'>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionEye size={14} />}
|
||||
onClick={() => handleViewDetail(record.id)}
|
||||
>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
/>
|
||||
{record.status === INVOICE_STATUS.PENDING && (
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ActionCheck size={14} />}
|
||||
onClick={() => {
|
||||
setApproveId(record.id);
|
||||
setApproveVisible(true);
|
||||
}}
|
||||
>
|
||||
{t('通过')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionX size={14} />}
|
||||
onClick={() => {
|
||||
setRejectId(record.id);
|
||||
setRejectVisible(true);
|
||||
}}
|
||||
>
|
||||
{t('拒绝')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{(record.status === INVOICE_STATUS.APPROVED ||
|
||||
record.status === INVOICE_STATUS.INVOICING) && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionBan size={14} />}
|
||||
onClick={() => handleFailCancel(record.id)}
|
||||
>
|
||||
{t('取消')}
|
||||
</Button>
|
||||
)}
|
||||
{record.status === INVOICE_STATUS.FAILED && (
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionRotateCw size={14} />}
|
||||
onClick={() => handleRetry(record.id)}
|
||||
>
|
||||
{t('重试')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<ActionBan size={14} />}
|
||||
onClick={() => handleFailCancel(record.id)}
|
||||
>
|
||||
{t('取消')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -374,7 +405,6 @@ const AdminInvoice = () => {
|
||||
placeholder={t('搜索抬头/税号/订单号/用户')}
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
onEnterPress={handleSearch}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('状态')} id='invoice-status'>
|
||||
@@ -576,10 +606,10 @@ const AdminInvoice = () => {
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
<Table
|
||||
<ConsoleListTable
|
||||
dataSource={detailData.topup_list}
|
||||
rowKey='id'
|
||||
pagination={false}
|
||||
pagination={{ pageSize: 10 }}
|
||||
size='small'
|
||||
columns={[
|
||||
{ title: 'ID', dataIndex: 'id', width: 60 },
|
||||
|
||||
@@ -17,7 +17,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import {
|
||||
ExternalLink as ActionExternalLink,
|
||||
BarChart3 as ActionBarChart3,
|
||||
@@ -854,70 +853,96 @@ const AdminOrganizations = () => {
|
||||
{
|
||||
title: t('操作'),
|
||||
key: 'actions',
|
||||
width: 140,
|
||||
width: 380,
|
||||
fixed: 'right',
|
||||
render: (_, record) =>
|
||||
isAdmin() ? (
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'quota',
|
||||
label: t('调额'),
|
||||
onClick: () => {
|
||||
render: (_, record) => (
|
||||
<div className='console-module-row-actions'>
|
||||
{isAdmin() && (
|
||||
<>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => openEditModal(record)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setQuotaOrgId(record.id);
|
||||
setQuotaAmount(0);
|
||||
setQuotaModalVisible(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'features',
|
||||
label: t('功能开关'),
|
||||
onClick: () => openFeatureModal(record),
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
label:
|
||||
record.status === 4
|
||||
? t('激活')
|
||||
: record.status === 1
|
||||
? t('冻结')
|
||||
: t('解冻'),
|
||||
onClick: () =>
|
||||
record.status === 4
|
||||
? handleActivate(record.id)
|
||||
: handleStatusChange(
|
||||
record.id,
|
||||
record.status === 1 ? 2 : 1,
|
||||
),
|
||||
},
|
||||
isRoot() && {
|
||||
key: 'notifications',
|
||||
disabled: alertToggleLoading === record.id,
|
||||
label: alertExcludedIds.has(record.id)
|
||||
? t('恢复通知')
|
||||
: t('屏蔽通知'),
|
||||
title: alertExcludedIds.has(record.id)
|
||||
? t('已屏蔽预警,点击恢复')
|
||||
: t('屏蔽该企业的预警通知'),
|
||||
onClick: () => toggleAlertExclude(record),
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
danger: true,
|
||||
onClick: () => handleDelete(record.id),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => openEditModal(record)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
) : null,
|
||||
}}
|
||||
>
|
||||
{t('调额')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => openFeatureModal(record)}
|
||||
>
|
||||
{t('功能开关')}
|
||||
</Button>
|
||||
{record.status === 4 ? (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
onClick={() => handleActivate(record.id)}
|
||||
>
|
||||
{t('激活')}
|
||||
</Button>
|
||||
) : record.status === 1 ? (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
onClick={() => handleStatusChange(record.id, 2)}
|
||||
>
|
||||
{t('冻结')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
onClick={() => handleStatusChange(record.id, 1)}
|
||||
>
|
||||
{t('解冻')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
onClick={() => handleDelete(record.id)}
|
||||
>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
{isRoot() && (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
loading={alertToggleLoading === record.id}
|
||||
title={
|
||||
alertExcludedIds.has(record.id)
|
||||
? t('已屏蔽预警,点击恢复')
|
||||
: t('屏蔽该企业的预警通知')
|
||||
}
|
||||
aria-label={
|
||||
alertExcludedIds.has(record.id)
|
||||
? t('恢复该企业的预警')
|
||||
: t('屏蔽该企业的预警')
|
||||
}
|
||||
onClick={() => toggleAlertExclude(record)}
|
||||
>
|
||||
{alertExcludedIds.has(record.id)
|
||||
? t('恢复通知')
|
||||
: t('屏蔽通知')}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ export default function LatestTierPanel({
|
||||
columns,
|
||||
onExport,
|
||||
refreshToken,
|
||||
toolbarActions,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const generation = useRef(0);
|
||||
@@ -42,7 +43,7 @@ export default function LatestTierPanel({
|
||||
const activeContext = useRef(context);
|
||||
activeContext.current = context;
|
||||
const exportRequest = useRef(null);
|
||||
const [query, setQuery] = useState({ status: 'all', page: 1 });
|
||||
const [query, setQuery] = useState({ status: 'all', page: 1, pageSize: 10 });
|
||||
const [state, setState] = useState({
|
||||
items: [],
|
||||
total: 0,
|
||||
@@ -142,16 +143,21 @@ export default function LatestTierPanel({
|
||||
partners={[]}
|
||||
searchableText={() => ''}
|
||||
onExport={exportAll}
|
||||
toolbarActions={toolbarActions}
|
||||
server={{
|
||||
...visible,
|
||||
page: query.page,
|
||||
pageSize: query.pageSize,
|
||||
exporting,
|
||||
onChange: (next) => {
|
||||
generation.current++;
|
||||
exportRequest.current = null;
|
||||
setExporting(false);
|
||||
setState((old) => ({ ...old, items: [], busy: true, error: '' }));
|
||||
setQuery(next);
|
||||
setQuery((current) => ({
|
||||
...next,
|
||||
pageSize: next.pageSize ?? current.pageSize,
|
||||
}));
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -21,13 +21,13 @@ import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Empty, Input, Select } from 'antd';
|
||||
import { Table } from '@/components/ui';
|
||||
import { Search } from '@/components/common/icons/ActionIcons';
|
||||
import { Download, Search } from '@/components/common/icons/ActionIcons';
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleSearchBar,
|
||||
ConsoleSearchActions,
|
||||
ConsoleFilterGrid,
|
||||
ConsoleTabs,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import { ConsoleCollectionSearch } from '../../components/console/ConsoleCollection';
|
||||
import { filterCommissionRows, matchesStatus } from './listFilters';
|
||||
|
||||
export default function ListPanel({
|
||||
@@ -37,6 +37,7 @@ export default function ListPanel({
|
||||
partners,
|
||||
searchableText,
|
||||
onExport,
|
||||
toolbarActions,
|
||||
context,
|
||||
server,
|
||||
}) {
|
||||
@@ -46,6 +47,7 @@ export default function ListPanel({
|
||||
const [scopedIds, setScopedIds] = useState(context?.ids || null);
|
||||
const [status, setStatus] = useState('all');
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
const set = (key, value) =>
|
||||
setDraft((current) => ({ ...current, [key]: value }));
|
||||
const tabSets = {
|
||||
@@ -130,7 +132,6 @@ export default function ListPanel({
|
||||
setScopedIds(null);
|
||||
setPage(1);
|
||||
};
|
||||
const [filtersOpen, setFiltersOpen] = useState(false);
|
||||
return (
|
||||
<div className={`commission-list commission-list--${section}`}>
|
||||
{tabSets[section] && (
|
||||
@@ -175,124 +176,107 @@ export default function ListPanel({
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<Button
|
||||
className='commission-filter-toggle'
|
||||
aria-expanded={filtersOpen}
|
||||
onClick={() => setFiltersOpen((value) => !value)}
|
||||
>
|
||||
{t(filtersOpen ? '隐藏操作项' : '显示操作项')}
|
||||
</Button>
|
||||
<ConsoleSearchBar
|
||||
className={`commission-filter-card${filtersOpen ? ' is-open' : ''}`}
|
||||
>
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
query();
|
||||
}}
|
||||
<ConsoleCollectionSearch className='commission-filter-card'>
|
||||
<ConsoleFilterGrid
|
||||
onReset={reset}
|
||||
onSearch={query}
|
||||
loading={server?.busy}
|
||||
>
|
||||
<div className='console-search-fields'>
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('搜索')}</span>
|
||||
<Input
|
||||
prefix={<Search size={16} aria-hidden />}
|
||||
value={draft.query}
|
||||
onChange={(event) => set('query', event.target.value)}
|
||||
allowClear
|
||||
placeholder={t(placeholders[section])}
|
||||
aria-label={t(placeholders[section])}
|
||||
/>
|
||||
</label>
|
||||
{typeOptions && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('搜索')}</span>
|
||||
<Input
|
||||
prefix={<Search size={16} aria-hidden />}
|
||||
value={draft.query}
|
||||
onChange={(event) => set('query', event.target.value)}
|
||||
allowClear
|
||||
placeholder={t(placeholders[section])}
|
||||
aria-label={t(placeholders[section])}
|
||||
<span>{t('类型筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('类型筛选')}
|
||||
value={draft.type}
|
||||
onChange={(value) => set('type', value)}
|
||||
options={[
|
||||
{
|
||||
value: '',
|
||||
label: t(
|
||||
section === 'assignments'
|
||||
? '全部客户类型'
|
||||
: section === 'tiers'
|
||||
? '全部来源'
|
||||
: '全部类型',
|
||||
),
|
||||
},
|
||||
...typeOptions.map(([value, label]) => ({
|
||||
value,
|
||||
label: t(label),
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
</label>
|
||||
{typeOptions && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('类型筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('类型筛选')}
|
||||
value={draft.type}
|
||||
onChange={(value) => set('type', value)}
|
||||
options={[
|
||||
{
|
||||
value: '',
|
||||
label: t(
|
||||
section === 'assignments'
|
||||
? '全部客户类型'
|
||||
: section === 'tiers'
|
||||
? '全部来源'
|
||||
: '全部类型',
|
||||
),
|
||||
},
|
||||
...typeOptions.map(([value, label]) => ({
|
||||
value,
|
||||
label: t(label),
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
{section === 'partners' && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('状态筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('状态筛选')}
|
||||
value={draft.status || ''}
|
||||
onChange={(value) => set('status', value)}
|
||||
options={[
|
||||
'',
|
||||
'draft',
|
||||
'active',
|
||||
'suspended',
|
||||
'terminated',
|
||||
].map((value, i) => ({
|
||||
)}
|
||||
{section === 'partners' && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('状态筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('状态筛选')}
|
||||
value={draft.status || ''}
|
||||
onChange={(value) => set('status', value)}
|
||||
options={['', 'draft', 'active', 'suspended', 'terminated'].map(
|
||||
(value, i) => ({
|
||||
value,
|
||||
label: t(
|
||||
['全部状态', '草稿', '生效中', '已暂停', '已终止'][i],
|
||||
),
|
||||
}))}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
{['assignments', 'bills', 'adjustments'].includes(section) && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('合作伙伴筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('合作伙伴筛选')}
|
||||
showSearch={{ optionFilterProp: 'label' }}
|
||||
value={draft.partner}
|
||||
onChange={(value) => set('partner', value)}
|
||||
options={[
|
||||
{ value: '', label: t('全部合作伙伴') },
|
||||
...partners.map((row) => ({
|
||||
value: row.id,
|
||||
label: row.name,
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
<ConsoleSearchActions
|
||||
onReset={reset}
|
||||
searchLabel='查询'
|
||||
loading={server?.busy}
|
||||
/>
|
||||
</form>
|
||||
</ConsoleSearchBar>
|
||||
}),
|
||||
)}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
{['assignments', 'bills', 'adjustments'].includes(section) && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('合作伙伴筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('合作伙伴筛选')}
|
||||
showSearch={{ optionFilterProp: 'label' }}
|
||||
value={draft.partner}
|
||||
onChange={(value) => set('partner', value)}
|
||||
options={[
|
||||
{ value: '', label: t('全部合作伙伴') },
|
||||
...partners.map((row) => ({
|
||||
value: row.id,
|
||||
label: row.name,
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
</ConsoleFilterGrid>
|
||||
</ConsoleCollectionSearch>
|
||||
<ConsoleCard className='commission-card commission-list-card'>
|
||||
<div className='commission-filter-end'>
|
||||
<div className='console-list-tools commission-filter-end'>
|
||||
<span>
|
||||
{t('共 {{count}} 条', {
|
||||
count: server ? server.total : filtered.length,
|
||||
})}
|
||||
</span>
|
||||
{onExport && (
|
||||
<Button
|
||||
loading={server?.exporting}
|
||||
disabled={!!server?.busy}
|
||||
onClick={() => onExport(filtered)}
|
||||
>
|
||||
{t('导出')}
|
||||
</Button>
|
||||
)}
|
||||
<div className='console-list-tool-actions'>
|
||||
{onExport && (
|
||||
<Button
|
||||
icon={<Download size={16} />}
|
||||
loading={server?.exporting}
|
||||
disabled={!!server?.busy}
|
||||
onClick={() => onExport(filtered)}
|
||||
>
|
||||
{t('导出')}
|
||||
</Button>
|
||||
)}
|
||||
{toolbarActions}
|
||||
</div>
|
||||
</div>
|
||||
<Table
|
||||
rowKey='id'
|
||||
@@ -309,18 +293,30 @@ export default function ListPanel({
|
||||
dataSource={filtered}
|
||||
size='middle'
|
||||
scroll={{ x: 'max-content' }}
|
||||
pagination={{
|
||||
size: 'small',
|
||||
pageSize: server ? 100 : 10,
|
||||
total: server ? server.total : filtered.length,
|
||||
current: server ? server.page : page,
|
||||
onChange: (next) => {
|
||||
setPage(next);
|
||||
server?.onChange({ ...filters, status, page: next });
|
||||
},
|
||||
showSizeChanger: false,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
}}
|
||||
pagination={
|
||||
(server ? server.total : filtered.length)
|
||||
? {
|
||||
size: 'small',
|
||||
pageSize: server ? server.pageSize : pageSize,
|
||||
total: server ? server.total : filtered.length,
|
||||
currentPage: server ? server.page : page,
|
||||
onPageChange: (next) => {
|
||||
setPage(next);
|
||||
server?.onChange({ ...filters, status, page: next });
|
||||
},
|
||||
onPageSizeChange: (nextSize) => {
|
||||
setPage(1);
|
||||
setPageSize(nextSize);
|
||||
server?.onChange({
|
||||
...filters,
|
||||
status,
|
||||
page: 1,
|
||||
pageSize: nextSize,
|
||||
});
|
||||
},
|
||||
}
|
||||
: false
|
||||
}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
|
||||
@@ -147,7 +147,7 @@ export default function PartnerDetail({
|
||||
dataSource={assignments.filter(
|
||||
(item) => item.partner_id === row.id,
|
||||
)}
|
||||
pagination={{ pageSize: 5, size: 'small' }}
|
||||
pagination={{ pageSize: 10 }}
|
||||
columns={[
|
||||
{
|
||||
title: t('客户'),
|
||||
|
||||
@@ -18,7 +18,11 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatIdReference } from '../../helpers/safeDisplay';
|
||||
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { ConsoleCollectionSearch } from '@/components/console/ConsoleCollection';
|
||||
import {
|
||||
ConsoleFilterField,
|
||||
ConsoleFilterGrid,
|
||||
} from '@/components/console/ConsolePrimitives';
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -44,6 +48,8 @@ import {
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
ArrowLeft as ActionArrowLeft,
|
||||
Download,
|
||||
Search,
|
||||
RefreshCw as ActionRefresh,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import {
|
||||
@@ -148,6 +154,9 @@ export default function PartnerPortal({
|
||||
const [customerStatus, setCustomerStatus] = useState('all');
|
||||
const [billMonth, setBillMonth] = useState('all');
|
||||
const [billStatus, setBillStatus] = useState('all');
|
||||
const [billPage, setBillPage] = useState(1);
|
||||
const [customerPage, setCustomerPage] = useState(1);
|
||||
const [detailPage, setDetailPage] = useState(1);
|
||||
const loadVersion = useRef(0);
|
||||
const detailVersion = useRef(0);
|
||||
const selectedId = useRef(null);
|
||||
@@ -252,6 +261,7 @@ export default function PartnerPortal({
|
||||
setDetailLoading(true);
|
||||
setError('');
|
||||
setQuery('');
|
||||
setDetailPage(1);
|
||||
setAction(null);
|
||||
setReason('');
|
||||
setActionError('');
|
||||
@@ -496,25 +506,9 @@ export default function PartnerPortal({
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 175,
|
||||
width: 230,
|
||||
render: (_, row) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'export',
|
||||
label: t('导出'),
|
||||
disabled: exportingId !== null || mutationLoading,
|
||||
onClick: () => exportStatement(row),
|
||||
},
|
||||
row.status === 'pending_confirmation' && {
|
||||
key: 'reject',
|
||||
label: t('驳回'),
|
||||
danger: true,
|
||||
disabled: mutationLoading,
|
||||
onClick: () => open(row, 'reject'),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div className='partner-portal-row-actions'>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
@@ -524,57 +518,119 @@ export default function PartnerPortal({
|
||||
{t('查看')}
|
||||
</Button>
|
||||
{row.status === 'pending_confirmation' && (
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
disabled={mutationLoading}
|
||||
onClick={() => open(row, 'confirm')}
|
||||
>
|
||||
{t('确认')}
|
||||
</Button>
|
||||
<>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
disabled={mutationLoading}
|
||||
onClick={() => open(row, 'confirm')}
|
||||
>
|
||||
{t('确认')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
disabled={mutationLoading}
|
||||
onClick={() => open(row, 'reject')}
|
||||
>
|
||||
{t('驳回')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</TableRowActions>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
disabled={exportingId !== null || mutationLoading}
|
||||
loading={exportingId === row.id}
|
||||
onClick={() => exportStatement(row)}
|
||||
>
|
||||
{t('导出')}
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const refreshButton = (
|
||||
<Button
|
||||
icon={<ActionRefresh size={16} />}
|
||||
disabled={mutationLoading || detailLoading}
|
||||
loading={loading}
|
||||
onClick={() => {
|
||||
load();
|
||||
if (selected) open(selected);
|
||||
}}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
);
|
||||
|
||||
const renderBills = () => (
|
||||
<>
|
||||
<ConsoleCollectionSearch>
|
||||
<ConsoleFilterGrid
|
||||
onReset={() => {
|
||||
setBillMonth('all');
|
||||
setBillStatus('all');
|
||||
setBillPage(1);
|
||||
}}
|
||||
onSearch={() => setBillPage(1)}
|
||||
>
|
||||
<ConsoleFilterField label={t('账期')} id='partner-bill-month'>
|
||||
<Select
|
||||
id='partner-bill-month'
|
||||
value={billMonth}
|
||||
onChange={(value) => {
|
||||
setBillMonth(value);
|
||||
setBillPage(1);
|
||||
}}
|
||||
optionList={[
|
||||
{ value: 'all', label: t('全部账期') },
|
||||
...Array.from(new Set(rows.map((row) => row.statement_month)))
|
||||
.sort()
|
||||
.reverse()
|
||||
.map((value) => ({ value, label: value })),
|
||||
]}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('状态')} id='partner-bill-status'>
|
||||
<Select
|
||||
id='partner-bill-status'
|
||||
value={billStatus}
|
||||
onChange={(value) => {
|
||||
setBillStatus(value);
|
||||
setBillPage(1);
|
||||
}}
|
||||
optionList={[
|
||||
{ value: 'all', label: t('全部状态') },
|
||||
...Array.from(new Set(rows.map((row) => row.status))).map(
|
||||
(value) => ({
|
||||
value,
|
||||
label: commissionLabel(t, 'status', value),
|
||||
}),
|
||||
),
|
||||
]}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
</ConsoleFilterGrid>
|
||||
</ConsoleCollectionSearch>
|
||||
<Card className='commission-card partner-portal-card'>
|
||||
<div className='partner-portal-filters'>
|
||||
<Select
|
||||
value={billMonth}
|
||||
onChange={setBillMonth}
|
||||
optionList={[
|
||||
{ value: 'all', label: t('全部账期') },
|
||||
...Array.from(new Set(rows.map((row) => row.statement_month)))
|
||||
.sort()
|
||||
.reverse()
|
||||
.map((value) => ({ value, label: value })),
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
value={billStatus}
|
||||
onChange={setBillStatus}
|
||||
optionList={[
|
||||
{ value: 'all', label: t('全部状态') },
|
||||
...Array.from(new Set(rows.map((row) => row.status))).map(
|
||||
(value) => ({
|
||||
value,
|
||||
label: commissionLabel(t, 'status', value),
|
||||
}),
|
||||
),
|
||||
]}
|
||||
/>
|
||||
<div className='console-list-tools commission-filter-end'>
|
||||
<Text type='secondary'>
|
||||
{t('共 {{count}} 张账单', { count: visibleBills.length })}
|
||||
</Text>
|
||||
<div className='console-list-tool-actions'>{refreshButton}</div>
|
||||
</div>
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={visibleBills}
|
||||
columns={billColumns}
|
||||
pagination={visibleBills.length > 0 ? { pageSize: 10 } : false}
|
||||
pagination={
|
||||
visibleBills.length > 0
|
||||
? { pageSize: 10, current: billPage, onChange: setBillPage }
|
||||
: false
|
||||
}
|
||||
scroll={{ x: 1120 }}
|
||||
empty={
|
||||
<Empty
|
||||
@@ -697,19 +753,46 @@ export default function PartnerPortal({
|
||||
<Card className='commission-card partner-portal-card'>
|
||||
<Tabs defaultActiveKey='usage' key={selected.id}>
|
||||
<Tabs.TabPane tab={t('单笔消耗明细')} itemKey='usage'>
|
||||
<Input
|
||||
className='partner-portal-detail-search'
|
||||
value={query}
|
||||
onChange={setQuery}
|
||||
placeholder={t('搜索客户、模型、计费记录或档位')}
|
||||
showClear
|
||||
/>
|
||||
<ConsoleCollectionSearch>
|
||||
<ConsoleFilterGrid
|
||||
onReset={() => {
|
||||
setQuery('');
|
||||
setDetailPage(1);
|
||||
}}
|
||||
onSearch={() => setDetailPage(1)}
|
||||
>
|
||||
<ConsoleFilterField
|
||||
label={t('搜索关键字')}
|
||||
id='partner-bill-detail-query'
|
||||
>
|
||||
<Input
|
||||
id='partner-bill-detail-query'
|
||||
prefix={<Search size={16} />}
|
||||
value={query}
|
||||
onChange={(value) => {
|
||||
setQuery(value);
|
||||
setDetailPage(1);
|
||||
}}
|
||||
placeholder={t('搜索客户、模型、计费记录或档位')}
|
||||
showClear
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
</ConsoleFilterGrid>
|
||||
</ConsoleCollectionSearch>
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={detailItems}
|
||||
columns={BillingColumns(t, money, formatDateTime)}
|
||||
scroll={{ x: 1800 }}
|
||||
pagination={detailItems.length > 0 ? { pageSize: 10 } : false}
|
||||
pagination={
|
||||
detailItems.length > 0
|
||||
? {
|
||||
pageSize: 10,
|
||||
current: detailPage,
|
||||
onChange: setDetailPage,
|
||||
}
|
||||
: false
|
||||
}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
@@ -922,96 +1005,136 @@ export default function PartnerPortal({
|
||||
);
|
||||
|
||||
const renderCustomers = () => (
|
||||
<Card className='commission-card partner-portal-card'>
|
||||
<Alert
|
||||
showIcon
|
||||
type='info'
|
||||
description={t(
|
||||
'仅展示本伙伴保护期及正式归属期间的信息。转移或终止后的客户消费不在可见范围内。',
|
||||
)}
|
||||
/>
|
||||
<div className='partner-portal-filters'>
|
||||
<Input
|
||||
value={customerQuery}
|
||||
onChange={setCustomerQuery}
|
||||
showClear
|
||||
placeholder={t('搜索客户名称或编号')}
|
||||
<>
|
||||
<Card className='commission-card partner-portal-card'>
|
||||
<Alert
|
||||
showIcon
|
||||
type='info'
|
||||
description={t(
|
||||
'仅展示本伙伴保护期及正式归属期间的信息。转移或终止后的客户消费不在可见范围内。',
|
||||
)}
|
||||
/>
|
||||
<Select
|
||||
value={customerStatus}
|
||||
onChange={setCustomerStatus}
|
||||
optionList={[
|
||||
{ value: 'all', label: t('全部状态') },
|
||||
...Array.from(new Set(customers.map((row) => row.status))).map(
|
||||
(value) => ({
|
||||
value,
|
||||
label: commissionLabel(t, 'status', value),
|
||||
}),
|
||||
),
|
||||
</Card>
|
||||
<ConsoleCollectionSearch>
|
||||
<ConsoleFilterGrid
|
||||
onReset={() => {
|
||||
setCustomerQuery('');
|
||||
setCustomerStatus('all');
|
||||
setCustomerPage(1);
|
||||
}}
|
||||
onSearch={() => setCustomerPage(1)}
|
||||
>
|
||||
<ConsoleFilterField
|
||||
label={t('搜索关键字')}
|
||||
id='partner-customer-query'
|
||||
>
|
||||
<Input
|
||||
id='partner-customer-query'
|
||||
prefix={<Search size={16} />}
|
||||
value={customerQuery}
|
||||
onChange={(value) => {
|
||||
setCustomerQuery(value);
|
||||
setCustomerPage(1);
|
||||
}}
|
||||
showClear
|
||||
placeholder={t('搜索客户名称或编号')}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
<ConsoleFilterField label={t('状态')} id='partner-customer-status'>
|
||||
<Select
|
||||
id='partner-customer-status'
|
||||
value={customerStatus}
|
||||
onChange={(value) => {
|
||||
setCustomerStatus(value);
|
||||
setCustomerPage(1);
|
||||
}}
|
||||
optionList={[
|
||||
{ value: 'all', label: t('全部状态') },
|
||||
...Array.from(new Set(customers.map((row) => row.status))).map(
|
||||
(value) => ({
|
||||
value,
|
||||
label: commissionLabel(t, 'status', value),
|
||||
}),
|
||||
),
|
||||
]}
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
</ConsoleFilterGrid>
|
||||
</ConsoleCollectionSearch>
|
||||
<Card className='commission-card partner-portal-card'>
|
||||
<div className='console-list-tools commission-filter-end'>
|
||||
<Text type='secondary'>
|
||||
{t('共 {{count}} 条归属记录', { count: visibleCustomers.length })}
|
||||
</Text>
|
||||
<div className='console-list-tool-actions'>{refreshButton}</div>
|
||||
</div>
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={visibleCustomers}
|
||||
pagination={
|
||||
visibleCustomers.length > 0
|
||||
? {
|
||||
pageSize: 10,
|
||||
current: customerPage,
|
||||
onChange: setCustomerPage,
|
||||
}
|
||||
: false
|
||||
}
|
||||
scroll={{ x: 1100 }}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无客户')}
|
||||
/>
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
title: t('客户'),
|
||||
render: (_, row) => (
|
||||
<b>
|
||||
{row.customer_name ||
|
||||
row.subject_name ||
|
||||
`${commissionLabel(t, 'subjectType', row.subject_type)} #${row.subject_id}`}
|
||||
</b>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('类型'),
|
||||
dataIndex: 'subject_type',
|
||||
render: (value) => commissionLabel(t, 'subjectType', value),
|
||||
},
|
||||
{ title: t('归属状态'), dataIndex: 'status', render: tag },
|
||||
{
|
||||
title: t('正式归属起点'),
|
||||
dataIndex: 'formal_at',
|
||||
render: formatDateTime,
|
||||
},
|
||||
{ title: t('保护期开始'), dataIndex: 'started_at', render: date },
|
||||
{
|
||||
title: t('保护期至'),
|
||||
render: (_, row) => date(protectionUntil(row)),
|
||||
},
|
||||
{
|
||||
title: t('保护期剩余天数'),
|
||||
render: (_, row) =>
|
||||
PROTECTED.includes(row.status)
|
||||
? Math.max(
|
||||
0,
|
||||
Math.ceil(
|
||||
(protectionUntil(row) - Date.now() / 1000) / 86400,
|
||||
),
|
||||
)
|
||||
: '—',
|
||||
},
|
||||
{
|
||||
title: t('归属结束'),
|
||||
dataIndex: 'ended_at',
|
||||
render: formatDateTime,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Text type='secondary'>
|
||||
{t('共 {{count}} 条归属记录', { count: visibleCustomers.length })}
|
||||
</Text>
|
||||
</div>
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={visibleCustomers}
|
||||
pagination={visibleCustomers.length > 0 ? { pageSize: 10 } : false}
|
||||
scroll={{ x: 1100 }}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无客户')}
|
||||
/>
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
title: t('客户'),
|
||||
render: (_, row) => (
|
||||
<b>
|
||||
{row.customer_name ||
|
||||
row.subject_name ||
|
||||
`${commissionLabel(t, 'subjectType', row.subject_type)} #${row.subject_id}`}
|
||||
</b>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('类型'),
|
||||
dataIndex: 'subject_type',
|
||||
render: (value) => commissionLabel(t, 'subjectType', value),
|
||||
},
|
||||
{ title: t('归属状态'), dataIndex: 'status', render: tag },
|
||||
{
|
||||
title: t('正式归属起点'),
|
||||
dataIndex: 'formal_at',
|
||||
render: formatDateTime,
|
||||
},
|
||||
{ title: t('保护期开始'), dataIndex: 'started_at', render: date },
|
||||
{
|
||||
title: t('保护期至'),
|
||||
render: (_, row) => date(protectionUntil(row)),
|
||||
},
|
||||
{
|
||||
title: t('保护期剩余天数'),
|
||||
render: (_, row) =>
|
||||
PROTECTED.includes(row.status)
|
||||
? Math.max(
|
||||
0,
|
||||
Math.ceil(
|
||||
(protectionUntil(row) - Date.now() / 1000) / 86400,
|
||||
),
|
||||
)
|
||||
: '—',
|
||||
},
|
||||
{
|
||||
title: t('归属结束'),
|
||||
dataIndex: 'ended_at',
|
||||
render: formatDateTime,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
|
||||
const renderEstimate = () => (
|
||||
@@ -1055,7 +1178,7 @@ export default function PartnerPortal({
|
||||
className='partner-portal-estimate-table'
|
||||
rowKey='statement_month'
|
||||
dataSource={realtime}
|
||||
pagination={false}
|
||||
pagination={realtime.length ? { pageSize: 10 } : false}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
@@ -1266,6 +1389,7 @@ export default function PartnerPortal({
|
||||
{selected && (
|
||||
<>
|
||||
<Button
|
||||
icon={<Download size={16} />}
|
||||
disabled={detailLoading || mutationLoading}
|
||||
onClick={() =>
|
||||
exportDetails(items, adjustments, selected, t)
|
||||
@@ -1301,17 +1425,10 @@ export default function PartnerPortal({
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
icon={<ActionRefresh size={16} />}
|
||||
disabled={mutationLoading || detailLoading}
|
||||
loading={loading}
|
||||
onClick={() => {
|
||||
load();
|
||||
if (selected) open(selected);
|
||||
}}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
{(selected ||
|
||||
!loaded ||
|
||||
!['bills', 'customers'].includes(active)) &&
|
||||
refreshButton}
|
||||
</div>
|
||||
</div>
|
||||
{error && <Alert showIcon type='error' description={error} />}
|
||||
|
||||
+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 && (
|
||||
|
||||
@@ -20,7 +20,7 @@ export function latestTierURL(filters = {}, page = 1, snapshot = {}) {
|
||||
const params = new URLSearchParams({
|
||||
view: 'latest',
|
||||
p: String(page),
|
||||
page_size: '100',
|
||||
page_size: String(filters.pageSize ?? 100),
|
||||
});
|
||||
if (filters.query?.trim()) params.set('q', filters.query.trim());
|
||||
if (filters.type) params.set('source_type', filters.type);
|
||||
@@ -39,7 +39,9 @@ export async function fetchAllLatestTiers(fetchJSON, filters = {}) {
|
||||
let snapshot;
|
||||
let total;
|
||||
for (let page = 1; ; page++) {
|
||||
const result = await fetchJSON(latestTierURL(filters, page, snapshot));
|
||||
const result = await fetchJSON(
|
||||
latestTierURL({ ...filters, pageSize: 100 }, page, snapshot),
|
||||
);
|
||||
if (!snapshot) {
|
||||
snapshot = { as_of: result.as_of, revision: result.revision };
|
||||
total = result.total;
|
||||
|
||||
@@ -57,6 +57,9 @@ test('latest all status is omitted and export pins server snapshot across all pa
|
||||
),
|
||||
false,
|
||||
);
|
||||
const listURL = new URL(latestTierURL({ pageSize: 20 }, 2), 'http://local');
|
||||
assert.equal(listURL.searchParams.get('page_size'), '20');
|
||||
assert.equal(listURL.searchParams.get('p'), '2');
|
||||
const urls = [];
|
||||
const rows = await fetchAllLatestTiers(
|
||||
async (url) => {
|
||||
@@ -69,9 +72,10 @@ test('latest all status is omitted and export pins server snapshot across all pa
|
||||
revision: 7,
|
||||
};
|
||||
},
|
||||
{ query: '中文', type: 'level' },
|
||||
{ query: '中文', type: 'level', pageSize: 20 },
|
||||
);
|
||||
assert.equal(rows.length, 2);
|
||||
assert.ok(urls.every((url) => /page_size=100/.test(url)));
|
||||
assert.match(urls[1], /as_of=123/);
|
||||
assert.match(urls[1], /revision=7/);
|
||||
});
|
||||
|
||||
@@ -975,7 +975,7 @@ export function OperationsDialog({
|
||||
<Table
|
||||
rowKey='id'
|
||||
dataSource={history}
|
||||
pagination={{ pageSize: 10, showTotal: true }}
|
||||
pagination={{ pageSize: 10 }}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
|
||||
@@ -905,8 +905,7 @@
|
||||
margin-top: 18px;
|
||||
}
|
||||
.commission-filter-end {
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 18px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.commission-search-field {
|
||||
display: flex;
|
||||
@@ -919,17 +918,6 @@
|
||||
.commission-search-field .ant-select {
|
||||
width: 100%;
|
||||
}
|
||||
.commission-filter-card .console-search-fields {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
.commission-filter-card .console-search-actions {
|
||||
margin-top: 16px;
|
||||
}
|
||||
.commission-filter-toggle.ant-btn {
|
||||
display: none;
|
||||
}
|
||||
.commission-detail-tabs {
|
||||
margin-top: 18px;
|
||||
padding: 8px 24px 24px;
|
||||
@@ -948,19 +936,9 @@
|
||||
outline-offset: 2px;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.commission-filter-card .console-search-fields {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.commission-card > .ant-card-body {
|
||||
padding: 16px;
|
||||
}
|
||||
.commission-filter-toggle.ant-btn {
|
||||
display: inline-flex;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.commission-filter-card:not(.is-open) {
|
||||
display: none;
|
||||
}
|
||||
.commission-page-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
Trash2 as ActionTrash2,
|
||||
AlertCircle as ActionAlertCircle,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Table,
|
||||
@@ -240,63 +239,69 @@ const VideoTaskQueue = ({
|
||||
{
|
||||
title: t('操作'),
|
||||
dataIndex: 'operate',
|
||||
width: 168,
|
||||
width: !isCompact ? 220 : 180,
|
||||
fixed: 'right',
|
||||
render: (text, record) => {
|
||||
const normalizedStatus = normalizeVideoTaskStatus(record.status);
|
||||
|
||||
return (
|
||||
<TableRowActions
|
||||
items={[
|
||||
normalizedStatus === 'success' && {
|
||||
key: 'download',
|
||||
label: t('下载'),
|
||||
onClick: () => onDownload(record),
|
||||
icon: <ActionDownload size={14} />,
|
||||
},
|
||||
(normalizedStatus === 'success' ||
|
||||
normalizedStatus === 'failure') &&
|
||||
canRegenerateVideoTask(record) && {
|
||||
key: 'regenerate',
|
||||
label: t('再生成'),
|
||||
onClick: () => onRegenerate && onRegenerate(record),
|
||||
icon: <ActionRefreshCw size={14} />,
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
onClick: () => {
|
||||
Modal.warning({
|
||||
title: t('确定删除此任务?'),
|
||||
content: t('删除后将无法恢复'),
|
||||
icon: (
|
||||
<ActionAlertCircle
|
||||
size={24}
|
||||
style={{ color: '#f59e0b' }}
|
||||
/>
|
||||
),
|
||||
okText: t('确定'),
|
||||
cancelText: t('取消'),
|
||||
onOk: () => onDelete(record.task_id),
|
||||
centered: true,
|
||||
okButtonProps: { type: 'danger' },
|
||||
});
|
||||
},
|
||||
icon: <ActionTrash2 size={14} />,
|
||||
danger: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Space>
|
||||
{/* 播放和下载按钮:仅根据状态显示,视频URL在点击时才获取 */}
|
||||
{normalizedStatus === 'success' && (
|
||||
<Button
|
||||
size='small'
|
||||
type='tertiary'
|
||||
icon={<ActionPlay size={14} />}
|
||||
onClick={() => onPlay && onPlay(record)}
|
||||
>
|
||||
{t('播放')}
|
||||
</Button>
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
type='tertiary'
|
||||
icon={<ActionPlay size={14} />}
|
||||
onClick={() => onPlay && onPlay(record)}
|
||||
>
|
||||
{!isCompact ? t('播放') : ''}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
type='tertiary'
|
||||
icon={<ActionDownload size={14} />}
|
||||
onClick={() => onDownload(record)}
|
||||
>
|
||||
{!isCompact ? t('下载') : ''}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</TableRowActions>
|
||||
{/* 再生成按钮 - 对所有已完成或失败的任务显示 */}
|
||||
{(normalizedStatus === 'success' ||
|
||||
normalizedStatus === 'failure') &&
|
||||
canRegenerateVideoTask(record) && (
|
||||
<Button
|
||||
size='small'
|
||||
type='primary'
|
||||
icon={<ActionRefreshCw size={14} />}
|
||||
onClick={() => onRegenerate && onRegenerate(record)}
|
||||
>
|
||||
{!isCompact ? t('再生成') : ''}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
size='small'
|
||||
type='danger'
|
||||
icon={<ActionTrash2 size={14} />}
|
||||
onClick={() => {
|
||||
Modal.warning({
|
||||
title: t('确定删除此任务?'),
|
||||
content: t('删除后将无法恢复'),
|
||||
icon: (
|
||||
<ActionAlertCircle size={24} style={{ color: '#f59e0b' }} />
|
||||
),
|
||||
okText: t('确定'),
|
||||
cancelText: t('取消'),
|
||||
onOk: () => onDelete(record.task_id),
|
||||
centered: true,
|
||||
okButtonProps: { type: 'danger' },
|
||||
});
|
||||
}}
|
||||
>
|
||||
{!isCompact ? t('删除') : ''}
|
||||
</Button>
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -24,10 +24,15 @@ import {
|
||||
Copy as ActionCopy,
|
||||
BookOpen as ActionBookOpen,
|
||||
HelpCircle as ActionHelpCircle,
|
||||
Search as ActionSearch,
|
||||
Plus as ActionPlus,
|
||||
Search as ActionSearch,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { writeClipboardText } from '../../helpers/clipboard';
|
||||
import { ConsoleCollectionSearch } from '../../components/console/ConsoleCollection';
|
||||
import {
|
||||
ConsoleFilterField,
|
||||
ConsoleFilterGrid,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import React, { useState, useRef, useEffect, useContext } from 'react';
|
||||
import Table from '../../components/ui/CenterActionTable';
|
||||
@@ -892,35 +897,28 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
<DesensitizeNotice t={t} />
|
||||
|
||||
<div className='km-panels'>
|
||||
<Card className='km-card km-search-card tour-search-input'>
|
||||
<label className='km-search-label' htmlFor='km-search-input'>
|
||||
{t('密钥查询')}
|
||||
</label>
|
||||
<div className='km-search-row'>
|
||||
<Input
|
||||
id='km-search-input'
|
||||
className='km-search-input'
|
||||
placeholder={t('搜索密钥名称、Key 或分组')}
|
||||
value={searchValue}
|
||||
onChange={(event) => setSearchValue(event.target.value)}
|
||||
onPressEnter={() => setSearchValue(searchValue)}
|
||||
allowClear
|
||||
/>
|
||||
<Button onClick={() => setSearchValue('')}>{t('重置')}</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<ActionSearch size={14} />}
|
||||
onClick={() => setSearchValue(searchValue)}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
<ConsoleCollectionSearch className='km-card km-search-card tour-search-input'>
|
||||
<ConsoleFilterGrid
|
||||
onReset={() => setSearchValue('')}
|
||||
onSearch={() => setSearchValue(searchValue.trim())}
|
||||
>
|
||||
<ConsoleFilterField label={t('密钥查询')} id='km-search-input'>
|
||||
<Input
|
||||
id='km-search-input'
|
||||
prefix={<ActionSearch size={14} />}
|
||||
placeholder={t('搜索密钥名称、Key 或分组')}
|
||||
value={searchValue}
|
||||
onChange={(event) => setSearchValue(event.target.value)}
|
||||
allowClear
|
||||
/>
|
||||
</ConsoleFilterField>
|
||||
</ConsoleFilterGrid>
|
||||
</ConsoleCollectionSearch>
|
||||
|
||||
<Card className='km-card km-list-card'>
|
||||
<div className='km-list-head'>
|
||||
<div className='km-list-head console-list-tools'>
|
||||
<h2>{t('密钥列表')}</h2>
|
||||
<div className='km-list-actions'>
|
||||
<div className='km-list-actions console-list-tool-actions'>
|
||||
<Button
|
||||
type='link'
|
||||
className='km-contact-link'
|
||||
@@ -928,14 +926,6 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
>
|
||||
{t('创建密钥后不知道怎么用?联系客服')}
|
||||
</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<ActionPlus size={16} />}
|
||||
className='tour-create-btn'
|
||||
onClick={handleCreate}
|
||||
>
|
||||
{t('创建密钥')}
|
||||
</Button>
|
||||
<TableColumnSettings
|
||||
columns={COLUMN_OPTIONS.map((option) => ({
|
||||
key: option.value,
|
||||
@@ -945,6 +935,14 @@ const KeyManagement = ({ embedded = false }) => {
|
||||
defaultValue={COLUMN_OPTIONS.map((option) => option.value)}
|
||||
onChange={setVisibleColumns}
|
||||
/>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<ActionPlus size={16} />}
|
||||
className='tour-create-btn'
|
||||
onClick={handleCreate}
|
||||
>
|
||||
{t('创建密钥')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
.km-page {
|
||||
--km-page-bg: #f8fafc;
|
||||
--km-text: rgba(0, 0, 0, 0.88);
|
||||
--km-label: #6b7789;
|
||||
--km-search-border: #f0f0f0;
|
||||
--km-card-border: #e6e9ef;
|
||||
--km-card-shadow: 0 4px 24px rgba(15, 23, 42, 0.02);
|
||||
@@ -24,7 +23,6 @@
|
||||
html.dark .km-page {
|
||||
--km-page-bg: var(--surface-bg-base);
|
||||
--km-text: var(--uc-heading);
|
||||
--km-label: var(--text-secondary);
|
||||
--km-search-border: var(--border-subtle);
|
||||
--km-card-border: var(--border-subtle);
|
||||
--km-card-shadow: none;
|
||||
@@ -71,28 +69,6 @@ html.dark .km-page {
|
||||
box-shadow: var(--km-card-shadow);
|
||||
}
|
||||
|
||||
/* 查询标签与消费记录筛选标签一致;输入 620px,输入与按钮 16px,按钮间 8px。 */
|
||||
.km-search-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 21px;
|
||||
margin-bottom: 8px;
|
||||
color: var(--km-label);
|
||||
font-size: 13px;
|
||||
line-height: 1.5714285714285714;
|
||||
}
|
||||
.km-search-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.km-search-row .km-search-input {
|
||||
width: 620px;
|
||||
max-width: 100%;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
/* 列表卡头:标题 15px/600,与表格 18px(同使用记录表格卡) */
|
||||
.km-list-head {
|
||||
display: flex;
|
||||
@@ -328,10 +304,6 @@ html.dark .km-edit-drawer {
|
||||
.km-page-standalone .km-content.uc-page {
|
||||
padding-top: 80px;
|
||||
}
|
||||
.km-search-row .km-search-input {
|
||||
width: 100%;
|
||||
margin-right: 0;
|
||||
}
|
||||
.km-list-head {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
@@ -17,21 +17,23 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatUserReference } from '../../helpers/safeDisplay';
|
||||
import {
|
||||
Search as ActionSearch,
|
||||
RefreshCw as ActionRefreshCw,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons';
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import { ConsoleCollectionSearch } from '@/components/console/ConsoleCollection';
|
||||
import {
|
||||
ConsoleFilterField,
|
||||
ConsoleFilterGrid,
|
||||
} from '@/components/console/ConsolePrimitives';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { getQuotaPerUnit } from '../../helpers';
|
||||
import { timestamp2string } from '../../helpers/utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Form as AntForm, Tabs as AntTabs } from 'antd';
|
||||
import { Tabs as AntTabs } from 'antd';
|
||||
import { Table, Select, Button, Tag, Tooltip } from '@/components/ui';
|
||||
import { API } from '../../helpers/api';
|
||||
import { useOrgAuditLogs } from '../../hooks/org/useOrgData';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import { OrgFilterCard, OrgListCard } from './components/OrgListCard';
|
||||
import { OrgListCard } from './components/OrgListCard';
|
||||
import OrgPromptRecords from './OrgPromptRecords';
|
||||
import {
|
||||
formatQuotaAsCNY,
|
||||
@@ -402,35 +404,20 @@ const OrgAudit = ({ orgId }) => {
|
||||
|
||||
const operations = (
|
||||
<>
|
||||
<OrgFilterCard
|
||||
className='oc-audit-filter'
|
||||
actions={
|
||||
<>
|
||||
{/* 重置 = 选择“全部操作”;搜索 = 以当前筛选重新查询(同“刷新”) */}
|
||||
<Button onClick={() => applyAction('')}>{t('重置')}</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<ActionSearch size={16} />}
|
||||
onClick={refresh}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<AntForm layout='vertical' requiredMark={false} component='div'>
|
||||
<AntForm.Item label={t('操作类型')}>
|
||||
<ConsoleCollectionSearch className='oc-audit-filter'>
|
||||
<ConsoleFilterGrid onReset={() => applyAction('')} onSearch={refresh}>
|
||||
<ConsoleFilterField label={t('操作类型')} id='org-audit-action-type'>
|
||||
<Select
|
||||
id='org-audit-action-type'
|
||||
value={actionFilter}
|
||||
onChange={applyAction}
|
||||
optionList={actionOptions}
|
||||
style={{ width: '100%' }}
|
||||
placeholder={t('全部操作')}
|
||||
filter
|
||||
/>
|
||||
</AntForm.Item>
|
||||
</AntForm>
|
||||
</OrgFilterCard>
|
||||
</ConsoleFilterField>
|
||||
</ConsoleFilterGrid>
|
||||
</ConsoleCollectionSearch>
|
||||
|
||||
<OrgListCard
|
||||
title={t('操作记录')}
|
||||
@@ -453,7 +440,6 @@ const OrgAudit = ({ orgId }) => {
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize,
|
||||
showSizeChanger: false,
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
onPageSizeChange: (size) => {
|
||||
|
||||
@@ -482,7 +482,7 @@ const OrgBudgets = ({ orgId, featureFlags }) => {
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey='id'
|
||||
scroll={{ x: 1040 }}
|
||||
/>
|
||||
|
||||
@@ -335,21 +335,17 @@ const MemberUsageSheet = ({ visible, onClose, member, orgId, t }) => {
|
||||
rowKey='id'
|
||||
size='small'
|
||||
loading={loading}
|
||||
pagination={
|
||||
total > pageSize || pageSize !== 20
|
||||
? {
|
||||
currentPage: page,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: (p) => fetchLogs(p),
|
||||
onPageSizeChange: (size) => {
|
||||
pageSizeRef.current = size;
|
||||
setPageSize(size);
|
||||
fetchLogs(1, appliedFilters, size);
|
||||
},
|
||||
}
|
||||
: false
|
||||
}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize,
|
||||
total,
|
||||
onPageChange: (p) => fetchLogs(p),
|
||||
onPageSizeChange: (size) => {
|
||||
pageSizeRef.current = size;
|
||||
setPageSize(size);
|
||||
fetchLogs(1, appliedFilters, size);
|
||||
},
|
||||
}}
|
||||
empty={
|
||||
<div className='py-8 text-center'>
|
||||
<div className='inline-flex p-3 rounded-full bg-gray-100 dark:bg-neutral-800 mb-2'>
|
||||
@@ -384,10 +380,6 @@ const renderBudgetAmount = (quota) => {
|
||||
};
|
||||
|
||||
const OrgDashboard = ({ orgId, orgRole, orgName, featureFlags }) => {
|
||||
const quotaPaginationSizeRef = useRef(null);
|
||||
useEffect(() => {
|
||||
quotaPaginationSizeRef.current = null;
|
||||
}, [orgId]);
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const [statusState] = useContext(StatusContext);
|
||||
@@ -615,23 +607,16 @@ const OrgDashboard = ({ orgId, orgRole, orgName, featureFlags }) => {
|
||||
loading={quotaLoading}
|
||||
rowKey='member_id'
|
||||
scroll={{ x: 860 }}
|
||||
pagination={
|
||||
memberQuotaTotal > memberQuotaPageSize ||
|
||||
quotaPaginationSizeRef.current !== null
|
||||
? {
|
||||
currentPage: memberQuotaPage,
|
||||
pageSize: memberQuotaPageSize,
|
||||
total: memberQuotaTotal,
|
||||
showSizeChanger: false,
|
||||
onPageChange: (page) => fetchQuota(page, memberQuotaPageSize),
|
||||
onPageSizeChange: (size) => {
|
||||
quotaPaginationSizeRef.current = size;
|
||||
fetchQuota(1, size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}
|
||||
: false
|
||||
}
|
||||
pagination={{
|
||||
currentPage: memberQuotaPage,
|
||||
pageSize: memberQuotaPageSize,
|
||||
total: memberQuotaTotal,
|
||||
onPageChange: (page) => fetchQuota(page, memberQuotaPageSize),
|
||||
onPageSizeChange: (size) => {
|
||||
fetchQuota(1, size);
|
||||
},
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
empty={<OrgStateBlock icon={Users} title={t('暂无成员数据')} />}
|
||||
/>
|
||||
{memberQuotaRows.length > 0 && (
|
||||
|
||||
@@ -368,7 +368,7 @@ const OrgDeptManage = ({ orgId, featureFlags }) => {
|
||||
dataSource={members}
|
||||
loading={membersLoading}
|
||||
rowKey='id'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
empty={<Empty description={t('暂无成员')} />}
|
||||
/>
|
||||
</TabPane>
|
||||
@@ -407,7 +407,7 @@ const OrgDeptManage = ({ orgId, featureFlags }) => {
|
||||
columns={rankColumns}
|
||||
dataSource={ranking}
|
||||
rowKey='user_id'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
empty={<Empty description={t('暂无用量数据')} />}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -408,7 +408,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
</Text>
|
||||
<Table
|
||||
size='small'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
dataSource={directUsage}
|
||||
rowKey='skill_id'
|
||||
columns={[
|
||||
@@ -489,7 +489,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
) : (
|
||||
<Table
|
||||
size='small'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
dataSource={data.alerts || []}
|
||||
columns={[
|
||||
{ title: t('Skill'), dataIndex: 'dimension_id' },
|
||||
@@ -572,7 +572,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
</div>
|
||||
) : (
|
||||
<Table
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
dataSource={comparison}
|
||||
columns={[
|
||||
{ title: t('版本'), dataIndex: 'version_id' },
|
||||
@@ -670,7 +670,7 @@ const OrgEffectiveness = ({ orgId, canManagePolicy, canManageSkills }) => {
|
||||
</div>
|
||||
) : (
|
||||
<Table
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
dataSource={experiments}
|
||||
columns={[
|
||||
{ title: t('实验'), dataIndex: 'name' },
|
||||
|
||||
@@ -942,7 +942,7 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
dataSource={rankingRows}
|
||||
loading={rankingLoading}
|
||||
rowKey='rank_row_key'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
scroll={{ x: 790 }}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
@@ -957,7 +957,6 @@ const OrgLogs = ({ orgId, orgRole, isDeptManager = false }) => {
|
||||
currentPage: page,
|
||||
pageSize,
|
||||
total,
|
||||
showSizeChanger: false,
|
||||
onPageChange: (p) => doPageFetch(p),
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
Form,
|
||||
Toast,
|
||||
Tag,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Banner,
|
||||
Typography,
|
||||
Tooltip,
|
||||
@@ -42,8 +42,7 @@ import { API } from '../../helpers/api';
|
||||
import { showError, collectPagedItems } from '../../helpers';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import OrgPanel from './components/OrgPanel';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { OrgListCard } from './components/OrgListCard';
|
||||
import { OrgListCard, OrgRowActions } from './components/OrgListCard';
|
||||
import OrgModal from './components/OrgModal';
|
||||
import DeptTreeSelect from './components/DeptTreeSelect';
|
||||
import {
|
||||
@@ -391,7 +390,7 @@ const OrgMemberAccounts = ({
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 110,
|
||||
width: 260,
|
||||
render: (_, r) => {
|
||||
const managed = r.created_by_org_id === r.organization_id;
|
||||
// 与后端 model.ResetManagedMemberPassword 的分级拦截保持一致
|
||||
@@ -405,53 +404,53 @@ const OrgMemberAccounts = ({
|
||||
}
|
||||
const canReset = !resetBlockedReason;
|
||||
return (
|
||||
<TableRowActions
|
||||
items={[
|
||||
deptEnabled && {
|
||||
key: 'department',
|
||||
label: t('分配部门'),
|
||||
onClick: () => {
|
||||
<OrgRowActions>
|
||||
{deptEnabled && (
|
||||
<Button
|
||||
type='link'
|
||||
onClick={() => {
|
||||
setDeptAssignFor(r);
|
||||
setDeptAssignVal(r.department_id || 0);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'reset-password',
|
||||
label: t('重置密码'),
|
||||
disabled: !canReset,
|
||||
title: resetBlockedReason || undefined,
|
||||
onClick: () =>
|
||||
Modal.confirm({
|
||||
title: t('重置该账号密码?'),
|
||||
content: managed
|
||||
? t('将生成一次性临时密码,并要求首次登录改密')
|
||||
: t(
|
||||
'该成员为个人平台账号,重置后其平台登录密码同步失效,请将临时密码安全告知本人',
|
||||
),
|
||||
okText: t('确认'),
|
||||
cancelText: t('取消'),
|
||||
onOk: () => resetPassword(r),
|
||||
}),
|
||||
},
|
||||
r.status === 1 &&
|
||||
r.role !== 'owner' && {
|
||||
key: 'offboard',
|
||||
label: t('离职回收'),
|
||||
danger: true,
|
||||
onClick: () =>
|
||||
Modal.confirm({
|
||||
title: t('确认离职回收该成员?'),
|
||||
content: t(
|
||||
'将禁用其企业成员身份与全部企业 Token,保留历史,不删除用户',
|
||||
),
|
||||
okText: t('确认'),
|
||||
cancelText: t('取消'),
|
||||
okButtonProps: { danger: true },
|
||||
onOk: () => offboard(r.id),
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
}}
|
||||
>
|
||||
{t('分配部门')}
|
||||
</Button>
|
||||
)}
|
||||
{canReset ? (
|
||||
<Popconfirm
|
||||
title={t('重置该账号密码?')}
|
||||
content={
|
||||
managed
|
||||
? t('将生成一次性临时密码,并要求首次登录改密')
|
||||
: t(
|
||||
'该成员为个人平台账号,重置后其平台登录密码同步失效,请将临时密码安全告知本人',
|
||||
)
|
||||
}
|
||||
onConfirm={() => resetPassword(r)}
|
||||
>
|
||||
<Button type='link'>{t('重置密码')}</Button>
|
||||
</Popconfirm>
|
||||
) : (
|
||||
<Tooltip content={resetBlockedReason}>
|
||||
<Button type='link' disabled>
|
||||
{t('重置密码')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{r.status === 1 && r.role !== 'owner' && (
|
||||
<Popconfirm
|
||||
title={t('确认离职回收该成员?')}
|
||||
content={t(
|
||||
'将禁用其企业成员身份与全部企业 Token,保留历史,不删除用户',
|
||||
)}
|
||||
onConfirm={() => offboard(r.id)}
|
||||
>
|
||||
<Button type='link' danger>
|
||||
{t('离职回收')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</OrgRowActions>
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -512,8 +511,7 @@ const OrgMemberAccounts = ({
|
||||
dataSource={members}
|
||||
loading={loading}
|
||||
pagination={{
|
||||
pageSize: 15,
|
||||
showSizeChanger: false,
|
||||
resetOnDataChange: true,
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
rowKey='id'
|
||||
@@ -525,7 +523,7 @@ const OrgMemberAccounts = ({
|
||||
columns={columns}
|
||||
dataSource={members}
|
||||
loading={loading}
|
||||
pagination={{ pageSize: 15, showSizeChanger: false }}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey='id'
|
||||
/>
|
||||
</OrgPanel>
|
||||
@@ -711,7 +709,7 @@ const OrgMemberAccounts = ({
|
||||
/>
|
||||
<Table
|
||||
size='small'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey={(r) => `${r.row}`}
|
||||
dataSource={importResult.details || []}
|
||||
columns={[
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
Input,
|
||||
Select,
|
||||
Tag,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Toast,
|
||||
Tooltip,
|
||||
Switch,
|
||||
@@ -42,8 +42,7 @@ import QuotaInput from '../../components/common/ui/QuotaInput';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import OrgPanel from './components/OrgPanel';
|
||||
import { Alert as AntAlert, Tabs as AntTabs } from 'antd';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { OrgListCard } from './components/OrgListCard';
|
||||
import { OrgListCard, OrgRowActions } from './components/OrgListCard';
|
||||
import OrgModal from './components/OrgModal';
|
||||
import OrgMemberAccounts from './OrgMemberAccounts';
|
||||
|
||||
@@ -573,7 +572,7 @@ const OrgMembers = ({
|
||||
if (canWrite) {
|
||||
memberColumns.push({
|
||||
title: t('操作'),
|
||||
width: 110,
|
||||
width: 260,
|
||||
fixed: 'right',
|
||||
render: (_, record) => {
|
||||
if (record.role === 'owner') {
|
||||
@@ -581,13 +580,11 @@ const OrgMembers = ({
|
||||
}
|
||||
const isSelf = Number(record.user_id) === currentUserId;
|
||||
return (
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'quota',
|
||||
label: t('配额'),
|
||||
title: t('设置该成员的个人额度上限'),
|
||||
onClick: () => {
|
||||
<OrgRowActions>
|
||||
<Tooltip content={t('设置该成员的个人额度上限')}>
|
||||
<Button
|
||||
type='link'
|
||||
onClick={() => {
|
||||
setQuotaMemberId(record.id);
|
||||
setQuotaMemberName(
|
||||
record.display_name || record.username || '',
|
||||
@@ -595,13 +592,15 @@ const OrgMembers = ({
|
||||
setQuotaLimit(record.quota_limit || 0);
|
||||
setQuotaPeriod(record.quota_period || 'none');
|
||||
setQuotaModalVisible(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'models',
|
||||
label: t('模型'),
|
||||
title: t('设置该成员可用的模型范围'),
|
||||
onClick: async () => {
|
||||
}}
|
||||
>
|
||||
{t('配额')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip content={t('设置该成员可用的模型范围')}>
|
||||
<Button
|
||||
type='link'
|
||||
onClick={async () => {
|
||||
setModelLimitsMemberId(record.id);
|
||||
setModelLimitsMemberName(
|
||||
record.display_name || record.username || '',
|
||||
@@ -630,15 +629,22 @@ const OrgMembers = ({
|
||||
/* ignore */
|
||||
}
|
||||
setLoadingOrgModels(false);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'groups',
|
||||
label: t('分组'),
|
||||
title: isSelf
|
||||
}}
|
||||
>
|
||||
{t('模型')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
content={
|
||||
isSelf
|
||||
? t('不能修改自己的可调用分组')
|
||||
: t('设置该成员可调用的分组'),
|
||||
onClick: () => {
|
||||
: t('设置该成员可调用的分组')
|
||||
}
|
||||
>
|
||||
<Button
|
||||
type='link'
|
||||
disabled={isSelf}
|
||||
onClick={() => {
|
||||
if (isSelf) return;
|
||||
setGroupsMemberId(record.id);
|
||||
setGroupsMemberName(
|
||||
@@ -646,15 +652,16 @@ const OrgMembers = ({
|
||||
);
|
||||
setSelectedMemberGroups(parseMemberGroups(record));
|
||||
setGroupsModalVisible(true);
|
||||
},
|
||||
disabled: isSelf,
|
||||
},
|
||||
orgRole === 'owner' &&
|
||||
record.role === 'admin' && {
|
||||
key: 'permissions',
|
||||
label: t('权限'),
|
||||
title: t('设置该管理员的细粒度权限'),
|
||||
onClick: () => {
|
||||
}}
|
||||
>
|
||||
{t('分组')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
{orgRole === 'owner' && record.role === 'admin' && (
|
||||
<Tooltip content={t('设置该管理员的细粒度权限')}>
|
||||
<Button
|
||||
type='link'
|
||||
onClick={() => {
|
||||
setPermMemberId(record.id);
|
||||
setPermMemberName(
|
||||
record.display_name || record.username || '',
|
||||
@@ -678,25 +685,23 @@ const OrgMembers = ({
|
||||
smart_router_manage: !!perms.smart_router_manage,
|
||||
});
|
||||
setPermModalVisible(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'remove',
|
||||
label: t('移除'),
|
||||
danger: true,
|
||||
onClick: () =>
|
||||
Modal.confirm({
|
||||
title: t(
|
||||
'确定移除该成员?移除后该成员将失去企业访问权限。',
|
||||
),
|
||||
okText: t('确认'),
|
||||
cancelText: t('取消'),
|
||||
okButtonProps: { danger: true },
|
||||
onOk: () => handleRemove(record.id),
|
||||
}),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
}}
|
||||
>
|
||||
{t('权限')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip content={t('从企业中移除该成员')}>
|
||||
<Popconfirm
|
||||
title={t('确定移除该成员?移除后该成员将失去企业访问权限。')}
|
||||
onConfirm={() => handleRemove(record.id)}
|
||||
>
|
||||
<Button type='link' danger>
|
||||
{t('移除')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Tooltip>
|
||||
</OrgRowActions>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
OctagonX as ActionOctagonX,
|
||||
Code2 as ActionCode2,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -218,115 +217,118 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
currentUserId > 0 && Number(row.version?.created_by) === currentUserId;
|
||||
const isReviewer =
|
||||
currentUserId > 0 && Number(row.review?.reviewer_id) === currentUserId;
|
||||
const [primaryAction, ...moreActions] = [
|
||||
{
|
||||
key: 'new-version',
|
||||
label: t('新版本'),
|
||||
onClick: () => {
|
||||
setEditingSkill(row.definition);
|
||||
setForm({
|
||||
...blankSkill,
|
||||
canonical_id: row.definition.canonical_id,
|
||||
});
|
||||
setEditorVisible(true);
|
||||
},
|
||||
disabled: row.definition.emergency_stopped,
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
label: t('历史版本'),
|
||||
onClick: () => openHistory(row.definition),
|
||||
},
|
||||
{
|
||||
key: 'runtime',
|
||||
label: t('执行模型实测'),
|
||||
onClick: () => {
|
||||
// Clear residue from a previous version's test before reopening.
|
||||
setEvidence({ model: '', input: '' });
|
||||
setEvidenceVersion(versionId);
|
||||
},
|
||||
disabled: !versionId,
|
||||
},
|
||||
{
|
||||
key: 'claim',
|
||||
label:
|
||||
isAuthor && row.review?.status === 'pending'
|
||||
? t('待他人审核')
|
||||
: t('领取审核'),
|
||||
onClick: () =>
|
||||
action(`/api/org/skills/private/versions/${versionId}/review/start`),
|
||||
disabled: !versionId || row.review?.status !== 'pending' || isAuthor,
|
||||
},
|
||||
{
|
||||
key: 'approve',
|
||||
label: t('通过'),
|
||||
onClick: () =>
|
||||
action(
|
||||
`/api/org/skills/private/versions/${versionId}/review/decision`,
|
||||
{ approved: true, conclusion: { decision: 'approved' } },
|
||||
),
|
||||
disabled:
|
||||
!versionId || row.review?.status !== 'reviewing' || !isReviewer,
|
||||
icon: <ActionFileCheck2 size={14} />,
|
||||
},
|
||||
{
|
||||
key: 'reject',
|
||||
label: t('驳回'),
|
||||
onClick: () =>
|
||||
action(
|
||||
`/api/org/skills/private/versions/${versionId}/review/decision`,
|
||||
{ approved: false, conclusion: { decision: 'rejected' } },
|
||||
),
|
||||
disabled:
|
||||
!versionId || row.review?.status !== 'reviewing' || !isReviewer,
|
||||
danger: true,
|
||||
},
|
||||
{
|
||||
key: 'publish',
|
||||
label: t('发布'),
|
||||
onClick: () =>
|
||||
action(`/api/org/skills/private/versions/${versionId}/publish`),
|
||||
disabled: !versionId || row.review?.status !== 'approved',
|
||||
},
|
||||
{
|
||||
key: 'rollback',
|
||||
label: t('回滚'),
|
||||
onClick: () =>
|
||||
askReason(t('回滚到当前列表版本'), (reason) =>
|
||||
action(
|
||||
`/api/org/skills/private/${row.definition.id}/versions/${versionId}/rollback`,
|
||||
{ reason },
|
||||
),
|
||||
),
|
||||
disabled: !versionId,
|
||||
icon: <ActionRotateCcw size={14} />,
|
||||
},
|
||||
{
|
||||
key: 'stop',
|
||||
label: t('紧急停用'),
|
||||
onClick: () =>
|
||||
askReason(t('紧急停用 Skill'), (reason) =>
|
||||
action(
|
||||
`/api/org/skills/private/${row.definition.id}/emergency-stop`,
|
||||
{ reason },
|
||||
),
|
||||
),
|
||||
disabled: row.definition.emergency_stopped,
|
||||
icon: <ActionOctagonX size={14} />,
|
||||
danger: true,
|
||||
},
|
||||
];
|
||||
return (
|
||||
<TableRowActions items={moreActions}>
|
||||
<div className='flex flex-wrap gap-2'>
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
disabled={primaryAction.disabled}
|
||||
onClick={primaryAction.onClick}
|
||||
disabled={row.definition.emergency_stopped}
|
||||
onClick={() => {
|
||||
setEditingSkill(row.definition);
|
||||
setForm({
|
||||
...blankSkill,
|
||||
canonical_id: row.definition.canonical_id,
|
||||
});
|
||||
setEditorVisible(true);
|
||||
}}
|
||||
>
|
||||
{primaryAction.label}
|
||||
{t('新版本')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
<Button size='small' onClick={() => openHistory(row.definition)}>
|
||||
{t('历史版本')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
disabled={!versionId}
|
||||
onClick={() => {
|
||||
// Clear residue from a previous version's test before reopening.
|
||||
setEvidence({ model: '', input: '' });
|
||||
setEvidenceVersion(versionId);
|
||||
}}
|
||||
>
|
||||
{t('执行模型实测')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
disabled={!versionId || row.review?.status !== 'pending' || isAuthor}
|
||||
onClick={() =>
|
||||
action(`/api/org/skills/private/versions/${versionId}/review/start`)
|
||||
}
|
||||
>
|
||||
{isAuthor && row.review?.status === 'pending'
|
||||
? t('待他人审核')
|
||||
: t('领取审核')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
icon={<ActionFileCheck2 size={14} />}
|
||||
disabled={
|
||||
!versionId || row.review?.status !== 'reviewing' || !isReviewer
|
||||
}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/org/skills/private/versions/${versionId}/review/decision`,
|
||||
{ approved: true, conclusion: { decision: 'approved' } },
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('通过')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
type='danger'
|
||||
disabled={
|
||||
!versionId || row.review?.status !== 'reviewing' || !isReviewer
|
||||
}
|
||||
onClick={() =>
|
||||
action(
|
||||
`/api/org/skills/private/versions/${versionId}/review/decision`,
|
||||
{ approved: false, conclusion: { decision: 'rejected' } },
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('驳回')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
disabled={!versionId || row.review?.status !== 'approved'}
|
||||
onClick={() =>
|
||||
action(`/api/org/skills/private/versions/${versionId}/publish`)
|
||||
}
|
||||
>
|
||||
{t('发布')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
icon={<ActionRotateCcw size={14} />}
|
||||
disabled={!versionId}
|
||||
onClick={() =>
|
||||
askReason(t('回滚到当前列表版本'), (reason) =>
|
||||
action(
|
||||
`/api/org/skills/private/${row.definition.id}/versions/${versionId}/rollback`,
|
||||
{ reason },
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('回滚')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
type='danger'
|
||||
icon={<ActionOctagonX size={14} />}
|
||||
disabled={row.definition.emergency_stopped}
|
||||
onClick={() =>
|
||||
askReason(t('紧急停用 Skill'), (reason) =>
|
||||
action(
|
||||
`/api/org/skills/private/${row.definition.id}/emergency-stop`,
|
||||
{ reason },
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('紧急停用')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const openCreateEditor = () => {
|
||||
@@ -458,7 +460,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</div>
|
||||
) : (
|
||||
<Table
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
dataSource={items}
|
||||
rowKey={(row) => row.definition.id}
|
||||
columns={[
|
||||
@@ -498,7 +500,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 170,
|
||||
width: 430,
|
||||
render: (_, row) => renderSkillActions(row),
|
||||
},
|
||||
]}
|
||||
@@ -613,7 +615,7 @@ const OrgPrivateSkills = ({ orgId }) => {
|
||||
</div>
|
||||
) : (
|
||||
<Table
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
dataSource={history}
|
||||
rowKey={(row) => row.version.id}
|
||||
columns={[
|
||||
|
||||
@@ -293,7 +293,7 @@ const OrgProjectManage = ({ orgId }) => {
|
||||
dataSource={members}
|
||||
loading={loading}
|
||||
rowKey='org_member_id'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
empty={<Empty description={t('暂无项目成员')} />}
|
||||
/>
|
||||
</OrgPanel>
|
||||
|
||||
@@ -37,8 +37,7 @@ import {
|
||||
import { API } from '../../helpers/api';
|
||||
import { showError, collectPagedItems } from '../../helpers';
|
||||
import OrgPageHeader from './components/OrgPageHeader';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { OrgListCard } from './components/OrgListCard';
|
||||
import { OrgListCard, OrgRowActions } from './components/OrgListCard';
|
||||
import OrgModal from './components/OrgModal';
|
||||
import OrgScopedLimitButtons from './components/OrgScopedLimitButtons';
|
||||
|
||||
@@ -310,6 +309,7 @@ const OrgProjects = ({ orgId }) => {
|
||||
}));
|
||||
}, [members, projectMembers]);
|
||||
|
||||
// 列宽与渲染对齐原型 EnterpriseProjects(150/350/120/140/300,scroll.x 1060);
|
||||
const columns = [
|
||||
{
|
||||
title: t('项目编码'),
|
||||
@@ -352,36 +352,27 @@ const OrgProjects = ({ orgId }) => {
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 168,
|
||||
width: 300,
|
||||
render: (_, record) => (
|
||||
<OrgScopedLimitButtons
|
||||
orgId={orgId}
|
||||
record={record}
|
||||
apiBase='/api/org/project'
|
||||
scopeLabel='项目'
|
||||
onSaved={fetchList}
|
||||
renderActions={(limitItems) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
...limitItems,
|
||||
{
|
||||
key: 'members',
|
||||
label: t('成员'),
|
||||
onClick: () => openMembers(record),
|
||||
},
|
||||
{
|
||||
key: 'tokens',
|
||||
label: t('密钥'),
|
||||
onClick: () => openTokens(record),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Button type='link' size='small' onClick={() => openEdit(record)}>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
)}
|
||||
/>
|
||||
<OrgRowActions>
|
||||
<OrgScopedLimitButtons
|
||||
orgId={orgId}
|
||||
record={record}
|
||||
apiBase='/api/org/project'
|
||||
scopeLabel='项目'
|
||||
onSaved={fetchList}
|
||||
variant='link'
|
||||
/>
|
||||
<Button type='link' onClick={() => openMembers(record)}>
|
||||
{t('成员')}
|
||||
</Button>
|
||||
<Button type='link' onClick={() => openTokens(record)}>
|
||||
{t('密钥')}
|
||||
</Button>
|
||||
<Button type='link' onClick={() => openEdit(record)}>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</OrgRowActions>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -416,8 +407,7 @@ const OrgProjects = ({ orgId }) => {
|
||||
dataSource={list}
|
||||
loading={loading}
|
||||
pagination={{
|
||||
pageSize: 15,
|
||||
showSizeChanger: false,
|
||||
resetOnDataChange: true,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
}}
|
||||
rowKey='id'
|
||||
@@ -529,7 +519,7 @@ const OrgProjects = ({ orgId }) => {
|
||||
},
|
||||
]}
|
||||
dataSource={projectMembers}
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey='org_member_id'
|
||||
size='small'
|
||||
/>
|
||||
@@ -589,7 +579,7 @@ const OrgProjects = ({ orgId }) => {
|
||||
},
|
||||
]}
|
||||
dataSource={orgTokens}
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey='id'
|
||||
size='small'
|
||||
/>
|
||||
|
||||
@@ -29,6 +29,7 @@ import i18next from 'i18next';
|
||||
import { Database, MessageSquareText, SlidersHorizontal } from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
Pagination,
|
||||
Button,
|
||||
Input,
|
||||
Select,
|
||||
@@ -61,6 +62,8 @@ const PromptCallDetails = ({ orgId, groupKey }) => {
|
||||
const quotaPerUnit = getQuotaPerUnit();
|
||||
const [calls, setCalls] = useState(null); // null = 加载中
|
||||
const [error, setError] = useState('');
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
@@ -89,6 +92,10 @@ const PromptCallDetails = ({ orgId, groupKey }) => {
|
||||
};
|
||||
}, [orgId, groupKey, t]);
|
||||
|
||||
useEffect(() => {
|
||||
setPage(1);
|
||||
}, [calls]);
|
||||
|
||||
if (calls === null) {
|
||||
return (
|
||||
<div className='text-xs text-gray-400 dark:text-gray-500 mt-2'>
|
||||
@@ -134,7 +141,7 @@ const PromptCallDetails = ({ orgId, groupKey }) => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{calls.map((log) => (
|
||||
{calls.slice((page - 1) * pageSize, page * pageSize).map((log) => (
|
||||
<tr
|
||||
key={log.id}
|
||||
className='border-t border-gray-100 dark:border-white/[0.06]'
|
||||
@@ -160,6 +167,18 @@ const PromptCallDetails = ({ orgId, groupKey }) => {
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<Pagination
|
||||
className='mt-4'
|
||||
align='end'
|
||||
currentPage={page}
|
||||
pageSize={pageSize}
|
||||
total={calls.length}
|
||||
onPageChange={setPage}
|
||||
onPageSizeChange={(size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -271,8 +271,7 @@ const OrgRequests = ({ orgId, orgRole, featureFlags }) => {
|
||||
loading={loading}
|
||||
empty={<TableEmpty />}
|
||||
pagination={{
|
||||
pageSize: 15,
|
||||
showSizeChanger: false,
|
||||
resetOnDataChange: true,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
}}
|
||||
rowKey='id'
|
||||
|
||||
@@ -309,7 +309,7 @@ const OrgSkillAssignments = ({ orgId, orgRole = '' }) => {
|
||||
columns={columns}
|
||||
dataSource={items}
|
||||
rowKey='id'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
/>
|
||||
)}
|
||||
</OrgPanel>
|
||||
|
||||
@@ -52,7 +52,6 @@ import {
|
||||
TextArea,
|
||||
} from '@/components/ui';
|
||||
import { useOrgTokens } from '../../hooks/org/useOrgData';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import {
|
||||
API,
|
||||
copy,
|
||||
@@ -145,9 +144,6 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
fetchTokenKey,
|
||||
} = useOrgTokens(orgId);
|
||||
const [page, setPage] = useState(1);
|
||||
// 窄屏下两侧固定列(名称+操作≈400px)会占满可视宽度,中间列无处可显示,故仅桌面端固定
|
||||
const isMobile = useIsMobile();
|
||||
const fixedSide = (side) => (isMobile ? undefined : side);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [visibleColumns, setVisibleColumns] = useState([
|
||||
'name',
|
||||
@@ -307,9 +303,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
title: t('名称'),
|
||||
key: 'name',
|
||||
dataIndex: 'name',
|
||||
width: 230,
|
||||
// 列数较多,常规桌面宽度也会横向滚动:名称与操作列固定在两侧,滚动时始终可见
|
||||
fixed: fixedSide('left'),
|
||||
width: 150,
|
||||
ellipsis: { showTitle: false },
|
||||
render: (name, record) => (
|
||||
<Tooltip content={name} position='topLeft'>
|
||||
@@ -333,7 +327,7 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
title: t('密钥'),
|
||||
key: 'key',
|
||||
dataIndex: 'key',
|
||||
width: 335,
|
||||
width: 300,
|
||||
render: (key, record) => {
|
||||
// key 为后端脱敏值(前 4 + **** + 后 4)
|
||||
const fullKey = revealedKeys[record.id];
|
||||
@@ -529,7 +523,6 @@ const OrgTokens = ({ orgId, orgRole }) => {
|
||||
title: t('操作'),
|
||||
key: 'actions',
|
||||
width: 90,
|
||||
fixed: fixedSide('right'),
|
||||
render: (_, record) => {
|
||||
// 管理员/超管可操作所有Token,普通成员只能操作自己创建的。
|
||||
if (!canOperateRow(record)) return '-';
|
||||
|
||||
@@ -179,11 +179,6 @@ const OrgAnalyticsPanel = ({
|
||||
const [trendRows, setTrendRows] = useState([]);
|
||||
const [prevRows, setPrevRows] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [detailPage, setDetailPage] = useState(1);
|
||||
|
||||
useEffect(() => {
|
||||
setDetailPage(1);
|
||||
}, [breakdownRows, dimension, rangeDays]);
|
||||
|
||||
useEffect(() => {
|
||||
initVChartTheme({ isWatchingThemeSwitch: true });
|
||||
@@ -513,16 +508,7 @@ const OrgAnalyticsPanel = ({
|
||||
dataSource={breakdownRows}
|
||||
rowKey='key'
|
||||
scroll={{ x: 880 }}
|
||||
pagination={{
|
||||
currentPage: Math.min(
|
||||
detailPage,
|
||||
Math.max(1, Math.ceil(breakdownRows.length / 10)),
|
||||
),
|
||||
pageSize: 10,
|
||||
showSizeChanger: false,
|
||||
onPageChange: setDetailPage,
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
}}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
/>
|
||||
)}
|
||||
</AntCard>
|
||||
|
||||
@@ -59,7 +59,7 @@ const OrgScopedLimitButtons = ({
|
||||
apiBase,
|
||||
scopeLabel,
|
||||
onSaved,
|
||||
renderActions,
|
||||
variant = 'default',
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -171,47 +171,46 @@ const OrgScopedLimitButtons = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
{renderActions ? (
|
||||
renderActions([
|
||||
{ key: 'models', label: t('模型'), onClick: openModelModal },
|
||||
{ key: 'groups', label: t('分组'), onClick: openGroupsModal },
|
||||
])
|
||||
) : (
|
||||
<>
|
||||
<Tooltip
|
||||
content={t(
|
||||
'设置该{{scope}}成员默认可用的模型范围(与成员/项目/部门限制取交集)',
|
||||
{ scope: t(scopeLabel) },
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='light'
|
||||
type={modelConfigured ? 'primary' : 'tertiary'}
|
||||
icon={<ActionLayers size={14} />}
|
||||
onClick={openModelModal}
|
||||
>
|
||||
{t('模型')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
content={t(
|
||||
'设置该{{scope}}成员默认可调用的分组(与成员/项目/部门限制取交集)',
|
||||
{ scope: t(scopeLabel) },
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='light'
|
||||
type={groupConfigured ? 'primary' : 'tertiary'}
|
||||
icon={<ActionLayers size={14} />}
|
||||
onClick={openGroupsModal}
|
||||
>
|
||||
{t('分组')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</>
|
||||
)}
|
||||
<Tooltip
|
||||
content={t(
|
||||
'设置该{{scope}}成员默认可用的模型范围(与成员/项目/部门限制取交集)',
|
||||
{ scope: t(scopeLabel) },
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
{...(variant === 'link'
|
||||
? { type: 'link' }
|
||||
: {
|
||||
size: 'small',
|
||||
theme: 'light',
|
||||
type: modelConfigured ? 'primary' : 'tertiary',
|
||||
icon: <ActionLayers size={14} />,
|
||||
})}
|
||||
onClick={openModelModal}
|
||||
>
|
||||
{t('模型')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
content={t(
|
||||
'设置该{{scope}}成员默认可调用的分组(与成员/项目/部门限制取交集)',
|
||||
{ scope: t(scopeLabel) },
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
{...(variant === 'link'
|
||||
? { type: 'link' }
|
||||
: {
|
||||
size: 'small',
|
||||
theme: 'light',
|
||||
type: groupConfigured ? 'primary' : 'tertiary',
|
||||
icon: <ActionLayers size={14} />,
|
||||
})}
|
||||
onClick={openGroupsModal}
|
||||
>
|
||||
{t('分组')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
{/* 模型限制 Modal */}
|
||||
<OrgModal
|
||||
|
||||
@@ -23,12 +23,10 @@ import {
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import TableEmpty from '../../../components/common/table/TableEmpty';
|
||||
import React, { useMemo } from 'react';
|
||||
import Table from '../../../components/ui/CenterActionTable';
|
||||
import { Card, Tag } from 'antd';
|
||||
import { Clock } from 'lucide-react';
|
||||
import { Button, Pagination } from '@/components/ui';
|
||||
import { Button, Table } from '@/components/ui';
|
||||
import { useTaskLogsData } from '../../../hooks/task-logs/useTaskLogsData';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { timestamp2string } from '../../../helpers';
|
||||
import { getTaskLogsColumns } from '../../../components/table/task-logs/TaskLogsColumnDefs';
|
||||
import TaskLogsFilters from '../../../components/table/task-logs/TaskLogsFilters';
|
||||
@@ -76,7 +74,6 @@ const OrgTaskRecords = () => {
|
||||
openVideoModal,
|
||||
visibleColumns,
|
||||
} = taskLogsData;
|
||||
const isMobile = useIsMobile();
|
||||
// 仅用于“实时更新中”提示(存在进行中任务时轮询);原型无“本页统计”区块,不渲染
|
||||
const pageStats = useTaskPageStats(logs);
|
||||
|
||||
@@ -257,26 +254,16 @@ const OrgTaskRecords = () => {
|
||||
dataSource={logs}
|
||||
rowKey='key'
|
||||
loading={loading}
|
||||
pagination={false}
|
||||
scroll={{ x: scrollX }}
|
||||
locale={{
|
||||
emptyText: <TableEmpty />,
|
||||
pagination={{
|
||||
currentPage: taskLogsData.activePage,
|
||||
pageSize: taskLogsData.pageSize,
|
||||
total: taskLogsData.logCount,
|
||||
onPageSizeChange: taskLogsData.handlePageSizeChange,
|
||||
onPageChange: taskLogsData.handlePageChange,
|
||||
}}
|
||||
scroll={{ x: scrollX }}
|
||||
empty={<TableEmpty />}
|
||||
/>
|
||||
{taskLogsData.logCount > 0 && (
|
||||
<Pagination
|
||||
currentPage={taskLogsData.activePage}
|
||||
pageSize={taskLogsData.pageSize}
|
||||
total={taskLogsData.logCount}
|
||||
pageSizeOpts={[10, 20, 50]}
|
||||
showSizeChanger
|
||||
onPageSizeChange={taskLogsData.handlePageSizeChange}
|
||||
onPageChange={taskLogsData.handlePageChange}
|
||||
preventPageChangeOnPageSizeChange={false}
|
||||
showQuickJumper={isMobile}
|
||||
showTotal={(total) => t('共 {{total}} 条', { total })}
|
||||
/>
|
||||
)}
|
||||
</OrgListCard>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -296,7 +296,7 @@ const OrgDsRules = ({ orgId, isSuperAdmin }) => {
|
||||
<Table
|
||||
columns={customColumns}
|
||||
dataSource={customRules}
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey='id'
|
||||
size='small'
|
||||
scroll={{ x: 'max(100%, 900px)' }}
|
||||
@@ -320,7 +320,7 @@ const OrgDsRules = ({ orgId, isSuperAdmin }) => {
|
||||
<Table
|
||||
columns={platformColumns}
|
||||
dataSource={platformRules.map((r, i) => ({ ...r, _key: i }))}
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
rowKey='_key'
|
||||
size='small'
|
||||
scroll={{ x: 'max(100%, 640px)' }}
|
||||
|
||||
@@ -26,7 +26,7 @@ import React, {
|
||||
} from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Alert, Button, Tag, Typography } from 'antd';
|
||||
import Table from '../../../components/ui/CenterActionTable';
|
||||
import { Table } from '@/components/ui';
|
||||
// 流水入口:ActionIcons 无 ScrollText,使用账本语义的 ReceiptText
|
||||
import { ReceiptText as ScrollText } from '@/components/common/icons/ActionIcons';
|
||||
import {
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import OrgStatCard from '../components/OrgStatCard';
|
||||
import OrgStateBlock from '../components/OrgStateBlock';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { OrgRowActions } from '../components/OrgListCard';
|
||||
import { renderQuota } from '../../../helpers/render';
|
||||
import { deptFundApi } from './fundApi';
|
||||
import { FUND_STATE, buildFundTree } from './fundFormat';
|
||||
@@ -193,39 +193,30 @@ const DeptFundsPanel = ({ orgId, deptId, deptName, refreshKey }) => {
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 168,
|
||||
width: 210,
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<TableRowActions
|
||||
items={
|
||||
canTransfer
|
||||
? [
|
||||
r.account && {
|
||||
key: 'ledger',
|
||||
label: t('流水'),
|
||||
onClick: () =>
|
||||
setLedgerAccount({ id: r.account.id, name: r.name }),
|
||||
},
|
||||
{
|
||||
key: 'recall',
|
||||
label: t('回收'),
|
||||
onClick: () => setTransfer({ mode: 'recall', row: r }),
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
>
|
||||
<OrgRowActions>
|
||||
{canTransfer && (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
disabled={centerDisabled || r.dept_status === 2}
|
||||
onClick={() => setTransfer({ mode: 'allocate', row: r })}
|
||||
>
|
||||
{t('分配')}
|
||||
</Button>
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
disabled={centerDisabled || r.dept_status === 2}
|
||||
onClick={() => setTransfer({ mode: 'allocate', row: r })}
|
||||
>
|
||||
{t('分配')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
onClick={() => setTransfer({ mode: 'recall', row: r })}
|
||||
>
|
||||
{t('回收')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{!canTransfer && r.account && (
|
||||
{r.account && (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
@@ -236,7 +227,7 @@ const DeptFundsPanel = ({ orgId, deptId, deptName, refreshKey }) => {
|
||||
{t('流水')}
|
||||
</Button>
|
||||
)}
|
||||
</TableRowActions>
|
||||
</OrgRowActions>
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -349,7 +340,7 @@ const DeptFundsPanel = ({ orgId, deptId, deptName, refreshKey }) => {
|
||||
dataSource={tree}
|
||||
loading={loading}
|
||||
rowKey='key'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
expandable={{ defaultExpandAllRows: true }}
|
||||
size='middle'
|
||||
scroll={{ x: 860 }}
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
fundEntryLabel,
|
||||
} from './fundFormat';
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
const DEFAULT_PAGE_SIZE = 20;
|
||||
const defaultRange = () => {
|
||||
const end = new Date();
|
||||
return [new Date(end.getTime() - 30 * 24 * 3600 * 1000), end];
|
||||
@@ -51,6 +51,7 @@ const FundLedgerSheet = ({ visible, account, fetchLedger, onClose }) => {
|
||||
const [range, setRange] = useState(defaultRange);
|
||||
const [types, setTypes] = useState([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(DEFAULT_PAGE_SIZE);
|
||||
const [items, setItems] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -77,7 +78,7 @@ const FundLedgerSheet = ({ visible, account, fetchLedger, onClose }) => {
|
||||
end_timestamp: end ? Math.floor(end.getTime() / 1000) : undefined,
|
||||
type: types.length ? types.join(',') : undefined,
|
||||
p: page,
|
||||
page_size: PAGE_SIZE,
|
||||
page_size: pageSize,
|
||||
});
|
||||
if (seq !== seqRef.current) return;
|
||||
if (res?.data?.success) {
|
||||
@@ -92,7 +93,7 @@ const FundLedgerSheet = ({ visible, account, fetchLedger, onClose }) => {
|
||||
} finally {
|
||||
if (seq === seqRef.current) setLoading(false);
|
||||
}
|
||||
}, [visible, account?.id, range, types, page, fetchLedger, t]);
|
||||
}, [visible, account?.id, range, types, page, pageSize, fetchLedger, t]);
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
@@ -263,8 +264,11 @@ const FundLedgerSheet = ({ visible, account, fetchLedger, onClose }) => {
|
||||
scroll={{ x: 'max-content' }}
|
||||
pagination={{
|
||||
currentPage: page,
|
||||
pageSize: PAGE_SIZE,
|
||||
showSizeChanger: false,
|
||||
pageSize,
|
||||
onPageSizeChange: (size) => {
|
||||
setPage(1);
|
||||
setPageSize(size);
|
||||
},
|
||||
total,
|
||||
onPageChange: setPage,
|
||||
showTotal: (n) => t('共 {{total}} 条', { total: n }),
|
||||
|
||||
@@ -28,14 +28,14 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Alert, Button, Switch, Tag, Typography } from 'antd';
|
||||
import { Building2, Layers, PiggyBank, Power, Wallet } from 'lucide-react';
|
||||
import Table from '../../../components/ui/CenterActionTable';
|
||||
import { Table } from '@/components/ui';
|
||||
// 流水入口:ActionIcons 无 ScrollText,使用账本语义的 ReceiptText
|
||||
import { ReceiptText as ScrollText } from '@/components/common/icons/ActionIcons';
|
||||
import OrgPanel from '../components/OrgPanel';
|
||||
import OrgStatCard from '../components/OrgStatCard';
|
||||
import OrgStateBlock from '../components/OrgStateBlock';
|
||||
import OrgModal from '../components/OrgModal';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { OrgRowActions } from '../components/OrgListCard';
|
||||
import { showError, showSuccess } from '../../../helpers/utils';
|
||||
import { renderQuota } from '../../../helpers/render';
|
||||
import { orgFundApi } from './fundApi';
|
||||
@@ -279,41 +279,32 @@ const OrgDeptFunds = ({ orgId }) => {
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 168,
|
||||
width: 220,
|
||||
fixed: 'right',
|
||||
render: (_, r) => {
|
||||
const isArchived = r.account?.status === FUND_ACCOUNT_STATUS.ARCHIVED;
|
||||
return (
|
||||
<TableRowActions
|
||||
items={
|
||||
canTransfer && !isArchived
|
||||
? [
|
||||
r.account && {
|
||||
key: 'ledger',
|
||||
label: t('流水'),
|
||||
onClick: () =>
|
||||
setLedgerAccount({ id: r.account.id, name: r.name }),
|
||||
},
|
||||
{
|
||||
key: 'recall',
|
||||
label: t('回收'),
|
||||
onClick: () => setTransfer({ mode: 'recall', row: r }),
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
>
|
||||
<OrgRowActions>
|
||||
{canTransfer && !isArchived && (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
disabled={r.dept_status === 2}
|
||||
onClick={() => setTransfer({ mode: 'allocate', row: r })}
|
||||
>
|
||||
{t('分配')}
|
||||
</Button>
|
||||
<>
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
disabled={r.dept_status === 2}
|
||||
onClick={() => setTransfer({ mode: 'allocate', row: r })}
|
||||
>
|
||||
{t('分配')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
onClick={() => setTransfer({ mode: 'recall', row: r })}
|
||||
>
|
||||
{t('回收')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{(!canTransfer || isArchived) && r.account && (
|
||||
{r.account && (
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
@@ -324,7 +315,7 @@ const OrgDeptFunds = ({ orgId }) => {
|
||||
{t('流水')}
|
||||
</Button>
|
||||
)}
|
||||
</TableRowActions>
|
||||
</OrgRowActions>
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -495,7 +486,7 @@ const OrgDeptFunds = ({ orgId }) => {
|
||||
dataSource={[...tree, ...(includeArchived ? archivedRows : [])]}
|
||||
loading={loading}
|
||||
rowKey='key'
|
||||
pagination={false}
|
||||
pagination={{ resetOnDataChange: true }}
|
||||
expandable={{ defaultExpandAllRows: true }}
|
||||
size='middle'
|
||||
scroll={{ x: 900 }}
|
||||
|
||||
@@ -18,7 +18,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { Trans } from 'react-i18next';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -594,40 +593,7 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
{
|
||||
title: t('操作'),
|
||||
render: (_, row) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'reconcile',
|
||||
label: t('触发对账'),
|
||||
onClick: () => reconcileOperationOrder(row.trade_no),
|
||||
disabled: !row.third_trade_no,
|
||||
},
|
||||
{
|
||||
key: 'expire',
|
||||
label: t('确认未付款并过期'),
|
||||
onClick: () => {
|
||||
setExpireOrder(row);
|
||||
setForceExpire(false);
|
||||
setForceExpireConfirmed(false);
|
||||
setExpireReason(t('确认该订单未完成 PayPal 支付'));
|
||||
},
|
||||
danger: true,
|
||||
},
|
||||
{
|
||||
key: 'force-expire',
|
||||
label: t('强制过期'),
|
||||
onClick: () => {
|
||||
setExpireOrder(row);
|
||||
setForceExpire(true);
|
||||
setForceExpireConfirmed(false);
|
||||
setExpireReason(
|
||||
t('管理员确认远端状态无法核验,强制关闭该 PayPal 订单'),
|
||||
);
|
||||
},
|
||||
danger: true,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div className='flex flex-wrap gap-2'>
|
||||
<Button
|
||||
htmlType='button'
|
||||
onClick={() => inspectOperationOrder(row.trade_no)}
|
||||
@@ -636,7 +602,45 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
>
|
||||
{t('查询远端状态')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
<Button
|
||||
htmlType='button'
|
||||
onClick={() => reconcileOperationOrder(row.trade_no)}
|
||||
disabled={!row.third_trade_no}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('触发对账')}
|
||||
</Button>
|
||||
<Button
|
||||
htmlType='button'
|
||||
onClick={() => {
|
||||
setExpireOrder(row);
|
||||
setForceExpire(false);
|
||||
setForceExpireConfirmed(false);
|
||||
setExpireReason(t('确认该订单未完成 PayPal 支付'));
|
||||
}}
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
>
|
||||
{t('确认未付款并过期')}
|
||||
</Button>
|
||||
<Button
|
||||
htmlType='button'
|
||||
onClick={() => {
|
||||
setExpireOrder(row);
|
||||
setForceExpire(true);
|
||||
setForceExpireConfirmed(false);
|
||||
setExpireReason(
|
||||
t('管理员确认远端状态无法核验,强制关闭该 PayPal 订单'),
|
||||
);
|
||||
}}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('强制过期')}
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -23,14 +23,14 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
// root 和被下放了「WeyAi」页签的管理员都能用。
|
||||
|
||||
import { Trans } from 'react-i18next';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import {
|
||||
Banner,
|
||||
Button,
|
||||
Card,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
Table,
|
||||
Tag,
|
||||
@@ -264,48 +264,7 @@ const SettingsWeyAiContent = () => {
|
||||
title: t('操作'),
|
||||
width: 300,
|
||||
render: (_, item, index) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
item.status === 'published' && {
|
||||
key: 'offline',
|
||||
label: t('下架'),
|
||||
onClick: () => setStatus(item, 'offline'),
|
||||
disabled: busyId === item.id,
|
||||
},
|
||||
item.status !== 'published' && {
|
||||
key: 'publish',
|
||||
label: t('发布'),
|
||||
onClick: () => setStatus(item, 'published'),
|
||||
disabled: busyId === item.id,
|
||||
},
|
||||
{
|
||||
key: 'up',
|
||||
label: t('上移'),
|
||||
onClick: () => move(index, -1),
|
||||
disabled: index === 0,
|
||||
},
|
||||
{
|
||||
key: 'down',
|
||||
label: t('下移'),
|
||||
onClick: () => move(index, 1),
|
||||
disabled: index === items.length - 1,
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
danger: true,
|
||||
onClick: () =>
|
||||
Modal.confirm({
|
||||
title: t('确定删除这个条目?'),
|
||||
content: t('删除后客户端不再显示;它的文件 7 天后清理'),
|
||||
okText: t('确认'),
|
||||
cancelText: t('取消'),
|
||||
okButtonProps: { danger: true },
|
||||
onOk: () => remove(item),
|
||||
}),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Space wrap>
|
||||
<Button
|
||||
onClick={() => setEditor({ visible: true, item })}
|
||||
type='link'
|
||||
@@ -313,7 +272,53 @@ const SettingsWeyAiContent = () => {
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
{item.status === 'published' ? (
|
||||
<Button
|
||||
loading={busyId === item.id}
|
||||
onClick={() => setStatus(item, 'offline')}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('下架')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
loading={busyId === item.id}
|
||||
onClick={() => setStatus(item, 'published')}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('发布')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
disabled={index === 0}
|
||||
aria-label={t('上移')}
|
||||
onClick={() => move(index, -1)}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('上移')}
|
||||
</Button>
|
||||
<Button
|
||||
disabled={index === items.length - 1}
|
||||
aria-label={t('下移')}
|
||||
onClick={() => move(index, 1)}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('下移')}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={t('确定删除这个条目?')}
|
||||
content={t('删除后客户端不再显示;它的文件 7 天后清理')}
|
||||
onConfirm={() => remove(item)}
|
||||
>
|
||||
<Button type='link' size='small' danger>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -22,7 +22,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
// 也会带上这里写的内容。客户端读公开接口 GET /api/weyai/desktop/release-notes,
|
||||
// 未登录也能看到;草稿只在这里可见。root 和被下放了「WeyAi」页签的管理员都能用。
|
||||
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import {
|
||||
Banner,
|
||||
@@ -31,6 +30,7 @@ import {
|
||||
Empty,
|
||||
Input,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Space,
|
||||
Switch,
|
||||
Table,
|
||||
@@ -197,37 +197,7 @@ const SettingsWeyAiReleaseNotes = () => {
|
||||
title: t('操作'),
|
||||
width: 240,
|
||||
render: (_, note) => (
|
||||
<TableRowActions
|
||||
items={[
|
||||
note.status === 'published' && {
|
||||
key: 'withdraw',
|
||||
label: t('撤回'),
|
||||
onClick: () => setStatus(note, 'draft'),
|
||||
disabled: busyId === note.id,
|
||||
},
|
||||
note.status !== 'published' && {
|
||||
key: 'publish',
|
||||
label: t('发布'),
|
||||
onClick: () => setStatus(note, 'published'),
|
||||
disabled: busyId === note.id,
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
disabled: busyId === note.id,
|
||||
danger: true,
|
||||
onClick: () =>
|
||||
Modal.confirm({
|
||||
title: t('确定删除这条版本说明吗?'),
|
||||
content: t('删除后客户端不再显示这个版本的说明'),
|
||||
okText: t('确认'),
|
||||
cancelText: t('取消'),
|
||||
okButtonProps: { danger: true },
|
||||
onOk: () => remove(note),
|
||||
}),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Space>
|
||||
<Button
|
||||
onClick={() => setDraft({ ...note })}
|
||||
type='link'
|
||||
@@ -235,7 +205,40 @@ const SettingsWeyAiReleaseNotes = () => {
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
{note.status === 'published' ? (
|
||||
<Button
|
||||
loading={busyId === note.id}
|
||||
onClick={() => setStatus(note, 'draft')}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('撤回')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
loading={busyId === note.id}
|
||||
onClick={() => setStatus(note, 'published')}
|
||||
type='link'
|
||||
size='small'
|
||||
>
|
||||
{t('发布')}
|
||||
</Button>
|
||||
)}
|
||||
<Popconfirm
|
||||
title={t('确定删除这条版本说明吗?')}
|
||||
content={t('删除后客户端不再显示这个版本的说明')}
|
||||
onConfirm={() => remove(note)}
|
||||
>
|
||||
<Button
|
||||
disabled={busyId === note.id}
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -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,
|
||||
})}
|
||||
|
||||
@@ -243,14 +243,6 @@ html.dark .usage-record-consume-card {
|
||||
background: var(--ur-consume-neutral-bg);
|
||||
color: var(--ur-text);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-use-time .ant-tag {
|
||||
margin-inline-end: 0;
|
||||
padding: 0 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 22px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-cost {
|
||||
color: var(--ur-cost);
|
||||
}
|
||||
@@ -306,12 +298,6 @@ html.dark .usage-record-consume-card {
|
||||
font-family: var(--ui-font-family-mono);
|
||||
font-size: 11px;
|
||||
}
|
||||
.usage-record-use-time {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.usage-record-cost {
|
||||
color: var(--ur-cost);
|
||||
font-weight: 600;
|
||||
|
||||
@@ -17,7 +17,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import TableEmpty from '../../components/common/table/TableEmpty';
|
||||
import TableToolbar from '../../components/common/table/TableToolbar';
|
||||
@@ -184,32 +183,7 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
|
||||
const index = value.articles.findIndex((a) => a.id === item.id);
|
||||
const move = (offset) => onChange(moveArticle(value, item.id, offset));
|
||||
return (
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'up',
|
||||
label: t('上移'),
|
||||
title: sortable ? undefined : '请在全部分类且无搜索时调整顺序',
|
||||
disabled: disabled || !sortable || index <= 0,
|
||||
onClick: () => move(-1),
|
||||
},
|
||||
{
|
||||
key: 'down',
|
||||
label: t('下移'),
|
||||
title: sortable ? undefined : '请在全部分类且无搜索时调整顺序',
|
||||
disabled:
|
||||
disabled || !sortable || index >= value.articles.length - 1,
|
||||
onClick: () => move(1),
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
danger: true,
|
||||
disabled,
|
||||
onClick: () => deleteArticle(item),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div className='website-insights-row-actions'>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
@@ -220,7 +194,38 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
aria-label={`上移${item.title}`}
|
||||
title={sortable ? undefined : '请在全部分类且无搜索时调整顺序'}
|
||||
disabled={disabled || !sortable || index <= 0}
|
||||
onClick={() => move(-1)}
|
||||
>
|
||||
{t('上移')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
aria-label={`下移${item.title}`}
|
||||
title={sortable ? undefined : '请在全部分类且无搜索时调整顺序'}
|
||||
disabled={
|
||||
disabled || !sortable || index >= value.articles.length - 1
|
||||
}
|
||||
onClick={() => move(1)}
|
||||
>
|
||||
{t('下移')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
danger
|
||||
disabled={disabled}
|
||||
onClick={() => deleteArticle(item)}
|
||||
>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user