"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Checkbox } from "@/components/ui/checkbox" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Plus, Loader2 } from "lucide-react" interface AddPrintBatchDialogProps { propId: string isPublished: boolean } // Mock propData for demonstration purposes. Replace with actual data source. const propData = { prop1: { printedCount: 500 }, prop2: { printedCount: 1000 }, // ... more props } export function AddPrintBatchDialog({ propId, isPublished }: AddPrintBatchDialogProps) { const [open, setOpen] = useState(false) const [quantity, setQuantity] = useState(1000) const [batchName, setBatchName] = useState("") const [printingMethod, setPrintingMethod] = useState("standard") const [isAutoActivate, setIsAutoActivate] = useState(false) const [isSubmitting, setIsSubmitting] = useState(false) const handleSubmit = async () => { setIsSubmitting(true) // 模拟API请求 await new Promise((resolve) => setTimeout(resolve, 1500)) setIsSubmitting(false) setOpen(false) } return ( 添加新印刷批次 为道具 {propId} 添加新的卡牌印刷批次。系统将自动生成唯一的卡牌ID。
setBatchName(e.target.value)} className="border-gray-300 focus-visible:ring-purple-500" />
setQuantity(Number.parseInt(e.target.value))} className="border-gray-300 focus-visible:ring-purple-500" />

将生成 {quantity} 个新的卡牌ID

setIsAutoActivate(!!checked)} />

批次ID:{" "} B {Math.floor(Math.random() * 1000) .toString() .padStart(3, "0")}

起始ID:{" "} {propId}-{(propData[propId as keyof typeof propData]?.printedCount || 0) + 1}

结束ID:{" "} {propId}-{(propData[propId as keyof typeof propData]?.printedCount || 0) + quantity}

实际ID将在创建批次时生成

) }