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

// 查询工资列表
export function listOnceWorkOrder(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/list',
    method: 'get',
    params: query
  })
}


// 导出
export function exportOnceWork(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  download(
    "business/onceWorkOrder/export",
    {
      ...data,
    },
    `单次任务导出_${new Date().getTime()}.xlsx`
  )
}

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

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

export function receive(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/receive',
    method: 'post',
    data: data
  })
}
export function updateRecordStatus(workOrderId,recordStatus){
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/updateRecordStatus',
    method: 'post',
    data: {"workOrderId":workOrderId,"resultStatus":recordStatus},
  })
}
export function uploadFiles(workOrderId,fileEntity){
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/uploadFiles',
    method: 'post',
    data: {"workOrderId":workOrderId,"sysFileStorage":fileEntity},
  })
}
export function delFile(id){
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/delFile',
    method: 'post',
    data: id
  })
}

export function FileList(query){
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/FileList',
    method: 'post',
    data:query
  })
}
export function continueHandleApi(data){
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/continueHandle',
    method: 'post',
    data: data
  })
}
export function entrustSourceApi(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/entrustSource',
    method: 'get',
    params: query
  })
}
export function selectRecordByOrderIdApi(query){
  request.defaults.baseURL = '/ezhizao-yzbh-production'
  return request({
    url: '/business/onceWorkOrder/selectRecordByOrderId',
    method: 'get',
    params: query
  })
}
