import request from '@/utils/request'

const baseUrl = import.meta.env.VITE_APP_BASE_API
const baseUrlProduction = import.meta.env.VITE_APP_PRODUCTION_API

// 载具类别列表
export function listCategory(query) {
  return request({
    url: baseUrl + '/business/carrierCategory/list',
    method: 'get',
    params: query
  })
}

// 通过搜索查询类别列表
export function listCategoryInfo(query) {
  return request({
    url: baseUrl + '/business/carrierCategory/listInfo',
    method: 'get',
    params: query
  })
}

// 查询载具类别
export function getCategory(id) {
  return request({
    url: baseUrl + '/business/carrierCategory/getInfo/' + id,
    method: 'get'
  })
}

// 保存载具类别
export function saveCategory(data) {
  return request({
    url: baseUrl + '/business/carrierCategory/save',
    method: 'post',
    data: data
  })
}

// 删除载具类别
export function delCategory(id) {
  return request({
    url: baseUrl + '/business/carrierCategory/remove/' + id,
    method: 'delete'
  })
}

/* ************************** 载具相关接口 *************************** */

// 查询载具管理列表
export function listCarrier(query) {
  return request({
    url: baseUrl + '/business/carrier/list',
    method: 'get',
    params: query
  })
}

// 查询载具管理详细
export function getCarrier(id) {
  return request({
    url: baseUrl + '/business/carrier/getInfo/' + id,
    method: 'get'
  })
}

// 新增载具管理
export function saveCarrier(data) {
  return request({
    url: baseUrl + '/business/carrier/save',
    method: 'post',
    data: data
  })
}

// 批量新增载具管理
export function saveMulyipleCategory(data) {
  return request({
    url: baseUrl + '/business/carrier/saveCarrier',
    method: 'post',
    data: data
  })
}



export function updateCarrier(data) {
  return request({
    url: baseUrl + '/business/carrier/update',
    method: 'put',
    data: data
  })
}

// 删除载具管理
export function delCarrier(id) {
  return request({
    url: baseUrl + '/business/carrier/remove/' + id,
    method: 'delete'
  })
}
//新增废弃载具信息
export function saveCarrierReject(data) {
  return request({
    url: baseUrl + '/business/carrierReject/save',
    method: 'post',
    data: data
  })
}

// 取消废弃
export function unAbandoned(id) {
  return request({
    url: baseUrl + '/business/carrier/unAbandoned/' + id,
    method: 'get'
  })
}

//是否可以打印
export function whether(data) {
  return request({
    url: baseUrlProduction + '/business/carrier/whether',
    method: 'post',
    data: data
  })
}
export function downloadQcImgs(query) {
  return request({
    url: baseUrl + '/business/carrier/downloadQcImgs',
    method: 'get',
    params: query
  })
}

// 查询载具管理列表
export function download(data) {
  return request({
    url: baseUrl + '/business/carrier/download',
    method: 'post',
    data: data
  })
}

export function printQrcodePdf(data) {
  return request({
    url: baseUrl + '/business/carrier/printQrcodePdf',
    method: 'post',
    responseType: 'blob',
    data: data,
    headers: {
      'Content-Type': 'application/json; application/octet-stream'
    }
  })
}

export function printUpdate(id) {
  return request({
    url: baseUrl + '/business/carrier/printUpdate/' + id,
    method: 'get'
  })
}
