/**
 * 设备交接单
*/
import request from '../../index'
import type { IListQuery, ISampleListQuery } from '@/views/business/schedule/interchangeReceipt/receiptList-interface'
const prefix = '/business/interchange'

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

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

// 取消
export function deleteReceiptList(data: { id: string }) {
  return request({
    url: `${prefix}/delete`,
    method: 'post',
    data,
  })
}

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

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

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

// 关联委托书的且是已收入的样品的列表
// export function getSampleList(data: ISampleListQuery) {
//   return request({
//     url: `${prefix}/sampleList?offset=${data.offset}&limit=${data.limit}`,
//     method: 'post',
//     data,
//   })
// }

// 查询样品列表
export function getSampleList(data: ISampleListQuery) {
  return request({
    url: `/customer/sample/listPageByInterchange?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

