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

const api = {
  repair: '/admin/repair'
}

export function getRepair (parameter) {
  return axios({
    url: api.repair + '/get',
    method: 'post',
    data: parameter
  })
}

export function getRepairList (data) {
  return axios({
    url: api.repair + '/list',
    method: 'post',
    data: data
  })
}

export function saveRepair (parameter) {
  return axios({
    url: api.repair + (parameter.id > 0 ? '/update' : '/save'),
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function review (parameter, uniqueArr) {
  return axios({
    url: api.repair + '/flow/start',
    method: 'post',
    data: {
      'repair': parameter,
      'files': uniqueArr
    },
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function complete (parameter) {
  return axios({
    url: api.repair + '/complete',
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function delRepair (parameter) {
  return axios({
    url: api.repair + '/delete',
    method: 'post',
    params: parameter
  })
}

export function selectDispatcher () {
  return axios({
    url: api.repair + '/selectDispatcher',
    method: 'get'
  })
}

export const repairExport = api.repair + '/export'
