Sfoglia il codice sorgente

chore: 用户信息恢复真实姓名

xyh 2 anni fa
parent
commit
6b986dbc7f

+ 1 - 0
packages/app/src/pages/user/table/hooks.tsx

@@ -100,6 +100,7 @@ export function useHandle(onFetch: () => void) {
   const columns: ColumnsType<UserListData> = [
     {title: '用户编号', dataIndex: 'code', key: 'code', width: NORMAL_TABLE_WIDTH},
     {title: '用户名称', dataIndex: 'userName', key: 'userName', width: SMALL_TABLE_WIDTH},
+    {title: '真实名称', dataIndex: 'realName', key: 'realName', width: SMALL_TABLE_WIDTH},
     {title: '部门', dataIndex: 'department', key: 'department', width: SMALL_TABLE_WIDTH},
     {title: '角色', dataIndex: 'role', key: 'role', width: NORMAL_TABLE_WIDTH},
     {title: '邮箱', dataIndex: 'email', key: 'email', width: NORMAL_TABLE_WIDTH},

+ 6 - 0
packages/app/src/pages/user/table/modal/Info.tsx

@@ -23,6 +23,12 @@ const UserModalInfo: FC<Props> = function({id}) {
         label='用户名'
         width={width}
       />
+      <ModalField
+        control={control}
+        name='userRealName'
+        label='真实姓名'
+        width={width}
+      />
       <ModalField
         control={control}
         name='userPassword'

+ 6 - 1
packages/app/src/pages/user/table/modal/hooks.ts

@@ -16,6 +16,7 @@ export type FormState = {
   userPhone: string;
   userDepartment: string;
   userRole: string;
+  userRealName: string;
 };
 
 const validate = object({
@@ -23,6 +24,7 @@ const validate = object({
   userPassword: string().required('请输入用户密码'),
   userDepartment: string().required('请选择部门'),
   userRole: string().required('请选择角色'),
+  userRealName: string().required('请输入真实姓名'),
 });
 
 function useAdd(onClose: () => void, onFetch: () => void) {
@@ -72,6 +74,7 @@ export function useFormState(
       userPhone: '',
       userDepartment: '',
       userRole: '',
+      userRealName: '',
     },
     resolver: yupResolver(validate),
   });
@@ -93,10 +96,11 @@ export function useFormState(
     userPhone,
     userDepartment,
     userRole,
+    userRealName,
   }) {
     const params: Omit<EditUserParams, 'id' | 'modifyTime' | 'modifyUser'> = {
       userName,
-      realName: userName,
+      realName: userRealName,
       email: userEmail,
       landline: userLandline,
       phone: userPhone,
@@ -133,5 +137,6 @@ export function useFetchUserInfo(id: string) {
     setValue('userPhone', data?.phone ?? '');
     setValue('userRole', data?.roleId ?? '');
     setValue('userDepartment', data?.departmentId ?? '');
+    setValue('userRealName', data?.realName ?? '');
   }, [data, setValue]);
 }