import request from '@/utils/request'

// 查询工单工作组员列表
export function listGxtWorkOrderPerson(query) {
  return request({
    url: '/gxt/workOrderPerson/list',
    method: 'get',
    params: query
  })
}

// 根据工单ID查询工作组员列表
export function listGxtWorkOrderPersonByOrderId(orderId) {
  return request({
    url: `/gxt/workOrderPerson/listByOrderId/${orderId}`,
    method: 'get'
  })
}

// 查询工单工作组员详细
export function getGxtWorkOrderPerson(id) {
  return request({
    url: '/gxt/workOrderPerson/' + id,
    method: 'get'
  })
}

// 新增工单工作组员
export function addGxtWorkOrderPerson(data) {
  return request({
    url: '/gxt/workOrderPerson',
    method: 'post',
    data: data
  })
}

// 批量新增工单工作组员
export function addBatchGxtWorkOrderPerson(orderId, orderCode, data) {
  return request({
    url: `/gxt/workOrderPerson/insertBatch/${orderId}/${orderCode}`,
    method: 'post',
    data: data
  })
}

// 修改工单工作组员
export function updateGxtWorkOrderPerson(data) {
  return request({
    url: '/gxt/workOrderPerson',
    method: 'put',
    data: data
  })
}

// 删除工单工作组员
export function delGxtWorkOrderPerson(id) {
  return request({
    url: '/gxt/workOrderPerson/' + id,
    method: 'delete'
  })
}

// 根据工单ID删除工作组员
export function delGxtWorkOrderPersonByOrderId(orderId) {
  return request({
    url: `/gxt/workOrderPerson/removeByOrderId/${orderId}`,
    method: 'delete'
  })
}

// 导出工单工作组员
export function exportGxtWorkOrderPerson(query) {
  return request({
    url: '/gxt/workOrderPerson/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
