import request from '@/utils/request'

export function getDepts(data = {}) {
  return request({
    url: 'system/department/getDepts',
    method: 'post',
    data
  })
}
/**
 * 获取部门树的数据 - 异步获取
 * @param {} pid
 * @returns
 */
export function getDeptsTree(data) {
  return request({
    url: 'system/department/getDeptsTree',
    method: 'post',
    data
  })
}

export function getParentTree(data) {
  return request({
    url: 'system/department/getParentTree',
    method: 'post',
    data
  })
}

export function add(data) {
  return request({
    url: 'system/department/saveFormJson',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'system/department/deleteFormJson',
    method: 'post',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'system/department/saveFormJson',
    method: 'post',
    data
  })
}

export default { add, edit, del, getDepts, getDeptsTree, getParentTree }
