/**
 * 样品列表接口
 */
import request from '../index'
import type { ISampleListQuery } from '@/views/customer/sample/list/sample_list_interface'
const prefix = '/meter'

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

// 数据删除
export function deleteSample(data: { id: string }) {
  return request({
    url: `${prefix}/sample/delete`,
    method: 'post',
    data,
  })
}

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

// 新增数据
export function addSample(data: object) {
  return request({
    url: `${prefix}/sample/submit`,
    method: 'post',
    data,
  })
}
// 编辑数据
export function updateSample(data: object) {
  return request({
    url: `${prefix}/sample/update`,
    method: 'post',
    data,
  })
}

// 查看详情
export function getSapmleDetail(data: { id: string }) {
  return request({
    url: `${prefix}/sample/detail`,
    method: 'post',
    data,
  })
}
