/*
 * 报警规则管理配置接口
*/
import request from '@/utils/request'
import qs from 'qs'

// 报警规则管理配置查询
export function warningRuleList(params) {
  return request({
    url: 'alarmRule/list',
    method: 'get',
    params
  })
}

// 添加报警规则管理
export function addWarningRule(params) {
  return request({
    url: 'alarmRule/add',
    method: 'post',
    params
  })
}
// 修改报警规则管理
export function updateWarningRule(params) {
  return request({
    url: 'alarmRule/update',
    method: 'post',
    params
  })
}
// 删除报警规则管理
export function delWarningRule(ids) {
  return request({
    url: 'alarmRule/delete',
    method: 'post',
    params: {
      ids: ids
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 批量导入
export function batchImportWarn(fileobj) {
  const param = new FormData()
  param.append('file', fileobj)
  return request({
    url: 'alarmRule/batchImport',
    method: 'post',
    timeout: 240000,
    headers: { 'Content-Type': 'multipart/form-data' },
    data: param
  })
}
