feat(group): edit group
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { getUserList } from "@/components/label/api/user"
|
||||
import { getUserGroupAll, getUserList } from "@/components/label/api/user"
|
||||
import { User } from "@/components/label/api/user/typing"
|
||||
import useAuth from "@/components/label/hooks/useAuth"
|
||||
import { useAllUserStore } from "@/components/label/store/auth"
|
||||
@@ -67,6 +67,18 @@ export default function TeamEmployeePage() {
|
||||
})
|
||||
}, [])
|
||||
|
||||
const [groupOpts, setGroupOpts] = useState<
|
||||
Array<{ label: string; value: string }>
|
||||
>([])
|
||||
|
||||
useEffect(() => {
|
||||
const run = async () => {
|
||||
const res = await getUserGroupAll()
|
||||
setGroupOpts(res ?? [])
|
||||
}
|
||||
queueMicrotask(run)
|
||||
}, [])
|
||||
|
||||
const columns = useMemo(() => {
|
||||
const cols: DataTableColumn<User.UserInfo>[] = [
|
||||
{ accessor: "uid", title: "UID", width: 80, textAlign: "center" },
|
||||
@@ -92,6 +104,10 @@ export default function TeamEmployeePage() {
|
||||
title: "组织",
|
||||
width: 180,
|
||||
textAlign: "center",
|
||||
render: (record) => {
|
||||
const group = groupOpts.find((g) => g.value === record.group_uuid)
|
||||
return group?.label ?? ""
|
||||
},
|
||||
},
|
||||
{
|
||||
accessor: "base_city",
|
||||
@@ -147,7 +163,7 @@ export default function TeamEmployeePage() {
|
||||
},
|
||||
]
|
||||
return cols
|
||||
}, [isShow])
|
||||
}, [isShow, groupOpts])
|
||||
|
||||
return (
|
||||
<Stack w="100%" h="calc(100vh - 56px)" p="md" gap="md">
|
||||
@@ -247,6 +263,7 @@ export default function TeamEmployeePage() {
|
||||
setPage(1)
|
||||
}}
|
||||
recordsPerPageOptions={[10, 20, 50, 100]}
|
||||
recordsPerPageLabel="当前页数"
|
||||
scrollAreaProps={{ type: "auto" }}
|
||||
style={{ width: "100%" }}
|
||||
/>
|
||||
@@ -277,6 +294,7 @@ export default function TeamEmployeePage() {
|
||||
<EditUserModal
|
||||
opened={editOpened}
|
||||
data={selectedUser}
|
||||
groupOpts={groupOpts}
|
||||
onCloseAction={(refresh) => {
|
||||
setEditOpened(false)
|
||||
setSelectedUser(null)
|
||||
|
||||
Reference in New Issue
Block a user