/**
 * 设备规格型号管理相关
 */
import request from '@/api/index'

// 列表
export function getModelList(params: any) {
  return request({
    url: `/equipment/model/listPage?limit=${params.limit}&offset=${params.offset}`,
    method: 'post',
    data: params,
  })
}
// 列表-不分页
export function getModelAllList(params: any) {
  return request({
    url: '/equipment/model/list',
    method: 'post',
    data: params,
  })
}
// 获取设备规格
export function getModelByname(params: any) {
  return request({
    url: '/equipment/model/listModel',
    method: 'get',
    params,
  })
}
// 设备名称列表/equipment/model/listEquipmentName
export function getDeviceNameList() {
  return request({
    url: '/equipment/model/listEquipmentName',
    method: 'get',
  })
}
// 导出
export function exportModelList(data: any) {
  return request({
    url: '/equipment/model/export',
    method: 'post',
    data,
    responseType: 'blob',
  })
}
// 新建或编辑
export function handlerFunApi(type: string, data: any) {
  if (type === 'create') {
    return request({
      url: '/equipment/model/add',
      method: 'post',
      data,
    })
  }
  else if (type === 'update') {
    return request({
      url: '/equipment/model/update',
      method: 'post',
      data,
    })
  }
}
// 删除
export function deleteModel(data: any) {
  return request({
    url: `/equipment/model/delete?id=${data.id}`,
    method: 'post',
  })
}
