import request from "@/Utils/requestUtils.js";
import $api from "@/Apis/api";
// 人效中心接口
export const personEfficiencyCenterService = {
  // 任务人效 start
  taskEfficiencyPageList: (data) => {
    return request.post(
      $api.personEfficiencyCenter.taskStatistics.taskEfficiencyPageList,
      data
    );
  },
  taskEfficiencyStatistics: (data) => {
    return request.post(
      $api.personEfficiencyCenter.taskStatistics.taskEfficiencyStatistics,
      data
    );
  },
  taskEfficiencyExport: (data) => {
    return request
      .post(
        $api.personEfficiencyCenter.taskStatistics.taskEfficiencyExport,
        data,
        {
          responseType: "blob",
        }
      )
      .then((res) => {
        request.download("任务人效统计", res);
      });
  },
  // 任务人效 end

  // 人员人效 start
  userEfficiencyPageList: (data) => {
    return request.post(
      $api.personEfficiencyCenter.personStatistics.userEfficiencyPageList,
      data
    );
  },
  setUserEfficiencyReport: (data) => {
    return request.post(
      $api.personEfficiencyCenter.personStatistics.setUserEfficiencyReport,
      data
    );
  },
  userEfficiencyExport: (data) => {
    return request
      .post(
        $api.personEfficiencyCenter.personStatistics.userEfficiencyExport,
        data,
        {
          responseType: "blob",
        }
      )
      .then((res) => {
        request.download("人员人效统计", res);
      });
  },
  // 人员人效 end

  // 站点人效 start
  districtEfficiencyList: (data) => {
    return request.post(
      $api.personEfficiencyCenter.districtStatistics.districtEfficiencyList,
      data
    );
  },
  districtEfficiencyExport: (data) => {
    return request
      .post(
        $api.personEfficiencyCenter.districtStatistics.districtEfficiencyExport,
        data,
        {
          responseType: "blob",
        }
      )
      .then((res) => {
        request.download("站点人效统计", res);
      });
  },
  // 站点人效 end

  // 人效报表 start
  efficiencyRecordingPageList: (data) => {
    return request.post(
      $api.personEfficiencyCenter.efficiencyStatement
        .efficiencyRecordingPageList,
      data
    );
  },
  efficiencyRecordingExport: (data) => {
    return request
      .post(
        $api.personEfficiencyCenter.efficiencyStatement
          .efficiencyRecordingExport,
        data,
        {
          responseType: "blob",
        }
      )
      .then((res) => {
        request.download("人效报表", res);
      });
  },
  efficiencyDetailList: (data) => {
    return request.post(
      $api.personEfficiencyCenter.efficiencyStatement.efficiencyDetailList,
      data
    );
  },
  setEfficiencyDetailPoint: (data) => {
    return request.post(
      $api.personEfficiencyCenter.efficiencyStatement.setEfficiencyDetailPoint,
      data
    );
  },
  efficiencyDetailExport: (data) => {
    return request
      .post(
        $api.personEfficiencyCenter.efficiencyStatement
          .efficiencyDetailExport,
        data,
        {
          responseType: "blob",
        }
      )
      .then((res) => {
        request.download("人效报表详情", res);
      });
  },
};
