fix [2]
This commit is contained in:
parent
595d4f34f9
commit
70d26e472f
@ -6,7 +6,7 @@ import { selectLeaseObjectUseFor } from '@/config/default-options';
|
|||||||
import * as CRMTypes from '@/graphql/crm.types';
|
import * as CRMTypes from '@/graphql/crm.types';
|
||||||
import { normalizeOptions } from '@/utils/entity';
|
import { normalizeOptions } from '@/utils/entity';
|
||||||
import { debouncedReaction, disposableReaction } from '@/utils/mobx';
|
import { debouncedReaction, disposableReaction } from '@/utils/mobx';
|
||||||
import { comparer, reaction } from 'mobx';
|
import { reaction } from 'mobx';
|
||||||
|
|
||||||
export function common({ store, apolloClient }: ProcessContext) {
|
export function common({ store, apolloClient }: ProcessContext) {
|
||||||
const { $calculation, $tables, $process } = store;
|
const { $calculation, $tables, $process } = store;
|
||||||
@ -304,16 +304,13 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
debouncedReaction(
|
reaction(
|
||||||
() => {
|
() => $calculation.$values.getValues(['leaseObjectType', 'maxMass']),
|
||||||
const values = $calculation.$values.getValues(['leaseObjectType', 'maxMass']);
|
async ({ leaseObjectType: leaseObjectTypeId, maxMass }) => {
|
||||||
const osago = $tables.insurance.row('osago').getValues();
|
|
||||||
|
|
||||||
return { ...values, osago };
|
|
||||||
},
|
|
||||||
async ({ leaseObjectType: leaseObjectTypeId, maxMass, osago }) => {
|
|
||||||
if (!leaseObjectTypeId) {
|
if (!leaseObjectTypeId) {
|
||||||
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
||||||
|
$tables.insurance.row('osago').column('insured').unblock();
|
||||||
|
$tables.insurance.row('osago').column('insCost').unblock();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -333,7 +330,7 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
query: CRMTypes.GetInsuranceCompaniesDocument,
|
query: CRMTypes.GetInsuranceCompaniesDocument,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (evo_leasingobject_type?.evo_id === '9' && maxMass < 20 && osago.insured === 100_000_000) {
|
if (evo_leasingobject_type?.evo_id === '9' && maxMass < 20) {
|
||||||
const otherInsuranceCompany = accounts?.find(
|
const otherInsuranceCompany = accounts?.find(
|
||||||
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
|
(x) => x?.evo_type_ins_policy === null && x.label?.includes('ПРОЧИЕ')
|
||||||
);
|
);
|
||||||
@ -346,14 +343,14 @@ export function common({ store, apolloClient }: ProcessContext) {
|
|||||||
.setValue(otherInsuranceCompany.value)
|
.setValue(otherInsuranceCompany.value)
|
||||||
.block();
|
.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tables.insurance.row('osago').column('insured').setValue(100_000_000).block();
|
||||||
|
$tables.insurance.row('osago').column('insCost').setValue(0).block();
|
||||||
} else {
|
} else {
|
||||||
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
$tables.insurance.row('osago').column('insuranceCompany').unblock();
|
||||||
|
$tables.insurance.row('osago').column('insured').unblock();
|
||||||
|
$tables.insurance.row('osago').column('insCost').unblock();
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
delay: 1,
|
|
||||||
equals: comparer.structural,
|
|
||||||
wait: 100,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user