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

// 查询工单管理列表
export function listLoop(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/list',
    method: 'get',
    params: query
  })
}

export function listOnce(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/onceList',
    method: 'get',
    params: query
  })
}


export function exportLoop(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  download(
    "business/workOrderService/exportLoop",
    {
      ...query,
    },
    `循环服务导出_${new Date().getTime()}.xlsx`
  )
}

export function exportOnce(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  download(
    "business/workOrderService/exportOnce",
    {
      ...query,
    },
    `单次服务导出_${new Date().getTime()}.xlsx`
  )
}

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

export function getOnceDetail(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/getOnceDetail',
    method: 'post',
    data: data
  })
}
export function saveDetail(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/saveDetail',
    method: 'post',
    data: data
  })
}
export function updateDetail(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/updateDetail',
    method: 'post',
    data: data
  })
}
export function saveOnceDetail(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/saveOnceDetail',
    method: 'post',
    data: data
  })
}
export function updateOnceDetail(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-crm'
  return request({
    url: '/business/workOrderService/updateOnceDetail',
    method: 'post',
    data: data
  })
}

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