import request from '@/utils/request';
//获取所有变电站
export function getTreefirst() {
  return request({
    url: '/basedata/substation/getSubstationList',
    method: 'get',
  });
}
//获取变电站信息
export function getTreelist(params: any) {
  return request({
    url: '/basedata/substation/getSubstationTree',
    method: 'get',
    params: params
  });
}
//获取table表格
export function getdevicedata(params: any) {
  return request({
    url: '/basedata/substation-device/getSubstationDeviceList',
    method: 'post',
    data: params
  });
}
//获取所属主设备select
export function getMainEquipment(params: any) {
  return request({
    url: '/basedata/substation-maindevice/getMainDevice',
    method: 'get',
    params: params
  });
}
//获取主设备类型
export function getMainType(params: any) {
  return request({
    url: '/basedata/substation-maindevice/getMainDeviceType',
    method: 'get',
    params: params
  });
}
//主设备下所属部件
export function getaccType(params: any) {
  return request({
    url: '/basedata/substation-maindevice/getComponent',
    method: 'get',
    params: params
  });
}
//间隔下所属部件
export function getBayType(params: any) {
  return request({
    url: '/basedata/substation-maindevice/getComponentByBay',
    method: 'get',
    params: params
  });
}
//新增点位
export function addPosition(params: any) {
  return request({
    url: '/basedata/substation-device/addSubstationDevice',
    method: 'post',
    data: params
  });
}
//改变状态
export function changeStatus(params: any) {
  return request({
    url: '/basedata/substation-device/setSubstationDeviceStatus',
    method: 'post',
    params: params
  });
}
//修改点位
export function editPosition(params: any) {
  return request({
    url: '/basedata/substation-device/updateSubstationDeviceById',
    method: 'post',
    data: params
  });
}
//删除
export function delPosition(params: any) {
  return request({
    url: '/basedata/substation-device/deleteSubstationDeviceById',
    method: 'post',
    params: params
  });
}
//获取摄像头
export function GetCamera(params: any) {
  return request({
    url: '/basedata/substation-patroldevice/getCameraList',
    method: 'get',
    params: params
  });
}
//获取摄像头状态
export function getPatrolDeviceStatus(params: any) {
  return request({
    url: '/basedata/substation-patroldevice/getPatrolDeviceStatus',
    method: 'get',
    params: params
  });
}
//查询关联摄像头
export function getCameraId(params: any) {
  return request({
    url: '/basedata/substation-device/getCameraById',
    method: 'get',
    params: params
  });
}
//导入文件
export function uploadfile(data: any) {
  return request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: '/basedata/substation-device/saveImgTemplate',
    method: 'POST',
    data
  });
}
//查询关联摄像头
export function getDeviceByType(params: any) {
  return request({
    url: '/system/dictionaryItems/getDeviceByType',
    method: 'get',
    params: params
  });
}
export function getDictionaryItems(params: any) {
  return request({
    url: '/system/dictionaryItems/getDictionaryItems',
    method: 'get',
    params: params
  });
}
//根据条件获取部件(分页)
export function getComponentByBayPage(params: any) {
  return request({
    url: '/basedata/substation-maindevice/getComponentByBayPage',
    method: 'post',
    data: params

  });
}
//根据条件获取主设备(分页)
export function getMainDevicePage(params: any) {
  return request({
    url: '/basedata/substation-maindevice/getMainDevicePage',
    method: 'post',
    data: params

  });
}
// 保存模板图片
export function saveImgTemplate(params: any) {
  return request({
    url: '/basedata/substation-device/saveImgTemplate',
    method: 'post',
    params: params,
  });
}
//导入点位
export function uploadFile(data: any) {
  return request({
    url: '/basedata/substation-device/uploadFile',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    method: 'post',
    data: data,
   
  });
}
//导出点位
export function deviceDownloadFile(queryParams: any) {
  return request({
    url: '/basedata/substation-device/deviceDownloadFile',
    method: 'post',
    params: queryParams,
    responseType: 'arraybuffer'
  });
}
// 后台消息获取
export function getMessageCount(params: any) {
  return request({
    url: '/system/message/getMessageCount',
    method: 'get',
    params: params,
  });
}