import request from '@/router/axios';

// 获取数据
export function fetchList(query) {
  return request({
    url: ' /admin/plan/page',
    method: 'get',
    params: query
  });
}
// 导出报告
export function planInfoExport(query) {
  return request({
    url: ' /admin/plan/info/export',
    method: 'get',
    responseType: 'arraybuffer',
    params: query
  });
}

// 导出详情报告
export function plandetailsExport(query) {
  return request({
    url: ' /admin/plan/details/export',
    method: 'get',
    responseType: 'arraybuffer',
    params: query
  });
}

// 获取数据
export function createListApi(data) {
  return request({
    url: ' /admin/plan/create',
    method: 'post',
    data
  });
}
// 审核数据
export function planCheckApi(data) {
  return request({
    url: '/admin/plan/check',
    method: 'post',
    data
  });
}

// 创建计划详情
export function planDetailCreateApi(data) {
  return request({
    url: ' /admin/plan/details/create',
    method: 'post',
    data
  });
}

// 获取计划详情
export function getPlanDetailsApi(id) {
  return request({
    url: `/admin/plan/details/${id}`,
    method: 'get'
  });
}

// 审核计划详情
export function checkPlanDetailsApi(data) {
  return request({
    url: `/admin/plan/details/check`,
    method: 'post',
    data
  });
}

// 获取通过的计划包
export function getPlanListApi(type, pkgId) {
  return request({
    url: `/admin/plan/list`,
    method: 'get',
    params: {
      planType: type,
      pkgId: pkgId
    }
  });
}

// 批量审核
export function planCheckBatchApi(data) {
  return request({
    url: `/admin/plan/check/batch`,
    method: 'post',
    data
  });
}

export function planUpdateApi(data) {
  return request({
    url: `/admin/plan/update`,
    method: 'post',
    data
  });
}

export function getListDescendantApi() {
  return request({
    url: `/admin/dept/list/descendant`,
    method: 'get'
  });
}

export function archivePlanApi(data) {
  return request({
    url: `/admin/archive/plan`,
    method: 'post',
    data
  });
}
