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

// 查询左边的树 searchLeftTree
export const searchLeftTree = async (data) => {
  return await get('/system/equipmentProfession/querySelfEquipmentProfession', data)
}

// 导出装备现有使用情况
export const exportStrength = async (type, ids) => {
  return await post('/system/' + type + '/export', ids)
}

//  查表
export const queryListEquipment = async (data) => {
  return await parmasPost('/CurrentUseOfMaterialsController/listEquipment', data)
}

//   新增点击型号查数据 system/equipmentModel/getInfoById
export const addqueryTable = async (data) => {
  return await parmasPost('/system/equipmentModel/getInfoById', data)
}

//   新增保存 system/equipmentStrength/add
export const addSave = async (data) => {
  return await post('/system/equipmentStrength/add', data)
}

// 编辑数据回显 system/equipmentStrength/getInfoById
export const queryItemDetil = async (data) => {
  return await parmasPost('/system/equipmentStrength/getInfoById', data)
}

// 删除接口  system/equipmentStrength/delete
export const deleteItem = async (data) => {
  return await parmasPost('/system/equipmentStrength/delete', data)
}

// 编辑保存
export const updateItem = async (data) => {
  return await post('/system/equipmentStrength/edit', data)
}

// 关联装备弹框
export const showGlzb = async (data) => {
  return await parmasPost('/system/equipmentStrength/queryAssociatedEquipment', data)
}

// 维修记录
export const showWxjl = async (data) => {
  return await parmasPost('/system/equipmentStrength/queryMaintenanceRecordByEquipmentModelId', data)
}

// 新增查标志码
export const addqueryTableQicai = async (data) => {
  return await parmasPost('/system/materialModel/getInfoById', data)
}

// ------------------------------------器材---------------------------------------------------

// 器材新增
export const qiCaiAdd = async (data) => {
  return await post('/system/materialStrength/add', data)
}

//   编辑数据回显 system/equipmentStrength/getInfoById
export const queryItemDetilQicai = async (data) => {
  return await parmasPost('/system/materialStrength/getInfoById', data)
}

// 器材删除
export const deleteItemQicai = async (data) => {
  return await parmasPost('/system/materialStrength/delete', data)
}

// 器材编辑保存
export const updateItemQicai = async (data) => {
  return await post('/system/materialStrength/edit', data)
}

// 器材查消耗记录
export const showXhjl = async (data) => {
  return await get('/system/materialConsume/list', data)
}

// 消耗记录新增确认
export const addXhjl = async (data) => {
  return await post('/system/materialConsume/add', data)
}

// 器材消耗记录删除
export const deleteItemQiCaiXhjl = async (data) => {
  return await parmasPost('/system/materialConsume/delete', data)
}
// 查表(器材)
export const queryListMaterial = async (data) => {
  return await parmasPost('/CurrentUseOfMaterialsController/listMaterial', data)
}

// --------------------------------------------------------------设备-----------------------------------------------------
// 查表--设备
export const queryListDevice = async (data) => {
  return await parmasPost('/CurrentUseOfMaterialsController/listDevice', data)
}

// 新增查标志码
export const addqueryTableSheBei = async (data) => {
  return await parmasPost('/system/deviceModel/getInfoById', data)
}

// 器材新增
export const SheBeiAdd = async (data) => {
  return await post('/system/deviceStrength/add', data)
}

//   编辑数据回显 system/equipmentStrength/getInfoById
export const queryItemDetilSheBei = async (data) => {
  return await parmasPost('/system/deviceStrength/getInfoById', data)
}

// 器材删除
export const deleteItemSheBei = async (data) => {
  return await parmasPost('/system/deviceStrength/delete', data)
}

// 器材编辑保存
export const updateItemSheBei = async (data) => {
  return await post('/system/deviceStrength/edit', data)
}

//设备查消耗记录
export const showXhjlSheBei = async (data) => {
  return await get('/system/deviceConsume/list', data)
}

// 设备记录新增确认
export const addXhjlSheBei = async (data) => {
  return await post('/system/deviceConsume/add', data)
}
// 下载装备现有使用情况模板
export function downLoadTemplate(type) {
  // window.open(process.env.VUE_APP_BASE_API + '/system/' + type + '/downLoadFile')
  window.location.href = process.env.VUE_APP_BASE_API + '/system/' + type + '/downLoadFile'
}
