/**
 * 溯源供方请求接口
 */
import request from '../index'
const prefix = '/meter'

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

// 数据删除
export function getSoucreListDelete(data: object) {
  return request({
    url: `${prefix}/supplier/delete`,
    method: 'post',
    data,
  })
}

// 查看详情
export function getSoucreListDetail(data: object) {
  return request({
    url: `${prefix}/supplier/detail`,
    method: 'post',
    data,
  })
}

// 省级联动
export function getSoucreListlevelType(pid: string) {
  return request({
    url: `/sys/area/list?pid=${pid}`,
    method: 'get',
  })
}

// 提交数据
export function sourceSubmit(data: object) {
  return request({
    url: '/meter/supplier/submit',
    method: 'post',
    data,
  })
}
// 保存至草稿箱
export function sourceSave(data: object) {
  return request({
    url: `${prefix}/supplier/save`,
    method: 'post',
    data,
  })
}
// 更新草稿箱文件
export function sourceDraftUpdate(data: object) {
  return request({
    url: `${prefix}/supplier/draftUpdate`,
    method: 'post',
    data,
  })
}
// 更新数据
export function getSoucreLisUpdate(data: object) {
  return request({
    url: `${prefix}/supplier/update`,
    method: 'post',
    data,
  })
}

// 导出列表
export function exportSourceList(data: { businessContent: string; supplierName: string; supplierNo: string; ids: string[] }) {
  return request({
    url: `${prefix}/supplier/listExport`,
    method: 'post',
    responseType: 'blob',
    data,
  })
}

// 溯源供方审批接口
export function getapprovalListPage(data: { offset: number; limit: number }) {
  return request({
    url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}
