import request from '@/utils/request'

// 获取领用申请一级列表-列表
export function getLeasePublishAuthList(query) {
  return request({
    url: '/material/authorize/list',
    method: 'get',
    params: query
  })
}

//获取班组下拉
export function getTeamList(data) {
  return request({
    url: '/material/select/getTeamList',
    method: 'POST',
    data
  })
}

export function sumbitAuthData(data) {
  return request({
    url: '/material/authorize/authorizeSubmit',
    method: 'POST',
    data
  })
}

// 上传身份证照片并识别
export function uploadIdCard(data) {
  return request({
    url: "/material/authorize/uploadPhoto",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: data,
  })
}

// 如果需要单独调用OCR识别接口
export function recognizeIdCard(file, type) {
  const formData = new FormData()
  formData.append("file", file)
  formData.append("type", type)

  return request({
    url: "/material/authorize/uploadPhoto",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: formData,
  })
}

//查看
export function getAuthDetail(data) {
  return request({
    url: '/material/authorize/authorizeView',
    method: 'POST',
    data
  })
}

// 项目部委托书
export function getAuthInfo(data) {
  return request({
    url: '/material/authorize/authorizeInfoView',
    method: 'POST',
    data
  })
}

export function getBusinessFormByCode(data) {
  return request({
    url: '/material/leaseTask/getBusinessFormByCode',
    method: 'get',
    params: data
  })
}


// 获取装卸单列表
export function getHandlingOrderList(query) {
  return request({
    url: '/material/back_apply_info/getHandlingOrderList',
    method: 'get',
    params: query
  })
}

export function uploadSort(data) {
  return request({
    url: '/material/back_apply_info/uploadSort',
    method: 'post',
    data: data
  })
}

// 删除装卸单
export function delHandlingOrder(data) {
  return request({
    url: '/material/back_apply_info/delHandlingOrder',
    method: 'post',
    data: data
  })
}

export function getSort(data) {
  return request({
    url: '/material/back_apply_info/getSort',
    method: 'post',
    data: data
  })
}

// 获取出门证列表
export function getExitPermitList(query) {
  return request({
    url: '/material/back_apply_info/getExitPermitList',
    method: 'get',
    params: query
  })
}

export const addExitPermit = (data) => {
  return request({
    method: 'POST',
    url: '/material/back_apply_info/addExitPermit',
    data:data,
  })
}

// 单号下拉
export function getCodeListApi(data = {}) {
  return request({
    url: '/material/back_apply_info/getCodeList',
    method: 'get',
    params: data
  })
}
