Revert "fix: платежи - загружаем КП Севертранс 380 с дегрессией, потом выбираем гибкую и платежи заполняются пустыми значениями"
This reverts commit f6879220cb5e1abb8d6fa755d16e7e3482979c7c.
This commit is contained in:
parent
6e5d05371f
commit
2a98c6c1a3
@ -341,7 +341,7 @@ export default function paymentsReactions({ store }: ReactionsContext) {
|
||||
},
|
||||
];
|
||||
|
||||
if (!$process.has('LoadKP') && degressionType !== 100_000_007) {
|
||||
if (!$process.has('LoadKP')) {
|
||||
$tables.payments.setValues(rows.map((row) => row.value));
|
||||
}
|
||||
|
||||
@ -350,6 +350,48 @@ export default function paymentsReactions({ store }: ReactionsContext) {
|
||||
}
|
||||
);
|
||||
|
||||
makeDisposable(
|
||||
() =>
|
||||
reaction(
|
||||
() => {
|
||||
const graphType = $calculation.element('radioGraphType').getValue();
|
||||
const payments = toJS($tables.payments.values);
|
||||
const degressionType = $calculation.element('selectSeasonType').getValue();
|
||||
|
||||
return {
|
||||
degressionType,
|
||||
graphType,
|
||||
payments,
|
||||
};
|
||||
},
|
||||
(nextParams, prevParams) => {
|
||||
if (nextParams.graphType === 100_000_001 && nextParams.degressionType === 100_000_007) {
|
||||
const changes = difference(nextParams.payments, prevParams.payments);
|
||||
|
||||
if (changes === null || changes.length > 1) return;
|
||||
|
||||
const [changeIndex] = changes;
|
||||
const value = nextParams.payments[changeIndex];
|
||||
const payments = nextParams.payments.slice(1, -1).map((payment, i) => {
|
||||
if (i <= changeIndex - 2) return payment;
|
||||
|
||||
return value;
|
||||
});
|
||||
|
||||
const firstPaymentPerc = $calculation.element('tbxFirstPaymentPerc').getValue();
|
||||
const lastPaymentPerc = $calculation.element('tbxLastPaymentPerc').getValue();
|
||||
|
||||
$tables.payments.setValues([firstPaymentPerc, ...payments, lastPaymentPerc]);
|
||||
}
|
||||
},
|
||||
{
|
||||
delay: 50,
|
||||
equals: comparer.structural,
|
||||
}
|
||||
),
|
||||
() => $process.has('LoadKP')
|
||||
);
|
||||
|
||||
/**
|
||||
* Сезонный
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user