更新操作按钮为菜单栏 & 调整页面表格顺序
This commit is contained in:
@@ -7,13 +7,17 @@ import { Controller, useForm } from "react-hook-form"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
import { getPageUser } from "@/actions/user"
|
||||
// import { DeductionDialog } from "@/app/(root)/cust/deduction"
|
||||
// import { DepositDialog } from "@/app/(root)/cust/deposit"
|
||||
import { UpdateDialog } from "@/app/(root)/cust/update"
|
||||
import { Auth } from "@/components/auth"
|
||||
import { DataTable } from "@/components/data-table"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import {
|
||||
Field,
|
||||
FieldError,
|
||||
@@ -49,10 +53,6 @@ type FormValues = z.infer<typeof filterSchema>
|
||||
export default function UserQueryPage() {
|
||||
const [userList, setUserList] = useState<User[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
// const [depositDialog, setDepositDialog] = useState(false)
|
||||
// const [deposit, setDeposit] = useState<User | null>(null)
|
||||
// const [deductionDialog, setDeductionDialog] = useState(false)
|
||||
// const [deduction, setDeduction] = useState<User | null>(null)
|
||||
const [isEditDialogOpen, setIsEditDialogOpen] = useState(false)
|
||||
const [currentEditUser, setCurrentEditUser] = useState<User | null>(null)
|
||||
const [currentFilters, setCurrentFilters] = useState<UserQueryParams>({})
|
||||
@@ -91,7 +91,7 @@ export default function UserQueryPage() {
|
||||
if (data.phone?.trim()) params.account = data.phone.trim()
|
||||
if (data.name?.trim()) params.name = data.name.trim()
|
||||
if (Object.keys(params).length === 0) {
|
||||
toast.info("请至少输入一个筛选条件")
|
||||
toast.info("请至少输入一个搜索条件")
|
||||
return
|
||||
}
|
||||
setCurrentFilters(params)
|
||||
@@ -154,7 +154,7 @@ export default function UserQueryPage() {
|
||||
<Button type="button" variant="outline" onClick={handleReset}>
|
||||
重置
|
||||
</Button>
|
||||
<Button type="submit">筛选</Button>
|
||||
<Button type="submit">搜索</Button>
|
||||
</FieldGroup>
|
||||
</form>
|
||||
|
||||
@@ -249,30 +249,7 @@ export default function UserQueryPage() {
|
||||
header: "操作",
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2 w-75">
|
||||
{/* <Auth scope={ScopeUserWriteBalanceInc}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
setDeposit(row.original)
|
||||
setDepositDialog(true)
|
||||
}}
|
||||
>
|
||||
充值
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeUserWriteBalanceDec}>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="destructive"
|
||||
onClick={() => {
|
||||
setDeduction(row.original)
|
||||
setDeductionDialog(true)
|
||||
}}
|
||||
>
|
||||
扣款
|
||||
</Button>
|
||||
</Auth> */}
|
||||
<div className="flex gap-2">
|
||||
<Auth scope={ScopeUserWriteBalance}>
|
||||
<Button
|
||||
size="sm"
|
||||
@@ -284,74 +261,81 @@ export default function UserQueryPage() {
|
||||
修改
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeTradeReadOfUser}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
router.push(`/client/trade?userId=${row.original.id}`)
|
||||
}}
|
||||
>
|
||||
交易明细
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeBillReadOfUser}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/billing?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
账单详情
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeResourceRead}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/resources?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
套餐管理
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeBatchReadOfUser}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
router.push(`/client/batch?userId=${row.original.id}`)
|
||||
}}
|
||||
>
|
||||
提取记录
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeChannelReadOfUser}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/channel?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
IP管理
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeBalanceActivityReadOfUser}>
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/balance?userId=${row.original.id}&phone=${row.original.phone}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
余额操作
|
||||
</Button>
|
||||
</Auth>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button size="sm" variant="outline">
|
||||
打开菜单
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-8">
|
||||
<Auth scope={ScopeTradeReadOfUser}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/trade?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
交易明细
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
<Auth scope={ScopeBillReadOfUser}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/billing?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
账单详情
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
<Auth scope={ScopeResourceRead}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/resources?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
套餐管理
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
<Auth scope={ScopeBatchReadOfUser}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/batch?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
提取记录
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
<Auth scope={ScopeChannelReadOfUser}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/channel?userId=${row.original.id}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
IP管理
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
<Auth scope={ScopeBalanceActivityReadOfUser}>
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
router.push(
|
||||
`/client/balance?userId=${row.original.id}&phone=${row.original.phone}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
余额明细
|
||||
</DropdownMenuItem>
|
||||
</Auth>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
@@ -370,20 +354,6 @@ export default function UserQueryPage() {
|
||||
currentUser={currentEditUser}
|
||||
onSuccess={refreshTable}
|
||||
/>
|
||||
|
||||
{/* <DepositDialog
|
||||
open={depositDialog}
|
||||
onOpenChange={setDepositDialog}
|
||||
currentUser={deposit}
|
||||
onSuccess={refreshTable}
|
||||
/> */}
|
||||
|
||||
{/* <DeductionDialog
|
||||
open={deductionDialog}
|
||||
onOpenChange={setDeductionDialog}
|
||||
currentUser={deduction}
|
||||
onSuccess={refreshTable}
|
||||
/> */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user