feature/2.9.42310.02-社保福利档案页面重构

This commit is contained in:
黎永顺 2023-11-24 14:45:37 +08:00
parent c2f4c4372c
commit 7579a8cd31
2 changed files with 14 additions and 9 deletions

View File

@ -126,6 +126,7 @@ class Index extends Component {
});
}
};
handleExtraChange = (key, value) => this.setState({ formData: { ...this.state.formData, [key]: value } });
renderTitle = () => {
const { loading } = this.state;
return <div className="titleDialog">
@ -162,7 +163,7 @@ class Index extends Component {
top={0} width={800} height={100} measureT={"%"} measureX={"px"} measureY={"%"}
direction={"right"} title={this.renderTitle()} onClose={this.handleClose}
content={<div className="salary-welfare-archive-edit-area">
{getWelfareSearchsForm(welfareProfileForm, conditions, this.handleFormChange, formData, this.props)}
{getWelfareSearchsForm(welfareProfileForm, conditions, this.handleFormChange, this.handleExtraChange, formData, this.props)}
</div>}
/>
);

View File

@ -656,7 +656,7 @@ export const welfareConditions = [
]
}
];
export const getWelfareSearchsForm = (form, condition, onChange = () => void (0), payload, extraFormField) => {
export const getWelfareSearchsForm = (form, condition, onChange = () => void (0), onExtraChange = () => void (0), payload, extraFormField) => {
const CustomComponent = ({ type }) => {
const value = payload[type].nonPayment ? payload[type].nonPayment.toString() : "";
return <WeaCheckbox value={value} content={getLabel(543196, "暂不缴纳")}/>;
@ -690,18 +690,21 @@ export const getWelfareSearchsForm = (form, condition, onChange = () => void (0)
});
return _.reduce(group, (pre, cur) => {
if (cur.props.title === getLabel(543194, "社保基础信息") && _.every(socialBase.items, o => o.items.length > 0)) {
return [...pre, cur, <BenefitBaseComponent dataSource={socialBase.items} value={payload}/>];
return [...pre, cur,
<BenefitBaseComponent dataSource={socialBase.items} value={payload} onChange={onExtraChange}/>];
} else if (cur.props.title === getLabel(543197, "公积金基础信息") && _.every(fundBase.items, o => o.items.length > 0)) {
return [...pre, cur, <BenefitBaseComponent dataSource={fundBase.items} value={payload}/>];
return [...pre, cur,
<BenefitBaseComponent dataSource={fundBase.items} value={payload} onChange={onExtraChange}/>];
} else if (cur.props.title === getLabel(543198, "其他福利基础信息") && _.every(otherBase.items, o => o.items.length > 0)) {
return [...pre, cur, <BenefitBaseComponent dataSource={otherBase.items} value={payload}/>];
return [...pre, cur,
<BenefitBaseComponent dataSource={otherBase.items} value={payload} onChange={onExtraChange}/>];
}
return [...pre, cur];
}, []);
};
const BenefitBaseComponent = (props) => {
const { dataSource, value } = props;
const { dataSource, value, onChange } = props;
return <React.Fragment>
{
_.map(dataSource, item => {
@ -710,9 +713,10 @@ const BenefitBaseComponent = (props) => {
items={_.map(items, child => ({
com: <WeaFormItem label={child.label} labelCol={{ span: 10 }} wrapperCol={{ span: 14 }}>
<WeaInputNumber
value={value[getKey(child)] || 0} precision={2}
// min={minNum > 0 ? minNum : -999999999999999}
// max={maxNum > 0 ? maxNum : 999999999999999}
value={value[getKey(child)] || (child.min !== "0.000" ? child.min : 0)} precision={2}
min={child.min !== "0.000" ? child.min : -999999999999999}
max={child.max !== "0.000" ? child.max : 999999999999999}
onChange={v => onChange(getKey(child), v)}
/>
</WeaFormItem>
}))}