import http from '@/api'

/**
 * @name 查询部门列表
 * @param query 参数
 * @returns 返回列表
 */
export const listDeptApi = (query: any) => {
  return http.get<any>('/system/dept/list', query, { loading: true })
}

/**
 * @name 查询部门详细
 * @param deptId deptId
 * @returns returns
 */
export const getDeptApi = (deptId: any) => {
  return http.get<any>(`/system/dept/${deptId}`)
}

/**
 * @name 新增部门
 * @param data data
 * @returns returns
 */
export const addDeptApi = (data: any) => {
  return http.post<any>('/system/dept', data, { loading: false })
}

/**
 * @name 修改部门
 * @param data data
 * @returns returns
 */
export const updateDeptApi = (data: any) => {
  return http.put<any>('/system/dept', data, { loading: false })
}

/**
 * @name 删除部门
 * @param deptId deptId
 * @returns returns
 */
export const delDeptApi = (deptId: any) => {
  return http.delete<any>(`/system/dept/${deptId}`)
}

/**
 * @name 下载模板
 * @returns returns
 */
export const importTemplateApi = () => {
  return http.downloadPost('/system/dept/importTemplate', {})
}

/**
 * @name 导入数据
 * @returns returns
 */
export const importDataApi = (data: any) => {
  return http.post('/system/dept/importData', data)
}

/**
 * @name 导出数据
 * @returns returns
 */
export const exportApi = (data: any) => {
  return http.downloadPost('/system/dept/export', data)
}
