/**
 * 基础管理接口
 */
import request from '@/utils/request'
import qs from 'qs'
import Vue from 'vue'
// 测试用
export function deviceConfigLog(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'deviceConfigLog/listPage',
    method: 'get',
    params
  })
}

// 路灯类型查询
export function getLampType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLamptype/listPage',
    method: 'get',
    params
  })
}
// 不分页查询所有路灯类型
export function getAllLampType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLamptype/list',
    method: 'get',
    params
  })
}
// 删除路灯类型
export function delLampType(ids) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLamptype/batchDelete',
    method: 'post',
    params: {
      busBaseLamptypeIds: ids
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 添加路灯类型
export function addLampType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLamptype/add',
    method: 'post',
    params
  })
}
// 编辑路灯类型
export function updateLampType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLamptype/update',
    method: 'post',
    params
  })
}

export function getLampboxType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLampboxtype/listPage',
    method: 'get',
    params
  })
}

export function getAllLampboxType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLampboxtype/list',
    method: 'get',
    params
  })
}

export function delLampboxType(ids) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLampboxtype/batchDelete',
    method: 'post',
    params: {
      lampboxtypeIds: ids
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}

export function addLampboxType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLampboxtype/add',
    method: 'post',
    params
  })
}

export function updateLampboxType(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'busBaseLampboxtype/update',
    method: 'post',
    params
  })
}
// 设备下发
export function toDevice(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'deviceConfigLog/config',
    method: 'post',
    params: {
      devcodeList: params
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}

// 全部设备下发
export function toDeviceAll(params) {
  const basetConfig = Vue.prototype.baseConfig // 注意该行应放在export里面，否则获取不到值
  const lampPath = basetConfig.lampBasePath
  return request({
    url: lampPath + 'deviceConfigLog/configAll',
    method: 'post',
    params: {
      devcodeList: params
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}

