/**
 * 设备管理接口
 */
import request from '@/utils/request'
import qs from 'qs'

// 设备查询
export function getDeviceImeiList(params) {
  return request({
    url: 'device/simManage/listPage',
    method: 'get',
    params
  })
}

// 添加设备
export function addDeviceImei(params) {
  return request({
    url: 'device/simManage/add',
    method: 'post',
    params
  })
}
// 修改设备
export function updateDeviceImei(params) {
  return request({
    url: 'device/simManage/update',
    method: 'post',
    params
  })
}
// 删除设备
export function delDeviceImei(ids) {
  return request({
    url: 'device/simManage/delete',
    method: 'post',
    params: {
      ids: ids
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 批量导入
export function batchImportDevice(fileobj) {
  const param = new FormData()
  param.append('file', fileobj)
  return request({
    url: 'device/simManage/batchImport',
    method: 'post',
    timeout: 240000,
    headers: { 'Content-Type': 'multipart/form-data' },
    data: param
  })
}
