import request from '@/utils/request'

// 查询监测设备列表
export function listDevice(query) {
  return request({
    url: '/center-monitor/device/list',
    method: 'get',
    params: query
  })
}
// 查询监测设备列表
export function listDeviceByDept(query) {
  return request({
    url: '/center-monitor/device/selectDeviceListByDeptIdAndWorkingStatus',
    method: 'get',
    params: query
  })
}

// 查询监测设备列表
export function listDeviceAll(query) {
  return request({
    url: '/center-monitor/device/listDeviceAll',
    method: 'get',
    params: query
  })
}

// 查询监测设备详细
export function getDevice(id) {
  return request({
    url: '/center-monitor/device/' + id,
    method: 'get'
  })
}

// 新增监测设备
export function addDevice(data) {
  return request({
    url: '/center-monitor/device',
    method: 'post',
    data: data
  })
}

// 修改监测设备
export function updateDevice(data) {
  return request({
    url: '/center-monitor/device',
    method: 'put',
    data: data
  })
}

// 删除监测设备
export function delDevice(id) {
  return request({
    url: '/center-monitor/device/' + id,
    method: 'delete'
  })
}

// 查询水流速监测设备列表
export function selectWaterVelocityMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectWaterVelocityMonitoringData',
    method: 'get',
    params: query
  })
}

// 查询水质监测设备列表
export function selectWaterQualityMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectWaterQualityMonitoringData',
    method: 'get',
    params: query
  })
}

// 查询大气监测设备列表
export function selectAtmosphereMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectAtmosphereMonitoringData',
    method: 'get',
    params: query
  })
}

// 查询土壤墒情监测设备列表
export function selectSoilMoistureMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectSoilMoistureMonitoringData',
    method: 'get',
    params: query
  })
}

// 查询水压监测设备列表
export function selectWaterPressureMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectWaterPressureMonitoringData',
    method: 'get',
    params: query
  })
}

// 查询病虫害监测设备列表
export function selectInsectPestsMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectInsectPestsMonitoringData',
    method: 'get',
    params: query
  })
}

// 查询部门列表
export function selectDeptMonitoringData(query) {
  return request({
    url: '/center-monitor/device/selectDeptMonitoringData',
    method: 'get',
    params: query
  })
}
// 查询水流速监测设备详细
export function getWaterVelocity(id) {
  return request({
    url: '/center-monitor/device/getWaterVelocity/' + id,
    method: 'get'
  })
}
// 查询土壤监测设备详细
export function getSoilMoisture(id) {
  return request({
    url: '/center-monitor/device/getSoilMoisture/' + id,
    method: 'get'
  })
}
// 查询水质监测设备详细
export function getWaterQuality(id) {
  return request({
    url: '/center-monitor/device/getWaterQuality/' + id,
    method: 'get'
  })
}
// 查询水压监测设备详细
export function getWaterPressure(id) {
  return request({
    url: '/center-monitor/device/getWaterPressure/' + id,
    method: 'get'
  })
}
// 查询大气监测设备详细
export function getAtmosphere(id) {
  return request({
    url: '/center-monitor/device/getAtmosphere/' + id,
    method: 'get'
  })
}

// 查询病虫害监测设备详细
export function getInsectPests(id) {
  return request({
    url: '/center-monitor/device/getInsectPests/' + id,
    method: 'get'
  })
}

// 根据设备编码查询水流度阈值
export function selectWaterVelocityThresholdByCode(code) {
  return request({
    url: '/center-monitor/threshold/selectWaterVelocityThresholdByCode/' + code,
    method: 'get'
  })
}

// 根据设备编码查询水流度阈值
export function addDeviceThreshold(data) {
  return request({
    url: '/center-monitor/threshold',
    method: 'post',
    data: data
  })
}

// 修改监测设备
export function updateDeviceThreshold(data) {
  return request({
    url: '/center-monitor/threshold',
    method: 'put',
    data: data
  })
}

// 根据设备编码查询大气阈值
export function selectAtmosphereThresholdByCode(code) {
  return request({
    url: '/center-monitor/atmosphereThreshold/selectAtmosphereThresholdByCode/' + code,
    method: 'get'
  })
}

// 新增大气阈值
export function addDeviceAtmosphereThreshold(data) {
  return request({
    url: '/center-monitor/atmosphereThreshold',
    method: 'post',
    data: data
  })
}

// 修改大气监测设备阈值
export function updateDeviceAtmosphereThreshold(data) {
  return request({
    url: '/center-monitor/atmosphereThreshold',
    method: 'put',
    data: data
  })
}

// 根据设备编码查询土壤阈值
export function selectSoilMoistureThresholdByCode(code) {
  return request({
    url: '/center-monitor/soilMoistureThreshold/selectSoilMoistureThresholdByCode/' + code,
    method: 'get'
  })
}

// 新增土壤阈值
export function addDeviceSoilMoistureThreshold(data) {
  return request({
    url: '/center-monitor/soilMoistureThreshold',
    method: 'post',
    data: data
  })
}

// 修改土壤监测设备阈值
export function updateDeviceSoilMoistureThreshold(data) {
  return request({
    url: '/center-monitor/soilMoistureThreshold',
    method: 'put',
    data: data
  })
}

// 根据设备编码查询水质阈值
export function selectWaterQualityThresholdByCode(code) {
  return request({
    url: '/center-monitor/waterQualityThreshold/selectWaterQualityThresholdByCode/' + code,
    method: 'get'
  })
}

// 新增水质阈值
export function addDeviceWaterQualityThreshold(data) {
  return request({
    url: '/center-monitor/waterQualityThreshold',
    method: 'post',
    data: data
  })
}

// 修改水质监测设备阈值
export function updateDeviceWaterQualityThreshold(data) {
  return request({
    url: '/center-monitor/waterQualityThreshold',
    method: 'put',
    data: data
  })
}

// 是否接开启告警功能
export function changeWarn(id, openWarn) {
  const data = {
    id,
    openWarn
  }
  return request({
    url: '/center-monitor/device/changeWarn',
    method: 'put',
    data: data
  })
}

// 是否接开启告警功能
export function SendWaterPressCommand(data) {
  return request({
    url: '/center-monitor/device/SendWaterPressCommand',
    method: 'post',
    data: data
  })
}


// 查询全部摄像头用于和检测设备一对多绑定
export function selectAllCameraList(data) {
  return request({
    url: '/center-monitor/camera/selectAllCameraList',
    method: 'get'
  })
}


