diff --git a/src/api/system/user/index.ts b/src/api/system/user/index.ts index 0867c48..987d185 100644 --- a/src/api/system/user/index.ts +++ b/src/api/system/user/index.ts @@ -209,6 +209,16 @@ export const deptTreeSelect = (): AxiosPromise => { }); }; +/** + * 设置部门主管 + */ +export const setDeptAdmin = (userId: Array | string | number) => { + return request({ + url: '/system/user/setDeptAdmin/' + userId, + method: 'get' + }); +}; + export default { listUser, getUser, @@ -225,5 +235,6 @@ export default { getAuthRole, updateAuthRole, deptTreeSelect, - listUserByDeptId + listUserByDeptId, + setDeptAdmin }; diff --git a/src/views/operate/employee/index.vue b/src/views/operate/employee/index.vue index 39ab533..101e493 100644 --- a/src/views/operate/employee/index.vue +++ b/src/views/operate/employee/index.vue @@ -75,6 +75,11 @@ 删除 + + + 设置部门主管 + + @@ -108,18 +113,23 @@ - + + + + - + - - + + @@ -314,7 +324,7 @@ import { checkPermi } from '@/utils/permission'; const router = useRouter(); const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const { sys_normal_disable, sys_user_sex, opr_employee_status } = toRefs(proxy?.useDict('sys_normal_disable', 'sys_user_sex','opr_employee_status')); +const { sys_normal_disable, sys_user_sex, opr_employee_status,opr_yes_no } = toRefs(proxy?.useDict('sys_normal_disable', 'sys_user_sex','opr_employee_status','opr_yes_no')); const userList = ref(); const loading = ref(true); const showSearch = ref(true); @@ -353,9 +363,11 @@ const columns = ref([ { key: 4, label: `部门`, visible: true, children: [] }, { key: 5, label: `手机号码`, visible: true, children: [] }, { key: 6, label: `入职时间`, visible: true, children: [] }, - { key: 7, label: `用工状态`, visible: true, children: [] }, - { key: 8, label: `状态`, visible: true, children: [] }, - { key: 9, label: `创建时间`, visible: true, children: [] } + { key: 7, label: `是否部门主管`, visible: true, children: [] }, + { key: 8, label: `用工状态`, visible: true, children: [] }, + { key: 9, label: `状态`, visible: true, children: [] }, + { key: 10, label: `离职时间`, visible: true, children: [] }, + { key: 11, label: `创建时间`, visible: true, children: [] } ]); const deptTreeRef = ref(); @@ -513,6 +525,17 @@ const handleDelete = async (row?: UserVO) => { } }; +/** 设置部门主管 */ +const handleDeptAdmin = async (row?: UserVO) => { + const userIds = row?.userId || ids.value; + const [err] = await to(proxy?.$modal.confirm('是否确认设置用户编号为"' + userIds + '"为部门主管?') as any); + if (!err) { + await api.setDeptAdmin(userIds); + await getList(); + proxy?.$modal.msgSuccess('设置成功'); + } +}; + /** 用户状态修改 */ const handleStatusChange = async (row: UserVO) => { let text = row.status === '0' ? '启用' : '停用';