Files
users/components/dialogs/create-assessment-task-dialog.tsx

137 lines
5.6 KiB
TypeScript
Raw Normal View History

"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>
)
}