import request from '@/utils/request'

// 查询维修工单流转记录列表
export function listGxtWorkOrderFlow(query) {
  return request({
    url: '/gxt/workOrderFlow/list',
    method: 'get',
    params: query
  })
}

// 根据工单ID查询流转记录列表
export function listGxtWorkOrderFlowByOrderId(orderId) {
  return request({
    url: `/gxt/workOrderFlow/listByOrderId/${orderId}`,
    method: 'get'
  })
}

// 查询维修工单流转记录详细
export function getGxtWorkOrderFlow(id) {
  return request({
    url: '/gxt/workOrderFlow/' + id,
    method: 'get'
  })
}

// 新增维修工单流转记录
export function addGxtWorkOrderFlow(data) {
  return request({
    url: '/gxt/workOrderFlow',
    method: 'post',
    data: data
  })
}

// 修改维修工单流转记录
export function updateGxtWorkOrderFlow(data) {
  return request({
    url: '/gxt/workOrderFlow',
    method: 'put',
    data: data
  })
}

// 删除维修工单流转记录
export function delGxtWorkOrderFlow(id) {
  return request({
    url: '/gxt/workOrderFlow/' + id,
    method: 'delete'
  })
}

// 导出维修工单流转记录
export function exportGxtWorkOrderFlow(query) {
  return request({
    url: '/gxt/workOrderFlow/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 记录工单流转
export function recordWorkOrderFlow(orderId, orderCode, actionType, fromStatus, toStatus, operatorId, operatorName, actionRemark) {
  return request({
    url: '/gxt/workOrderFlow/record',
    method: 'post',
    data: {
      orderId: orderId,
      orderCode: orderCode,
      actionType: actionType,
      fromStatus: fromStatus,
      toStatus: toStatus,
      operatorId: operatorId,
      operatorName: operatorName,
      actionRemark: actionRemark
    }
  })
}
