/**
 * 垃圾中转站管理接口
 */
import request from '@/utils/request'
import qs from 'qs'
// 垃圾中转站查询
export function getTransferstationListPage(params) {
  return request({
    url: '/sanitation/transferstation/listPage',
    method: 'get',
    params
  })
}
// 垃圾中转站查询
export function getTransferstationList(pid) {
  return request({
    url: '/sanitation/transferstation/list',
    method: 'get',
    params: {
      pid: pid
    }
  })
}

// 添加垃圾中转站
export function addTransferstation(params) {
  return request({
    url: '/sanitation/transferstation/add',
    method: 'post',
    params
  })
}
// 修改垃圾中转站机构
export function updateTransferstation(params) {
  return request({
    url: '/sanitation/transferstation/update',
    method: 'post',
    params
  })
}
// 删除垃圾中转站机构
export function delTransferstation(ids) {
  return request({
    url: '/sanitation/transferstation/delete',
    method: 'post',
    params: {
      ids
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 批量导入
export function batchImportTransferstation(fileobj) {
  const param = new FormData()
  param.append('file', fileobj)
  return request({
    url: '/sanitation/transferstation/import',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: param
  })
}
// 批量导出
export function batchExportTransferstation(params, config) {
  return request({
    url: '/sanitation/transferstation/export',
    method: 'get',
    timeout: 120000,
    params,
    ...config,
    responseType: 'blob' // 这一步也很关键，一定要加上 responseType 值为 blob
  })
}
