Browse Source

优化用户管理新增用户可以根据左侧选择的部门默认选中部门和主属部门数据

zhontai 2 years ago
parent
commit
ca1a5605f5
2 changed files with 8 additions and 4 deletions
  1. 4 3
      src/views/admin/user/components/user-form.vue
  2. 4 1
      src/views/admin/user/index.vue

+ 4 - 3
src/views/admin/user/components/user-form.vue

@@ -209,7 +209,7 @@ const getRoles = async () => {
 }
 
 // 打开对话框
-const open = async (row: any = {}) => {
+const open = async (row: UserUpdateInput & UserUpdateInput) => {
   proxy.$modal.loading()
 
   await getOrgs()
@@ -225,8 +225,9 @@ const open = async (row: any = {}) => {
     }
   } else {
     state.form = {
-      orgIds: [] as any,
-      roleIds: [] as any,
+      orgIds: row.orgIds,
+      orgId: row.orgId,
+      roleIds: [] as number[],
       staff: {},
     } as UserAddInput & UserUpdateInput
   }

+ 4 - 1
src/views/admin/user/index.vue

@@ -180,7 +180,10 @@ const onQuery = async () => {
 
 const onAdd = () => {
   state.userFormTitle = '新增用户'
-  userFormRef.value.open()
+  userFormRef.value.open({
+    orgIds: state.pageInput.filter?.orgId && state.pageInput.filter.orgId > 0 ? [state.pageInput.filter?.orgId] : [],
+    orgId: state.pageInput.filter?.orgId,
+  })
 }
 
 const onEdit = (row: UserGetPageOutput) => {