salary-management-front/pc4mobx/hrmSalary/pages/salary/components/taxFillingInfoDialog.js

100 lines
3.2 KiB
JavaScript

/*
* Author: 黎永顺
* name: 个税申报-异常、失败详情
* Description:
* Date: 2023/8/18
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider, WeaTable } from "ecCom";
import { Button } from "antd";
import { taxFillColumns, taxFillCondition } from "./constants";
import { getSearchs } from "../../../util";
const { getLabel } = WeaLocaleProvider;
@inject("taxAgentStore")
@observer
class TaxFilingInfoDialofg extends Component {
constructor(props) {
super(props);
this.state = {
selectedRowKeys: []
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (!_.isEmpty(nextProps.taxAgentTaxReturnCheckFormDTO) &&
Object.prototype.toString.call(nextProps.taxAgentTaxReturnCheckFormDTO) === "[object Object]"
) {
const { taxAgentTaxReturnCheckFormDTO, taxAgentStore: { taxfillInfoForm } } = nextProps;
taxfillInfoForm.initFormFields(taxFillCondition);
const fields = _.map(taxFillCondition[0].items, it => {
return it.domkey[0];
});
fields.map(item => {
taxfillInfoForm.updateFields({
[item]: taxAgentTaxReturnCheckFormDTO[item] || ""
});
});
}
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
const { taxAgentStore: { setTaxfillInfoForm } } = nextProps;
setTaxfillInfoForm();
}
}
render() {
const { selectedRowKeys } = this.state;
const { taxAgentStore: { taxfillInfoForm }, taxAgentTaxReturnCheckFormDTO, loading } = this.props;
const rowSelection = {
type: "radio",
selectedRowKeys,
onChange: selectedRowKeys => this.setState({ selectedRowKeys })
};
return (
<WeaDialog
{...this.props}
hasScroll className="taxfillingDialog" initLoadCss
buttons={
Object.prototype.toString.call(taxAgentTaxReturnCheckFormDTO) === "[object Object]" ?
[
<Button type="primary" onClick={this.props.onCancel}>{getLabel(545147, "知道了")}</Button>
] : [
<Button loading={loading} type="primary"
onClick={() => !_.isEmpty(selectedRowKeys) && this.props.onSubmit(selectedRowKeys[0])}>{getLabel(725, "提交")}</Button>
]
}
style={{
width: 850,
height: 480,
minHeight: 200,
minWidth: 380,
maxHeight: "50%",
maxWidth: "50%",
overflow: "hidden",
transform: "translate(0px, 0px)"
}}
>
<div className="taxfillingDialogContent">
{
Object.prototype.toString.call(taxAgentTaxReturnCheckFormDTO) === "[object Object]" ?
getSearchs(taxfillInfoForm, taxFillCondition, 1) :
<WeaTable
rowKey="index" dataSource={taxAgentTaxReturnCheckFormDTO}
columns={_.map(taxFillColumns, o => ({
dataIndex: o.dataIndex,
width: 200,
title: getLabel(o.titleId, o.title)
}))}
scroll={{ x: 1200 }} rowSelection={rowSelection}
/>
}
</div>
</WeaDialog>
);
}
}
export default TaxFilingInfoDialofg;