import request from '@/api/index'
// 变压器列表
export function getTransformerList(params: any) {
  return request({
    url: '/sgPwrtransfmB/listPage',
    method: 'get',
    params,
  })
}
// 添加变压器
export function addTransformerList(data: any) {
  return request({
    url: '/sgPwrtransfmB/add',
    method: 'post',
    data,
  })
}
// 修改变压器
export function updateTransformerList(data: any) {
  return request({
    url: '/sgPwrtransfmB/update',
    method: 'post',
    data,
  })
}
// 删除变压器
export function deleteTransformerList(id: any) {
  return request({
    url: `/sgPwrtransfmB/delete?id=${id}`,
    method: 'post',
  })
}
// 用电用气用热导出
export function templateExport(params: object) {
  return request({
    url: '/deviceCollectionLog/export',
    method: 'get',
    params,
    responseType: 'blob',
  })
}
// 用电用气用热导入
export function templateImport(data: object) {
  return request({
    url: '/deviceCollectionLog/import',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })
}
// 用电用气用热模板下载
export function templateDownload(type: string) {
  if (type === '0') {
    // 用电
    return request({
      url: '/static/electricity.xlsx',
      method: 'get',
      responseType: 'blob',
    })
  }
  else {
    // 用热 用气
    return request({
      url: '/static/heat.xlsx',
      method: 'get',
      responseType: 'blob',
    })
  }
}
