R41: 完成员工批量导入
这个提交包含在:
@@ -23,6 +23,7 @@ import { TableSkeleton } from "../components/common/TableSkeleton";
|
||||
import { StatusBadge } from "../components/common/StatusBadge";
|
||||
import { Pagination } from "../components/common/Pagination";
|
||||
import { CreateUserDialog, type CreateUserFormData } from "./user-management/CreateUserDialog";
|
||||
import { UserImportDialog } from "./user-management/UserImportDialog";
|
||||
import { UserRoleDialog } from "./user-management/UserRoleDialog";
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
@@ -51,6 +52,7 @@ export function UserManagementPage() {
|
||||
const [resetResult, setResetResult] = useState<{ userId: string; password: string } | null>(null);
|
||||
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
const [importOpen, setImportOpen] = useState(false);
|
||||
const [roleDialogUser, setRoleDialogUser] = useState<UserSummary | null>(null);
|
||||
|
||||
const listQuery = useQuery({
|
||||
@@ -142,25 +144,37 @@ export function UserManagementPage() {
|
||||
title="系统用户管理"
|
||||
subtitle="创建/启用/禁用账号,重置密码并分配角色(仅试运行最小运营)。"
|
||||
actions={
|
||||
<CreateUserDialog
|
||||
open={createOpen}
|
||||
onOpenChange={setCreateOpen}
|
||||
onSubmit={(data) => createMutation.mutate(data)}
|
||||
isPending={createMutation.isPending}
|
||||
departments={{
|
||||
isLoading: departmentsQuery.isLoading,
|
||||
items: departmentsQuery.data?.items ?? [],
|
||||
}}
|
||||
managers={{
|
||||
isLoading: managersQuery.isLoading,
|
||||
items: (managersQuery.data?.items ?? []).map((item) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
employeeNo: item.employeeNo,
|
||||
})),
|
||||
}}
|
||||
roleOptions={ROLE_OPTIONS}
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<UserImportDialog
|
||||
open={importOpen}
|
||||
onOpenChange={setImportOpen}
|
||||
onImported={async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ["users"] }),
|
||||
queryClient.invalidateQueries({ queryKey: ["employees"] }),
|
||||
]);
|
||||
}}
|
||||
/>
|
||||
<CreateUserDialog
|
||||
open={createOpen}
|
||||
onOpenChange={setCreateOpen}
|
||||
onSubmit={(data) => createMutation.mutate(data)}
|
||||
isPending={createMutation.isPending}
|
||||
departments={{
|
||||
isLoading: departmentsQuery.isLoading,
|
||||
items: departmentsQuery.data?.items ?? [],
|
||||
}}
|
||||
managers={{
|
||||
isLoading: managersQuery.isLoading,
|
||||
items: (managersQuery.data?.items ?? []).map((item) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
employeeNo: item.employeeNo,
|
||||
})),
|
||||
}}
|
||||
roleOptions={ROLE_OPTIONS}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户