import request from '@/utils/request'

// 查询设备列列表
export function listAlarmPreview(query) {
  return request({
    url: '/database_op/query_com_alarm_overview_condition.cgi',
    method: 'get',
    params: query
  })
}

// 查询设备列详细
export function getAlarm(id) {
  return request({
    url: '/database_op/query_com_alarm_overview_mainkey.cgi',
    method: 'get',
    params: {
      alarm_overview_id: id
    }
  })
}

// export function getCamera(id) {
//   return request({
//     headers: {
//       'Content-Type': 'application/x-www-form-urlencoded'
//     },
//     url: '/database_op/query_com_camera.cgi',
//     method: 'post',
//     data: JSON.stringify({
//       camera_id: id
//     }),
//     transformRequest: [function (data) {
//       let ret = ''
//       for (let it in data) {
//         ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it])
//       }
//       return `camera_id=${id}`
//     }]
//   })
// }

// 新增设备列
export function addAlarm(data) {
  return request({
    url: '/database_op/insert_com_alarm_overview.cgi.cgi',
    method: 'post',
    data: data
  })
}

// 修改设备列
export function updateAlarm(data) {
  return request({
    url: '/database_op/update_com_alarm_overview.cgi',
    method: 'post',
    data: data
  })
}

// 删除设备列
export function delAlarm(id) {
  return request({
    url: '/database_op/delete_com_alarm_overview.cgi',
    method: 'post',
    data: {
      alarm_overview_id: id
    }
  })
}

// 导出设备列
export function exportCamera(query) {
  return request({
    url: '/database_op/camera/camera/export',
    method: 'get',
    params: query
  })
}


export function downloadCamera() {

}