import request from '@/utils/request';
import { baseURL } from '@/config';
// 获取故障信息
export function getData(data) {
  let param = '?page=' + data.page + '&size=' + data.size;
  if (data.projectId != '') {
    param += '&projectId=' + data.projectId;
  }
  if (data.deviceId != '') {
    param += '&deviceId=' + data.deviceId;
  }
  if (data.start != '') {
    param += '&start=' + data.start;
  }
  if (data.end != '') {
    param += '&end=' + data.end;
  }
  return request({
    url: '/faultAnalysis/getFaultInfo' + param,
    method: 'get',
    data,
  });
}

// 获取层级项目站点
export function getProjectDeviceTree(data) {
  return request({
    url: '/faultAnalysis/getProjectDeviceTree',
    method: 'get',
    data,
  });
}

// 获取故障详情
export function getFaultDetails(data) {
  let param = '?page=' + data.page + '&size=' + data.size;
  if (data.projectId != '') {
    param += '&projectId=' + data.projectId;
  }
  if (data.deviceId != '') {
    param += '&deviceId=' + data.deviceId;
  }
  if (data.start != '') {
    param += '&start=' + data.start;
  }
  if (data.end != '') {
    param += '&end=' + data.end;
  }
  return request({
    url: '/faultAnalysis/getFaultDetails' + param,
    method: 'get',
    data,
  });
}
