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
+23 -14
View File
@@ -21,19 +21,21 @@ import React, { useState } from 'react';
import { Card, Table, Progress } from '@/components/ui';
import { renderQuota } from '../../helpers';
const ChannelConsumption = ({ data, title, icon, t }) => {
const ChannelConsumption = ({ data, title, icon, t, embedded = false }) => {
const [currentPage, setCurrentPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
if (!data || data.length === 0) {
return (
<Card
className='shadow-sm hover:shadow-md transition-shadow'
className={`shadow-sm hover:shadow-md transition-shadow ${embedded ? 'analytics-fold-content' : ''}`}
title={
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
</div>
embedded ? undefined : (
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
</div>
)
}
bodyStyle={{ padding: '16px' }}
>
@@ -122,19 +124,26 @@ const ChannelConsumption = ({ data, title, icon, t }) => {
return (
<Card
className='shadow-sm hover:shadow-md transition-shadow'
className={`shadow-sm hover:shadow-md transition-shadow ${embedded ? 'analytics-fold-content' : ''}`}
title={
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>TOP {data.length}</span>
</div>
embedded ? undefined : (
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>
TOP {data.length}
</span>
</div>
)
}
bodyStyle={{ padding: '0' }}
>
<Table
columns={columns}
dataSource={data}
dataSource={data.map((record, index) => ({
...record,
key: `${record.channel_name}-${index}`,
}))}
pagination={{
currentPage,
pageSize,
@@ -148,7 +157,7 @@ const ChannelConsumption = ({ data, title, icon, t }) => {
},
}}
size='small'
rowKey={(record, index) => `${record.channel_name}-${index}`}
rowKey='key'
/>
</Card>
);
@@ -0,0 +1,45 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
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 { ChevronDown } from 'lucide-react';
import './collapsible-panel.css';
const CollapsibleHeader = ({ icon, title, isOpen, onToggle, extra }) => (
<button
type='button'
aria-expanded={isOpen}
className='w-full text-left flex items-center justify-between gap-2 cursor-pointer select-none px-5 py-4 bg-white dark:bg-gray-800 rounded-xl shadow-sm hover:shadow-md transition-all border border-gray-100 dark:border-gray-700'
onClick={onToggle}
>
<span className='flex items-center gap-2 min-w-0 flex-wrap'>
<span className='text-brand flex-shrink-0'>{icon}</span>
<span className='font-semibold text-gray-800 dark:text-gray-100'>
{title}
</span>
{extra}
</span>
<ChevronDown
aria-hidden='true'
className={`w-5 h-5 flex-shrink-0 text-gray-400 transition-transform duration-300 ${isOpen ? 'rotate-180' : ''}`}
/>
</button>
);
export default CollapsibleHeader;
+23 -9
View File
@@ -22,7 +22,7 @@ import { Card, Table, Button } from '@/components/ui';
import { IconDownload } from '@/components/ui/icons';
import { renderQuota } from '../../helpers';
const DailyStatsTable = ({ data, title, icon, t }) => {
const DailyStatsTable = ({ data, title, icon, t, embedded = false }) => {
const columns = [
{
title: t('日期'),
@@ -161,13 +161,29 @@ const DailyStatsTable = ({ data, title, icon, t }) => {
return (
<Card
className='shadow-sm hover:shadow-md transition-shadow'
className={`shadow-sm hover:shadow-md transition-shadow ${embedded ? 'analytics-fold-content' : ''}`}
title={
<div className='flex items-center justify-between w-full'>
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
embedded ? undefined : (
<div className='flex items-center justify-between w-full'>
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
</div>
<Button
icon={<IconDownload />}
size='small'
onClick={handleExport}
disabled={!data || data.length === 0}
>
{t('导出CSV')}
</Button>
</div>
)
}
bodyStyle={{ padding: '0' }}
>
{embedded && (
<div className='flex justify-end p-4'>
<Button
icon={<IconDownload />}
size='small'
@@ -177,9 +193,7 @@ const DailyStatsTable = ({ data, title, icon, t }) => {
{t('导出CSV')}
</Button>
</div>
}
bodyStyle={{ padding: '0' }}
>
)}
<Table
columns={columns}
dataSource={data || []}
+2 -2
View File
@@ -34,7 +34,7 @@ import { renderQuota } from '../../helpers';
const OverviewCards = ({ overview, t }) => {
if (!overview) {
return (
<div className='grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6'>
<div className='grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4'>
{[...Array(6)].map((_, i) => (
<Card key={i} className='animate-pulse'>
<div className='h-20 bg-gray-200 dark:bg-gray-700 rounded'></div>
@@ -124,7 +124,7 @@ const OverviewCards = ({ overview, t }) => {
};
return (
<div className='grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6'>
<div className='grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4'>
{cards.map((card, index) => (
<Card
key={index}
@@ -54,6 +54,7 @@ const RiskControlBanLogs = ({
banLogStatus,
setBanLogStatus,
banLogPage,
banLogPageSize,
fetchBanLogs,
unbanUser,
t,
@@ -204,12 +205,13 @@ const RiskControlBanLogs = ({
rowKey='id'
loading={loading}
pagination={{
pageSize: 20,
pageSize: banLogPageSize,
showTotal: true,
total: banLogTotal,
// 受控分页:避免切换状态筛选后 Semi 内部页码与 hook 不同步
currentPage: banLogPage,
onPageChange: (page) => fetchBanLogs({ page }),
onPageSizeChange: (pageSize) => fetchBanLogs({ page: 1, pageSize }),
}}
empty={t('暂无封号记录')}
scroll={{ x: 1400 }}
+298 -293
View File
@@ -18,19 +18,17 @@ For commercial licensing, please contact support@quantumnous.com
*/
import React, { useMemo, useState, useEffect, useCallback } from 'react';
import { Card, Spin, Tag, Progress, Empty } from '@/components/ui';
import { Card, Spin, Tag, Progress } from '@/components/ui';
import CollapsibleHeader from './CollapsibleHeader';
import { VChart } from '@visactor/react-vchart';
import { API, showError } from '../../helpers';
import {
UserCheck,
Briefcase,
Cpu,
Users,
TrendingUp,
BarChart3,
PieChart,
ChevronDown,
ChevronUp,
} from 'lucide-react';
// 职业类型标签配置
@@ -271,314 +269,321 @@ const UserSurveyStats = ({ title, icon, t }) => {
surveyStats?.ai_tool_stats?.find((s) => s.ai_tool_usage === 3)?.count || 0;
return (
<Card
className='shadow-sm hover:shadow-md transition-shadow'
title={
<div className='flex items-center justify-between w-full'>
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<div className='analytics-fold-panel'>
<CollapsibleHeader
icon={icon}
title={title}
isOpen={!collapsed}
onToggle={() => setCollapsed((value) => !value)}
extra={
<>
{totalUsers > 0 && (
<Tag color='purple' size='small'>
{totalUsers} {t('人已填写')}
</Tag>
)}
</div>
<button
onClick={() => setCollapsed(!collapsed)}
className='flex items-center gap-1 px-2 py-1 text-sm text-gray-500 hover:text-brand-deep hover:bg-brand/5 dark:hover:bg-brand-deep/20 rounded transition-colors'
>
<span className='text-xs'>{collapsed ? t('展开') : t('收起')}</span>
{collapsed ? <ChevronDown size={16} /> : <ChevronUp size={16} />}
</button>
</div>
}
bodyStyle={{ padding: collapsed ? '0' : '16px' }}
>
{!collapsed && (
<Spin spinning={loading}>
{totalUsers === 0 ? (
<Empty
image={<UserCheck className='w-16 h-16 text-gray-300' />}
description={t('暂无问卷数据')}
style={{ padding: '40px 0' }}
/>
) : (
<div className='space-y-6'>
{/* 概览统计卡片 */}
<div className='grid grid-cols-2 sm:grid-cols-4 gap-4'>
<div className='p-4 bg-gradient-to-br from-brand-from/5 to-brand-to/5 dark:from-brand-from/20 dark:to-brand-to/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<Users className='w-4 h-4 text-brand' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('总填写')}
</span>
</div>
<div className='text-2xl font-bold text-brand-deep dark:text-brand-from'>
{totalUsers}
</div>
</>
}
/>
<div className={collapsed ? 'hidden' : ''}>
<Card
className='analytics-fold-content shadow-sm'
bodyStyle={{ padding: '16px' }}
>
{!collapsed && (
<Spin spinning={loading}>
{totalUsers === 0 ? (
<div className='h-[300px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
<div className='p-4 bg-gradient-to-br from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<Briefcase className='w-4 h-4 text-blue-500' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('技术岗位')}
</span>
</div>
<div className='text-2xl font-bold text-blue-600 dark:text-blue-400'>
{techUsers}
</div>
<div className='text-xs text-gray-400 mt-1'>
{totalUsers > 0
? ((techUsers / totalUsers) * 100).toFixed(1)
: 0}
%
</div>
</div>
<div className='p-4 bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<Cpu className='w-4 h-4 text-green-500' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('正在使用AI')}
</span>
</div>
<div className='text-2xl font-bold text-green-600 dark:text-green-400'>
{activeAIUsers}
</div>
<div className='text-xs text-gray-400 mt-1'>
{totalUsers > 0
? ((activeAIUsers / totalUsers) * 100).toFixed(1)
: 0}
%
</div>
</div>
<div className='p-4 bg-gradient-to-br from-orange-50 to-amber-50 dark:from-orange-900/20 dark:to-amber-900/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<TrendingUp className='w-4 h-4 text-orange-500' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('有兴趣尝试')}
</span>
</div>
<div className='text-2xl font-bold text-orange-600 dark:text-orange-400'>
{interestedUsers}
</div>
<div className='text-xs text-gray-400 mt-1'>
{totalUsers > 0
? ((interestedUsers / totalUsers) * 100).toFixed(1)
: 0}
%
</div>
</div>
</div>
{/* 图表区域 */}
<div className='grid grid-cols-1 lg:grid-cols-2 gap-6'>
{/* 职业分布 */}
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<PieChart className='w-4 h-4 text-blue-500' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('职业分布')}
</span>
</div>
{jobTypePieSpec ? (
<>
<VChart
spec={jobTypePieSpec}
option={{ mode: 'desktop-browser' }}
style={{ height: 180 }}
/>
<div className='mt-3 space-y-2'>
{surveyStats?.job_type_stats?.map((item) => {
const config = JOB_TYPE_CONFIG[item.job_type];
return (
<div
key={item.job_type}
className='flex items-center justify-between'
>
<div className='flex items-center gap-2'>
<span className='text-lg'>{config?.icon}</span>
<span className='text-sm text-gray-600 dark:text-gray-400'>
{config?.label}
</span>
</div>
<div className='flex items-center gap-2'>
<Progress
percent={item.percentage}
size='small'
style={{ width: 60 }}
showInfo={false}
stroke={
config?.color === 'blue'
? '#3b82f6'
: config?.color === 'green'
? '#10b981'
: '#f59e0b'
}
/>
<span className='text-sm font-medium w-12 text-right'>
{item.count}
</span>
</div>
</div>
);
})}
) : (
<div className='space-y-6'>
{/* 概览统计卡片 */}
<div className='grid grid-cols-2 sm:grid-cols-4 gap-4'>
<div className='p-4 bg-gradient-to-br from-brand-from/5 to-brand-to/5 dark:from-brand-from/20 dark:to-brand-to/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<Users className='w-4 h-4 text-brand' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('总填写')}
</span>
</div>
</>
) : (
<div className='h-[200px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
)}
</div>
{/* AI工具使用情况 */}
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<PieChart className='w-4 h-4 text-green-500' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('AI工具使用情况')}
</span>
</div>
{aiToolPieSpec ? (
<>
<VChart
spec={aiToolPieSpec}
option={{ mode: 'desktop-browser' }}
style={{ height: 180 }}
/>
<div className='mt-3 space-y-2'>
{surveyStats?.ai_tool_stats?.map((item) => {
const config = AI_TOOL_CONFIG[item.ai_tool_usage];
const colors = {
green: '#10b981',
blue: '#3b82f6',
orange: '#f59e0b',
grey: '#9ca3af',
};
return (
<div
key={item.ai_tool_usage}
className='flex items-center justify-between'
>
<div className='flex items-center gap-2'>
<span className='text-lg'>{config?.icon}</span>
<span className='text-sm text-gray-600 dark:text-gray-400'>
{config?.label}
</span>
</div>
<div className='flex items-center gap-2'>
<Progress
percent={item.percentage}
size='small'
style={{ width: 60 }}
showInfo={false}
stroke={colors[config?.color] || '#9ca3af'}
/>
<span className='text-sm font-medium w-12 text-right'>
{item.count}
</span>
</div>
</div>
);
})}
<div className='text-2xl font-bold text-brand-deep dark:text-brand-from'>
{totalUsers}
</div>
</div>
<div className='p-4 bg-gradient-to-br from-blue-50 to-cyan-50 dark:from-blue-900/20 dark:to-cyan-900/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<Briefcase className='w-4 h-4 text-blue-500' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('技术岗位')}
</span>
</div>
<div className='text-2xl font-bold text-blue-600 dark:text-blue-400'>
{techUsers}
</div>
<div className='text-xs text-gray-400 mt-1'>
{totalUsers > 0
? ((techUsers / totalUsers) * 100).toFixed(1)
: 0}
%
</div>
</div>
<div className='p-4 bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<Cpu className='w-4 h-4 text-green-500' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('正在使用AI')}
</span>
</div>
<div className='text-2xl font-bold text-green-600 dark:text-green-400'>
{activeAIUsers}
</div>
<div className='text-xs text-gray-400 mt-1'>
{totalUsers > 0
? ((activeAIUsers / totalUsers) * 100).toFixed(1)
: 0}
%
</div>
</div>
<div className='p-4 bg-gradient-to-br from-orange-50 to-amber-50 dark:from-orange-900/20 dark:to-amber-900/20 rounded-xl'>
<div className='flex items-center gap-2 mb-2'>
<TrendingUp className='w-4 h-4 text-orange-500' />
<span className='text-xs text-gray-500 dark:text-gray-400'>
{t('有兴趣尝试')}
</span>
</div>
<div className='text-2xl font-bold text-orange-600 dark:text-orange-400'>
{interestedUsers}
</div>
<div className='text-xs text-gray-400 mt-1'>
{totalUsers > 0
? ((interestedUsers / totalUsers) * 100).toFixed(1)
: 0}
%
</div>
</>
) : (
<div className='h-[200px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
)}
</div>
</div>
{/* 填写趋势 */}
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<BarChart3 className='w-4 h-4 text-brand' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('近30天填写趋势')}
</span>
</div>
{trendSpec ? (
<VChart
spec={trendSpec}
option={{ mode: 'desktop-browser' }}
style={{ height: 200 }}
/>
) : (
<div className='h-[200px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
)}
</div>
{/* 交叉分析表格 */}
{surveyStats?.cross_analysis &&
surveyStats.cross_analysis.length > 0 && (
{/* 图表区域 */}
<div className='grid grid-cols-1 lg:grid-cols-2 gap-6'>
{/* 职业分布 */}
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<PieChart className='w-4 h-4 text-blue-500' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('职业分布')}
</span>
</div>
{jobTypePieSpec ? (
<>
<VChart
spec={jobTypePieSpec}
option={{ mode: 'desktop-browser' }}
style={{ height: 180 }}
/>
<div className='mt-3 space-y-2'>
{surveyStats?.job_type_stats?.map((item) => {
const config = JOB_TYPE_CONFIG[item.job_type];
return (
<div
key={item.job_type}
className='flex items-center justify-between'
>
<div className='flex items-center gap-2'>
<span className='text-lg'>
{config?.icon}
</span>
<span className='text-sm text-gray-600 dark:text-gray-400'>
{config?.label}
</span>
</div>
<div className='flex items-center gap-2'>
<Progress
percent={item.percentage}
size='small'
style={{ width: 60 }}
showInfo={false}
stroke={
config?.color === 'blue'
? '#3b82f6'
: config?.color === 'green'
? '#10b981'
: '#f59e0b'
}
/>
<span className='text-sm font-medium w-12 text-right'>
{item.count}
</span>
</div>
</div>
);
})}
</div>
</>
) : (
<div className='h-[200px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
)}
</div>
{/* AI工具使用情况 */}
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<PieChart className='w-4 h-4 text-green-500' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('AI工具使用情况')}
</span>
</div>
{aiToolPieSpec ? (
<>
<VChart
spec={aiToolPieSpec}
option={{ mode: 'desktop-browser' }}
style={{ height: 180 }}
/>
<div className='mt-3 space-y-2'>
{surveyStats?.ai_tool_stats?.map((item) => {
const config = AI_TOOL_CONFIG[item.ai_tool_usage];
const colors = {
green: '#10b981',
blue: '#3b82f6',
orange: '#f59e0b',
grey: '#9ca3af',
};
return (
<div
key={item.ai_tool_usage}
className='flex items-center justify-between'
>
<div className='flex items-center gap-2'>
<span className='text-lg'>
{config?.icon}
</span>
<span className='text-sm text-gray-600 dark:text-gray-400'>
{config?.label}
</span>
</div>
<div className='flex items-center gap-2'>
<Progress
percent={item.percentage}
size='small'
style={{ width: 60 }}
showInfo={false}
stroke={
colors[config?.color] || '#9ca3af'
}
/>
<span className='text-sm font-medium w-12 text-right'>
{item.count}
</span>
</div>
</div>
);
})}
</div>
</>
) : (
<div className='h-[200px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
)}
</div>
</div>
{/* 填写趋势 */}
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<BarChart3 className='w-4 h-4 text-brand' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('交叉分析')}
{t('近30天填写趋势')}
</span>
</div>
<div className='overflow-x-auto'>
<table className='w-full text-sm'>
<thead>
<tr className='border-b border-gray-200 dark:border-gray-700'>
<th className='text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400'>
{t('职业类型')}
</th>
<th className='text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400'>
{t('AI工具使用')}
</th>
<th className='text-right py-2 px-3 font-medium text-gray-600 dark:text-gray-400'>
{t('人数')}
</th>
</tr>
</thead>
<tbody>
{surveyStats.cross_analysis.map((item, index) => (
<tr
key={index}
className='border-b border-gray-100 dark:border-gray-700/50 last:border-0'
>
<td className='py-2 px-3'>
<div className='flex items-center gap-2'>
<span>
{JOB_TYPE_CONFIG[item.job_type]?.icon}
</span>
<span className='text-gray-700 dark:text-gray-300'>
{JOB_TYPE_CONFIG[item.job_type]?.label}
</span>
</div>
</td>
<td className='py-2 px-3'>
<Tag
color={
AI_TOOL_CONFIG[item.ai_tool_usage]?.color
}
size='small'
>
{AI_TOOL_CONFIG[item.ai_tool_usage]?.label}
</Tag>
</td>
<td className='py-2 px-3 text-right font-medium'>
{item.count}
</td>
</tr>
))}
</tbody>
</table>
</div>
{trendSpec ? (
<VChart
spec={trendSpec}
option={{ mode: 'desktop-browser' }}
style={{ height: 200 }}
/>
) : (
<div className='h-[200px] flex items-center justify-center text-gray-400'>
{t('暂无数据')}
</div>
)}
</div>
)}
</div>
{/* 交叉分析表格 */}
{surveyStats?.cross_analysis &&
surveyStats.cross_analysis.length > 0 && (
<div className='bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4'>
<div className='flex items-center gap-2 mb-4'>
<BarChart3 className='w-4 h-4 text-brand' />
<span className='font-medium text-gray-700 dark:text-gray-300'>
{t('交叉分析')}
</span>
</div>
<div className='overflow-x-auto'>
<table className='w-full text-sm'>
<thead>
<tr className='border-b border-gray-200 dark:border-gray-700'>
<th className='text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400'>
{t('职业类型')}
</th>
<th className='text-left py-2 px-3 font-medium text-gray-600 dark:text-gray-400'>
{t('AI工具使用')}
</th>
<th className='text-right py-2 px-3 font-medium text-gray-600 dark:text-gray-400'>
{t('人数')}
</th>
</tr>
</thead>
<tbody>
{surveyStats.cross_analysis.map((item, index) => (
<tr
key={index}
className='border-b border-gray-100 dark:border-gray-700/50 last:border-0'
>
<td className='py-2 px-3'>
<div className='flex items-center gap-2'>
<span>
{JOB_TYPE_CONFIG[item.job_type]?.icon}
</span>
<span className='text-gray-700 dark:text-gray-300'>
{JOB_TYPE_CONFIG[item.job_type]?.label}
</span>
</div>
</td>
<td className='py-2 px-3'>
<Tag
color={
AI_TOOL_CONFIG[item.ai_tool_usage]
?.color
}
size='small'
>
{
AI_TOOL_CONFIG[item.ai_tool_usage]
?.label
}
</Tag>
</td>
<td className='py-2 px-3 text-right font-medium'>
{item.count}
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
)}
</div>
)}
</Spin>
)}
</Spin>
)}
</Card>
</Card>
</div>
</div>
);
};
+18 -14
View File
@@ -20,16 +20,18 @@ import React from 'react';
import { Card, Table } from '@/components/ui';
import { renderQuota } from '../../helpers';
const UserTopupRanking = ({ data, title, icon, t }) => {
const UserTopupRanking = ({ data, title, icon, t, embedded = false }) => {
if (!data || data.length === 0) {
return (
<Card
className='shadow-sm hover:shadow-md transition-shadow'
className={`shadow-sm hover:shadow-md transition-shadow ${embedded ? 'analytics-fold-content' : ''}`}
title={
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
</div>
embedded ? undefined : (
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
</div>
)
}
bodyStyle={{ padding: '16px' }}
>
@@ -123,15 +125,17 @@ const UserTopupRanking = ({ data, title, icon, t }) => {
return (
<Card
className='shadow-sm hover:shadow-md transition-shadow'
className={`shadow-sm hover:shadow-md transition-shadow ${embedded ? 'analytics-fold-content' : ''}`}
title={
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>
{t('共')} {data.length} {t('人')}
</span>
</div>
embedded ? undefined : (
<div className='flex items-center gap-2'>
<span className='text-brand'>{icon}</span>
<span className='font-semibold'>{title}</span>
<span className='text-xs text-gray-400 ml-2'>
{t('共')} {data.length} {t('人')}
</span>
</div>
)
}
bodyStyle={{ padding: '0' }}
>
@@ -0,0 +1,35 @@
.console-page .analytics-fold-panel {
min-width: 0;
overflow: hidden;
border: 1px solid var(--console-border);
border-radius: 0.75rem;
background: var(--console-surface);
}
.console-page .analytics-fold-panel > button {
border: 0;
border-radius: 0;
box-shadow: none;
background: transparent;
border-bottom-color: var(--console-border);
transition: none;
}
.console-page .analytics-fold-panel > button:focus:not(:focus-visible) {
outline: none;
}
.console-page .analytics-fold-panel > button:focus-visible {
outline: 2px solid var(--console-primary);
outline-offset: -2px;
}
.console-page .analytics-fold-panel > button[aria-expanded='true'] {
border-bottom: 1px solid var(--console-border);
}
.console-page .analytics-fold-panel .analytics-fold-content.ant-card {
border: 0;
border-radius: 0;
box-shadow: none;
}
@@ -39,8 +39,8 @@ export const ReportHeader = ({ report, onExport, t }) => {
m.rollup_ready && m.history_floor > 0 && m.prev_start < m.history_floor;
return (
<>
<Card className='shadow-sm mb-4' bodyStyle={{ padding: '16px 20px' }}>
<div className='flex flex-col gap-4'>
<Card className='shadow-sm' bodyStyle={{ padding: '16px 20px' }}>
<div className='flex flex-col md:flex-row md:items-center md:justify-between gap-3'>
<div className='min-w-0'>
<div className='text-xs font-semibold tracking-wider text-brand mb-1'>
@@ -68,7 +68,6 @@ export const ReportHeader = ({ report, onExport, t }) => {
</Card>
{!m.rollup_ready ? (
<Banner
className='mb-4'
type='warning'
fullMode={false}
closeIcon={null}
@@ -80,7 +79,6 @@ export const ReportHeader = ({ report, onExport, t }) => {
) : null}
{m.rollup_ready && !m.history_ready ? (
<Banner
className='mb-4'
type='info'
fullMode={false}
closeIcon={null}
@@ -92,7 +90,6 @@ export const ReportHeader = ({ report, onExport, t }) => {
) : null}
{beyondFloor ? (
<Banner
className='mb-4'
type='info'
fullMode={false}
closeIcon={null}
@@ -106,7 +103,6 @@ export const ReportHeader = ({ report, onExport, t }) => {
) : null}
{stale ? (
<Banner
className='mb-4'
type='warning'
fullMode={false}
closeIcon={null}
@@ -118,7 +114,7 @@ export const ReportHeader = ({ report, onExport, t }) => {
)}
/>
) : null}
</>
</div>
);
};
+8 -6
View File
@@ -120,11 +120,13 @@ const OrgReportPanel = ({ report, loading, error, onRetry, t }) => {
: 'transition-opacity'
}
>
<ReportHeader
report={report}
onExport={() => exportOrgDetail(report.orgs || [], cny, t)}
t={t}
/>
<div className='pb-2.5'>
<ReportHeader
report={report}
onExport={() => exportOrgDetail(report.orgs || [], cny, t)}
t={t}
/>
</div>
<KeyFindings findings={findings} onJump={jump} t={t} />
@@ -191,7 +193,7 @@ const OrgReportPanel = ({ report, loading, error, onRetry, t }) => {
</div>
<SectionTitle index={7} title={t('团队与明细')} />
<div className='space-y-4 mb-6'>
<div className='flex flex-col gap-2.5 mb-6'>
<SalesRepTable
reps={reps}
cny={cny}
@@ -49,7 +49,7 @@ export const SectionCard = ({
export const SectionTitle = ({ id, index, title, desc }) => (
<div
id={id}
className='flex items-baseline gap-2 mb-3 mt-8 flex-wrap scroll-mt-24'
className='flex items-baseline gap-2 mb-3 mt-4 flex-wrap scroll-mt-24'
>
{index ? (
<span className='text-xs font-semibold tracking-wider text-brand tabular-nums'>