diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js index 03a89212..e2342e93 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js @@ -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 {
{ runStatuses !== "4,5" && showOperateBtn && - + }
; @@ -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 ( { + this.setState({ errorDialog: { ...errorDialog, visible: false } }, () => { + const promise = this.save(true); + message.success(getLabel(30700, "操作成功!")); + this.props.onClose(true); + }); + }}>{getLabel(111, "确认")} + ]} + onCancel={() => this.setState({ errorDialog: { ...errorDialog, visible: false } })} + bottomLeft={getLabel(111, "点击【确认】自动将不满足条件的基数值设置为对应的上限或下限值")} + > +
+
") }}/> +
+
} /> ); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/config.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/config.js index 7431c2d7..cbec934f 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/config.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/config.js @@ -815,8 +815,8 @@ const BenefitBaseComponent = (props) => { com: onChange(getKey(child), v)} viewAttr={(runStatuses === "4,5" || !showOperateBtn) ? 1 : 2} />