fix(ui): 统一三中心表格交互并优化企业及配套页面

- 公共表格:统一分组标签、状态开关和危险操作确认,支持防重复提交和失败重试,修复浮层触发组件的 ref 转发。
- 控制台:统一用户和渠道编辑抽屉,修正分组回填与提交格式,对齐系统设置操作区和预约列表。
- 企业中心:调整技能中心页签和窄屏布局,优化质量监控提示栏、效能分析及成本对账,统一消耗明细和审计日志筛选。
- 用户中心及公共页面:优化密钥和消费记录展示,对齐模型超市筛选,统一公开与内嵌客户端下载页。
- 同步多语言文案、组件规范与移动端视口要求。
This commit is contained in:
zhanjunhao
2026-11-24 13:26:07 +08:00
parent bf708039a3
commit 34e318454d
124 changed files with 2682 additions and 1810 deletions
@@ -1,6 +1,9 @@
import { TABLE_GROUP_COLUMN_WIDTH } from '@/components/common/table/TableGroupTags';
import { toGroupList } from '@/helpers/groupList';
import { confirmTableAction } from '@/components/common/table/confirmTableAction';
import TableStatusSwitch from '@/components/common/table/TableStatusSwitch';
import { writeClipboardText } from '../../../helpers/clipboard';
import React, { useState } from 'react';
import { Switch } from 'antd';
import {
Button,
InputNumber,
@@ -34,11 +37,8 @@ const formatDisplayPercent = (value, digits = 0) => {
function ChannelStatusSwitch({ record, manageChannel, t }) {
const [loading, setLoading] = useState(false);
return (
<Switch
size='small'
<TableStatusSwitch
checked={record.status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
disabled={!isRoot()}
loading={loading}
aria-label={t('状态')}
@@ -405,20 +405,16 @@ export const getChannelsColumns = ({
key: COLUMN_KEYS.GROUP,
title: t('分组'),
dataIndex: 'group',
render: (text, record, index) => (
<div>
<Space spacing={2}>
{text
?.split(',')
.sort((a, b) => {
if (a === 'default') return -1;
if (b === 'default') return 1;
return a.localeCompare(b);
})
.map((item, index) => renderGroup(item))}
</Space>
</div>
),
width: TABLE_GROUP_COLUMN_WIDTH,
render: (groups) =>
renderGroup(
toGroupList(groups).sort((left, right) => {
if (left === right) return 0;
if (left === 'default') return -1;
if (right === 'default') return 1;
return left.localeCompare(right);
}),
),
},
{
key: COLUMN_KEYS.TYPE,
@@ -723,19 +719,20 @@ export const getChannelsColumns = ({
type: 'danger',
onClick: async () => {
const content = await buildDeleteConfirmContent(record.id, t);
Modal.confirm({
confirmTableAction({
title: t('确定是否要删除此渠道?'),
content,
onOk: () => {
(async () => {
await manageChannel(record.id, 'delete', record);
await refresh();
setTimeout(() => {
if (channels.length === 0 && activePage > 1) {
refresh(activePage - 1);
}
}, 100);
})();
okType: 'danger',
focusable: { autoFocusButton: 'cancel' },
onOk: async () => {
if (!(await manageChannel(record.id, 'delete', record)))
return false;
await refresh();
setTimeout(() => {
if (channels.length === 0 && activePage > 1) {
refresh(activePage - 1);
}
}, 100);
},
});
},
@@ -1,3 +1,4 @@
import { toGroupList } from '@/helpers/groupList';
import { formatIdReference } from '../../../../helpers/safeDisplay';
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js';
@@ -46,13 +47,7 @@ import SecureVerificationModal from '../../../common/modals/SecureVerificationMo
import ChannelKeyDisplay from '../../../common/ui/ChannelKeyDisplay';
import { useSecureVerification } from '../../../../hooks/common/useSecureVerification';
import { createApiCalls } from '../../../../services/secureVerification';
import {
IconServer,
IconSetting,
IconCode,
IconGlobe,
IconBolt,
} from '@/components/ui/icons';
import { Code, Globe, Server, Settings, Zap } from 'lucide-react';
const { Text } = Typography;
@@ -573,11 +568,7 @@ const EditChannelModal = (props) => {
} else {
data.models = data.models.split(',');
}
if (data.group === '') {
data.groups = [];
} else {
data.groups = data.group.split(',');
}
data.groups = toGroupList(data.group);
if (data.model_mapping !== '') {
data.model_mapping = JSON.stringify(
JSON.parse(data.model_mapping),
@@ -1575,7 +1566,7 @@ const EditChannelModal = (props) => {
let res;
localInputs.auto_ban = localInputs.auto_ban ? 1 : 0;
localInputs.models = localInputs.models.join(',');
localInputs.group = (localInputs.groups || []).join(',');
localInputs.group = toGroupList(localInputs.groups).join(',');
// 日消耗限额统一使用 token(quota)单位,确保为整数
if (localInputs.daily_quota_limit && localInputs.daily_quota_limit > 0) {
@@ -1921,7 +1912,7 @@ const EditChannelModal = (props) => {
{/* Header: Basic Info */}
<div className='console-channel-section'>
<Avatar size='small' color='blue'>
<IconServer size={16} />
<Server size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>
@@ -2462,7 +2453,7 @@ const EditChannelModal = (props) => {
onClick={handleApiConfigSecretClick}
>
<Avatar size='small' color='green'>
<IconGlobe size={16} />
<Globe size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>
@@ -2683,7 +2674,7 @@ const EditChannelModal = (props) => {
{/* Header: Model Config */}
<div className='console-channel-section'>
<Avatar size='small' color='purple'>
<IconCode size={16} />
<Code size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>
@@ -2888,7 +2879,7 @@ const EditChannelModal = (props) => {
{/* Header: Advanced Settings */}
<div className='console-channel-section'>
<Avatar size='small' color='orange'>
<IconSetting size={16} />
<Settings size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>
@@ -3433,7 +3424,7 @@ const EditChannelModal = (props) => {
{/* Header: Channel Extra Settings */}
<div className='console-channel-section'>
<Avatar size='small' color='violet'>
<IconBolt size={16} />
<Zap size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>
@@ -1,5 +1,8 @@
import { toGroupList } from '@/helpers/groupList';
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js';
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent';
import { useIsMobile } from '../../../../hooks/common/useIsMobile';
import '../../../console/module-alignment.css';
import React, { useState, useEffect, useRef } from 'react';
import {
API,
@@ -18,29 +21,43 @@ import {
Spin,
Banner,
Card,
Tag,
Avatar,
Form,
Row,
Col,
} from '@/components/ui';
import {
IconSave,
IconClose,
IconBookmark,
IconUser,
IconCode,
IconSetting,
} from '@/components/ui/icons';
import { Bookmark, Code, Settings } from 'lucide-react';
import { getChannelModels } from '../../../../helpers';
import { useTranslation } from 'react-i18next';
const { Text, Title } = Typography;
const { Text } = Typography;
const MODEL_MAPPING_EXAMPLE = {
'gpt-3.5-turbo': 'gpt-3.5-turbo-0125',
};
function TagEditorSection({ icon, color, title, description, children }) {
return (
<div>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'>
<div className='console-channel-section'>
<Avatar size='small' color={color}>
{icon}
</Avatar>
<div>
<Text className='text-lg font-medium'>{title}</Text>
<div className='text-xs text-gray-600'>{description}</div>
</div>
</div>
{children}
</Card>
</div>
);
}
const EditTagModal = (props) => {
const { t } = useTranslation();
const isMobile = useIsMobile();
const { visible, tag, handleClose, refresh } = props;
const [loading, setLoading] = useState(false);
const [originModelOptions, setOriginModelOptions] = useState([]);
@@ -159,6 +176,7 @@ const EditTagModal = (props) => {
};
const handleSave = async (values) => {
if (loading) return;
setLoading(true);
const formVals = values || formApiRef.current?.getValues() || {};
let data = { tag };
@@ -170,8 +188,9 @@ const EditTagModal = (props) => {
}
data.model_mapping = formVals.model_mapping;
}
if (formVals.groups && formVals.groups.length > 0) {
data.groups = formVals.groups.join(',');
const groups = toGroupList(formVals.groups);
if (groups.length > 0) {
data.groups = groups.join(',');
}
if (formVals.models && formVals.models.length > 0) {
data.models = formVals.models.join(',');
@@ -234,6 +253,8 @@ const EditTagModal = (props) => {
showSuccess(t('标签更新成功!'));
refresh();
handleClose();
} else if (res?.data) {
showError(res.data.message || t('操作失败'));
}
} catch (error) {
showError(error);
@@ -254,6 +275,10 @@ const EditTagModal = (props) => {
}, [originModelOptions, inputs.models]);
const onVisibilityChange = useEffectEvent(() => {
if (visible) {
setCustomModel('');
formApiRef.current?.setValue('custom_model', '');
}
const fetchTagModels = async () => {
if (!tag) return;
setLoading(true);
@@ -319,6 +344,7 @@ const EditTagModal = (props) => {
setModelOptions(localModelOptions);
setCustomModel('');
formApiRef.current?.setValue('custom_model', '');
handleInputChange('models', localModels);
if (addedModels.length > 0) {
@@ -335,44 +361,27 @@ const EditTagModal = (props) => {
return (
<SideSheet
rootClassName='console-channel-drawer'
classNames={{ header: 'console-channel-editor-header' }}
placement='right'
title={
<Space>
<Tag color='blue' shape='circle'>
{t('编辑')}
</Tag>
<Title heading={4} className='m-0'>
{t('编辑标签')}
</Title>
</Space>
}
title={t('编辑标签')}
bodyStyle={{ padding: '0' }}
visible={visible}
width={600}
width={isMobile ? '100%' : 600}
onCancel={handleClose}
footer={
<div className='flex justify-end'>
<Space>
<Button
theme='solid'
onClick={() => formApiRef.current?.submitForm()}
loading={loading}
icon={<IconSave />}
>
{t('保存')}
</Button>
<Button
theme='light'
type='primary'
onClick={handleClose}
icon={<IconClose />}
>
{t('取消')}
</Button>
</Space>
<div className='console-channel-footer'>
<Button onClick={handleClose}>{t('取消')}</Button>
<Button
theme='solid'
type='primary'
onClick={() => formApiRef.current?.submitForm()}
loading={loading}
>
{t('提交')}
</Button>
</div>
}
closeIcon={null}
>
<Form
key={tag || 'edit'}
@@ -382,110 +391,238 @@ const EditTagModal = (props) => {
>
{() => (
<Spin spinning={loading}>
<div className='p-2'>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'>
{/* Header: Tag Info */}
<div className='flex items-center mb-2'>
<Avatar size='small' color='blue' className='mr-2 shadow-md'>
<IconBookmark size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('标签信息')}</Text>
<div className='text-xs text-gray-600'>
{t('标签的基本配置')}
</div>
</div>
</div>
<div className='console-channel-sections p-2'>
<TagEditorSection
icon={<Bookmark size={16} />}
color='blue'
title={t('标签信息')}
description={t('标签的基本配置')}
>
<Banner
type='warning'
description={t('所有编辑均为覆盖操作,留空则不更改')}
className='!rounded-lg mb-4'
/>
<div className='space-y-4'>
<Form.Input
field='new_tag'
label={t('标签名称')}
placeholder={t('请输入新标签,留空则解散标签')}
onChange={(value) => handleInputChange('new_tag', value)}
/>
</div>
</Card>
<Row gutter={12}>
<Col xs={24} md={12}>
<Form.Input
field='new_tag'
label={t('标签名称')}
placeholder={t('请输入新标签,留空则解散标签')}
showClear
onChange={(value) => handleInputChange('new_tag', value)}
/>
</Col>
<Col xs={24} md={12}>
<Form.Select
field='groups'
label={t('分组')}
placeholder={t(
'请选择可以使用该渠道的分组,留空则不更改',
)}
multiple
allowAdditions
additionLabel={t(
'请在系统设置页面编辑分组倍率以添加新的分组:',
)}
optionList={groupOptions}
style={{ width: '100%' }}
onChange={(value) => handleInputChange('groups', value)}
/>
</Col>
</Row>
</TagEditorSection>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'>
{/* Header: Model Config */}
<div className='flex items-center mb-2'>
<Avatar
size='small'
color='purple'
className='mr-2 shadow-md'
>
<IconCode size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('模型配置')}</Text>
<div className='text-xs text-gray-600'>
{t('模型选择和映射设置')}
</div>
</div>
</div>
<TagEditorSection
icon={<Code size={16} />}
color='purple'
title={t('模型配置')}
description={t('模型选择和映射设置')}
>
<Banner
type='info'
description={t(
'当前模型列表为该标签下所有渠道模型列表最长的一个,并非所有渠道的并集,请注意可能导致某些渠道模型丢失。',
)}
className='!rounded-lg mb-4'
/>
<Form.Select
field='models'
label={t('模型')}
placeholder={t('请选择该渠道所支持的模型,留空则不更改')}
multiple
filter={selectFilter}
autoClearSearchValue={false}
searchPosition='dropdown'
optionList={modelOptions}
style={{ width: '100%' }}
onChange={(value) => handleInputChange('models', value)}
/>
<div className='space-y-4'>
<Banner
type='info'
description={t(
'当前模型列表为该标签下所有渠道模型列表最长的一个,并非所有渠道的并集,请注意可能导致某些渠道模型丢失。',
)}
className='!rounded-lg mb-4'
/>
<Form.Select
field='models'
label={t('模型')}
placeholder={t('请选择该渠道所支持的模型,留空则不更改')}
multiple
filter={selectFilter}
autoClearSearchValue={false}
searchPosition='dropdown'
optionList={modelOptions}
style={{ width: '100%' }}
onChange={(value) => handleInputChange('models', value)}
/>
<Form.Input
field='custom_model'
label={t('自定义模型名称')}
placeholder={t('输入自定义模型名称')}
onChange={(value) => setCustomModel(value.trim())}
value={customModel}
suffix={
<Button
size='small'
type='primary'
onClick={addCustomModels}
>
{t('填入')}
</Button>
}
/>
<Form.Input
field='custom_model'
label={t('自定义模型名称')}
placeholder={t('输入自定义模型名称')}
onChange={(value) => setCustomModel(value.trim())}
suffix={
<Button
size='small'
type='primary'
onClick={addCustomModels}
<Form.TextArea
field='model_mapping'
label={t('模型重定向')}
placeholder={t(
'此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,留空则不更改',
)}
autosize
onChange={(value) =>
handleInputChange('model_mapping', value)
}
extraText={
<Space>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'model_mapping',
JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2),
)
}
>
{t('填入')}
</Button>
}
/>
{t('填入模板')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'model_mapping',
JSON.stringify({}, null, 2),
)
}
>
{t('清空重定向')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() => handleInputChange('model_mapping', '')}
>
{t('不更改')}
</Text>
</Space>
}
/>
</TagEditorSection>
<Form.TextArea
field='model_mapping'
label={t('模型重定向')}
placeholder={t(
'此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,留空则不更改',
)}
autosize
onChange={(value) =>
handleInputChange('model_mapping', value)
}
extraText={
<Space>
<TagEditorSection
icon={<Settings size={16} />}
color='orange'
title={t('高级设置')}
description={t('渠道的高级配置选项')}
>
<Form.TextArea
field='param_override'
label={t('参数覆盖')}
placeholder={t(
'此项可选,用于覆盖请求参数。不支持覆盖 stream 参数\n旧格式(直接覆盖):\n{\n "temperature": 0,\n "max_tokens": 1000\n}\n\n新格式(支持条件判断与json自定义):\n{\n "operations": [\n {\n "path": "temperature",\n "mode": "set",\n "value": 0.7,\n "conditions": [\n {\n "path": "model",\n "mode": "prefix",\n "value": "gpt"\n }\n ]\n }\n ]\n}',
)}
autosize
showClear
onChange={(value) =>
handleInputChange('param_override', value)
}
extraText={
<div className='flex gap-2 flex-wrap'>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'param_override',
JSON.stringify({ temperature: 0 }, null, 2),
)
}
>
{t('旧格式模板')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'param_override',
JSON.stringify(
{
operations: [
{
path: 'temperature',
mode: 'set',
value: 0.7,
conditions: [
{
path: 'model',
mode: 'prefix',
value: 'gpt',
},
],
logic: 'AND',
},
],
},
null,
2,
),
)
}
>
{t('新格式模板')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange('param_override', null)
}
>
{t('不更改')}
</Text>
</div>
}
/>
<Form.TextArea
field='header_override'
label={t('请求头覆盖')}
placeholder={t(
'此项可选,用于覆盖请求头参数\n格式示例:\n{\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",\n "Authorization": "Bearer {api_key}"\n}',
)}
autosize
showClear
onChange={(value) =>
handleInputChange('header_override', value)
}
extraText={
<div className='flex flex-col gap-1'>
<div className='flex gap-2 flex-wrap items-center'>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'model_mapping',
JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2),
'header_override',
JSON.stringify(
{
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0',
Authorization: 'Bearer {api_key}',
},
null,
2,
),
)
}
>
@@ -494,201 +631,27 @@ const EditTagModal = (props) => {
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'model_mapping',
JSON.stringify({}, null, 2),
)
}
>
{t('清空重定向')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() => handleInputChange('model_mapping', '')}
>
{t('不更改')}
</Text>
</Space>
}
/>
</div>
</Card>
<Card className='!rounded-2xl shadow-sm border-0 mb-6'>
{/* Header: Advanced Settings */}
<div className='flex items-center mb-2'>
<Avatar
size='small'
color='orange'
className='mr-2 shadow-md'
>
<IconSetting size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('高级设置')}</Text>
<div className='text-xs text-gray-600'>
{t('渠道的高级配置选项')}
</div>
</div>
</div>
<div className='space-y-4'>
<Form.TextArea
field='param_override'
label={t('参数覆盖')}
placeholder={t(
'此项可选,用于覆盖请求参数。不支持覆盖 stream 参数\n旧格式(直接覆盖):\n{\n "temperature": 0,\n "max_tokens": 1000\n}\n\n新格式(支持条件判断与json自定义):\n{\n "operations": [\n {\n "path": "temperature",\n "mode": "set",\n "value": 0.7,\n "conditions": [\n {\n "path": "model",\n "mode": "prefix",\n "value": "gpt"\n }\n ]\n }\n ]\n}',
)}
autosize
showClear
onChange={(value) =>
handleInputChange('param_override', value)
}
extraText={
<div className='flex gap-2 flex-wrap'>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'param_override',
JSON.stringify({ temperature: 0 }, null, 2),
)
}
>
{t('旧格式模板')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'param_override',
JSON.stringify(
{
operations: [
{
path: 'temperature',
mode: 'set',
value: 0.7,
conditions: [
{
path: 'model',
mode: 'prefix',
value: 'gpt',
},
],
logic: 'AND',
},
],
},
null,
2,
),
)
}
>
{t('新格式模板')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange('param_override', null)
handleInputChange('header_override', null)
}
>
{t('不更改')}
</Text>
</div>
}
/>
<Form.TextArea
field='header_override'
label={t('请求头覆盖')}
placeholder={t(
'此项可选,用于覆盖请求头参数\n格式示例:\n{\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",\n "Authorization": "Bearer {api_key}"\n}',
)}
autosize
showClear
onChange={(value) =>
handleInputChange('header_override', value)
}
extraText={
<div className='flex flex-col gap-1'>
<div className='flex gap-2 flex-wrap items-center'>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange(
'header_override',
JSON.stringify(
{
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0',
Authorization: 'Bearer {api_key}',
},
null,
2,
),
)
}
>
{t('填入模板')}
</Text>
<Text
className='!text-ui-color-primary cursor-pointer'
onClick={() =>
handleInputChange('header_override', null)
}
>
{t('不更改')}
</Text>
</div>
<div>
<Text type='tertiary' size='small'>
{t('支持变量:')}
</Text>
<div className='text-xs text-tertiary ml-2'>
<div>
{t('渠道密钥')}:{' '}
{I18N_TECHNICAL_TEXT.API_KEY_PLACEHOLDER}
</div>
<div>
<Text type='tertiary' size='small'>
{t('支持变量:')}
</Text>
<div className='text-xs text-tertiary ml-2'>
<div>
{t('渠道密钥')}:{' '}
{I18N_TECHNICAL_TEXT.API_KEY_PLACEHOLDER}
</div>
</div>
</div>
}
/>
</div>
</Card>
<Card className='!rounded-2xl shadow-sm border-0'>
{/* Header: Group Settings */}
<div className='flex items-center mb-2'>
<Avatar size='small' color='green' className='mr-2 shadow-md'>
<IconUser size={16} />
</Avatar>
<div>
<Text className='text-lg font-medium'>{t('分组设置')}</Text>
<div className='text-xs text-gray-600'>
{t('用户分组配置')}
</div>
</div>
</div>
<div className='space-y-4'>
<Form.Select
field='groups'
label={t('分组')}
placeholder={t('请选择可以使用该渠道的分组,留空则不更改')}
multiple
allowAdditions
additionLabel={t(
'请在系统设置页面编辑分组倍率以添加新的分组:',
)}
optionList={groupOptions}
style={{ width: '100%' }}
onChange={(value) => handleInputChange('groups', value)}
/>
</div>
</Card>
}
/>
</TagEditorSection>
</div>
</Spin>
)}
@@ -1,3 +1,4 @@
import TableActionPopconfirm from '@/components/common/table/TableActionPopconfirm';
import { formatIdReference } from '../../../../helpers/safeDisplay';
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent';
@@ -247,6 +248,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
showSuccess(t('密钥已删除'));
await loadKeyStatus(currentPage, pageSize); // Reload current page
onRefresh && onRefresh(); // Refresh parent component
return true;
} else {
showError(res.data.message);
}
@@ -255,6 +257,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
} finally {
setOperationLoading((prev) => ({ ...prev, [operationId]: false }));
}
return false;
};
// Handle page size change
@@ -414,21 +417,21 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
{t('启用')}
</Button>
)}
<Popconfirm
<TableActionPopconfirm
title={t('确定要删除此密钥吗?')}
content={t('此操作不可撤销,将永久删除该密钥')}
onConfirm={() => handleDeleteKey(record.index)}
okType={'danger'}
position={'topRight'}
>
<Button
type='danger'
type='link'
danger
size='small'
loading={operationLoading[`delete_${record.index}`]}
>
{t('删除')}
</Button>
</Popconfirm>
</TableActionPopconfirm>
</Space>
),
},