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.code != '') {
    param += '&code=' + data.code;
  }
  if (data.date != '') {
    param += '&date=' + data.date;
  }
  return request({
    url: '/waterDetection/list' + param,
    method: 'get',
    data,
  });
}
//水质申请删除
export function doDelete(data) {
  return request({
    url: '/waterDetection/remove',
    method: 'post',
    data,
  });
}
//水质申请添加
export function doAdd(data) {
  return request({
    url: '/waterDetection/add',
    method: 'post',
    data,
  });
}
//水质申请修改
export function doEdit(data) {
  return request({
    url: '/waterDetection/update',
    method: 'post',
    data,
  });
}
//导出
export function exportWaterDetection(data) {
  var param = '?projectId=' + data.projectId;
  if (data.deviceName != '') {
    param += '&deviceName=' + data.deviceName;
  }
  if (data.date != '') {
    param += '&date=' + data.date;
  }
  return baseURL + '/waterDetectionReport/export' + param;
}
//达标率
export function waterRate(data) {
  var param = '?projectId=' + data.projectId;
  if (data.code != '') {
    param += '&deviceCode=' + data.code;
  }
  if (data.date != '') {
    param += '&date=' + data.date;
  }
  return request({
    url: '/waterDetection/rate' + param,
    method: 'get',
    data,
  });
}
