import React, { useState } from 'react'; import { useTheme } from '../contexts/ThemeContext'; import { PageType } from '../components/Sidebar'; import { Settings, User, Bell, Shield, Database, Palette, Key, Globe, Monitor, Smartphone, Mail, MessageSquare, Clock, Save, RefreshCw, CheckCircle, AlertTriangle, ChevronRight, Building, Users, Bot, Workflow, FileText, Zap, } from 'lucide-react'; interface SystemSettingsProps { onNavigate: (page: PageType) => void; } const SystemSettings: React.FC = ({ onNavigate }) => { const { theme } = useTheme(); const isDark = theme === 'dark'; // 主题颜色类 const cardBg = isDark ? 'bg-slate-800/30' : 'bg-white'; const cardBorder = isDark ? 'border-blue-800/30' : 'border-red-200'; const textPrimary = isDark ? 'text-white' : 'text-gray-900'; const textSecondary = isDark ? 'text-slate-400' : 'text-gray-600'; const textMuted = isDark ? 'text-slate-500' : 'text-gray-500'; const btnSecondary = isDark ? 'bg-slate-700/50 hover:bg-slate-600/50 border-blue-800/30 text-slate-300' : 'bg-gray-100 hover:bg-gray-200 border-gray-300 text-gray-700'; const btnPrimary = isDark ? 'bg-blue-600 hover:bg-blue-500' : 'bg-red-600 hover:bg-red-500'; const inputBg = isDark ? 'bg-slate-900/50' : 'bg-gray-50'; const inputBorder = isDark ? 'border-blue-800/30' : 'border-gray-300'; const [activeTab, setActiveTab] = useState('general'); const [settings, setSettings] = useState({ // 通用设置 systemName: '智能策略系统', systemVersion: 'V1.0.0', language: 'zh-CN', timezone: 'Asia/Shanghai', // 通知设置 emailNotification: true, inAppNotification: true, smsNotification: false, // 安全设置 sessionTimeout: 30, passwordExpiration: 90, twoFactorAuth: false, // 运行规则 maxDiscussionRounds: 10, maxRollbackTimes: 3, enableStateGate: true, enableLogicChainCheck: true, enableRiskReview: true, allowPartialParallel: true, }); const tabs = [ { id: 'general', label: '通用设置', icon: Settings }, { id: 'user', label: '用户管理', icon: Users }, { id: 'agent', label: '智能体管理', icon: Bot }, { id: 'notification', label: '通知设置', icon: Bell }, { id: 'security', label: '安全设置', icon: Shield }, { id: 'workflow', label: '运行规则', icon: Workflow }, { id: 'template', label: '模板管理', icon: FileText }, ]; return (
{/* 顶部标题栏 */}

系统设置

管理智能策略系统的各项配置

系统运行正常
{/* 左侧导航 (20%) */}

设置分类

{/* 系统信息 */}

系统信息

版本号 {settings.systemVersion}
运行环境 生产环境
最后更新 2026-03-19
{/* 右侧设置区 (80%) */}
{/* 通用设置 */} {activeTab === 'general' && (

通用设置

setSettings({ ...settings, systemName: e.target.value })} className={`w-full px-4 py-2.5 ${inputBg} ${inputBorder} rounded-lg ${textPrimary} text-sm`} />

自动保存设置

开启后,系统会自动保存您的设置更改

)} {/* 用户管理 */} {activeTab === 'user' && (

用户管理

{[ { name: '张策略', role: '管理员', email: 'zhang@company.com', status: 'active' }, { name: '李智能', role: '策略分析师', email: 'li@company.com', status: 'active' }, { name: '王智能体', role: '智能体管理员', email: 'wang@company.com', status: 'active' }, { name: '赵运维', role: '运维工程师', email: 'zhao@company.com', status: 'inactive' }, ].map((user, i) => (

{user.name}

{user.email}

{user.role} {user.status === 'active' ? '在线' : '离线'}
))}
)} {/* 智能体管理 */} {activeTab === 'agent' && (

智能体管理

{[ { name: 'GoalAgent', type: '目标分析', status: 'running', tasks: 156 }, { name: 'AudienceAgent', type: '受众分析', status: 'running', tasks: 142 }, { name: 'BehaviorAgent', type: '行为分析', status: 'idle', tasks: 98 }, { name: 'DriverAgent', type: '驱动分析', status: 'idle', tasks: 87 }, { name: 'NarrativeAgent', type: '叙事分析', status: 'idle', tasks: 76 }, { name: 'LogicChainAgent', type: '逻辑链收敛', status: 'idle', tasks: 65 }, ].map((agent, i) => (
{agent.name}
{agent.status === 'running' ? '运行中' : '空闲'}

{agent.type}

已完成任务 {agent.tasks}
))}
)} {/* 通知设置 */} {activeTab === 'notification' && (

通知设置

{[ { id: 'email', label: '邮件通知', description: '接收任务完成、风险提醒等邮件通知', icon: Mail, enabled: settings.emailNotification }, { id: 'inApp', label: '站内通知', description: '在系统内显示通知消息', icon: MessageSquare, enabled: settings.inAppNotification }, { id: 'sms', label: '短信通知', description: '发送重要事项的短信提醒', icon: Smartphone, enabled: settings.smsNotification }, ].map((item) => (

{item.label}

{item.description}

))}
至
)} {/* 安全设置 */} {activeTab === 'security' && (

安全设置

双因素认证

登录时需要额外的验证码验证

)} {/* 运行规则 */} {activeTab === 'workflow' && (

运行规则配置

{[ { id: 'enableStateGate', label: '启用状态门控', description: '智能体输出需要通过状态门控检查才能进入下一节点' }, { id: 'enableLogicChainCheck', label: '启用逻辑链校验', description: '在逻辑链收敛阶段进行一致性检查' }, { id: 'enableRiskReview', label: '启用风险强制复核', description: '高风险项必须经过人工确认才能继续' }, { id: 'allowPartialParallel', label: '允许局部并行', description: '独立的流程节点可以并行执行' }, ].map((item) => (

{item.label}

{item.description}

))}
setSettings({ ...settings, maxDiscussionRounds: Number(e.target.value) })} className={`w-full px-4 py-2.5 ${inputBg} ${inputBorder} rounded-lg ${textPrimary} text-sm`} />

超出此轮数将自动收敛

setSettings({ ...settings, maxRollbackTimes: Number(e.target.value) })} className={`w-full px-4 py-2.5 ${inputBg} ${inputBorder} rounded-lg ${textPrimary} text-sm`} />

超出此次数将终止任务

)} {/* 模板管理 */} {activeTab === 'template' && (

模板管理

{[ { name: '宣传策略模板', type: '策略生成', fields: 24, updated: '2026-03-15' }, { name: '活动方案模板', type: '方案推演', fields: 32, updated: '2026-03-10' }, { name: '市场分析模板', type: '市场调研', fields: 18, updated: '2026-03-08' }, { name: '产品推广模板', type: '产品营销', fields: 28, updated: '2026-03-05' }, { name: '品牌公关模板', type: '公关传播', fields: 22, updated: '2026-03-01' }, { name: '用户调研模板', type: '用户洞察', fields: 16, updated: '2026-02-28' }, ].map((template, i) => (
{template.name}

{template.type}

{template.fields} 个字段 更新于 {template.updated}
))}
)} {/* 保存按钮 */}
); }; export default SystemSettings;