import request from '@/utils/request'
import { download } from '@/utils/request'
// 查询委托签约合同列表
export function listEntrustOrder(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder/list',
    method: 'get',
    params: query
  })
}

// 查询委托签约合同列表
export function listTenant(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder/listTenant',
    method: 'get',
    params: query
  })
}
// 查询委托签约合同详细
export function getEntrustOrder(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder/' + id,
    method: 'get'
  })
}

// 新增委托签约合同
export function addEntrustOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder',
    method: 'post',
    data: data
  })
}

// 修改委托签约合同
export function updateEntrustOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder',
    method: 'put',
    data: data
  })
}

// 删除委托签约合同
export function delEntrustOrder(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder/' + id,
    method: 'delete'
  })
}

export function confirmEntrustOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder/confirm',
    method: 'post',
    data: data
  })
}

export function finishedEntrustOrder(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/entrustOrder/finished',
    method: 'post',
    data: data
  })
}

export function exportEntrustOrder(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  download(
    "business/entrustOrder/export",
    {
      ...query,
    },
    `委托订单导出_${new Date().getTime()}.xlsx`
  )
}

export function getMonths(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: `/business/entrustOrder/getMonths/${id}`,
    method: 'get'
  })
}
