"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Card } from "@/components/ui/card" import { ArrowLeft } from "lucide-react" import { useRouter } from "next/navigation" import { StepIndicator } from "../components/step-indicator" import { BasicSettings } from "./components/basic-settings" import { TargetSelection } from "./components/target-selection" import { useToast } from "@/components/ui/use-toast" export default function CreateAnalysisPlanPage() { const router = useRouter() const { toast } = useToast() const [currentStep, setCurrentStep] = useState(1) const [formData, setFormData] = useState({ taskName: "", analysisTypes: [] as string[], targetType: "device", // "device" or "trafficPool" selectedDevices: [] as string[], selectedTrafficPool: "", tags: [] as string[], regions: [] as string[], keywords: [] as string[], }) const handleNext = () => { setCurrentStep((prev) => prev + 1) } const handleBack = () => { if (currentStep === 1) { router.back() } else { setCurrentStep((prev) => prev - 1) } } const handleSubmit = async () => { try { // 显示加载状态 toast({ title: "正在创建分析计划...", description: "请稍候", }) // 模拟API请求延迟 await new Promise((resolve) => setTimeout(resolve, 1500)) // 成功提示 toast({ title: "分析计划创建成功", description: "您可以在列表中查看分析进度", }) // 跳转回列表页 router.push("/workspace/ai-analyzer") } catch (error) { toast({ title: "创建失败", description: "请稍后重试", variant: "destructive", }) } } const updateFormData = (data: Partial) => { setFormData((prev) => ({ ...prev, ...data })) } return (
{/* 头部 */}

新建分析计划

{/* 步骤指示器 */}
{/* 主内容区域 */}
{currentStep === 1 && ( )} {currentStep === 2 && ( )}
) }