feature/2.10.1.2402.01-个税-个税申报线下对比添加导出功能以及缓存对比项目的功能开发
This commit is contained in:
parent
4ebcb8a066
commit
b57a95979d
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
<WeaTop title={getLabel(111, "在线对比")} icon={<i className="icon-coms-fa"/>}
|
||||
iconBgcolor="#F14A2D" buttonSpace={10} showDropIcon={false}
|
||||
buttons={[
|
||||
<Dropdown.Button type="primary"
|
||||
overlay={<Menu onClick={this.handleCompareOpts}>
|
||||
<Menu.Item key="exportContrast">{getLabel(81272, "导出全部")}</Menu.Item>
|
||||
</Menu>}>
|
||||
{getLabel(111, "项目筛选")}
|
||||
</Dropdown.Button>,
|
||||
<WeaCheckbox content={getLabel(543283, "只显示有差异的人员")} value={onlyShowDiffEmp ? 1 : 0}
|
||||
onChange={v => this.handleDiffChange("onlyShowDiffEmp", v)}
|
||||
/>,
|
||||
|
|
@ -103,9 +124,9 @@ class Index extends Component {
|
|||
]}
|
||||
>
|
||||
<WeaTable rowKey="id" dataSource={dataSource} pagination={pagination} bordered
|
||||
loading={loading} scroll={{ x: 1200, y: `calc(100vh - 170px)` }}
|
||||
className="online-comparison-table"
|
||||
scroll={{ x: 1200, y: `calc(100vh - 170px)` }} className="online-comparison-table"
|
||||
columns={[
|
||||
{ dataIndex: getLabel(1933, "工号"), title: getLabel(1933, "工号"), width: 100 },
|
||||
{ dataIndex: getLabel(25034, "姓名"), title: getLabel(25034, "姓名"), width: 150 },
|
||||
{ dataIndex: getLabel(23787, "证件类型"), title: getLabel(23787, "证件类型"), width: 150 },
|
||||
{ dataIndex: getLabel(1839, "证件号码"), title: getLabel(1839, "证件号码"), width: 180 },
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { WeaLoadingGlobal } from "ecCom";
|
||||
|
||||
const server = window.server || "";
|
||||
export const formHeaderPost = (url, method, params, header) => {
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue