import request from '@/utils/request'

// 查询导入任务列表
export function listImport(query) {
  return request({
    url: '/business/import/list',
    method: 'get',
    params: query
  })
}

// 查询导入任务详细
export function getImport(id) {
  return request({
    url: '/business/import/' + id,
    method: 'get'
  })
}

// 查询导入任务详细
export function getImportDetail(id) {
  return request({
    url: '/business/import/detail/' + id,
    method: 'get'
  })
}


// 新增导入任务
export function addImport(data) {
  return request({
    url: '/business/import/add',
    method: 'post',
    data: data
  })
}

// 修改导入任务
export function updateImport(data) {
  return request({
    url: '/business/import/update',
    method: 'post',
    data: data
  })
}

// 删除导入任务
export function delImport(id) {
  return request({
    url: '/business/import/delete/' + id,
    method: 'get'
  })
}

// 打印导入任务
export function printImport(query) {
  return request({
    url: '/business/import/print',
    method: 'get',
    params: query
  })
}

// 开始导入任务
export function startImport(id) {
  return request({
    url: '/business/import/start/' + id,
    method: 'post',
  })
}

// 导入任务日志
export function importLog(id, offset) {
  return request({
    url: '/business/import/log/' + id,
    method: 'get',
    params: {offset}
  })
}

// 下载导入任务日志
export function downloadLog(id) {
  return request({
    url: '/business/import/downloadLog/' + id,
    method: 'get',
    responseType: 'blob',
  })
}
