diff --git a/src/components/kpi/SubjectTable/Profit.jsx b/src/components/kpi/SubjectTable/Profit.jsx index 68bc77e..93385ee 100644 --- a/src/components/kpi/SubjectTable/Profit.jsx +++ b/src/components/kpi/SubjectTable/Profit.jsx @@ -36,7 +36,7 @@ export default observer((props) => { const PercentInput = useMemo( () => // eslint-disable-next-line react/display-name - ({ value, onChange, record, ...extProps }) => { + ({ value, onChange, record, month, ...extProps }) => { // // eslint-disable-next-line react-hooks/rules-of-hooks const [inputValue, setInputValue] = useState(value); const handleInputChange = (e) => { @@ -44,10 +44,11 @@ export default observer((props) => { onChange?.(e.target.value); }; const calcV = inputValue ? numberConvert10K(fixToInt((Number(record?.yearValue) * inputValue) / 100)) : 0; + const sumUtil = new Array(month).fill(1).reduce((r, v, i) => r + fixToInt((Number(record?.yearValue || 0) * record[`M${i + 1}Percent`]) / 100), 0); // 累计 return ( - {calcV} + {calcV}, {numberConvert10K(sumUtil)} ); },