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.inspectorName != '') {
    param += '&inspectorName=' + data.inspectorName;
  }
  if (data.date != '') {
    param += '&date=' + data.date;
  }
  return request({
    url: '/inspection/list' + param,
    method: 'get',
    data,
  });
}
//相关字典数据查询
export function dict(data) {
  return request({
    url: '/inspection/dict',
    method: 'get',
    data,
  });
}
//获取站点列表
export function getDevices(data) {
  return request({
    url: '/task/devices?projectId=' + data.projectId,
    method: 'get',
    data,
  });
}
//巡检添加
export function doAdd(data) {
  return request({
    url: '/inspection/add',
    method: 'post',
    data,
  });
}

//巡检修改
export function toEdit(data) {
  return request({
    url: '/inspection/update',
    method: 'post',
    data,
  });
}
//删除
export function doDelete(data) {
  return request({
    url: '/inspection/remove',
    method: 'post',
    data,
  });
}
//导出
export function doExport(data) {
  var param = '?projectId=' + data.projectId;
  if (data.projectId != '') {
    param += '&projectId=' + data.projectId;
  }
  return baseURL + '/taskReport/export' + param;
}
