import request from '@/router/axios';
/*获取人才列表*/
export const getList =
  (current, size, params, groupId) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/list',
      method: 'get',
      params: {...params, current, size, groupId}
    })
  }

/*新增人才*/
export const add =
  (row) => {
    return request(
      {url: '/api/jobslink-api/tenant/talents/save', method: 'post', data: row})
  }

/*编辑人才*/
export const update =
  (row) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/tenant/update',
      method: 'post',
      data: row
    })
  }

/*删除人才*/
export const remove =
  (ids) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/remove',
      method: 'post',
      params: {ids}
    })
  }

/*人才详情*/
export const detail =
  (id) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/detail',
      method: 'get',
      params: {id}
    })
  }

export const talentsDetail =
  ({id, ...args} = {}) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/' + id,
      method: 'get',
      params: {...args}
    })
  }


/*获取分组*/
export const getDept =
  (params = {}) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/group/listAll',
      method: 'get',
      params
    })
  }

/*新建分组*/
export const addDept =
  (row) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/group/save',
      method: 'post',
      data: row
    })
  }


/*编辑分组*/
export const updateDept =
  (row) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/group/update',
      method: 'post',
      data: row
    })
  }


/*删除分组*/
export const removeDept =
  (ids) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/group/remove',
      method: 'post',
      params: {ids}
    })
  }


/*转移分组*/
export const transferDept =
  (groupIds, ids, deptId) => {
    return request({
      url: '/api/jobslink-api/tenant/talents/updateAllGroup',
      method: 'post',
      params: {groupIds, ids, deptId}
    })
  }

/*导入人才库*/
export const upload = () => {
  return `/api/jobslink-api/tenant/talents/tenant/import-talents?isCovered=1`
}

export const getDeptMyTree = (params) => {
  return request({
    url: '/api/jobslink-api/system/dept/my-tree',
    method: 'get',
    params
  })
}

export const getDeptAllTree = (params) => {
  return request({
    url: '/api/jobslink-api/system/dept/all-tree',
    method: 'get',
    params
  })
}

export const talentsEliminate = (params) => {
  return request({
    url: '/api/jobslink-api/tenant/talents/eliminate',
    method: 'post',
    data: params
  })
}

export const talentsApproval = (params) => {
  return request({
    url: '/api/jobslink-api/tenant/talents/approval',
    method: 'post',
    data: params
  })
}

export const tenantSuspected = (params) => {
  return request({
    url: '/api/jobslink-api/tenant/talents/suspected',
    method: 'post',
    data: params
  })
}

