修改客户管理认领和管理员字段展示逻辑

This commit is contained in:
Eamon
2026-01-09 18:36:08 +08:00
parent c85293fd1d
commit 887ff2f07c
5 changed files with 31 additions and 12 deletions

View File

@@ -10,7 +10,7 @@ import type { User } from "@/models/user"
export default function UserPage() {
const table = useDataTable<User>((page, size) => getPageUsers({ page, size }))
const bind = useFetch((id: number) => bindAdmin({ id }), {
const bind = useFetch(table, (id: number) => bindAdmin({ id }), {
done: "用户已认领",
fail: "用户认领失败",
})
@@ -73,7 +73,10 @@ export default function UserPage() {
},
},
{ header: "联系方式", accessorKey: "contact_wechat" },
{ header: "管理员", accessorKey: "admin_id" },
{
header: "管理员",
cell: ({ row }) => row.original.admin?.name,
},
{
header: "最后登录时间",
accessorKey: "last_login",
@@ -92,9 +95,9 @@ export default function UserPage() {
<Button
size={"sm"}
onClick={() => bind(ctx.row.original.id)}
disabled={ctx.row.original.admin_id !== null}
disabled={!!ctx.row.original.admin_id}
>
{ctx.row.original.admin_id !== null ? "已认领" : "认领"}
{ctx.row.original.admin_id ? "已认领" : "认领"}
</Button>
),
},