fix(ui): 统一三中心表格交互并优化企业及配套页面
- 公共表格:统一分组标签、状态开关和危险操作确认,支持防重复提交和失败重试,修复浮层触发组件的 ref 转发。 - 控制台:统一用户和渠道编辑抽屉,修正分组回填与提交格式,对齐系统设置操作区和预约列表。 - 企业中心:调整技能中心页签和窄屏布局,优化质量监控提示栏、效能分析及成本对账,统一消耗明细和审计日志筛选。 - 用户中心及公共页面:优化密钥和消费记录展示,对齐模型超市筛选,统一公开与内嵌客户端下载页。 - 同步多语言文案、组件规范与移动端视口要求。
This commit is contained in:
@@ -2,12 +2,13 @@ import { formatUserReference } from '../../helpers/safeDisplay';
|
||||
import {
|
||||
Copy as ActionCopy,
|
||||
Search as ActionSearch,
|
||||
RotateCcw as ActionRotateCcw,
|
||||
RefreshCw as ActionRefreshCw,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import i18next from 'i18next';
|
||||
import { Form as AntForm } from 'antd';
|
||||
import { UsageRecordFilterContent } from '../../components/common/table/UsageRecordFilterCard';
|
||||
import { Database, MessageSquareText, SlidersHorizontal } from 'lucide-react';
|
||||
import {
|
||||
Table,
|
||||
@@ -26,6 +27,9 @@ import OrgPanel from './components/OrgPanel';
|
||||
import OrgStateBlock from './components/OrgStateBlock';
|
||||
import { formatQuotaAsCNY } from './orgAuditFormat';
|
||||
|
||||
const recordTextClassName =
|
||||
'min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-[13px] leading-5 text-gray-600 dark:text-gray-300';
|
||||
|
||||
const emptyFilters = {
|
||||
memberId: '',
|
||||
modelName: '',
|
||||
@@ -318,16 +322,9 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
width: 170,
|
||||
render: (v) => (
|
||||
<Tooltip content={v || '-'} position='top'>
|
||||
<Tag
|
||||
size='small'
|
||||
color='violet'
|
||||
type='light'
|
||||
style={{ maxWidth: 154 }}
|
||||
>
|
||||
<span className='block overflow-hidden text-ellipsis whitespace-nowrap'>
|
||||
{v || '-'}
|
||||
</span>
|
||||
</Tag>
|
||||
<span className={`block max-w-[154px] ${recordTextClassName}`}>
|
||||
{v || '-'}
|
||||
</span>
|
||||
</Tooltip>
|
||||
),
|
||||
},
|
||||
@@ -345,7 +342,7 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
position='topLeft'
|
||||
style={{ maxWidth: 480 }}
|
||||
>
|
||||
<span className='min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-[13px] leading-5 text-gray-600 dark:text-gray-300'>
|
||||
<span className={`flex-1 ${recordTextClassName}`}>
|
||||
{brief || '-'}
|
||||
</span>
|
||||
</Tooltip>
|
||||
@@ -502,8 +499,8 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='mb-4 mt-4 flex items-start gap-3 rounded-xl border border-brand/15 bg-brand/[0.045] px-4 py-3 text-xs leading-5 text-gray-600 dark:text-gray-300'>
|
||||
<div className='oc-audit-stack'>
|
||||
<div className='flex items-start gap-3 rounded-xl border border-brand/15 bg-brand/[0.045] px-4 py-3 text-xs leading-5 text-gray-600 dark:text-gray-300'>
|
||||
<Database size={16} className='mt-0.5 flex-none text-brand' />
|
||||
<div>
|
||||
<div className='font-medium text-[var(--text-primary)]'>
|
||||
@@ -525,74 +522,74 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
? t('已应用 {{count}} 个筛选条件', { count: activeFilterCount })
|
||||
: t('可按成员、模型、关键词和时间范围组合查询')
|
||||
}
|
||||
className='mb-4'
|
||||
className='usage-record-filter-card org-usage-filter-card'
|
||||
padding='pt-4'
|
||||
>
|
||||
<div className='grid grid-cols-1 items-end gap-3 sm:grid-cols-2 xl:grid-cols-[180px_180px_minmax(200px,1fr)_360px_auto]'>
|
||||
<label className='min-w-0'>
|
||||
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'>
|
||||
{t('企业成员')}
|
||||
</span>
|
||||
<Select
|
||||
value={selectedMemberId}
|
||||
onChange={setSelectedMemberId}
|
||||
optionList={memberOptions}
|
||||
placeholder={t('全部成员')}
|
||||
style={{ width: '100%' }}
|
||||
loading={membersLoading}
|
||||
filter
|
||||
/>
|
||||
</label>
|
||||
<label className='min-w-0'>
|
||||
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'>
|
||||
{t('模型')}
|
||||
</span>
|
||||
<Input
|
||||
value={modelName}
|
||||
onChange={setModelName}
|
||||
placeholder={t('输入模型名称')}
|
||||
showClear
|
||||
onEnterPress={applyFilter}
|
||||
/>
|
||||
</label>
|
||||
<label className='min-w-0'>
|
||||
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'>
|
||||
{t('提示词')}
|
||||
</span>
|
||||
<Input
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
placeholder={t('搜索提示词关键词')}
|
||||
showClear
|
||||
onEnterPress={applyFilter}
|
||||
/>
|
||||
</label>
|
||||
<label className='min-w-0 sm:col-span-2 xl:col-span-1'>
|
||||
<span className='mb-1.5 block text-xs text-gray-500 dark:text-gray-400'>
|
||||
{t('时间范围')}
|
||||
</span>
|
||||
<DatePicker
|
||||
type='dateTimeRange'
|
||||
density='compact'
|
||||
value={timeRange}
|
||||
onChange={setTimeRange}
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</label>
|
||||
<div className='flex flex-wrap gap-2 sm:col-span-2 xl:col-span-1 xl:flex-nowrap'>
|
||||
<Button
|
||||
type='primary'
|
||||
icon={<ActionSearch size={14} />}
|
||||
onClick={applyFilter}
|
||||
loading={loading || membersLoading}
|
||||
>
|
||||
{t('查询')}
|
||||
</Button>
|
||||
<Button icon={<ActionRotateCcw size={14} />} onClick={resetFilters}>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<UsageRecordFilterContent>
|
||||
<AntForm
|
||||
layout='vertical'
|
||||
requiredMark={false}
|
||||
autoComplete='off'
|
||||
className='usage-record-filter-form'
|
||||
onFinish={applyFilter}
|
||||
>
|
||||
<div className='usage-record-filter-grid'>
|
||||
<AntForm.Item
|
||||
label={t('时间范围')}
|
||||
htmlFor='org-prompts-start'
|
||||
className='usage-record-filter-wide'
|
||||
>
|
||||
<DatePicker
|
||||
id={{ start: 'org-prompts-start' }}
|
||||
type='dateTimeRange'
|
||||
value={timeRange}
|
||||
onChange={setTimeRange}
|
||||
placeholder={[t('开始时间'), t('结束时间')]}
|
||||
/>
|
||||
</AntForm.Item>
|
||||
<AntForm.Item label={t('企业成员')} htmlFor='org-prompts-member'>
|
||||
<Select
|
||||
id='org-prompts-member'
|
||||
value={selectedMemberId}
|
||||
onChange={setSelectedMemberId}
|
||||
optionList={memberOptions}
|
||||
placeholder={t('全部成员')}
|
||||
loading={membersLoading}
|
||||
filter
|
||||
/>
|
||||
</AntForm.Item>
|
||||
<AntForm.Item label={t('模型')} htmlFor='org-prompts-model'>
|
||||
<Input
|
||||
id='org-prompts-model'
|
||||
value={modelName}
|
||||
onChange={setModelName}
|
||||
placeholder={t('输入模型名称')}
|
||||
showClear
|
||||
/>
|
||||
</AntForm.Item>
|
||||
<AntForm.Item label={t('提示词')} htmlFor='org-prompts-keyword'>
|
||||
<Input
|
||||
id='org-prompts-keyword'
|
||||
value={keyword}
|
||||
onChange={setKeyword}
|
||||
placeholder={t('搜索提示词关键词')}
|
||||
showClear
|
||||
/>
|
||||
</AntForm.Item>
|
||||
</div>
|
||||
<div className='usage-record-filter-actions'>
|
||||
<Button onClick={resetFilters}>{t('重置')}</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
htmlType='submit'
|
||||
icon={<ActionSearch size={14} />}
|
||||
loading={loading || membersLoading}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
</div>
|
||||
</AntForm>
|
||||
</UsageRecordFilterContent>
|
||||
</OrgPanel>
|
||||
|
||||
<OrgPanel
|
||||
@@ -652,7 +649,7 @@ const OrgPromptRecords = ({ orgId }) => {
|
||||
}
|
||||
/>
|
||||
</OrgPanel>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user