import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/busDevice',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/busDevice/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/busDevice',
    method: 'put',
    data
  })
}

export function getQrCode(id) {
  return request({
    url: 'api/busDevice/getQrCode?id=' + id,
    method: 'get'
  })
}

export function getDeviceTree(pid) {
  return request({
    url: 'api/busDevice/getDeviceTree?pid=' + pid,
    method: 'get'
  })
}

export function getChild(id) {
  return request({
    url: 'api/busDevice/child?id=' + id,
    method: 'get'
  })
}

export default { add, edit, del, getDeviceTree }
