import React, { useState } from "react"; import { FileText, Search, Filter, Download, Target, Clock, CheckCircle, AlertTriangle, Plus, TrendingUp, TrendingDown, ChevronRight, User, Eye, } from "lucide-react"; import { useTheme } from "@/contexts/ThemeContext"; import { PageType } from "@/components/Sidebar"; interface TaskDashboardProps { onNavigate: (page: PageType) => void; } const TaskDashboard: 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-100"; 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-400"; const inputBg = isDark ? "bg-slate-900/50" : "bg-white"; const [timeRange, setTimeRange] = useState("month"); const [categoryFilter, setCategoryFilter] = useState("all"); const [statusFilter, setStatusFilter] = useState("all"); // 统计数据 const stats = { total: 1286, inProgress: 326, completed: 842, delayed: 57, weeklyNew: 93, priorityPending: 41, }; // 二级任务分类数据 const categoryData = [ { name: "XK任务", count: 320, percentage: 25 }, { name: "规划任务", count: 240, percentage: 19 }, { name: "MNTY任务", count: 280, percentage: 22 }, { name: "效果PG任务", count: 300, percentage: 23 }, ]; // 三级任务数据 const thirdLevelData = [ { name: "任务JC", count: 120 }, { name: "任务调度", count: 200 }, { name: "任务FX", count: 140 }, { name: "行动CE", count: 100 }, { name: "XDTY任务", count: 70 }, { name: "方案TY任务", count: 120 }, { name: "XXTY任务", count: 90 }, { name: "任务PG", count: 160 }, { name: "行动PG", count: 80 }, { name: "信息PG", count: 130 }, { name: "账号PG", count: 60 }, ]; // 预警任务列表 const warningTasks = [ { id: "001", name: "五四宣传执行任务", category: "规划任务 / 行动CE", status: "已延期", dueDate: "04-20", riskLevel: "high", }, { id: "002", name: "青年传播调度任务", category: "XK任务 / 任务调度", status: "待处理", dueDate: "04-18", riskLevel: "medium", }, { id: "003", name: "效果复盘信息任务", category: "效果PG / 信息PG", status: "阻塞中", dueDate: "04-17", riskLevel: "high", }, ]; // 我的待办 const myTodos = { pending: 8, pendingConfirm: 3, pendingReview: 2, }; // Top 5 排行 const top5ByVolume = [ { name: "任务PG", count: 160 }, { name: "信息PG", count: 130 }, { name: "任务FX", count: 120 }, { name: "任务调度", count: 100 }, { name: "方案TY任务", count: 90 }, ]; const top5ByDelay = [ { name: "行动CE", count: 15 }, { name: "任务调度", count: 12 }, { name: "信息PG", count: 10 }, { name: "XDTY任务", count: 8 }, { name: "账号PG", count: 6 }, ]; // 完成率对比 const completionRates = [ { name: "XK任务", rate: 72 }, { name: "规划任务", rate: 61 }, { name: "MNTY任务", rate: 68 }, { name: "效果PG任务", rate: 54 }, ]; return (
{/* 顶部筛选区 */}

任务统计总览

面向分级分类任务体系的全局监控看板

{/* 第一行:核心指标卡 */}
任务总数

1,286

较上周 +8%
进行中

326

占比 25.4%
已完成

842

完成率 65.5%
延期任务

57

需重点关注
本周新增

93

较上周 +12
重点待处理

41

高优先级 12
{/* 第二行:分类分布区 */}
{/* 左侧:二级任务分类分布 */}

二级任务分类分布

{categoryData.map((item, index) => (
{item.name} {item.count}
))}
{/* 中间:三级任务分布(点击下钻) */}

三级任务分布

{thirdLevelData.slice(0, 5).map((item, index) => (
{item.name}
{item.count}
))}
{/* 右侧:三级任务数量Top5 */}

三级任务数量 Top 5

{top5ByVolume.map((item, index) => (
{index + 1} {item.name} {item.count}
))}
{/* 第三行:状态与趋势分析区 */}
{/* 左侧:任务状态分布 */}

任务状态分布

{categoryData.map((item, index) => (
{item.name}
))}
未开始
进行中
已完成
延期
{/* 中间:任务趋势图(简化版) */}

任务趋势(近30天)

{[65, 72, 68, 75, 80, 78, 85, 82, 88, 92, 87, 95].map( (value, index) => (
) )}
新增任务
完成任务
{/* 右侧:分类完成率对比 */}

分类完成率对比

{completionRates.map((item, index) => (
{item.name} {item.rate}%
))}
{/* 第四行:预警与行动区 */}
{/* 左侧:预警任务列表 */}

预警任务

{warningTasks.map((task) => (
{task.name}
截止:{task.dueDate}
{task.category} {task.status}
))}
{/* 中间:重点分类排行 */}

重点排行

任务量 Top 5
{top5ByVolume.map((item, index) => (
{index + 1}. {item.name} {item.count}
))}
延期量 Top 5
{top5ByDelay.map((item, index) => (
{index + 1}. {item.name} {item.count}
))}
{/* 右侧:我的待办/快捷入口 */}

我的待办

{myTodos.pending}

待处理

{myTodos.pendingConfirm}

待确认

{myTodos.pendingReview}

待复核

); }; export default TaskDashboard;