diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index 62a022d1..8c9a2a11 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -272,3 +272,6 @@ export const deleteInfo = (params) => { export const getTaxdeclarationContrastList = (params) => { return postFetch("/api/bs/hrmsalary/taxdeclaration/contrast", params); }; +export const exportContrast = params => { + return postExportFetch("/api/bs/hrmsalary/taxdeclaration/exportContrast", params); +}; diff --git a/pc4mobx/hrmSalary/pages/declareOnlineComparison/index.js b/pc4mobx/hrmSalary/pages/declareOnlineComparison/index.js index d765be50..c6394f04 100644 --- a/pc4mobx/hrmSalary/pages/declareOnlineComparison/index.js +++ b/pc4mobx/hrmSalary/pages/declareOnlineComparison/index.js @@ -5,8 +5,9 @@ * Date: 2024/1/22 */ import React, { Component } from "react"; -import { WeaCheckbox, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; -import { getTaxdeclarationContrastList } from "../../apis/declare"; +import { WeaCheckbox, WeaLoadingGlobal, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom"; +import { Dropdown, Menu } from "antd"; +import { exportContrast, getTaxdeclarationContrastList } from "../../apis/declare"; import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -15,7 +16,7 @@ class Index extends Component { constructor(props) { super(props); this.state = { - loading: false, dataSource: [], columns: [], + dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, queryParams: { onlyShowDiffEmp: true, onlyShowDiffItem: true } }; @@ -28,10 +29,10 @@ class Index extends Component { getTaxdeclarationContrastList = () => { const { pageInfo, queryParams } = this.state; const { params: { taxDeclarationId } } = this.props; - this.setState({ loading: true }); + WeaLoadingGlobal.start(); getTaxdeclarationContrastList({ taxDeclarationId, ...pageInfo, ...queryParams }) .then(({ status, data }) => { - this.setState({ loading: false }); + WeaLoadingGlobal.destroy(); if (status) { const { columns, pageInfo: result } = data; const { list: dataSource, pageNum: current, pageSize, total } = result; @@ -61,7 +62,7 @@ class Index extends Component { })) }); } - }).catch(() => this.setState({ loading: false })); + }).catch(() => WeaLoadingGlobal.destroy()); }; handleDiffChange = (key, value) => { const { queryParams } = this.state; @@ -69,9 +70,23 @@ class Index extends Component { queryParams: { ...queryParams, [key]: value === "1" } }, () => this.getTaxdeclarationContrastList()); }; + handleCompareOpts = async ({ key }) => { + const { params: { taxDeclarationId } } = this.props; + const { queryParams } = this.state; + switch (key) { + case "exportContrast": + WeaLoadingGlobal.start(); + const payload = { taxDeclarationId, ...queryParams }; + const promise = await exportContrast(payload); + WeaLoadingGlobal.destroy(); + break; + default: + break; + } + }; render() { - const { loading, columns, dataSource, pageInfo, queryParams } = this.state; + const { columns, dataSource, pageInfo, queryParams } = this.state; const { onlyShowDiffEmp, onlyShowDiffItem } = queryParams; const pagination = { ...pageInfo, @@ -94,6 +109,12 @@ class Index extends Component { } iconBgcolor="#F14A2D" buttonSpace={10} showDropIcon={false} buttons={[ + + {getLabel(81272, "导出全部")} + }> + {getLabel(111, "项目筛选")} + , this.handleDiffChange("onlyShowDiffEmp", v)} />, @@ -103,9 +124,9 @@ class Index extends Component { ]} > { if (typeof localStorage.access_token === "string" && localStorage.access_token !== "") { @@ -34,6 +36,7 @@ export const postExportFetch = (url, params) => { } url = server + url + "?__random__=" + (new Date()).valueOf(); return fetch(url, getFetchParams("POST", params)).then(res => { + WeaLoadingGlobal.destroy(); const filename = res.headers.get("Content-Disposition").split("filename=")[1]; res.blob().then(blob => { const url = window.URL.createObjectURL(blob);