/** * @description 部门相关API * @author yslg * @since 2025-10-06 */ import { api } from '@/apis/index'; import type { SysDept, SysRole, DeptRoleVO, SysDeptRole } from '@/types'; /** * 部门API服务 */ export const deptApi = { /** * @description 查询所有部门 * @returns Promise 部门列表 * @author yslg * @ since 2025-10-06 */ async getAllDepts(): Promise { const response = await api.post('/depts/all'); return response.data.dataList!; }, /** * @description 查询部门列表 * @param filter 过滤条件 * @returns Promise 部门列表 * @author yslg * @ since 2025-10-06 */ async getDeptList(filter: SysDept): Promise { const response = await api.post('/depts/list', filter); return response.data.dataList!; }, /** * @description 查询部门 * @param dept 部门信息 * @returns Promise 部门信息 * @author yslg * @ since 2025-10-06 */ async getDeptById(dept: SysDept): Promise { const response = await api.post('/depts/id', dept); return response.data.data!; }, /** * @description 创建部门 * @param dept 部门信息 * @returns Promise 部门信息 * @author yslg * @ since 2025-10-06 */ async createDept(dept: SysDept): Promise { const response = await api.post('/depts/dept', dept); return response.data.data!; }, /** * @description 更新部门 * @param dept 部门信息 * @returns Promise 部门信息 * @author yslg * @ since 2025-10-06 */ async updateDept(dept: SysDept): Promise { const response = await api.put('/depts/dept', dept); return response.data.data!; }, /** * @description 删除部门 * @param dept 部门信息 * @returns Promise 部门信息 * @author yslg * @ since 2025-10-06 */ async deleteDept(dept: SysDept): Promise { const response = await api.delete('/depts/dept', dept); return response.data.data!; }, /** * @description 查询部门绑定角色 * @param dept 部门信息 * @returns Promise 角色列表 * @author yslg * @ since 2025-10-06 */ async getDeptByRole(dept: SysDept): Promise { const response = await api.post('/depts/role', dept); return response.data.dataList!; }, /** * @description 查询部门角色列表 * @param dept 部门角色信息 * @returns Promise 部门角色列表 * @author yslg * @ since 2025-10-06 */ async getDeptRoleList(dept: SysDeptRole): Promise { const response = await api.post('/depts/role/list', dept); return response.data.dataList!; }, /** * @description 绑定部门角色 * @param deptRole 部门角色VO * @returns Promise 部门角色信息 * @author yslg * @ since 2025-10-06 */ async bindDeptRole(deptRole: DeptRoleVO): Promise { const response = await api.post('/depts/bind/role', deptRole); return response.data.data!; }, /** * @description 解绑部门角色 * @param deptRole 部门角色VO * @returns Promise 部门角色信息 * @author yslg * @ since 2025-10-06 */ async unbindDeptRole(deptRole: DeptRoleVO): Promise { const response = await api.post('/depts/unbind/role', deptRole); return response.data.data!; } };