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

This commit is contained in:
黎永顺 2023-11-27 15:29:07 +08:00
parent 7579a8cd31
commit 2c7633b0c9
5 changed files with 60 additions and 5 deletions

View File

@ -113,8 +113,31 @@ class Index extends Component {
}
});
};
updateForm = () => {
covertPayload = (welfareType, paymentForm) => {
const { archivesStore: { welfareProfileForm } } = this.props;
const welfareData = welfareProfileForm.getFormParams();
const { formData } = this.state;
console.log(welfareData, formData, this.props, paymentForm);
return {
baseForm: {
...formData[welfareType], ..._.reduce(_.keys(formData[welfareType]), (pre, cur) => {
if (welfareData[cur]) return { ...pre, [cur]: welfareData[cur] };
return { ...pre };
}, {}),
underTake: welfareData[`${_.lowerCase(welfareType.split("_")[0])}UnderTake`]
},
paymentForm: !_.isEmpty(paymentForm) ? _.reduce(paymentForm, (pre, cur) => {
if (formData[cur] || formData[cur] === 0) return { ...pre, [cur]: formData[cur] };
return { ...pre, [cur]: "0" };
}, {}) : "",
welfareType
};
};
save = () => {
console.log(this.covertPayload("SOCIAL_SECURITY", getConditionDomkeys(this.props.socialBase.items)));
};
updateFormData=()=>{
}
handleFormChange = (val) => {
const changeKey = _.keys(val)[0], changeVal = val[changeKey].value;
const { archivesStore: { setHasBeenModify }, onChangeProgramme, employeeId, paymentOrganization } = this.props;
@ -127,6 +150,9 @@ class Index extends Component {
}
};
handleExtraChange = (key, value) => this.setState({ formData: { ...this.state.formData, [key]: value } });
handleNoPaymentChange = (type, value) => this.setState({
formData: { ...this.state.formData, [type]: { ...this.state.formData[type], nonPayment: value } }
});
renderTitle = () => {
const { loading } = this.state;
return <div className="titleDialog">
@ -163,7 +189,12 @@ 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, this.handleExtraChange, formData, this.props)}
{
getWelfareSearchsForm(
welfareProfileForm, conditions, this.handleFormChange, this.handleNoPaymentChange, this.handleExtraChange,
formData, this.props
)
}
</div>}
/>
);

View File

@ -11,6 +11,7 @@ import { message, Modal, Spin } from "antd";
import WelfareEditArchiveSlide from "../welfareEditArchiveSlide";
import * as API from "../../../../../apis/welfareArchive";
import { welfareTypeEnum } from "../../config";
import { getConditionDomkeys, getConditionFields } from "../../../../../util";
const getLabel = WeaLocaleProvider.getLabel;
const APILIST = {
@ -239,6 +240,8 @@ class Index extends Component {
if (status) {
this.setState({
welfareEditSlide: { ...this.state.welfareEditSlide, [`${type}Base`]: data }
}, () => {
console.log(this.archiveSlideRef);
});
}
});

View File

@ -656,10 +656,13 @@ export const welfareConditions = [
]
}
];
export const getWelfareSearchsForm = (form, condition, onChange = () => void (0), onExtraChange = () => void (0), payload, extraFormField) => {
export const getWelfareSearchsForm = (form, condition, onChange = () => void (0), onNoPaymentChange = () => 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, "暂不缴纳")}/>;
return <WeaCheckbox
value={value} content={getLabel(543196, "暂不缴纳")}
onChange={v => onNoPaymentChange(type, v)}
/>;
};
const { socialBase, fundBase, otherBase } = extraFormField;
const { isFormInit } = form;
@ -720,7 +723,10 @@ const BenefitBaseComponent = (props) => {
/>
</WeaFormItem>
}))}
customComponent={<h1>123</h1>}
customComponent={<div className="welfare-same-box">
<span>{getLabel(543195, "各项福利基数一致")}</span>
<WeaInputNumber style={{ width: 100 }}/>
</div>}
title={title} col={2} showGroup className="twoColumns-welfare-info-wrapper"
/>;
})

View File

@ -205,6 +205,12 @@
background: #FFF;
border: 1px solid #e5e5e5;
}
.welfare-same-box {
& > span {
margin-right: 10px;
}
}
}
}
}

View File

@ -15,6 +15,15 @@ export const getConditionDomkeys = (condition) => {
});
return domkeyList;
};
// 获取condition的field集合
export const getConditionFields = (condition) => {
return _.reduce(condition, (pre, cur) => {
return {
...pre,
..._.reduce(cur.items, (pre1, cur1) => ({ ...pre1, [cur1["domkey"][0]]: cur1 }), {})
};
}, {});
};
// 渲染form表单: 一般对form的渲染都统一使用该方法
export const getSearchs = (form, condition, col, isCenter, onChange = () => void (0), title) => {