表格与页面样式调整
This commit is contained in:
@@ -10,6 +10,7 @@ import { getPageUser } from "@/actions/user"
|
||||
import { UpdateDialog } from "@/app/(root)/cust/update"
|
||||
import { Auth } from "@/components/auth"
|
||||
import { DataTable } from "@/components/data-table"
|
||||
import { Page } from "@/components/page"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
@@ -53,10 +54,7 @@ type FormValues = z.infer<typeof filterSchema>
|
||||
export default function UserQueryPage() {
|
||||
const [userList, setUserList] = useState<User[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [isEditDialogOpen, setIsEditDialogOpen] = useState(false)
|
||||
const [currentEditUser, setCurrentEditUser] = useState<User | null>(null)
|
||||
const [currentFilters, setCurrentFilters] = useState<UserQueryParams>({})
|
||||
const [isAddDialogOpen, setIsAddDialogOpen] = useState(false)
|
||||
|
||||
const router = useRouter()
|
||||
const { control, handleSubmit, reset } = useForm<FormValues>({
|
||||
@@ -111,8 +109,8 @@ export default function UserQueryPage() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<form onSubmit={onFilter} className="bg-white p-4">
|
||||
<Page>
|
||||
<form onSubmit={onFilter} className="bg-card p-4 rounded-lg">
|
||||
<div className="flex flex-wrap items-end gap-4">
|
||||
<Controller
|
||||
name="phone"
|
||||
@@ -147,9 +145,7 @@ export default function UserQueryPage() {
|
||||
|
||||
<FieldGroup className="flex-row justify-start mt-4 gap-2">
|
||||
<Auth scope={ScopeUserWrite}>
|
||||
<Button type="button" onClick={() => setIsAddDialogOpen(true)}>
|
||||
添加用户
|
||||
</Button>
|
||||
<AddUserDialog onSuccess={refreshTable} />
|
||||
</Auth>
|
||||
<Button type="button" variant="outline" onClick={handleReset}>
|
||||
重置
|
||||
@@ -249,17 +245,12 @@ export default function UserQueryPage() {
|
||||
header: "操作",
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<div className="flex flex-wrap gap-2 w-75">
|
||||
<Auth scope={ScopeUserWriteBalance}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
setCurrentEditUser(row.original)
|
||||
setIsEditDialogOpen(true)
|
||||
}}
|
||||
>
|
||||
修改
|
||||
</Button>
|
||||
<UpdateDialog
|
||||
user={row.original}
|
||||
onSuccess={refreshTable}
|
||||
/>
|
||||
</Auth>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -343,17 +334,6 @@ export default function UserQueryPage() {
|
||||
]}
|
||||
/>
|
||||
</Suspense>
|
||||
<AddUserDialog
|
||||
open={isAddDialogOpen}
|
||||
onOpenChange={setIsAddDialogOpen}
|
||||
onSuccess={refreshTable}
|
||||
/>
|
||||
<UpdateDialog
|
||||
open={isEditDialogOpen}
|
||||
onOpenChange={setIsEditDialogOpen}
|
||||
currentUser={currentEditUser}
|
||||
onSuccess={refreshTable}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user