import request from '@/utils/request'

// 查询部门列表
export function listCompanyDept(query) {
  return request({
    url: '/company/companyDept/list',
    method: 'get',
    params: query
  })
}

// 查询部门详细
export function getCompanyDept(deptId) {
  return request({
    url: '/company/companyDept/' + deptId,
    method: 'get'
  })
}

// 新增部门
export function addCompanyDept(data) {
  return request({
    url: '/company/companyDept',
    method: 'post',
    data: data
  })
}

// 修改部门
export function updateCompanyDept(data) {
  return request({
    url: '/company/companyDept',
    method: 'put',
    data: data
  })
}

// 删除部门
export function delCompanyDept(deptId) {
  return request({
    url: '/company/companyDept/' + deptId,
    method: 'delete'
  })
}

// 导出部门
export function exportCompanyDept(query) {
  return request({
    url: '/company/companyDept/export',
    method: 'get',
    params: query
  })
}

export function treeselect(query) {
  return request({
    url: '/company/companyDept/treeselect',
    method: 'get',
    params: query
  })
}

export function treeselectByCompanyId(query) {
  return request({
    url: '/company/companyDept/treeselectByCompanyId/' + query,
    method: 'get',
    params: query
  })
}
