137 lines
5.6 KiB
TypeScript
137 lines
5.6 KiB
TypeScript
|
|
"use client"
|
|||
|
|
|
|||
|
|
import { useState } from "react"
|
|||
|
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"
|
|||
|
|
import { Button } from "@/components/ui/button"
|
|||
|
|
import { Input } from "@/components/ui/input"
|
|||
|
|
import { Label } from "@/components/ui/label"
|
|||
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
|||
|
|
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
|
|||
|
|
import { Users, Database } from "lucide-react"
|
|||
|
|
|
|||
|
|
interface CreateAssessmentTaskDialogProps {
|
|||
|
|
open: boolean
|
|||
|
|
onOpenChange: (open: boolean) => void
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export function CreateAssessmentTaskDialog({ open, onOpenChange }: CreateAssessmentTaskDialogProps) {
|
|||
|
|
const [formData, setFormData] = useState({
|
|||
|
|
name: "",
|
|||
|
|
model: "",
|
|||
|
|
targetType: "all",
|
|||
|
|
crowdId: "",
|
|||
|
|
schedule: "once",
|
|||
|
|
scheduleTime: "",
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
const handleSubmit = () => {
|
|||
|
|
console.log("创建评估任务:", formData)
|
|||
|
|
onOpenChange(false)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return (
|
|||
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|||
|
|
<DialogContent className="sm:max-w-[500px]">
|
|||
|
|
<DialogHeader>
|
|||
|
|
<DialogTitle>创建评估任务</DialogTitle>
|
|||
|
|
</DialogHeader>
|
|||
|
|
<div className="space-y-6 py-4">
|
|||
|
|
<div className="space-y-2">
|
|||
|
|
<Label>任务名称</Label>
|
|||
|
|
<Input
|
|||
|
|
placeholder="输入任务名称"
|
|||
|
|
value={formData.name}
|
|||
|
|
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
|||
|
|
/>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div className="space-y-2">
|
|||
|
|
<Label>选择模型</Label>
|
|||
|
|
<Select value={formData.model} onValueChange={(value) => setFormData({ ...formData, model: value })}>
|
|||
|
|
<SelectTrigger>
|
|||
|
|
<SelectValue placeholder="选择评估模型" />
|
|||
|
|
</SelectTrigger>
|
|||
|
|
<SelectContent>
|
|||
|
|
<SelectItem value="clv">CLV预测模型 v2.3.1</SelectItem>
|
|||
|
|
<SelectItem value="rfm">RFM评分模型 v1.5.0</SelectItem>
|
|||
|
|
<SelectItem value="churn">流失预警模型 v3.1.2</SelectItem>
|
|||
|
|
<SelectItem value="fraud">欺诈检测模型 v2.0.0</SelectItem>
|
|||
|
|
<SelectItem value="segment">用户分群模型 v1.0.0</SelectItem>
|
|||
|
|
</SelectContent>
|
|||
|
|
</Select>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div className="space-y-3">
|
|||
|
|
<Label>评估对象</Label>
|
|||
|
|
<RadioGroup
|
|||
|
|
value={formData.targetType}
|
|||
|
|
onValueChange={(value) => setFormData({ ...formData, targetType: value })}
|
|||
|
|
>
|
|||
|
|
<div className="flex items-center space-x-2 p-3 border rounded-lg hover:bg-gray-50">
|
|||
|
|
<RadioGroupItem value="all" id="all" />
|
|||
|
|
<Label htmlFor="all" className="flex items-center gap-2 cursor-pointer flex-1">
|
|||
|
|
<Database className="w-4 h-4 text-blue-500" />
|
|||
|
|
<div>
|
|||
|
|
<p className="font-medium">全部用户</p>
|
|||
|
|
<p className="text-xs text-gray-500">评估全量用户数据</p>
|
|||
|
|
</div>
|
|||
|
|
</Label>
|
|||
|
|
</div>
|
|||
|
|
<div className="flex items-center space-x-2 p-3 border rounded-lg hover:bg-gray-50">
|
|||
|
|
<RadioGroupItem value="crowd" id="crowd" />
|
|||
|
|
<Label htmlFor="crowd" className="flex items-center gap-2 cursor-pointer flex-1">
|
|||
|
|
<Users className="w-4 h-4 text-purple-500" />
|
|||
|
|
<div>
|
|||
|
|
<p className="font-medium">指定人群包</p>
|
|||
|
|
<p className="text-xs text-gray-500">选择已有人群包进行评估</p>
|
|||
|
|
</div>
|
|||
|
|
</Label>
|
|||
|
|
</div>
|
|||
|
|
</RadioGroup>
|
|||
|
|
{formData.targetType === "crowd" && (
|
|||
|
|
<Select value={formData.crowdId} onValueChange={(value) => setFormData({ ...formData, crowdId: value })}>
|
|||
|
|
<SelectTrigger>
|
|||
|
|
<SelectValue placeholder="选择人群包" />
|
|||
|
|
</SelectTrigger>
|
|||
|
|
<SelectContent>
|
|||
|
|
<SelectItem value="1">高价值用户包-S级 (125,800人)</SelectItem>
|
|||
|
|
<SelectItem value="2">流失预警用户包 (23,400人)</SelectItem>
|
|||
|
|
<SelectItem value="3">潜力转化用户包 (89,000人)</SelectItem>
|
|||
|
|
<SelectItem value="4">新用户引导包 (12,580人)</SelectItem>
|
|||
|
|
</SelectContent>
|
|||
|
|
</Select>
|
|||
|
|
)}
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div className="space-y-3">
|
|||
|
|
<Label>执行计划</Label>
|
|||
|
|
<RadioGroup
|
|||
|
|
value={formData.schedule}
|
|||
|
|
onValueChange={(value) => setFormData({ ...formData, schedule: value })}
|
|||
|
|
>
|
|||
|
|
<div className="flex items-center space-x-2">
|
|||
|
|
<RadioGroupItem value="once" id="once" />
|
|||
|
|
<Label htmlFor="once">立即执行(单次)</Label>
|
|||
|
|
</div>
|
|||
|
|
<div className="flex items-center space-x-2">
|
|||
|
|
<RadioGroupItem value="daily" id="daily" />
|
|||
|
|
<Label htmlFor="daily">每天执行</Label>
|
|||
|
|
</div>
|
|||
|
|
<div className="flex items-center space-x-2">
|
|||
|
|
<RadioGroupItem value="weekly" id="weekly" />
|
|||
|
|
<Label htmlFor="weekly">每周执行</Label>
|
|||
|
|
</div>
|
|||
|
|
</RadioGroup>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<DialogFooter>
|
|||
|
|
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
|||
|
|
取消
|
|||
|
|
</Button>
|
|||
|
|
<Button onClick={handleSubmit}>创建任务</Button>
|
|||
|
|
</DialogFooter>
|
|||
|
|
</DialogContent>
|
|||
|
|
</Dialog>
|
|||
|
|
)
|
|||
|
|
}
|