feature/2.9.10.2312.02-社保档案个人和公司基数设置
This commit is contained in:
parent
8c06171190
commit
cf47cdeb56
|
|
@ -43,13 +43,33 @@ class Index extends Component {
|
|||
archivesStore: { welfareProfileForm }, socialBase, fundBase, otherBase, runStatuses,
|
||||
employeeId, paymentOrganization, socialBaseData, fundBaseData, othersBaseData
|
||||
} = props;
|
||||
let socialComData = {}, fundComData = {}, otherComData = {};
|
||||
if (!_.isNil(socialBase.comItems) && !_.isNil(socialBase.comData)) {
|
||||
_.forEach(getConditionDomkeys(socialBase.comItems), o => ({
|
||||
...socialComData,
|
||||
[`${o}_com`]: socialBase.comData[o]
|
||||
}));
|
||||
}
|
||||
if (!_.isNil(fundBase.comItems) && !_.isNil(fundBase.comData)) {
|
||||
_.forEach(getConditionDomkeys(fundBase.comItems), o => ({
|
||||
...fundComData,
|
||||
[`${o}_com`]: fundBase.comData[o]
|
||||
}));
|
||||
}
|
||||
if (!_.isNil(otherBase.comItems) && !_.isNil(otherBase.comData)) {
|
||||
_.forEach(getConditionDomkeys(otherBase.comItems), o => ({
|
||||
...otherComData,
|
||||
[`${o}_com`]: otherBase.comData[o]
|
||||
}));
|
||||
}
|
||||
const payload = { employeeId, paymentOrganization, welfareTypeEnum: "" };
|
||||
API.getBaseForm(payload).then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { data: result } = data;
|
||||
const formData = {
|
||||
...result, ...socialBaseData, ...fundBaseData, ...othersBaseData,
|
||||
...socialBase.data, ...fundBase.data, ...otherBase.data
|
||||
...socialBase.data, ...fundBase.data, ...otherBase.data,
|
||||
...socialComData, ...fundComData, ...otherComData
|
||||
};
|
||||
this.setState({
|
||||
formData,
|
||||
|
|
@ -120,7 +140,7 @@ class Index extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
covertPayload = (welfareType, underTakeType, paymentForm) => {
|
||||
covertPayload = (welfareType, underTakeType, paymentForm, paymentComForm) => {
|
||||
const { archivesStore: { welfareProfileForm } } = this.props;
|
||||
const welfareData = welfareProfileForm.getFormParams();
|
||||
const { formData } = this.state;
|
||||
|
|
@ -136,13 +156,20 @@ class Index extends Component {
|
|||
if (formData[cur] || formData[cur] === 0) return { ...pre, [cur]: toDecimal_n(formData[cur], 2).toString() };
|
||||
return { ...pre, [cur]: "0" };
|
||||
}, {})) : "",
|
||||
paymentComForm: !_.isEmpty(paymentComForm) ? JSON.stringify(_.reduce(paymentComForm, (pre, cur) => {
|
||||
if (formData[`${cur}_com`] || formData[`${cur}_com`] === 0) return {
|
||||
...pre,
|
||||
[cur]: toDecimal_n(formData[`${cur}_com`], 2).toString()
|
||||
};
|
||||
return { ...pre, [cur]: "0" };
|
||||
}, {})) : "",
|
||||
welfareType, validate: welfareData[`${underTakeType}SchemeId`] ? !!welfareData[`${underTakeType}StartTime`] : true
|
||||
};
|
||||
};
|
||||
save = async () => {
|
||||
const socailPayload = this.covertPayload("SOCIAL_SECURITY", "social", getConditionDomkeys(this.props.socialBase.items)),
|
||||
fundPayload = this.covertPayload("ACCUMULATION_FUND", "fund", getConditionDomkeys(this.props.fundBase.items)),
|
||||
otherPayload = this.covertPayload("OTHER", "other", getConditionDomkeys(this.props.otherBase.items));
|
||||
const socailPayload = this.covertPayload("SOCIAL_SECURITY", "social", getConditionDomkeys(this.props.socialBase.items), getConditionDomkeys(this.props.socialBase.comItems || [])),
|
||||
fundPayload = this.covertPayload("ACCUMULATION_FUND", "fund", getConditionDomkeys(this.props.fundBase.items), getConditionDomkeys(this.props.fundBase.comItems || [])),
|
||||
otherPayload = this.covertPayload("OTHER", "other", getConditionDomkeys(this.props.otherBase.items), getConditionDomkeys(this.props.otherBase.comItems || []));
|
||||
if (!(socailPayload.validate && fundPayload.validate && otherPayload.validate)) {
|
||||
message.warning(getLabel(111, "请维护起始缴纳月!"));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -240,11 +240,11 @@ class Index extends Component {
|
|||
this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum[type], schemeId })
|
||||
.then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { data: defVal, items } = data;
|
||||
const { data: defVal, items, comData, comItems } = data;
|
||||
this.setState({
|
||||
welfareEditSlide: { ...this.state.welfareEditSlide, [`${type}Base`]: data }
|
||||
}, () => {
|
||||
this.archiveSlideRef.wrappedInstance.updateFormData(_.reduce(getConditionDomkeys(items), (pre, cur) => {
|
||||
const perData = _.reduce(getConditionDomkeys(items), (pre, cur) => {
|
||||
const minNum = !_.isNil(getConditionFields(items)[cur].min) ? Number(getConditionFields(items)[cur].min) : undefined,
|
||||
maxNum = !_.isNil(getConditionFields(items)[cur].max) ? Number(getConditionFields(items)[cur].max) : undefined;
|
||||
const val = !_.isNil(defVal) ? Number(defVal[cur]) : 0;
|
||||
|
|
@ -252,7 +252,21 @@ class Index extends Component {
|
|||
...pre,
|
||||
[cur]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
|
||||
};
|
||||
}, {}));
|
||||
}, {});
|
||||
if (!_.isNil(comItems)) {
|
||||
const comDataTmpv = _.reduce(getConditionDomkeys(comItems), (pre, cur) => {
|
||||
const minNum = !_.isNil(getConditionFields(comItems)[cur].min) ? Number(getConditionFields(comItems)[cur].min) : undefined,
|
||||
maxNum = !_.isNil(getConditionFields(comItems)[cur].max) ? Number(getConditionFields(comItems)[cur].max) : undefined;
|
||||
const val = !_.isNil(comData) ? Number(comData[cur]) : 0;
|
||||
return {
|
||||
...pre,
|
||||
[`${cur}_com`]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
|
||||
};
|
||||
}, {});
|
||||
this.archiveSlideRef.wrappedInstance.updateFormData({ ...perData, ...comDataTmpv });
|
||||
return;
|
||||
}
|
||||
this.archiveSlideRef.wrappedInstance.updateFormData({ ...perData });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -666,7 +666,6 @@ export const getWelfareSearchsForm = (form, condition, onChange = () => void (0)
|
|||
/>;
|
||||
};
|
||||
const { socialBase, fundBase, otherBase, runStatuses } = extraFormField;
|
||||
console.log(socialBase);
|
||||
const { isFormInit } = form;
|
||||
const formParams = form.getFormParams();
|
||||
let group = [];
|
||||
|
|
@ -695,30 +694,69 @@ 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} dataSourceCom={socialBase.comItems} value={payload}
|
||||
onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>];
|
||||
if (!_.isNil(socialBase.comItems) && _.every(socialBase.comItems, o => o.items.length > 0)) {
|
||||
return [
|
||||
...pre, cur,
|
||||
<BenefitBaseComponent
|
||||
dataSource={_.map(socialBase.items, o => ({ ...o, title: `${o.title}(${getLabel(500201, "个人")})` }))}
|
||||
value={payload} onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>,
|
||||
<BenefitBaseComponent
|
||||
dataSource={_.map(socialBase.comItems, o => ({
|
||||
...o, title: `${o.title}(${getLabel(1851, "公司")})`,
|
||||
items: _.map(o.items, g => ({ ...g, domkey: [`${getKey(g)}_com`] }))
|
||||
}))}
|
||||
value={payload} onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>
|
||||
];
|
||||
} else {
|
||||
return [...pre, cur,
|
||||
<BenefitBaseComponent dataSource={socialBase.items} value={payload}
|
||||
onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>];
|
||||
}
|
||||
} else if (cur.props.title === getLabel(543197, "公积金基础信息") && _.every(fundBase.items, o => o.items.length > 0)) {
|
||||
return [...pre, cur,
|
||||
<BenefitBaseComponent dataSource={fundBase.items} value={payload} onChange={onExtraChange}
|
||||
onSameChange={onSameChange} runStatuses={runStatuses}/>];
|
||||
if (!_.isNil(fundBase.comItems) && _.every(fundBase.comItems, o => o.items.length > 0)) {
|
||||
return [
|
||||
...pre, cur,
|
||||
<BenefitBaseComponent
|
||||
dataSource={_.map(fundBase.items, o => ({ ...o, title: `${o.title}(${getLabel(500201, "个人")})` }))}
|
||||
value={payload} onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>,
|
||||
<BenefitBaseComponent
|
||||
dataSource={_.map(fundBase.comItems, o => ({
|
||||
...o, title: `${o.title}(${getLabel(1851, "公司")})`,
|
||||
items: _.map(o.items, g => ({ ...g, domkey: [`${getKey(g)}_com`] }))
|
||||
}))}
|
||||
value={payload} onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>
|
||||
];
|
||||
} else {
|
||||
return [...pre, cur,
|
||||
<BenefitBaseComponent dataSource={fundBase.items} value={payload} onChange={onExtraChange}
|
||||
onSameChange={onSameChange} runStatuses={runStatuses}/>];
|
||||
}
|
||||
} else if (cur.props.title === getLabel(543198, "其他福利基础信息") && _.every(otherBase.items, o => o.items.length > 0)) {
|
||||
return [...pre, cur,
|
||||
<BenefitBaseComponent dataSource={otherBase.items} value={payload} onChange={onExtraChange}
|
||||
onSameChange={onSameChange} runStatuses={runStatuses}/>];
|
||||
if (!_.isNil(fundBase.comItems) && _.every(fundBase.comItems, o => o.items.length > 0)) {
|
||||
return [
|
||||
...pre, cur,
|
||||
<BenefitBaseComponent
|
||||
dataSource={_.map(otherBase.items, o => ({ ...o, title: `${o.title}(${getLabel(500201, "个人")})` }))}
|
||||
value={payload} onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>,
|
||||
<BenefitBaseComponent
|
||||
dataSource={_.map(otherBase.comItems, o => ({
|
||||
...o, title: `${o.title}(${getLabel(1851, "公司")})`,
|
||||
items: _.map(o.items, g => ({ ...g, domkey: [`${getKey(g)}_com`] }))
|
||||
}))}
|
||||
value={payload} onChange={onExtraChange} onSameChange={onSameChange} runStatuses={runStatuses}/>
|
||||
];
|
||||
} else {
|
||||
return [...pre, cur,
|
||||
<BenefitBaseComponent dataSource={otherBase.items} value={payload} onChange={onExtraChange}
|
||||
onSameChange={onSameChange} runStatuses={runStatuses}/>];
|
||||
}
|
||||
}
|
||||
return [...pre, cur];
|
||||
}, []);
|
||||
};
|
||||
|
||||
const BenefitBaseComponent = (props) => {
|
||||
const { dataSource, dataSourceCom, value, onChange, onSameChange, runStatuses } = props;
|
||||
const [comFields] = dataSourceCom || [];
|
||||
const list = !_.isNil(comFields) ? _.map(dataSource, o => ({
|
||||
...o,
|
||||
items: [...o.items, ...comFields.items]
|
||||
})) : dataSource;
|
||||
console.log(list);
|
||||
const { dataSource, value, onChange, onSameChange, runStatuses } = props;
|
||||
return <React.Fragment>
|
||||
{
|
||||
_.map(dataSource, item => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue