127 lines
4.1 KiB
JavaScript
127 lines
4.1 KiB
JavaScript
/*
|
|
* Author: 黎永顺
|
|
* name: 报税信息
|
|
* Description:
|
|
* Date: 2022/12/1
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { WeaBrowser, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSearchGroup, WeaSelect } from "ecCom";
|
|
import { fieldList } from "./constants";
|
|
import { taxReturnGetForm } from "../../../apis/taxAgent";
|
|
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
class TaxDeclarationInfo extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
fieldForm: {
|
|
name: "",
|
|
taxCode: "",
|
|
city: "",
|
|
areaCode: "",
|
|
passwordType: "TAX_NET_PASSWORD",
|
|
account: "",
|
|
realNamePassword: "",
|
|
netPassword: "",
|
|
registrationNo: "",
|
|
departmentCode: "",
|
|
taxInforVerifiyStatus: ""
|
|
},
|
|
fieldItem: []
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.setState({
|
|
fieldItem: _.filter(_.map(fieldList, item => ({
|
|
...item,
|
|
label: getLabel(item.lanId, item.label)
|
|
})), it => it.key !== "account" && it.key !== "realNamePassword")
|
|
}, () => {
|
|
this.taxReturnGetForm();
|
|
});
|
|
}
|
|
|
|
taxReturnGetForm = () => {
|
|
const { taxAgentId } = this.props;
|
|
taxReturnGetForm({ taxAgentId }).then(({ status, data }) => {
|
|
if (status) {
|
|
const { fieldForm } = this.state;
|
|
this.setState({
|
|
fieldForm: {
|
|
...fieldForm,
|
|
..._.reduce(_.keys(fieldForm), (pre, cur) => {
|
|
return { ...pre, [cur]: data[cur] };
|
|
}, {})
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
handleChangeValue = (key, value) => {
|
|
const { fieldForm } = this.state;
|
|
this.setState({
|
|
fieldForm: {
|
|
...fieldForm,
|
|
[key]: value
|
|
}
|
|
}, () => {
|
|
if (key === "passwordType" && this.state.fieldForm.passwordType === "REAL_NAME_PASSWORD") {
|
|
this.setState({
|
|
fieldItem: _.filter(fieldList, it => it.key !== "netPassword"),
|
|
fieldForm: { ...this.state.fieldForm, realNameAccount: "", realNameAccountPassword: "" }
|
|
});
|
|
} else if (key === "passwordType" && this.state.fieldForm.passwordType === "TAX_NET_PASSWORD") {
|
|
this.setState({
|
|
fieldItem: _.filter(fieldList, it => it.key !== "account" && it.key !== "realNamePassword"),
|
|
fieldForm: { ...this.state.fieldForm, taxOnlinePassword: "" }
|
|
});
|
|
}
|
|
});
|
|
};
|
|
|
|
render() {
|
|
const { fieldItem, fieldForm } = this.state;
|
|
return (
|
|
<div className="taxDeclarationInfoWrapper">
|
|
<WeaSearchGroup col={1} needTigger showGroup>
|
|
{
|
|
_.map(fieldItem, item => {
|
|
const { key, label, type, viewAttr, options = [] } = item;
|
|
return <WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 14 }} key={key}>
|
|
{
|
|
(type === "TEXT" || type === "PASSWORD") &&
|
|
<WeaInput autocomplete="off" value={fieldForm[key]} type={_.lowerCase(type)} viewAttr={viewAttr}
|
|
onChange={(v) => this.handleChangeValue(key, v)}/>
|
|
}
|
|
{
|
|
type === "SELECT" &&
|
|
<WeaBrowser value={fieldForm[key]} type={58} viewAttr={viewAttr}
|
|
onChange={(__, ___, datas) => {
|
|
if (!_.isEmpty(datas)) {
|
|
this.handleChangeValue(key, `1-${datas[0].pid}-${datas[0].id}`);
|
|
} else {
|
|
this.handleChangeValue(key, "");
|
|
}
|
|
}}
|
|
/>
|
|
}
|
|
{
|
|
type === "RADIO" &&
|
|
<WeaSelect detailtype={3} value={fieldForm[key]}
|
|
options={_.map(options, it => ({ ...it, showname: getLabel(it.lanId, it.showname) }))}
|
|
viewAttr={viewAttr}
|
|
onChange={(v) => this.handleChangeValue(key, v)}/>
|
|
}
|
|
</WeaFormItem>;
|
|
})
|
|
}
|
|
</WeaSearchGroup>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default TaxDeclarationInfo;
|