From f6f1e9dd039f5104e5ac77e123e8a4954be93c02 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 5 Nov 2025 15:07:31 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E7=BD=91=E8=81=94=E6=B8=85=E7=AE=97?= =?UTF-8?q?=E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8(0401)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/welfareEditArchiveSlide/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js index 83a1dfe1..4a82a4c2 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareEditArchiveSlide/index.js @@ -264,12 +264,18 @@ class Index extends Component { }); } else if (changeKey === "socialBase" || changeKey === "fundBase") { if (!changeVal) return; - const { data = {}, comData = {} } = this.props[changeKey]; + const { data = {}, items, comItems, comData = {} } = this.props[changeKey]; const changeData = _.reduce(_.keys(data), (pre, cur) => { - return { ...pre, [cur]: toDecimal_n(changeVal, 2) || "" }; + const min = _.find(items[0].items, o => o.domkey[0] === cur).min; + const max = _.find(items[0].items, o => o.domkey[0] === cur).max; + const result = (parseFloat(toDecimal_n(changeVal, 2)) < parseFloat(min) && !!parseFloat(min)) ? parseFloat(min) : (parseFloat(toDecimal_n(changeVal, 2)) > parseFloat(max) && !!parseFloat(max)) ? parseFloat(max) : parseFloat(toDecimal_n(changeVal, 2)); + return { ...pre, [cur]: result || "" }; }, {}); const changeComData = _.reduce(_.keys(comData), (pre, cur) => { - return { ...pre, [`${cur}_com`]: toDecimal_n(changeVal, 2) || "" }; + const min = _.find(comItems[0].items, o => o.domkey[0] === cur).min; + const max = _.find(comItems[0].items, o => o.domkey[0] === cur).max; + const result = (parseFloat(toDecimal_n(changeVal, 2)) < parseFloat(min) && !!parseFloat(min)) ? parseFloat(min) : (parseFloat(toDecimal_n(changeVal, 2)) > parseFloat(max) && !!parseFloat(max)) ? parseFloat(max) : parseFloat(toDecimal_n(changeVal, 2)); + return { ...pre, [`${cur}_com`]: result || "" }; }, {}); this.setState({ formData: { ...this.state.formData, ...changeData, ...changeComData } }); }