import request from '@/utils/request';

//获取所有角色
export function getdata(params:any){
  return request({
    url: '/basedata/substation/getSubstationBayTree' ,
    method: 'get',
    params:params
  });
}
//新增变电站
export function adddata(params: any) {
  return request({
    url: '/basedata/substation/addSubstation',
    method: 'post',
    data: params,
  });
}
//改变变电站状态
export function changestatus(params: any) {
    return request({
      url: '/basedata/substation/setSubstationStatus',
      method: 'post',
      params: params,
    });
  }
  //改变区域状态
export function changearea(params: any) {
  return request({
    url: '/basedata/substation/setSubstationAreaStatus',
    method: 'post',
    params: params,
  });
}
//改变间隔状态
export function changeinterval(params: any) {
  return request({
    url: '/basedata/substation/setSubstationBayStatus',
    method: 'post',
    params: params,
  });
}
//删除变电站
export function deldata(params: any) {
    return request({
      url: '/basedata/substation/deleteSubstation',
      method: 'post',
      params: params,
    });
  }
  //删除区域
  export function delarea(params: any) {
    return request({
      url: '/basedata/substation/deleteSubstationArea',
      method: 'post',
      params: params,
    });
  }
   //删除间隔
   export function delinterval(params: any) {
    return request({
      url: '/basedata/substation/deleteSubstationBay',
      method: 'post',
      params: params,
    });
  }
//修改变电站
export function deitdata(params: any) {
    return request({
      url: '/basedata/substation/updateSubstation',
      method: 'post',
      data: params,
    });
  }
//新增区域
export function addArea(params: any) {
    return request({
      url: '/basedata/substation/addSubstationArea',
      method: 'post',
      data: params,
    });
  }
//修改区域
export function editArea(params: any) {
    return request({
      url: '/basedata/substation/updateSubstationArea',
      method: 'post',
      data: params,
    });
  }
  //新增间隔
  export function addInterval(params: any) {
    return request({
      url: '/basedata/substation/addSubstationBay',
      method: 'post',
      data: params,
    });
  }
  //修改间隔
  export function editInterval(params: any) {
    return request({
      url: '/basedata/substation/updateSubstationBay',
      method: 'post',
      data: params,
    });
  } 
  //上传图片
  export function uploadIcon (data:any) {
    return request({
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      url: '/basedata/substation/uploadImage',
      method: 'POST',
      data
    });
  }
  //删除图片
  export function delIcon (params:any) {
    return request({
      url: '/basedata/substation/deleteImage',
      method: 'POST',
      params:params
    });
  }
  //删除图片2
  export function delallIcon (params:any) {
    return request({
      url: '/basedata/substation/cancelImage',
      method: 'POST',
      params:params
    });
  }
  //导入文件
  export function uploadfile (data:any) {
    return request({
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      url: '/basedata/substation/uploadFile',
      method: 'POST',
      data
    });
  }

  //3d修改变电站
  export function getSubstationById(params: any) {
    return request({
      url: '/basedata/substation/getSubstationById',
      method: 'post',
      params
    });
  }
  //3d修改变电站
  export function updateSubstation_bak(params: any) {
    return request({
      url: '/basedata/substation/updateSubstation_bak',
      method: 'post',
      data: params
    });
  }
  //3D查询无人车
  export function getrobotdata(params: any) {
    return request({
      url: '/basedata/substation-patroldevice/getPatrolDeviceByType',
      method: 'get',
      params: params
    });
  }
  //3D查询无人机
  export function getPatrolDeviceList(params: any) {
    return request({
      url: '/basedata/substation-patroldevice/getPatrolDevicePage',
      method: 'get',
      params: params
    });
  }


  //巡视任务列表（前后10条）
  export function todoList(params: any) {
    return request({
      url: '/patroltasks/task-todo/getTaskToDoListByStation',
      method: 'get',
      params: params
    });
  }
  //根据任务执行情况ID查询点位查询(所有)
  export function DeviceById(params: any) {
    return request({
      url: '/patroltasks/task-todo/getTaskDeviceList',
      method: 'get',
      params: params
    });
  }
  //检测边缘节点是否在线
  export function stationOnline(params: any) {
    return request({
      url: '/basedata/substation/getStationOnline',
      method: 'get',
      params: params
    });
  }
  //边缘节点-同步
  export function sendMsgOfS(params: any) {
    return request({
      url: '/stationnode/sendMsgOfSyncBaseData',
      method: 'post',
      params: params
    });
  }
  //获取机器人，无人机
  export function getRobotList(params: any) {
    return request({
      url: '/basedata/substation-patroldevice/getRobotList',
      method: 'get',
      params: params
    });
  }
  //获取历史点位
  export function getHistoryDevice(params: any) {
    return request({
      url: '/patroltasks/task-todo/getHistoryDevice',
      method: 'get',
      params: params
    });
  }