import { get, post, deletes, put, uget } from '@/http/index'

// 查询设备标准列表
export const listDeviceStandard = async (data) => {
  return await get('/system/deviceStandard/list', data)
}

// 查询设备标准详细
export const getDeviceStandard = async (data) => {
  return await uget('/system/deviceStandard/', data)
}

// 新增设备标准
export const addDeviceStandard = async (formData) => {
  return await post('/system/deviceStandard', formData)
}

// 修改设备标准
export const updateDeviceStandard = async (data) => {
  return await put('/system/deviceStandard', data)
}

// 删除设备标准
export const delDeviceStandard = async (deviceStandardId) => {
  return await deletes('/system/deviceStandard/', deviceStandardId)
}

// 导出设备标准
export const exportDeviceStandard = async (formData) => {
  return await post('/system/deviceStandard/export', formData)
}

// 查询根据设备型号id查询设备标准
export const queryDeviceStandardsByDeviceModelId = async (data) => {
  return await uget('/system/deviceStandard/queryDeviceStandardsByDeviceModelId/', data)
}

// 查询器材标准列表
export const listMaterialStandard = async (data) => {
  return await get('/system/materialStandard/list', data)
}

// // 查询器材标准详细
export const getMaterialStandard = async (data) => {
  return await uget('/system/materialStandard/', data)
}

// 新增器材标准
export const addMaterialStandard = async (formData) => {
  return await post('/system/materialStandard', formData)
}

// 修改器材标准
export const updateMaterialStandard = async (data) => {
  return await put('/system/materialStandard', data)
}

// 删除器材标准
export const delMaterialStandard = async (materialStandardId) => {
  return await deletes('/system/materialStandard/', materialStandardId)
}

// 新增器材标准
export const exportMaterialStandard = async (formData) => {
  return await post('/system/materialStandard/export', formData)
}

// 查询根据装备型号id查询器材标准
export const queryMaterialStandardsByEquipmentModelId = async (data) => {
  return await get('/system/materialStandard/list', data)
}

// /system/deviceStandard/list
export const searchSheBeiTable = async (data) => {
  return await get('/system/deviceStandard/list', data)
}

// 下载模板，1001：器材标准，1002：设备标准
export function downLoadTemplate(type) {
  if (type == 1001) {
    window.open(process.env.VUE_APP_BASE_API + '/system/materialStandard/downLoadFile')
  } else if (type == 1002) {
    window.open(process.env.VUE_APP_BASE_API + '/system/deviceStandard/downLoadFile')
  }
}
