import request from '@/utils/request'
import { listGxtOrder } from '@/api/gxt/gxtOrder'

// 查询维修工单列表
export function listRepairOrder(query) {
  return request({
    url: '/gxt/repairOrder/list',
    method: 'get',
    params: query
  })
}

// 查询维修工单详细
export function getRepairOrder(id) {
  return request({
    url: '/gxt/repairOrder/' + id,
    method: 'get'
  })
}

// 根据MIS工单编码查询工单信息
export function getRepairOrderByMisOrderNo(query) {
  return request({
    url: '/gxt/repairOrder/getInfoByMisOrderNo/',
    method: 'get',
    params: query
  })
}

// 新增维修工单
export function addRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder',
    method: 'post',
    data: data
  })
}

// 修改维修工单
export function updateRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder',
    method: 'put',
    data: data
  })
}

// 删除维修工单
export function delRepairOrder(id) {
  return request({
    url: '/gxt/repairOrder/' + id,
    method: 'delete'
  })
}

// 派单维修工单
export function assignRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/assign',
    method: 'put',
    data: data
  })
}

// 接单维修工单
export function acceptRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/accept',
    method: 'put',
    data: data
  })
}

// 开始维修工单
export function startRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/start',
    method: 'put',
    data: data
  })
}

// 挂起维修工单
export function suspendRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/suspend',
    method: 'put',
    data: data
  })
}

// 审批挂起维修工单
export function approveSuspendRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/approve',
    method: 'put',
    data: data
  })
}

// 暂停维修工单
export function pauseRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/pause',
    method: 'put',
    data: data
  })
}

// 恢复维修工单
export function resumeRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/resume',
    method: 'put',
    data: data
  })
}

// 恢复维修工单
export function revokeRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/revoke',
    method: 'put',
    data: data
  })
}

// 维修工单处理完成（进入待结单状态）
export function processDoneRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/processDone',
    method: 'put',
    data: data
  })
}

// 正式结单（完结工单）
export function finalizeRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/finalize',
    method: 'put',
    data: data
  })
}

// 评分维修工单
export function ratingRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/rating',
    method: 'put',
    data: data
  })
}

// 复运维修工单
export function restartRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/restart',
    method: 'put',
    data: data
  })
}

// 查询首页工单统计数据
export function selectHomePageData() {
  return request({
    url: '/gxt/repairOrder/selectHomePageData',
    method: 'get'
  })
}

// 退回维修工单
export function returnRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/return',
    method: 'put',
    data: data
  })
}

// 作废维修工单
export function invalidateRepairOrder(data) {
  return request({
    url: '/gxt/repairOrder/invalidate',
    method: 'put',
    data: data
  })
}

// 获取导出字段
export function getExportFields() {
  return request({
    url: '/gxt/repairOrder/exportFields',
    method: 'get'
  })
}
