86133 | aaa3f5d | 2025-04-20 21:33:29 +0800 | [diff] [blame] | 1 | import { request } from '@umijs/max'; |
| 2 | import { downLoadXlsx } from '@/utils/downloadfile'; |
| 3 | |
| 4 | // 查询部门列表 |
| 5 | export async function getDeptList(params?: API.System.DeptListParams) { |
| 6 | return request<API.System.DeptPageResult>('/api/system/dept/list', { |
| 7 | method: 'GET', |
| 8 | headers: { |
| 9 | 'Content-Type': 'application/json;charset=UTF-8', |
| 10 | }, |
| 11 | params |
| 12 | }); |
| 13 | } |
| 14 | |
| 15 | // 查询部门列表(排除节点) |
| 16 | export function getDeptListExcludeChild(deptId: number) { |
| 17 | return request(`/api/system/dept/list/exclude/${deptId}`, { |
| 18 | method: 'get', |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | // 查询部门详细 |
| 23 | export function getDept(deptId: number) { |
| 24 | return request<API.System.DeptInfoResult>(`/api/system/dept/${deptId}`, { |
| 25 | method: 'GET' |
| 26 | }); |
| 27 | } |
| 28 | |
| 29 | // 新增部门 |
| 30 | export async function addDept(params: API.System.Dept) { |
| 31 | return request<API.Result>('/api/system/dept', { |
| 32 | method: 'POST', |
| 33 | headers: { |
| 34 | 'Content-Type': 'application/json;charset=UTF-8', |
| 35 | }, |
| 36 | data: params |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | // 修改部门 |
| 41 | export async function updateDept(params: API.System.Dept) { |
| 42 | return request<API.Result>('/api/system/dept', { |
| 43 | method: 'PUT', |
| 44 | headers: { |
| 45 | 'Content-Type': 'application/json;charset=UTF-8', |
| 46 | }, |
| 47 | data: params |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | // 删除部门 |
| 52 | export async function removeDept(ids: string) { |
| 53 | return request<API.Result>(`/api/system/dept/${ids}`, { |
| 54 | method: 'DELETE' |
| 55 | }); |
| 56 | } |