import Axios from 'axios'

import {
  ALARM_MANG_EXP,
  ALARM_MANG_EXP_TOTAL,
  ALARM_MANG_EXP_QUERY,
  ALARM_MANG_EXP_EXPORT,
  ALARM_MANG_EXP_IMPORT,
  REQUEST_CONFIG,
} from '../../utils/RequestUrls'

var staticMethods = {
  /**
   * @Description  : 分页查询API
   * @author       : ls
   * @date         : 2020/5/6 16:16
   * @param        :
   * @return       :
   */
  putAlarmMangExpQueryterms: function (beginItem, endItem, selectList) {
    return Axios.put(ALARM_MANG_EXP_QUERY + '/' + beginItem + '/' + endItem + '/', selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : 查询总页数
   * @author       : ls
   * @date         : 2020/5/6 16:06
   * @param        :
   * @return       :
   */
  putAlarmMangExpListCounts: function (selectList) {
    return Axios.put(ALARM_MANG_EXP_TOTAL, selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : 创建报表模板
   * @author       : ls
   * @date         : 2020/5/2 14:14
   * @param        :
   * @return       :
   */
  addAlarmMangExp: function (template) {
    return Axios.post(ALARM_MANG_EXP, template, REQUEST_CONFIG)
  },
  /**
   * @Description  : 修改报表模板
   * @author       : ls
   * @date         : 2020/5/2 14:15
   * @param        :
   * @return       :
   */
  putModifyAlarmMangExp: function (template) {
    return Axios.put(ALARM_MANG_EXP, template, REQUEST_CONFIG)
  },
  /**
   * @Description  : 删除
   * @author       : ls
   * @date         : 2020/5/2 14:15
   * @param        :
   * @return       :
   */
  deleteDeleteAlarmMangExp: function (keyList) {
    return Axios.delete(ALARM_MANG_EXP, {
      data: keyList,
      headers: {'Content-Type': 'application/json', 'Encoding': 'utf-8'}
    })
  },
  /**
   * @Description  : 导入
   * @author       : ls
   * @date         : 2020/7/7 11:59
   * @param        :
   * @return       :
   */
  postUploadAlarmMangExp: function (fileFormData) {
    // return Axios.post(ALARM_MANG_EXP_IMPORT + '/1', fileFormData, {headers: {
    return Axios.post(ALARM_MANG_EXP_IMPORT, fileFormData, {headers: {
      'Content-Type': 'multipart/form-data',
      'Accept': 'application/json'
    }})
  },
  /**
   * @Description  : 导出
   * @author       : ls
   * @date         : 2020/7/7 15:57
   * @param        :
   * @return       :
   */
  putDownloadAlarmMangExp: function (conditionSet) {
    return Axios.put(ALARM_MANG_EXP_EXPORT, conditionSet, {
      headers: {
        'Content-Type': 'application/json'
      },
      responseType: 'arraybuffer'
    })
  }
}

function AlarmMangExpAPI () {
  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}
// inject static methods
Object.assign(AlarmMangExpAPI, staticMethods)
export default AlarmMangExpAPI
