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

//个税申报表-个税申报表列表
export const getDeclareList = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/list", params);
};

//个税申报表-个税申报表生成
export const saveDeclare = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/save", params);
};
//个税申报表-个税申报表批量生成
export const batSaveDeclare = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/batSave", params);
};

//个税申报表-个税申报表相关信息
export const getDeclareInfo = params => {
  return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/getTaxDeclarationInfo", "get", params);
};

// 个税申报表详情列表
export const getDetailList = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/detail/list", params);
};

// 个税申报表导出
export const exportSalaryArchive = (id = "") => {
  fetch("/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=" + id).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 withDrawTaxDeclaration = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/withDrawTaxDeclaration", params);
};


