import request from '@/utils/request'

// 查询设备信息列表
export function listDevice(query) {
  return request({
    url: '/pms/device/list',
    method: 'get',
    params: query
  })
}

// 查询设备信息详细
export function getDevice(id) {
  return request({
    url: '/pms/device/' + id,
    method: 'get'
  })
}

// 新增设备信息
export function addDevice(data) {
  return request({
    url: '/pms/device',
    method: 'post',
    data: data
  })
}

// 修改设备信息
export function updateDevice(data) {
  return request({
    url: '/pms/device',
    method: 'put',
    data: data
  })
}

// 删除设备信息
export function delDevice(id) {
  return request({
    url: '/pms/device/' + id,
    method: 'delete'
  })
}
// 获取设备信息
export function selectDevicelnfo(query) {
  return request({
    url: '/pms/device/selectDeviceInfo',
    method: 'get',    
    params: query
  })
}


//生成设备报表
export function downloadDeviceReport(id) {
  return request({
    url: '/pms/statement/equipmentReport/'+ id,
    method: 'get',
  })
}

//下载设备报表
export function downloadDeviceReportFile(url) {
  return request({
    url: url,
    method: 'get',
  })
}



/**设备类型 **********************************************************/
// 查询DeviceType列表
export function listDeviceType(query) {
  return request({
    url: '/pms/DeviceType/list',
    method: 'get',
    params: query
  })
}

// 查询DeviceType详细
export function getDeviceType(code) {
  return request({
    url: '/pms/DeviceType/' + code,
    method: 'get'
  })
}
// 获取默认配置信息
export function getNamesByType(code) {
  return request({
    url: '/pms/DeviceType/getNamesByType/' + code,
    method: 'get'
  })
}

// 新增DeviceType
export function addDeviceType(data) {
  return request({
    url: '/pms/DeviceType',
    method: 'post',
    data: data
  })
}

// 修改DeviceType
export function updateDeviceType(data) {
  return request({
    url: '/pms/DeviceType',
    method: 'put',
    data: data
  })
}

// 删除DeviceType
export function delDeviceType(code) {
  return request({
    url: '/pms/DeviceType/' + code,
    method: 'delete'
  })
}



/*************************设备配置 **************************************/

// 查询设备配置列表
export function listDeviceConfig(query) {
  return request({
    url: '/pms/DeviceConfig/list',
    method: 'get',
    params: query
  })
}

// 查询设备配置详细
export function getDeviceConfig(code) {
  return request({
    url: '/pms/DeviceConfig/' + code,
    method: 'get'
  })
}

// 新增设备配置
export function addDeviceConfig(data) {
  return request({
    url: '/pms/DeviceConfig',
    method: 'post',
    data: data
  })
}

// 修改设备配置
export function updateDeviceConfig(data) {
  return request({
    url: '/pms/DeviceConfig',
    method: 'put',
    data: data
  })
}

// 删除设备配置
export function delDeviceConfig(code) {
  return request({
    url: '/pms/DeviceConfig/' + code,
    method: 'delete'
  })
}
