/**
 * 分包方证书管理
 */
import request from '../../index'
import type { IListQuery } from '@/views/business/subpackage/certificate/certificate-interface'

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

// 导出
export function exportcertificateList(data: Omit<IListQuery, 'limit' | 'offset'>) {
  return request({
    url: '/business/outsourceCertificate/listExport',
    method: 'post',
    responseType: 'blob',
    data,
  })
}

// 新建
export function addCertificateList(data: Object) {
  return request({
    url: '/business/outsourceCertificate/add',
    method: 'post',
    data,
  })
}
// 编辑
export function updateCertificateList(data: Object) {
  return request({
    url: '/business/outsourceCertificate/update',
    method: 'post',
    data,
  })
}

// 样品列表
export function getSampleListByCertificate(data: any) {
  return request({
    url: `/customer/sample/listPageBySubpackageCertificate?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 删除
export function delCertificate(data: { id: string }) {
  return request({
    url: '/business/outsourceCertificate/delete',
    method: 'post',
    data,
  })
}
