import { WeaTools } from "ecCom";
import { postFetch } from "../util/request";

//数据采集-累计专项附加扣除列表
export const getCumDeductList = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/list", params);
};

//数据采集-累计专项附加扣除列表的高级搜索
export const getCumDeductSaCondition = (params) => {
  return WeaTools.callApi("/api/bs/hrmsalary/addUpDeduction/getSearchCondition", "get", params);
};

//数据采集-累计专项附加扣除-导出
export const exportCumDeductList = (ids = "") => {
  fetch("/api/bs/hrmsalary/addUpDeduction/export?ids=" + ids).then((res) =>
    res.blob().then((blob) => {
      var filename = `累计专项附加扣除.xlsx`;
      var a = document.createElement("a");
      var url = window.URL.createObjectURL(blob);
      a.href = url;
      a.download = filename;
      a.click();
      window.URL.revokeObjectURL(url);
    })
  );
};

//数据采集-获取累计专项附加扣除记录
export const getCumDeductDetailList = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/getDetailList", params);
};

//数据采集-累计专项附加扣除-导出明细
export const exportCumDeductDetailList = (id, ids = "") => {
  fetch(
    "/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=" +
    id +
    "&ids=" +
    ids + "&taxAgentId=" + taxAgentId
  ).then((res) =>
    res.blob().then((blob) => {
      var filename = `累计专项附加扣除.xlsx`;
      var a = document.createElement("a");
      var url = window.URL.createObjectURL(blob);
      a.href = url;
      a.download = filename;
      a.click();
      window.URL.revokeObjectURL(url);
    })
  );
};

// 数据采集-获取累计专项附加扣除-导入
export const importCumDeductParam = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/importAddUpDeduction", params);
};

// 数据采集-获取累计专项附加扣除-导入预览
export const importCumDeductPreview = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/preview", params);
};

//新增累计专项附加扣除
export const createAddUpDeduction = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/createAddUpDeduction", params);
};
//查看信息
export const getAddUpDeduction = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/getAddUpDeduction", params);
};
//编辑累计专项附加扣除
export const editAddUpDeduction = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/editAddUpDeduction", params);
};
//批量删除累计专项附加扣除
export const deleteSelectAddUpDeduction = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/deleteSelectAddUpDeduction", params);
};
//一键清空累计专项附加扣除
export const deleteAllAddUpDeduction = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/deleteAllAddUpDeduction", params);
};
//一键累计
export const autoAddAll = (params) => {
  return postFetch("/api/bs/hrmsalary/addUpDeduction/autoAddAll", params);
};

//数据采集列表查询
export const getTableDate = ({ url, ...params }) => {
  return postFetch(url, params);
};
//数据采集列表详情记录查询
export const getTableRecordDate = ({ url, ...params }) => {
  return postFetch(url, params);
};

