import request from '@/utils/request'

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

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

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

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

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

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

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