import request from '@/utils/request'
import { download } from '@/utils/request'

// request.defaults.baseURL = '/ezhizao-yzbh-crm'
// 查询档案入库列表
export function listOrder(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/list',
    method: 'get',
    params: query
  })
}

// 查询档案入库详细
export function getOrder(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/' + id,
    method: 'get'
  })
}

// 新增档案入库
export function addOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order',
    method: 'post',
    data: data
  })
}

// 修改档案入库
export function updateOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order',
    method: 'put',
    data: data
  })
}

// 删除档案入库
export function delBinOrder(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/bin/order/' + id,
    method: 'post'
  })
}

// 删除档案入库
export function delOrder(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/' + id,
    method: 'Delete'
  })
}

export function initTaskTypes(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/initTaskTypes',
    method: 'get'
  })
}

export function exportOrder(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  download(
    "business/archive/order/export",
    {
      ...query,
    },
    `合同导出_${new Date().getTime()}.xlsx`
  )
}

export function exportLoopTemplate() {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  download(
    "business/archive/order/exportLoopTemplate",
    {
    },
    `循环合同模板_${new Date().getTime()}.xlsx`
  )
}

export function exportOnceTemplate() {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  download(
    "business/archive/order/exportOnceTemplate",
    {
    },
    `单次合同模板_${new Date().getTime()}.xlsx`
  )
}

// 文件上传
export function importLoop(file) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: `/business/archive/order/importLoop`,
    method: 'post',
    data: file,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
// 文件上传
export function importOnce(file) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: `/business/archive/order/importOnce`,
    method: 'post',
    data: file,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
export function verifyOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/verify',
    method: 'post',
    data: data
  })
}

export function dissolutionOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/dissolution',
    method: 'post',
    data: data
  })
}

export function alterOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/alter',
    method: 'post',
    data: data
  })

}

export function verifyCheckOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/archive/order/verifyCheck',
    method: 'post',
    data: data
  })
}
