/**
 * 任务单接口
*/
import request from '../../index'
import type { IListQuery } from '@/views/business/manager/order/order-interface'
const prefix = '/business/order'

// 列表查询
export function getOrderList(data: IListQuery) {
  return request({
    url: `${prefix}/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 导出列表
export function exportOrderList(data: Omit<IListQuery, 'limit' | 'offset'>) {
  return request({
    url: `${prefix}/listExport`,
    method: 'post',
    responseType: 'blob',
    data,
  })
}

// 接收
export function receiveOrder(data: { id: string }) {
  return request({
    url: `${prefix}/receive`,
    method: 'post',
    data,
  })
}

// 退回
export function backOrder(data: { id: string }) {
  return request({
    url: `${prefix}/back`,
    method: 'post',
    data,
  })
}

// 新增
export function addOrder(data: any) {
  return request({
    url: `${prefix}/add`,
    method: 'post',
    data,
  })
}

// 编辑
export function updateOrder(data: any) {
  return request({
    url: `${prefix}/update`,
    method: 'post',
    data,
  })
}

// 详情
export function getOrderDetail(data: any) {
  return request({
    url: `${prefix}/detail`,
    method: 'post',
    data,
  })
}

// 详情的补送或退回
export function replenishOrBack(data: any) {
  return request({
    url: `${prefix}/sample/apply`,
    method: 'post',
    data,
  })
}

// 受检设备列表
export function getEquipmentList(data: any) {
  return request({
    url: `${prefix}/sample/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 受检设备列表(已接收)
export function getReceivedEquipmentList(data: any) {
  return request({
    url: `${prefix}/sample/received/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

