/* * Author: 黎永顺 * name: 个税申报-异常、失败详情 * Description: * Date: 2023/8/18 */ import React, { Component } from "react"; import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaReqTop, WeaTable } from "ecCom"; import { Button, Col, Row } from "antd"; import { taxdeclarationEmployeeList4Fail, taxdeclarationEmployeeList4NotDeclare, taxdeclarationEmployeeList4NoValue } from "../../../apis/declare"; import { convertToUrlString, getQueryString } from "../../../util/url"; const { getLabel } = WeaLocaleProvider; const APIFox = { list4NotDeclare: taxdeclarationEmployeeList4NotDeclare, list4NoValue: taxdeclarationEmployeeList4NoValue, list4Fail: taxdeclarationEmployeeList4Fail }; class DeclareResultDialog extends Component { constructor(props) { super(props); this.state = { keyword: "", selectedKey: "", pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, columns: [], dataSource: [] }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { const { type } = nextProps; this.setState({ selectedKey: _.head(type).key }, () => this.queryList()); } } queryList = () => { const taxDeclareRecordId = getQueryString("id"); const { keyword, pageInfo, selectedKey } = this.state; const payload = { ...pageInfo, keyword, taxDeclareRecordId }; this.setState({ loading: true }); APIFox[selectedKey](payload).then(({ status, data }) => { this.setState({ loading: false }); if (status) { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; this.setState({ dataSource, pageInfo: { ...pageInfo, current, pageSize, total }, columns }); } else { } }).catch(() => this.setState({ loading: false })); }; errorExport = () => { let exportUrl = ""; const { selectedKey, keyword } = this.state; const payload = { taxDeclareRecordId: getQueryString("id"), keyword }; if (selectedKey === "list4NotDeclare") { exportUrl = "/api/bs/hrmsalary/taxdeclaration/employee/export4NotDeclare"; } else if (selectedKey === "list4NoValue") { exportUrl = "/api/bs/hrmsalary/taxdeclaration/employee/export4NoValue"; } window.open(`${window.ecologyContentPath || ""}${exportUrl}?${convertToUrlString(payload)}`, "_blank"); }; failExport = () => { const payload = { taxDeclareRecordId: getQueryString("id") }; window.open(`${window.ecologyContentPath || ""}/api/bs/hrmsalary/taxdeclaration/employee/export4Fail?${convertToUrlString(payload)}`, "_blank"); }; render() { const { type } = this.props; const { loading, columns, dataSource, pageInfo, selectedKey, keyword } = this.state; const pagination = { ...pageInfo, showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, showQuickJumper: true, showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange: (current, pageSize) => { this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.queryList()); }, onChange: current => { this.setState({ pageInfo: { ...pageInfo, current } }, () => this.queryList()); } }; return ( {this.props.title} ) : {getLabel(17416, "导出")} ]} onChange={key => this.setState({ selectedKey: key }, () => this.queryList())} /> } style={{ width: 1150, height: 606.6, minHeight: 200, minWidth: 380, maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" }} >
{ type.length !== 1 && < div className="declareNoSearchBox"> this.setState({ keyword: val })} onSearch={this.queryList} />
}
); } } export default DeclareResultDialog;