send additionaldata for checking results
This commit is contained in:
parent
108dffa1b9
commit
4c1ab5fd4a
@ -21,6 +21,7 @@ export const openNotification = ({
|
||||
style: {
|
||||
zIndex: 9999999999,
|
||||
},
|
||||
duration: 10,
|
||||
}),
|
||||
750,
|
||||
);
|
||||
|
||||
@ -12,6 +12,7 @@ import { Status } from 'core/types/statuses';
|
||||
import { TableProps } from 'core/types/Calculation/Store/tables';
|
||||
import { resultsValues } from 'core/types/Calculation/Store/values';
|
||||
import valuesConstants from 'core/constants/values';
|
||||
import getAdditionalData from './lib/additionalData';
|
||||
|
||||
const cleanResults = () => {
|
||||
for (let resultValue of resultsValues) {
|
||||
@ -316,13 +317,19 @@ const actions: TAction = {
|
||||
var preparedData = prepareCalculationData({
|
||||
calculationStore: CalculationStore,
|
||||
});
|
||||
console.log('preparedData', preparedData);
|
||||
|
||||
var additionalData = getAdditionalData({
|
||||
calculationStore: CalculationStore,
|
||||
});
|
||||
console.log('additionalData', additionalData);
|
||||
|
||||
CalculationStore.cleanTable('tableResults');
|
||||
|
||||
console.log('preparedData', preparedData);
|
||||
cleanResults();
|
||||
|
||||
return CalculationService.calculate(preparedData)
|
||||
return CalculationService.calculate(
|
||||
Object.assign(preparedData, { additionalData }),
|
||||
)
|
||||
.then(res => {
|
||||
message.success({
|
||||
content: 'Расчет завершен успешно!',
|
||||
@ -433,6 +440,11 @@ const actions: TAction = {
|
||||
openNotification({
|
||||
type: 'error',
|
||||
title: 'Ошибка во время расчета!',
|
||||
description:
|
||||
err.response &&
|
||||
err.response.data &&
|
||||
err.response.data.errors &&
|
||||
err.response.data.errors.join(', '),
|
||||
})();
|
||||
|
||||
unlockButtons();
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
import { ICalculationStore } from 'core/types/Calculation/Store/index';
|
||||
export default ({
|
||||
calculationStore,
|
||||
}: {
|
||||
calculationStore: ICalculationStore;
|
||||
}): any => {
|
||||
const selectedTarifId = calculationStore.values.tarif;
|
||||
if (selectedTarifId) {
|
||||
const tarif = calculationStore.options.selectTarif?.find(
|
||||
x => x.evo_tarifid === selectedTarifId,
|
||||
);
|
||||
if (tarif) {
|
||||
return {
|
||||
minCashflowMSFONominal: tarif.evo_min_irr,
|
||||
maxCashflowMSFONominal: tarif.evo_max_irr,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user