AlarmAPI.js 1.14 KB
Newer Older
YazhouChen's avatar
YazhouChen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
import {
  ALARM_ADMQ,
  ALARM_CONFIRM,
  ALARM_DELETE,
  REQUEST_CONFIG,
  ALARM_CLEARUP
} from '../../utils/RequestUrls'
import Axios from 'axios'

var staticMethods = {
  // 获取所有告警
  getAlarmCollection: function () {
    return Axios.get(ALARM_ADMQ)
  },
  // 告警确认
  putAlarmConfirm: function (alarmKeys) {
    return Axios.put(ALARM_CONFIRM, alarmKeys, REQUEST_CONFIG)
  },
  // 告警清除
  putAlarmClearup: function (alarmKeys) {
    return Axios.put(ALARM_CLEARUP, alarmKeys, REQUEST_CONFIG)
  },
  // 告警删除
  putAlarmDelete: function (alarmKeys) {
    return Axios.delete(ALARM_DELETE, {
      data: alarmKeys,
      REQUEST_CONFIG
    })
  }

  // // 设备的批量删除
  // batchDeleteDevice: function (deviceKeyList) {
  //   return Axios.delete(DEVICE_ADMQ,{
  //     data:deviceKeyList,
  //     headers:{'Content-Type':'application/json','Encoding':'utf-8'}
  //   });
  // },
}

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