custom/网联清算有限公司(0401)
This commit is contained in:
parent
c18fb35511
commit
f6f1e9dd03
|
|
@ -264,12 +264,18 @@ class Index extends Component {
|
||||||
});
|
});
|
||||||
} else if (changeKey === "socialBase" || changeKey === "fundBase") {
|
} else if (changeKey === "socialBase" || changeKey === "fundBase") {
|
||||||
if (!changeVal) return;
|
if (!changeVal) return;
|
||||||
const { data = {}, comData = {} } = this.props[changeKey];
|
const { data = {}, items, comItems, comData = {} } = this.props[changeKey];
|
||||||
const changeData = _.reduce(_.keys(data), (pre, cur) => {
|
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) => {
|
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 } });
|
this.setState({ formData: { ...this.state.formData, ...changeData, ...changeComData } });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue