R84 R86 收口用户开通界面与自动化回归
这个提交包含在:
@@ -12,11 +12,9 @@ import { Input } from "../../components/ui/input";
|
||||
import { Label } from "../../components/ui/label";
|
||||
|
||||
export interface CreateUserFormData {
|
||||
employeeNo: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
password: string;
|
||||
departmentId: string | undefined;
|
||||
directManagerId: string | null;
|
||||
roles: string[];
|
||||
@@ -48,16 +46,13 @@ export function CreateUserDialog({
|
||||
managers,
|
||||
roleOptions,
|
||||
}: CreateUserDialogProps) {
|
||||
const [employeeNo, setEmployeeNo] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
const [phone, setPhone] = useState("");
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [departmentId, setDepartmentId] = useState("");
|
||||
const [directManagerId, setDirectManagerId] = useState("");
|
||||
const [createRoles, setCreateRoles] = useState<Set<string>>(() => new Set(["employee"]));
|
||||
|
||||
const trimmedEmployeeNo = employeeNo.trim();
|
||||
const trimmedName = name.trim();
|
||||
const trimmedPhone = phone.trim();
|
||||
const trimmedEmail = email.trim();
|
||||
@@ -65,19 +60,15 @@ export function CreateUserDialog({
|
||||
|
||||
const canSubmit =
|
||||
!isPending &&
|
||||
trimmedEmployeeNo !== "" &&
|
||||
trimmedName !== "" &&
|
||||
trimmedPhone !== "" &&
|
||||
trimmedEmail !== "" &&
|
||||
password !== "" &&
|
||||
rolesArray.length >= 1;
|
||||
|
||||
function resetForm() {
|
||||
setEmployeeNo("");
|
||||
setName("");
|
||||
setPhone("");
|
||||
setEmail("");
|
||||
setPassword("");
|
||||
setDepartmentId("");
|
||||
setDirectManagerId("");
|
||||
setCreateRoles(new Set(["employee"]));
|
||||
@@ -92,11 +83,9 @@ export function CreateUserDialog({
|
||||
|
||||
function handleSubmit() {
|
||||
onSubmit({
|
||||
employeeNo: trimmedEmployeeNo,
|
||||
name: trimmedName,
|
||||
phone: trimmedPhone,
|
||||
email: trimmedEmail,
|
||||
password,
|
||||
departmentId: departmentId || undefined,
|
||||
directManagerId: directManagerId ? directManagerId : null,
|
||||
roles: rolesArray,
|
||||
@@ -113,20 +102,10 @@ export function CreateUserDialog({
|
||||
<DialogContent className="max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>新建用户</DialogTitle>
|
||||
<DialogDescription>请填写基础信息与初始密码(满足密码策略)。</DialogDescription>
|
||||
<DialogDescription>请填写基础信息。工号与一次性口令将在创建成功后由系统生成并展示一次。</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="grid gap-4">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="employeeNo">工号</Label>
|
||||
<Input
|
||||
id="employeeNo"
|
||||
data-testid="users-create-employeeNo"
|
||||
value={employeeNo}
|
||||
onChange={(e) => setEmployeeNo(e.target.value)}
|
||||
placeholder="E1001"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="name">姓名</Label>
|
||||
<Input
|
||||
@@ -157,17 +136,6 @@ export function CreateUserDialog({
|
||||
placeholder="[email protected]"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">初始密码</Label>
|
||||
<Input
|
||||
id="password"
|
||||
data-testid="users-create-password"
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder="至少12位,含大小写与数字"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="departmentId">部门(可选)</Label>
|
||||
|
||||
在新工单中引用
屏蔽一个用户