import { Button, Popover, Progress } from "antd"; import { Calendar, Clock, Play, Trash2, X } from "lucide-react"; interface TaskItem { id: string; name: string; status: string; progress: number; scheduleConfig: { type: string; cronExpression?: string; executionCount?: number; maxExecutions?: number; }; nextExecution?: string; importConfig: { source?: string; }; createdAt: string; } export default function TaskPopover() { const tasks: TaskItem[] = [ { id: "1", name: "导入客户数据", status: "importing", progress: 65, scheduleConfig: { type: "manual", }, importConfig: { source: "local", }, createdAt: "2025-07-29 14:23", }, { id: "2", name: "定时同步订单", status: "waiting", progress: 0, scheduleConfig: { type: "scheduled", cronExpression: "0 0 * * *", executionCount: 3, maxExecutions: 10, }, nextExecution: "2025-07-31 00:00", importConfig: { source: "api", }, createdAt: "2025-07-28 09:10", }, { id: "3", name: "清理历史日志", status: "finished", progress: 100, scheduleConfig: { type: "manual", }, importConfig: { source: "system", }, createdAt: "2025-07-27 17:45", }, ]; return (

近期任务

{tasks.length === 0 ? (

暂无创建任务

) : (
{tasks.map((task) => (

{task.name}

{task.status === "waiting" && ( )}
{task.status === "importing" && (
导入进度 {Math.round(task.progress)}%
)} {/* Schedule Information */} {task.scheduleConfig.type === "scheduled" && (
定时任务
Cron: {task.scheduleConfig.cronExpression}
{task.nextExecution && (
下次执行: {task.nextExecution}
)}
执行次数: {task.scheduleConfig.executionCount || 0}/ {task.scheduleConfig.maxExecutions || 10}
)}
{task.importConfig.source === "local" ? "本地上传" : task.importConfig.source || "未知来源"} {task.createdAt}
))}
)}
} >
); }