fix(ui): 修复登录与并发请求并统一表格、主题和页面展示

验证:868 项单测、ESLint、Prettier、UI 依赖审计和差异检查通过。
This commit is contained in:
zhanjunhao
2026-11-19 18:58:46 +08:00
parent 99fe167103
commit 13105bdba5
128 changed files with 4672 additions and 5391 deletions
@@ -16,6 +16,7 @@ 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 { Trans } from 'react-i18next';
import {
ChevronRight as ActionChevronRight,
@@ -774,7 +775,11 @@ const FlowInner = ({
) : (
<div className='space-y-1'>
{sheetMembers.map((m) => {
const name = m.display_name || m.username || `#${m.user_id}`;
const name = formatUserReference(
m.display_name || m.username,
m.user_id,
t('未知用户'),
);
return (
<div
key={m.user_id}
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import { formatPercent } from '../../../helpers/safeDisplay';
import { RefreshCw as ActionRefreshCw } from '@/components/common/icons/ActionIcons';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -93,11 +94,16 @@ const DeltaBadge = ({ cur, prev, t }) => {
if (!prev || prev <= 0) {
return <small>{t('无上期对比')}</small>;
}
const pct = ((cur - prev) / prev) * 100;
const up = pct >= 0;
const pct = Number.isFinite(Number(cur))
? ((Number(cur) - Number(prev)) / Number(prev)) * 100
: null;
const up = pct !== null && pct >= 0;
return (
<small className={up ? 'is-up' : 'is-down'}>
{up ? '↑' : '↓'} {Math.abs(pct).toFixed(1)}%<em>{t('较上期')}</em>
{pct === null
? '-'
: `${up ? '↑' : '↓'} ${formatPercent(Math.abs(pct), 1)}`}
<em>{t('较上期')}</em>
</small>
);
};
@@ -432,12 +438,14 @@ const OrgAnalyticsPanel = ({
width: 300,
render: (_, r) => {
const pct =
breakdownTotal > 0 ? ((r.quota || 0) / breakdownTotal) * 100 : 0;
breakdownTotal > 0
? ((Number(r.quota) || 0) / breakdownTotal) * 100
: null;
return (
<div className='oc-ea-cost-share'>
<div>
<strong>{renderQuota(r.quota || 0, 2)}</strong>
<span>{pct.toFixed(1)}%</span>
<span>{formatPercent(pct, 1)}</span>
</div>
<Progress
percent={Math.round(pct)}
@@ -59,7 +59,7 @@ const OrgScopedLimitButtons = ({
apiBase,
scopeLabel,
onSaved,
variant = 'default',
renderActions,
}) => {
const { t } = useTranslation();
@@ -171,46 +171,47 @@ const OrgScopedLimitButtons = ({
return (
<>
<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>
{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>
</>
)}
{/* 模型限制 Modal */}
<OrgModal
@@ -19,12 +19,10 @@ For commercial licensing, please contact support@quantumnous.com
import { useMemo } from 'react';
import { theme } from 'antd';
import { useActualTheme } from '../../../context/Theme';
import { brandAccentFromToken } from '../../../components/ui/UiThemeProvider';
/**
* 消耗明细页(/org/logs)主题桥:只从 Ant token 推导页面局部变量,挂在页面根节点 style 上。
* - --oc-brand:原型 --brand(页签、额度、统计图标等强调色),浅色 / 深色 / 自定义主色三态跟随 token。
* - --oc-brand 继承页面作用域的品牌强调色。
* - --oc-stat-brand-bg:统计图标浅底(原型 #b9650810 = 品牌色 6.3% 透明度)。
* - --ur-progress-done:任务进度满格描边(原型 strokeColor = var(--brand))。
* - --oc-task-{success|failure|pending}-{text|bg|border}:绘图与视频“本页统计”语义色(Ant success / error / warning)。
@@ -32,10 +30,8 @@ import { brandAccentFromToken } from '../../../components/ui/UiThemeProvider';
*/
export function useOrgLogsThemeStyle() {
const { token } = theme.useToken();
const dark = useActualTheme() === 'dark';
return useMemo(
() => ({
'--oc-brand': brandAccentFromToken(token.colorPrimary, dark),
'--oc-stat-brand-bg':
'color-mix(in srgb, var(--oc-brand) 6.3%, transparent)',
'--ur-progress-done': 'var(--oc-brand)',
@@ -49,7 +45,7 @@ export function useOrgLogsThemeStyle() {
'--oc-task-pending-bg': token.colorWarningBg,
'--oc-task-pending-border': token.colorWarningBorder,
}),
[token, dark],
[token],
);
}