"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Label } from "@/components/ui/label" import { Input } from "@/components/ui/input" import { Checkbox } from "@/components/ui/checkbox" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import { Calendar } from "@/components/ui/calendar" import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover" import { format } from "date-fns" import { CalendarIcon, Clock } from "lucide-react" interface ExecutionSetupProps { formData: any updateFormData: (data: any) => void onNext: () => void onBack: () => void } export function ExecutionSetup({ formData, updateFormData, onNext, onBack }: ExecutionSetupProps) { const [scheduleType, setScheduleType] = useState(formData.executionConfig?.scheduleType || "immediate") const [scheduledDate, setScheduledDate] = useState( formData.executionConfig?.scheduledTime ? new Date(formData.executionConfig.scheduledTime) : undefined, ) const [scheduledTime, setScheduledTime] = useState( formData.executionConfig?.scheduledTime ? format(new Date(formData.executionConfig.scheduledTime), "HH:mm") : "09:00", ) const [notifyOnComplete, setNotifyOnComplete] = useState( formData.executionConfig?.notifyOnComplete !== undefined ? formData.executionConfig.notifyOnComplete : true, ) const [importTags, setImportTags] = useState( formData.executionConfig?.importTags !== undefined ? formData.executionConfig.importTags : true, ) const [sendToWechat, setSendToWechat] = useState( formData.executionConfig?.sendToWechat !== undefined ? formData.executionConfig.sendToWechat : false, ) const [wechatId, setWechatId] = useState(formData.executionConfig?.wechatId || "") const handleContinue = () => { let scheduledTimeString = "" if (scheduleType === "scheduled" && scheduledDate) { const [hours, minutes] = scheduledTime.split(":").map(Number) const dateObj = new Date(scheduledDate) dateObj.setHours(hours, minutes) scheduledTimeString = dateObj.toISOString() } updateFormData({ executionConfig: { scheduleType, scheduledTime: scheduledTimeString, notifyOnComplete, importTags, sendToWechat, wechatId: sendToWechat ? wechatId : "", }, }) onNext() } return (

执行设置

设置策略执行时间和结果处理方式

提交后立即开始执行策略优化

在指定的时间执行策略优化

{scheduleType === "scheduled" && (
setScheduledTime(e.target.value)} className="w-full" />
)}
setNotifyOnComplete(checked as boolean)} />
setImportTags(checked as boolean)} />
setSendToWechat(checked as boolean)} />
{sendToWechat && (
setWechatId(e.target.value)} placeholder="输入接收报告的微信号" className="mt-1" />
)}
) }