import request from '@/utils/request'

// 查询员工调动记录列表
export function listTransfer(query) {
  return request({
    url: '/ccdi/staffTransfer/list',
    method: 'get',
    params: query
  })
}

// 查询员工调动记录详情
export function getTransfer(id) {
  return request({
    url: '/ccdi/staffTransfer/' + id,
    method: 'get'
  })
}

// 新增员工调动记录
export function addTransfer(data) {
  return request({
    url: '/ccdi/staffTransfer',
    method: 'post',
    data: data
  })
}

// 修改员工调动记录
export function updateTransfer(data) {
  return request({
    url: '/ccdi/staffTransfer',
    method: 'put',
    data: data
  })
}

// 删除员工调动记录
export function delTransfer(ids) {
  return request({
    url: '/ccdi/staffTransfer/' + ids,
    method: 'delete'
  })
}

// 下载导入模板
export function importTemplate() {
  return request({
    url: '/ccdi/staffTransfer/importTemplate',
    method: 'post'
  })
}

// 导入员工调动记录
export function importData(file, updateSupport) {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('updateSupport', updateSupport)
  return request({
    url: '/ccdi/staffTransfer/importData',
    method: 'post',
    data: formData
  })
}

// 查询导入状态
export function getImportStatus(taskId) {
  return request({
    url: '/ccdi/staffTransfer/importStatus/' + taskId,
    method: 'get'
  })
}

// 查询导入失败记录
export function getImportFailures(taskId, pageNum, pageSize) {
  return request({
    url: '/ccdi/staffTransfer/importFailures/' + taskId,
    method: 'get',
    params: { pageNum, pageSize }
  })
}

// 获取员工列表(用于下拉选择)
export function getStaffList(query) {
  return request({
    url: '/ccdi/baseStaff/options',
    method: 'get',
    params: { query }
  })
}
