import React, { useState } from 'react'; import { useTheme } from '../contexts/ThemeContext'; import { Scale, Search, Plus, Edit, Trash2, Download, Filter, Folder, FolderOpen, ChevronRight, TrendingUp, TrendingDown, Minus, Target, CheckCircle, AlertCircle, Clock, Star, BarChart3, PieChart, Activity, Settings, Copy, Link2, FileText, User, Calendar, } from 'lucide-react'; import { PageType } from '../components/Sidebar'; interface EvaluationIndex { id: string; name: string; category: string; type: 'quantitative' | 'qualitative' | 'composite'; weight: number; description: string; calculationMethod?: string; dataSource?: string; updateFrequency: 'realtime' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'quarterly'; status: 'active' | 'draft' | 'deprecated'; createdAt: string; updatedAt: string; author: string; tags: string[]; baseline?: number; target?: number; currentValue?: number; trend: 'up' | 'down' | 'stable'; relatedIndices: string[]; } interface EvaluationSystem { id: string; name: string; description: string; category: string; indices: string[]; status: 'active' | 'draft' | 'archived'; createdAt: string; updatedAt: string; author: string; } interface EvaluationIndexResourceManagementProps { onNavigate: (page: PageType) => void; } const mockIndices: EvaluationIndex[] = [ { id: 'idx-001', name: '网络影响力指数', category: '影响力评估', type: 'composite', weight: 0.25, description: '综合评估目标在网络空间的影响力水平', calculationMethod: '加权平均法', dataSource: '社交媒体数据、新闻报道量', updateFrequency: 'daily', status: 'active', createdAt: '2023-06-15', updatedAt: '2024-03-10', author: '评估组A', tags: ['影响力', '网络', '综合'], baseline: 50, target: 80, currentValue: 72, trend: 'up', relatedIndices: ['idx-002', 'idx-003'], }, { id: 'idx-002', name: '传播范围指数', category: '传播效果', type: 'quantitative', weight: 0.20, description: '衡量信息在网络中的传播覆盖范围', calculationMethod: '触达人数 × 地域覆盖率', dataSource: '平台API数据', updateFrequency: 'realtime', status: 'active', createdAt: '2023-07-20', updatedAt: '2024-03-12', author: '评估组B', tags: ['传播', '覆盖', '定量'], baseline: 10000, target: 50000, currentValue: 42500, trend: 'up', relatedIndices: ['idx-001'], }, { id: 'idx-003', name: '舆论倾向指数', category: '舆情分析', type: 'qualitative', weight: 0.30, description: '评估网络舆论对目标的整体态度倾向', calculationMethod: '情感分析模型', dataSource: '社交媒体评论、新闻评论区', updateFrequency: 'hourly', status: 'active', createdAt: '2023-08-10', updatedAt: '2024-03-11', author: '评估组A', tags: ['舆情', '情感', '定性'], baseline: 0, target: 75, currentValue: 68, trend: 'stable', relatedIndices: ['idx-001', 'idx-004'], }, { id: 'idx-004', name: '响应时效指数', category: '效能评估', type: 'quantitative', weight: 0.15, description: '评估对网络事件的响应速度', calculationMethod: '平均响应时间 (小时)', dataSource: '事件追踪系统', updateFrequency: 'weekly', status: 'active', createdAt: '2023-09-05', updatedAt: '2024-03-08', author: '评估组C', tags: ['时效', '效能', '定量'], baseline: 24, target: 4, currentValue: 6, trend: 'down', relatedIndices: ['idx-005'], }, { id: 'idx-005', name: '协调联动指数', category: '协作效能', type: 'composite', weight: 0.10, description: '评估多部门协作的顺畅程度', calculationMethod: '任务完成率 × 沟通效率', dataSource: '协同办公系统', updateFrequency: 'monthly', status: 'draft', createdAt: '2024-01-15', updatedAt: '2024-03-05', author: '评估组D', tags: ['协作', '联动', '综合'], trend: 'stable', relatedIndices: ['idx-004'], }, { id: 'idx-006', name: '风险预警准确率', category: '预警效能', type: 'quantitative', weight: 0.25, description: '风险预警的准确程度', calculationMethod: '准确预警数 / 总预警数', dataSource: '预警系统日志', updateFrequency: 'monthly', status: 'active', createdAt: '2023-10-20', updatedAt: '2024-02-28', author: '评估组A', tags: ['预警', '准确率', '定量'], baseline: 60, target: 90, currentValue: 82, trend: 'up', relatedIndices: [], }, { id: 'idx-007', name: '策略有效性指数', category: '策略评估', type: 'composite', weight: 0.30, description: '评估所采取措施的有效性', calculationMethod: '多维度加权评估', dataSource: '策略执行数据、效果追踪', updateFrequency: 'quarterly', status: 'active', createdAt: '2023-11-10', updatedAt: '2024-03-01', author: '评估组B', tags: ['策略', '效果', '综合'], baseline: 50, target: 85, currentValue: 78, trend: 'up', relatedIndices: ['idx-001', 'idx-003'], }, { id: 'idx-008', name: '信息完整度', category: '数据质量', type: 'quantitative', weight: 0.10, description: '目标画像信息的完整程度', calculationMethod: '已填写字段数 / 总字段数', dataSource: '画像数据库', updateFrequency: 'weekly', status: 'deprecated', createdAt: '2023-05-01', updatedAt: '2024-01-15', author: '评估组C', tags: ['数据', '完整度', '定量'], trend: 'stable', relatedIndices: [], }, ]; const mockSystems: EvaluationSystem[] = [ { id: 'sys-001', name: '网络态势综合评估体系', description: '用于评估网络空间整体态势的综合指标体系', category: '态势评估', indices: ['idx-001', 'idx-002', 'idx-003'], status: 'active', createdAt: '2023-06-01', updatedAt: '2024-03-10', author: '评估部', }, { id: 'sys-002', name: '响应效能评估体系', description: '评估应急响应和处置效能的指标体系', category: '效能评估', indices: ['idx-004', 'idx-005'], status: 'active', createdAt: '2023-09-01', updatedAt: '2024-03-08', author: '效能组', }, ]; const typeLabels: Record = { quantitative: '定量', qualitative: '定性', composite: '综合', }; const typeColors: Record = { quantitative: 'bg-blue-500/20 text-blue-400', qualitative: 'bg-purple-500/20 text-purple-400', composite: 'bg-orange-500/20 text-orange-400', }; const statusColors: Record = { active: { bg: 'bg-green-500/20', text: 'text-green-400', label: '使用中' }, draft: { bg: 'bg-yellow-500/20', text: 'text-yellow-400', label: '草稿' }, deprecated: { bg: 'bg-gray-500/20', text: 'text-gray-400', label: '已废弃' }, }; const frequencyLabels: Record = { realtime: '实时', hourly: '每小时', daily: '每日', weekly: '每周', monthly: '每月', quarterly: '每季度', }; const trendIcons: Record = { up: , down: , stable: , }; const categories = ['全部', '影响力评估', '传播效果', '舆情分析', '效能评估', '协作效能', '预警效能', '策略评估', '数据质量']; const EvaluationIndexResourceManagement: React.FC = ({ onNavigate }) => { const { theme } = useTheme(); const isDark = theme === 'dark'; const [viewMode, setViewMode] = useState<'index' | 'system'>('index'); const [searchQuery, setSearchQuery] = useState(''); const [selectedCategory, setSelectedCategory] = useState('全部'); const [selectedType, setSelectedType] = useState('all'); const [selectedStatus, setSelectedStatus] = useState('all'); const [selectedIndex, setSelectedIndex] = useState(null); const [expandedCategories, setExpandedCategories] = useState>(new Set(['影响力评估', '传播效果', '舆情分析'])); const filteredIndices = mockIndices.filter(index => { const matchesSearch = index.name.toLowerCase().includes(searchQuery.toLowerCase()) || index.description.toLowerCase().includes(searchQuery.toLowerCase()) || index.tags.some(tag => tag.toLowerCase().includes(searchQuery.toLowerCase())); const matchesCategory = selectedCategory === '全部' || index.category === selectedCategory; const matchesType = selectedType === 'all' || index.type === selectedType; const matchesStatus = selectedStatus === 'all' || index.status === selectedStatus; return matchesSearch && matchesCategory && matchesType && matchesStatus; }); const stats = { total: mockIndices.length, active: mockIndices.filter(i => i.status === 'active').length, draft: mockIndices.filter(i => i.status === 'draft').length, deprecated: mockIndices.filter(i => i.status === 'deprecated').length, }; const groupedIndices = filteredIndices.reduce((acc, index) => { if (!acc[index.category]) { acc[index.category] = []; } acc[index.category].push(index); return acc; }, {} as Record); const toggleCategory = (category: string) => { setExpandedCategories(prev => { const next = new Set(prev); if (next.has(category)) { next.delete(category); } else { next.add(category); } return next; }); }; const calculateProgress = (index: EvaluationIndex) => { if (!index.baseline || !index.target || !index.currentValue) return null; const progress = ((index.currentValue - index.baseline) / (index.target - index.baseline)) * 100; return Math.min(Math.max(progress, 0), 100); }; return (
{/* 页面标题 */}

评估指标体系资源管理

管理和维护评估指标库与指标体系

{/* 统计卡片 */}

指标总数

{stats.total}

使用中

{stats.active}

草稿

{stats.draft}

已废弃

{stats.deprecated}

{/* 视图切换和筛选栏 */}
{/* 视图切换 */}
{/* 筛选栏 */}
{/* 搜索框 */}
setSearchQuery(e.target.value)} className={`w-full pl-10 pr-4 py-2 rounded-lg border transition-all ${ isDark ? 'bg-slate-900/50 border-slate-700 text-white placeholder-slate-500 focus:border-amber-500' : 'bg-gray-50 border-gray-200 text-gray-900 placeholder-gray-400 focus:border-amber-400' }`} />
{/* 分类筛选 */}
{/* 类型筛选 */} {/* 状态筛选 */}
{/* 指标列表 */} {viewMode === 'index' ? (
{Object.entries(groupedIndices).map(([category, indices]) => (
{/* 分类标题 */} {/* 指标列表 */} {expandedCategories.has(category) && (
{indices.map((index, idx) => (
setSelectedIndex(index)} >
{index.type === 'quantitative' ? : index.type === 'qualitative' ? : }

{index.name}

{index.description}

{/* 进度条 */} {index.currentValue !== undefined && index.baseline !== undefined && index.target !== undefined && (
当前值: {index.currentValue} 目标: {index.target}
= 100 ? 'bg-green-500' : calculateProgress(index)! >= 50 ? 'bg-amber-500' : 'bg-red-500' }`} style={{ width: `${calculateProgress(index)}%` }} />
)}
{typeLabels[index.type]} {statusColors[index.status].label}
{index.trend && trendIcons[index.trend]} {index.updateFrequency === 'realtime' ? '实时' : index.updateFrequency === 'daily' ? '每日' : index.updateFrequency === 'weekly' ? '每周' : index.updateFrequency === 'monthly' ? '每月' : '每季度'}
权重: {index.weight * 100}%
{index.tags.slice(0, 3).map(tag => ( {tag} ))}
))}
)}
))}
) : ( /* 体系管理视图 */
{mockSystems.map(system => (

{system.name}

{system.category}

{system.status === 'active' ? '使用中' : system.status === 'draft' ? '草稿' : '已归档'}

{system.description}

包含 {system.indices.length} 个指标
))}
)} {/* 指标详情弹窗 */} {selectedIndex && (
setSelectedIndex(null)}>
e.stopPropagation()} >
{selectedIndex.type === 'quantitative' ? : selectedIndex.type === 'qualitative' ? : }

{selectedIndex.name}

{typeLabels[selectedIndex.type]}

{selectedIndex.category}

指标描述

{selectedIndex.description}

{selectedIndex.calculationMethod && (

计算方法

{selectedIndex.calculationMethod}

)} {selectedIndex.dataSource && (

数据来源

{selectedIndex.dataSource}

)}

权重

{selectedIndex.weight * 100}%

更新频率

{frequencyLabels[selectedIndex.updateFrequency]}

状态

{statusColors[selectedIndex.status].label}

趋势

{trendIcons[selectedIndex.trend]} {selectedIndex.trend === 'up' ? '上升' : selectedIndex.trend === 'down' ? '下降' : '稳定'}
{selectedIndex.baseline !== undefined && (

基线值

{selectedIndex.baseline}

)} {selectedIndex.target !== undefined && (

目标值

{selectedIndex.target}

)} {selectedIndex.currentValue !== undefined && (

当前值

{selectedIndex.currentValue}

)}

作者

{selectedIndex.author}

更新时间

{selectedIndex.updatedAt}

标签

{selectedIndex.tags.map(tag => ( {tag} ))}
{selectedIndex.relatedIndices.length > 0 && (

关联指标

{selectedIndex.relatedIndices.map(relatedId => { const related = mockIndices.find(i => i.id === relatedId); return related ? ( {related.name} ) : null; })}
)}
)}
); }; export default EvaluationIndexResourceManagement;