import request from '../../index'
import type { IEnvironmentalDetail, IListQuery } from '@/views/business/lab/environmental/environmentalList_interface'
const prefix = '/business/environmentRecord'

// 环境记录单列表查询-分页
export function getEnvironmentRecordList(data: { offset: number; limit: number }) {
  return request({
    url: `${prefix}/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 环境记录单删除
export function getEnvironmentRecordDelete(data: { id: string }) {
  return request({
    url: `${prefix}/delete`,
    method: 'post',
    data,
  })
}

// 新增环境记录单
export function getEnvironmentRecordAdd(data: IEnvironmentalDetail) {
  return request({
    url: `${prefix}/add`,
    method: 'post',
    data,
  })
}

// 环境监测记录单-详情
export function getEnvironmentRecordDetail(data: { id: string }) {
  return request({
    url: `${prefix}/detail`,
    method: 'post',
    data,
  })
}

// 环境监测记录单-编辑
export function getEnvironmentRecordUpdate(data: IEnvironmentalDetail) {
  return request({
    url: `${prefix}/update`,
    method: 'post',
    data,
  })
}

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