feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 9fc5fd212d
commit 28e924e371
242 changed files with 9242 additions and 5043 deletions
@@ -17,15 +17,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React from 'react';
import { writeClipboardText } from '../../../helpers/clipboard';
import React, { useState } from 'react';
import { Switch } from 'antd';
import {
Button,
Dropdown,
InputNumber,
Modal,
Progress,
Space,
SplitButtonGroup,
Tag,
Tooltip,
} from '@/components/ui';
@@ -42,9 +42,39 @@ import {
hoverOrClickTrigger,
} from '../../../helpers';
import { CHANNEL_OPTIONS } from '../../../constants';
import { IconTreeTriangleDown, IconMore } from '@/components/ui/icons';
import { IconTreeTriangleDown } from '@/components/ui/icons';
import { ShuffleBrandIcon } from '../../common/icons/BrandIcons';
function ChannelStatusSwitch({ record, manageChannel, t }) {
const [loading, setLoading] = useState(false);
return (
<Switch
size='small'
checked={record.status === 1}
checkedChildren={t('启用')}
unCheckedChildren={t('禁用')}
disabled={!isRoot()}
loading={loading}
aria-label={t('状态')}
onClick={(_, event) => event.stopPropagation()}
onChange={async (checked) => {
setLoading(true);
try {
await manageChannel(
record.id,
checked ? 'enable' : 'disable',
record,
);
} catch (error) {
showError(error.message);
} finally {
setLoading(false);
}
}}
/>
);
}
// 删除单个渠道的确认文案:若该渠道被其他渠道列为兜底,追加影响说明。
// 查询失败不阻塞删除,仅回退为原确认文案
const buildDeleteConfirmContent = async (channelId, t) => {
@@ -360,8 +390,7 @@ export const getChannelsColumns = ({
theme='outline'
onClick={(e) => {
e.stopPropagation();
navigator.clipboard
.writeText(record.remark)
writeClipboardText(record.remark)
.then(() => {
showSuccess(t('复制成功'));
})
@@ -425,13 +454,46 @@ export const getChannelsColumns = ({
title: t('状态'),
dataIndex: 'status',
render: (text, record, index) => {
const statusControl =
record.children !== undefined ? (
renderStatus(text, record.channel_info, t)
) : (
<Space>
<ChannelStatusSwitch
record={record}
manageChannel={manageChannel}
t={t}
/>
{record.channel_info?.is_multi_key && (
<span>
{(record.channel_info.multi_key_size || 0) -
Object.keys(record.channel_info.multi_key_status_list || {})
.length}
/{record.channel_info.multi_key_size || 0}
</span>
)}
</Space>
);
if (text === 3) {
if (record.other_info === '') {
record.other_info = '{}';
let otherInfo;
try {
otherInfo =
typeof record.other_info === 'string'
? JSON.parse(record.other_info)
: record.other_info;
} catch {
return statusControl;
}
let otherInfo = JSON.parse(record.other_info);
let reason = otherInfo['status_reason'];
let time = otherInfo['status_time'];
if (
!otherInfo ||
typeof otherInfo !== 'object' ||
Array.isArray(otherInfo) ||
(!otherInfo.status_reason && !otherInfo.status_time)
) {
return statusControl;
}
const reason = otherInfo.status_reason || '';
const time = otherInfo.status_time;
return (
<div>
<Tooltip
@@ -439,12 +501,12 @@ export const getChannelsColumns = ({
t('原因:') + reason + t(',时间:') + timestamp2string(time)
}
>
{renderStatus(text, record.channel_info, t)}
{statusControl}
</Tooltip>
</div>
);
} else {
return renderStatus(text, record.channel_info, t);
return statusControl;
}
},
},
@@ -660,7 +722,7 @@ export const getChannelsColumns = ({
},
{
key: COLUMN_KEYS.OPERATE,
title: '',
title: t('操作'),
dataIndex: 'operate',
fixed: 'right',
render: (text, record, index) => {
@@ -704,105 +766,63 @@ export const getChannelsColumns = ({
];
return (
<Space wrap>
<Space wrap className='console-module-row-actions'>
{isRoot() && (
<SplitButtonGroup
className='overflow-hidden'
aria-label={t('测试单个渠道操作项目组')}
>
<>
<Button
type='link'
size='small'
type='tertiary'
onClick={() => testChannel(record, '')}
>
{t('测试')}
</Button>
<Button
type='link'
size='small'
type='tertiary'
icon={<IconTreeTriangleDown />}
onClick={() => {
setCurrentTestChannel(record);
setShowModelTestModal(true);
}}
/>
</SplitButtonGroup>
)}
{isRoot() && (
<>
{record.status === 1 ? (
>
{t('批量测试')}
</Button>
<Button
type='link'
size='small'
onClick={() => {
setEditingChannel(record);
setShowEdit(true);
}}
>
{t('编辑')}
</Button>
<Button
type='link'
danger
size='small'
onClick={moreMenuItems[0].onClick}
>
{t('删除')}
</Button>
<Button
type='link'
size='small'
onClick={moreMenuItems[1].onClick}
>
{t('复制')}
</Button>
{record.channel_info?.is_multi_key && (
<Button
type='danger'
size='small'
onClick={() =>
manageChannel(record.id, 'disable', record)
}
>
{t('禁用')}
</Button>
) : (
<Button
size='small'
onClick={() => manageChannel(record.id, 'enable', record)}
>
{t('启用')}
</Button>
)}
{record.channel_info?.is_multi_key ? (
<SplitButtonGroup aria-label={t('多密钥渠道操作项目组')}>
<Button
type='tertiary'
size='small'
onClick={() => {
setEditingChannel(record);
setShowEdit(true);
}}
>
{t('编辑')}
</Button>
<Dropdown
trigger='click'
position='bottomRight'
menu={[
{
node: 'item',
name: t('多密钥管理'),
onClick: () => {
setCurrentMultiKeyChannel(record);
setShowMultiKeyManageModal(true);
},
},
]}
>
<Button
type='tertiary'
size='small'
icon={<IconTreeTriangleDown />}
/>
</Dropdown>
</SplitButtonGroup>
) : (
<Button
type='tertiary'
type='link'
size='small'
onClick={() => {
setEditingChannel(record);
setShowEdit(true);
setCurrentMultiKeyChannel(record);
setShowMultiKeyManageModal(true);
}}
>
{t('编辑')}
{t('多密钥管理')}
</Button>
)}
<Dropdown
trigger='click'
position='bottomRight'
menu={moreMenuItems}
>
<Button icon={<IconMore />} type='tertiary' size='small' />
</Dropdown>
</>
)}
</Space>
@@ -814,21 +834,21 @@ export const getChannelsColumns = ({
{isRoot() && (
<>
<Button
type='tertiary'
type='link'
size='small'
onClick={() => manageTag(record.key, 'enable')}
>
{t('启用全部')}
</Button>
<Button
type='tertiary'
type='link'
size='small'
onClick={() => manageTag(record.key, 'disable')}
>
{t('禁用全部')}
</Button>
<Button
type='tertiary'
type='link'
size='small'
onClick={() => {
setShowEditTag(true);