import request from '@/utils/request'

// 查询能源设备部件列表
export function listComponent(query) {
  return request({
    url: '/ems/device/component/list',
    method: 'get',
    params: query
  })
}

// 根据设备code查询设备下的部件
export function listByDevice(deviceCode) {
  return request({
    url: '/ems/device/component/listByDevice?deviceCode=' + deviceCode,
    method: 'get',
  })
}

// 查询能源设备部件详细
export function getComponent(id) {
  return request({
    url: '/ems/device/component/' + id,
    method: 'get'
  })
}


// 新增能源设备部件
export function addComponent(data) {
  return request({
    url: '/ems/device/component',
    method: 'post',
    data: data
  })
}

// 修改能源设备部件
export function updateComponent(data) {
  return request({
    url: '/ems/device/component',
    method: 'put',
    data: data
  })
}

// 删除能源设备部件
export function delComponent(id) {
  return request({
    url: '/ems/device/component/' + id,
    method: 'delete'
  })
}
