fix: resetValues after get calculate results

This commit is contained in:
vchikalkin 2023-06-01 15:13:31 +03:00
parent b7ae72d4c0
commit fe614b2529
3 changed files with 18 additions and 5 deletions

View File

@ -52,7 +52,18 @@ export default function reactions({ store, apolloClient }: ProcessContext) {
osago: $tables.insurance.row('osago').getValues(),
},
payments: $tables.payments.getValues,
values: omit(values, ['IRR_Perc', 'downloadKp', 'lastPaymentRub', 'pi', 'totalPayments']),
values: omit(values, [
'IRR_Perc',
'irrInfo',
'downloadKp',
'lastPaymentRub',
'lastPaymentPerc',
'pi',
'totalPayments',
'tarif',
'rate',
'creditRate',
]),
};
},
() => {

View File

@ -4,6 +4,7 @@ import type { Risk } from '@/Components/Calculation/Form/Insurance/FinGAPTable/t
import { STALE_TIME } from '@/constants/request';
import type * as CRMTypes from '@/graphql/crm.types';
import type { ProcessContext } from '@/process/types';
import { disposableReaction } from '@/utils/mobx';
import { gql } from '@apollo/client';
import type { QueryFunctionContext } from '@tanstack/react-query';
import dayjs from 'dayjs';
@ -14,7 +15,7 @@ import { flatten } from 'tools/object';
dayjs.extend(utc);
export default function reactions({ store, apolloClient, queryClient }: ProcessContext) {
const { $calculation, $tables } = store;
const { $calculation, $tables, $process } = store;
// Расчет итоговой суммы ФинГАП и запись в таблицу страхования
reaction(
() => $tables.fingap.totalSum,
@ -112,7 +113,8 @@ export default function reactions({ store, apolloClient, queryClient }: ProcessC
// Заполнение таблицы рисков ФинГАП + Запрос расчета финГАП в мозжечок
reaction(
disposableReaction(
() => $process.has('Calculate'),
() => {
const finGAPInsuranceCompany = $tables.insurance.row('fingap').getValue('insuranceCompany');
const paymentsValues = toJS($tables.payments.values);

View File

@ -3,7 +3,7 @@ import type { ValidationParams } from '../../validation/types';
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
import * as insuranceTableConfig from '@/config/tables/insurance-table';
import type RootStore from '@/stores/root';
import { makeAutoObservable } from 'mobx';
import { makeAutoObservable, toJS } from 'mobx';
export type InsuranceTableData = {
options?: Record<Insurance.Keys, Insurance.RowOptions>;
@ -124,7 +124,7 @@ export default class InsuranceTable {
getValues: () => {
const rowIndex = this.values.findIndex((x) => x.key === key);
return this.values[rowIndex];
return toJS(this.values[rowIndex]);
},
reset: (valueName: Insurance.Values) => {