

import request from '@/utils/request'
//获取部门列表
export function getDepartmentList(params) {
    return request({
      url: '/department/list',
      method: 'get',
      params:{ departmentName:params}
    })
  }

  //删除部门
  export function deleteDepartment(id) {
    return request({
      url: '/department/delete',
      method: 'get',
      params: { departmentId: id }
    })
  }
  //部门详情
  export function departmentDetail(id) {
    return request({
      url: '/department/detail',
      method: 'get',
      params: { departmentId: id }
    })
  }

  //部门添加
  export function addDepartment(data) {
    return request({
      url: '/department/add',
      method: 'post',
      data: data
    })
  }
  //部门更新
  export function updateDepartment(data) {
    return request({
      url: '/department/update',
      method: 'post',
      data: data
    })
  }
  //更新部门父级部门
  export function updateDepartmentParent(data) {
    return request({
      url: '/department/updateParent',
      method: 'post',
      data: data
    })
  }
  //上移下移部门
  export function updateDepartmentSort(id,sort) {
    return request({
      url: '/department/updateSort',
      method: 'get',
      params: { departmentId: id,sort: sort }
    })
  }
  //获取部门名称
  export function getDepartmentName(departmentName) {
    return request({
      url: '/department/listNotree',
      method: 'get',
      params: {departmentName: departmentName }
    })
  }
//获取最底层的部门名称
export function getDepartmentNameBottom(departmentName) {
  return request({
    url: '/department/listCanSelect',
    method: 'get',
    params: {departmentName: departmentName }

  })
}
