表格与页面样式调整

This commit is contained in:
2026-04-11 17:12:16 +08:00
parent 4307efae98
commit 04426ba36d
33 changed files with 239 additions and 1460 deletions

View File

@@ -14,6 +14,7 @@ import {
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"
import { Field, FieldError, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
@@ -30,18 +31,15 @@ const Schema = z.object({
type FormValues = z.infer<typeof Schema>
interface UpdateDeductionDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
currentUser: User | null
user: User
onSuccess: () => void
}
export function DeductionDialog({
open,
onOpenChange,
currentUser,
user,
onSuccess,
}: UpdateDeductionDialogProps) {
const [open, setOpen] = useState(false)
const [isLoading, setIsLoading] = useState(false)
const {
@@ -58,17 +56,16 @@ export function DeductionDialog({
})
const onSubmit = async (data: FormValues) => {
if (!currentUser) return
setIsLoading(true)
try {
const result = await getDeduction({
user_id: currentUser.id,
user_id: user.id,
amount: data.deduction,
})
if (result.success) {
toast.success("扣款成功")
onOpenChange(false)
setOpen(false)
reset()
onSuccess()
} else {
@@ -86,16 +83,19 @@ export function DeductionDialog({
if (!open) {
reset()
}
onOpenChange(open)
setOpen(open)
}
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogTrigger asChild>
<Button size="sm"></Button>
</DialogTrigger>
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
<DialogHeader>
<DialogTitle></DialogTitle>
<DialogDescription>
{currentUser?.name || currentUser?.username}
{user.name || user.username}
</DialogDescription>
</DialogHeader>