diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 0d13a4f..d909049 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -235,9 +235,11 @@ async function getDeptAllUser(deptId: any) { } /** 查询所有用户 */ -async function getAllUser() { - const res = await listUserByDeptId(100); - allUserList.value = res.data || []; +async function getAllUser(deptId: any) { + if (deptId !== null && deptId !== '' && deptId !== undefined) { + const res = await listUserByDeptId(deptId); + allUserList.value = res.data || []; + } } /** 取消按钮 */ @@ -287,7 +289,7 @@ const handleAdd = async (row?: DeptVO) => { getDeptAllUser(row.deptId); } // 加载所有用户列表,用于选择分管副总 - getAllUser(); + getAllUser(row.deptId); dialog.visible = true; dialog.title = '添加部门'; } @@ -299,7 +301,7 @@ const handleUpdate = async (row: DeptVO) => { //查询当前部门所有用户 getDeptAllUser(row.deptId); // 加载所有用户列表,用于选择分管副总 - getAllUser(); + getAllUser(row.deptId); const res = await getDept(row.deptId); form.value = res.data; const response = await listDeptExcludeChild(row.deptId);