import request from '@/utils/request';
import { baseURL } from '@/config';
//任务分页查询
export function getList(data) {
  var param =
    '?page=' +
    data.page +
    '&size=' +
    data.size +
    '&type=' +
    data.type +
    '&projectId=' +
    data.projectId;
  if (data.status != 3) {
    param += '&status=' + data.status;
  }
  return request({
    url: '/task/list' + param,
    method: 'get',
    data,
  });
}
//获取报警用户列表
export function getHandlers(data) {
  return request({
    url: '/task/handlers?deviceCode=' + data.deviceCode,
    method: 'get',
    data,
  });
}
//获取站点列表
export function getDevices(data) {
  return request({
    url: '/task/devices?projectId=' + data.projectId,
    method: 'get',
    data,
  });
}
//删除任务
export function doDelete(data) {
  return request({
    url: '/task/remove',
    method: 'post',
    data,
  });
}
//新建任务
export function doAdd(data) {
  return request({
    url: '/task/add',
    method: 'post',
    data,
  });
}
//任务反馈
export function feedback(data) {
  return request({
    url: '/task/feedback',
    method: 'post',
    data,
  });
}
//水质申请修改
export function doEdit(data) {
  return request({
    url: '/task/update',
    method: 'post',
    data,
  });
}
//导出
export function taskExport(data) {
  var param = '?projectId=' + data.projectId;
  if (data.projectId != '') {
    param += '&projectId=' + data.projectId;
  }
  return baseURL + '/taskReport/export' + param;
}
//任务级别字典数据
export function getTaskLevel(data) {
  return request({
    url: '/task/taskLevel',
    method: 'get',
    data,
  });
}
//任务类型字典数据
export function getTaskType(data) {
  return request({
    url: '/task/taskType',
    method: 'get',
    data,
  });
}
