import req from '@/request.js'
const portal = window.context.portal

//可视化分析-训练对象汇总
export async function trainObject() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/trainObject`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
// 可视化分析-训练保障汇总
export async function trainSafeguard() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/trainSafeguard`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
// 可视化分析-装备资源基础饼状图
export async function equipmentBasePancake() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/equipmentBasePancake`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
// 可视化分析-训练消耗指标饼状图
export async function indexDataPancake() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/indexDataPancake`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
// 可视化分析-训练场地饼状图
export async function spacePancake() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/spacePancake`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
// 可视化分析-训练器材饼状图
export async function trainEquipmentPancake() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/trainEquipmentPancake`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
// 可视化分析-训练计划完成情况柱状图
export async function trainPlanStylolitic() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/trainPlanStylolitic`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}

//可视化分析-各单位年度训练计划完成情况柱状图
export async function orgYearTrainPlan() {
  return new Promise((resolve, reject) => {
    req
      .post(portal + `/exam/statistical/orgYearTrainPlan`)
      .then(res => resolve(res?.data || {}))
      .catch(err => reject(err))
  })
}
