import { getAll, equipmentMonitoring, deleteEquipment, getMonitoringById, deleteMonitoringBachByIds } from '@/api/equipment'

const equipment = {
  state: {

  },
  mutations: {

  },
  actions: {
    EquipmentGetAll({ commit }, data) {
      return new Promise((resolve, reject) => {
        getAll(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    EquipmentMonitoring({ commit }, data) { // 提交设备数据
      return new Promise((resolve, reject) => {
        equipmentMonitoring(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    DeleteEquipment({ commit }, data) { // 删除设备
      return new Promise((resolve, reject) => {
        deleteEquipment(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetMonitoringById({ commit }, data) { // 根据设备id 和 类型
      return new Promise((resolve, reject) => {
        getMonitoringById(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    DeleteMonitoringBachByIds({ commit }, data) { // 批量删除设备,id 集合
      return new Promise((resolve, reject) => {
        deleteMonitoringBachByIds(data).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default equipment

