import request from '@/utils/request';
import { baseURL } from '@/config';
//设备列表分页查询
export function getList(data) {
  var param =
    '?page=' +
    data.page +
    '&size=' +
    data.size +
    '&projectId=' +
    data.projectId;
  if (data.deviceName != '') {
    param += '&deviceName=' + data.deviceName;
  }
  if (data.equipmentName != '') {
    param += '&equipmentName=' + data.equipmentName;
  }
  return request({
    url: '/equipment/list' + param,
    method: 'get',
    data,
  });
}
//获取站点列表
export function getDevices(data) {
  return request({
    url: '/task/devices?projectId=' + data.projectId,
    method: 'get',
    data,
  });
}
//字典数据获取
export function alarmCategoryDict(data) {
  return request({
    url: '/equipment/dict',
    method: 'get',
    data,
  });
}
//添加
export function doAdd(data) {
  return request({
    url: '/equipment/add',
    method: 'post',
    data,
  });
}
//修改
export function doEdit(data) {
  return request({
    url: '/equipment/update',
    method: 'post',
    data,
  });
}
//删除
export function doDelete(data) {
  return request({
    url: '/alarmRecord/remove',
    method: 'post',
    data,
  });
}
//导出
export function doExport(data) {
  var param = '?projectId=' + data.projectId;
  if (data.deviceName != '') {
    param += '&deviceName=' + data.deviceName;
  }
  if (data.equipmentName != '') {
    param += '&equipmentName=' + data.equipmentName;
  }
  return baseURL + 'equipment/export' + param;
}
