From 661cc02ed43233f2f57f961f1887c4bbbd9ad5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 14 Feb 2023 17:32:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/socialSecurityForm.js | 58 ++++++++++++------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index d67c1566..461f542c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -15,25 +15,23 @@ export default class SocialSecurityForm extends React.Component { getPaymentForm(this.props.employeeId, "SOCIAL_SECURITY", siSchemeId, this.props.record.paymentOrganization); } - // 表单变化 - handleFormChange = (params) => { - console.log("params", params); - return; + handleFormChange = ({ key, value }) => { + const params = { [key]: value }; const { archivesStore: { socialSecurityForm, setSocialSecurityForm }, onChangeRecordSchemeId } = this.props; const { data } = socialSecurityForm; let request = { ...data, ...params }; let form = { ...socialSecurityForm }; form.data = request; setSocialSecurityForm(form); - Object.keys(params).length > 1 && - onChangeRecordSchemeId(params.socialSchemeId); + key === "socialName" && this.handleFetchPaymentForm(value); + key === "socialName" && onChangeRecordSchemeId(value); }; - // 获取基数表单 - handleFetchPaymentForm(value) { - const { archivesStore: { getPaymentForm } } = this.props; - getPaymentForm(this.props.employeeId, "SOCIAL_SECURITY", value, this.props.record.paymentOrganization); - } + handleFetchPaymentForm = (value) => { + const { archivesStore: { getPaymentForm }, employeeId, record } = this.props; + const { paymentOrganization } = record; + getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization); + }; //基数变化 handlePaymentChange(params) { @@ -67,6 +65,7 @@ export default class SocialSecurityForm extends React.Component { ..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"), item => ({ com: SocialSelect({ + key: item["domkey"][0], label: item.label, value: !_.isNil(socialData[item["domkey"][0]]) ? socialData[item["domkey"][0]].toString() : "", options: item.options, @@ -75,6 +74,7 @@ export default class SocialSecurityForm extends React.Component { })), { com: SocialDatePicker({ + key: "socialStartTime", label: "社保起始缴纳月", value: socialStartTime, onChange: this.handleFormChange @@ -82,6 +82,7 @@ export default class SocialSecurityForm extends React.Component { }, { com: SocialEditInput({ + key: "schemeAccount", label: "社保账号", value: schemeAccount, onChange: this.handleFormChange @@ -89,6 +90,7 @@ export default class SocialSecurityForm extends React.Component { }, { com: SocialDatePicker({ + key: "socialEndTime", label: "社保最后缴纳月", value: socialEndTime, onChange: this.handleFormChange @@ -99,7 +101,8 @@ export default class SocialSecurityForm extends React.Component {
} + customComponent={} items={socialItems} col={2} showGroup needTigger={false}/> { !_.isEmpty(socialName) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { @@ -107,6 +110,7 @@ export default class SocialSecurityForm extends React.Component { return ({ com: SocialInputNumber({ + key: child["domkey"][0], label: child.label, value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", onChange: this.handleFormChange @@ -226,36 +230,46 @@ export default class SocialSecurityForm extends React.Component { } } const SocialTitle = (props) => { - const { value, onChange } = props; - return ; + const { value, onChange, key } = props; + return onChange({ key, value: val })}/>; }; const SocialSelect = (props) => { - const { value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { key, value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return - + onChange({ key, value: val })}/> ; }; const SocialEditInput = (props) => { - const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( - + onChange({ key, value: val })}/> ); }; const SocialInputNumber = (props) => { - const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( - + onChange({ key, value: val })} min={0} precision={2}/> ); }; const SocialDatePicker = (props) => { - const { value, onChange, label, format = "YYYY-MM", viewAttr = 2, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { + key, + value, + onChange, + label, + format = "YYYY-MM", + viewAttr = 2, + labelColSpan = 12, + wrapperColSpan = 12 + } = props; return ( - + onChange({ key, value: val })}/> ); };