custom/网联清算有限公司(0401)

This commit is contained in:
lys 2025-11-05 15:07:31 +08:00
parent c18fb35511
commit f6f1e9dd03
1 changed files with 9 additions and 3 deletions

View File

@ -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 } });
}