Merge branch 'feature/2.12.1.2403.02-社保档案保存修改' into release/2.14.2.2405.02

This commit is contained in:
黎永顺 2024-05-23 11:04:54 +08:00
commit bf477457d7
2 changed files with 42 additions and 18 deletions

View File

@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom";
import { WeaDialog, WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom";
import * as API from "../../../../../apis/welfareArchive";
import { getTaxAgentSelectList } from "../../../../../apis/taxAgent";
import { sysinfo } from "../../../../../apis/ruleconfig";
@ -23,7 +23,7 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, conditions: [], formData: {}
loading: false, conditions: [], formData: {}, errorDialog: { visible: false, errorMsg: "" }
};
}
@ -180,7 +180,7 @@ class Index extends Component {
welfareType, validate: welfareData[`${underTakeType}SchemeId`] ? !!welfareData[`${underTakeType}StartTime`] : true
};
};
save = async () => {
save = async (changeData = false) => {
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 || []));
@ -198,13 +198,18 @@ class Index extends Component {
}, {
status: otherStatus,
errormsg: otherErrorMsg = "!"
}] = await Promise.all([API.save(socailPayload), API.save(fundPayload), API.save(otherPayload)]);
}] = await Promise.all([
API.save({ ...socailPayload, changeData }),
API.save({ ...fundPayload, changeData }),
API.save({ ...otherPayload, changeData })]);
this.setState({ loading: false });
if (socialStatus && fundStatus && otherStatus) {
message.success(getLabel(30700, "操作成功!"));
this.props.onClose(true);
} else {
message.error(socialErrorMsg + fundErrorMsg + otherErrorMsg);
!changeData && this.setState({
errorDialog: { visible: true, errorMsg: socialErrorMsg + fundErrorMsg + otherErrorMsg }
});
}
};
updateFormData = (baseData) => this.setState({ formData: { ...this.state.formData, ...baseData } });
@ -246,18 +251,19 @@ class Index extends Component {
};
handleExtraChange = (key, value) => this.setState({ formData: { ...this.state.formData, [key]: value } });
handleSameChange = (baseItems, value) => {
if (!value) return;
let newFormDatas = {}, hasCompromise = false;
baseItems.forEach((formLabel) => {
const { min, max } = formLabel;
// const { min, max } = formLabel;
newFormDatas[getKey(formLabel)] = toDecimal_n(value, 2) || "";
if (min !== "0.000" && value !== "" && Number(value) < Number(min)) {
hasCompromise = true;
newFormDatas[getKey(formLabel)] = toDecimal_n(Number(min), 2);
}
if (max !== "0.000" && value !== "" && Number(value) > Number(max)) {
hasCompromise = true;
newFormDatas[getKey(formLabel)] = toDecimal_n(Number(max), 2);
}
// if (min !== "0.000" && value !== "" && Number(value) < Number(min)) {
// hasCompromise = true;
// newFormDatas[getKey(formLabel)] = toDecimal_n(Number(min), 2);
// }
// if (max !== "0.000" && value !== "" && Number(value) > Number(max)) {
// hasCompromise = true;
// newFormDatas[getKey(formLabel)] = toDecimal_n(Number(max), 2);
// }
});
if (hasCompromise) {
message.warning(getLabel("111", "超出所选缴纳方案设置的基数上下限范围,将自动按基数上下限填充。"));
@ -278,7 +284,7 @@ class Index extends Component {
<div className="titleCol titleRightBox">
{
runStatuses !== "4,5" && showOperateBtn &&
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(537558, "保存")}</Button>
<Button type="primary" onClick={() => this.save()} loading={loading}>{getLabel(537558, "保存")}</Button>
}
</div>
</div>;
@ -300,7 +306,7 @@ class Index extends Component {
render() {
const { archivesStore: { welfareProfileForm }, showOperateBtn } = this.props;
const { conditions, formData } = this.state;
const { conditions, formData, errorDialog } = this.state;
return (
<WeaSlideModal
className="salary-welfare-archive-edit-layout" {...this.props}
@ -313,6 +319,24 @@ class Index extends Component {
this.handleSameChange, formData, this.props, showOperateBtn
)
}
<WeaDialog title={getLabel(111, "信息确认")} visible={errorDialog.visible}
style={{ width: 480, height: 200 }} hasScroll
buttons={[
<Button type="primary" onClick={() => {
this.setState({ errorDialog: { ...errorDialog, visible: false } }, () => {
const promise = this.save(true);
message.success(getLabel(30700, "操作成功!"));
this.props.onClose(true);
});
}}>{getLabel(111, "确认")}</Button>
]}
onCancel={() => this.setState({ errorDialog: { ...errorDialog, visible: false } })}
bottomLeft={getLabel(111, "点击【确认】自动将不满足条件的基数值设置为对应的上限或下限值")}
>
<div style={{ padding: 16 }}>
<div dangerouslySetInnerHTML={{ __html: (errorDialog.errorMsg).replace(/\n/g, "</br>") }}/>
</div>
</WeaDialog>
</div>}
/>
);

View File

@ -815,8 +815,8 @@ const BenefitBaseComponent = (props) => {
com: <WeaFormItem label={child.label} labelCol={{ span: 10 }} wrapperCol={{ span: 14 }}>
<WeaInputNumber
value={value[getKey(child)] || (child.min !== "0.000" ? child.min : 0)} precision={2}
min={(child.min !== "0.000" && value.welBaseAutoAdjust) ? parseFloat(child.min) : -999999999999999}
max={(child.max !== "0.000" && value.welBaseAutoAdjust) ? parseFloat(child.max) : 999999999999999}
// min={(child.min !== "0.000" && value.welBaseAutoAdjust) ? parseFloat(child.min) : -999999999999999}
// max={(child.max !== "0.000" && value.welBaseAutoAdjust) ? parseFloat(child.max) : 999999999999999}
onChange={v => onChange(getKey(child), v)}
viewAttr={(runStatuses === "4,5" || !showOperateBtn) ? 1 : 2}
/>