fix evo_id_elt_osago
This commit is contained in:
parent
9147c0fdc8
commit
f7072cff25
@ -3,6 +3,7 @@ import ELTService from 'core/services/ELTService';
|
||||
import { ICalculationStore } from 'core/types/Calculation/Store';
|
||||
import { IAccount } from 'core/types/Entities/crmEntities';
|
||||
import { toJS } from 'mobx';
|
||||
import { map_evo_id_elt_FieldName } from '../lib/resetIns';
|
||||
|
||||
const CancelToken = axios.CancelToken;
|
||||
export let sources = {};
|
||||
@ -18,6 +19,8 @@ export const fetchData = (insType: string, composeRequest, convertEltResult) =>
|
||||
const { ELTStore } = this.stores;
|
||||
const request = composeRequest.call(this);
|
||||
|
||||
const evo_id_elt_fieldName = map_evo_id_elt_FieldName[insType];
|
||||
|
||||
const requests = ELTStore[insType].list.map(
|
||||
(company: IAccount, i: number) => {
|
||||
//@ts-ignore
|
||||
@ -26,17 +29,20 @@ export const fetchData = (insType: string, composeRequest, convertEltResult) =>
|
||||
ELTService[insType]
|
||||
.getCalculation(
|
||||
{
|
||||
companyIds: [company.evo_id_elt],
|
||||
companyIds: [company[evo_id_elt_fieldName]],
|
||||
...request,
|
||||
},
|
||||
sources[insType].token,
|
||||
)
|
||||
.then(res => {
|
||||
if (!company.evo_id_elt || !res[company.evo_id_elt]) {
|
||||
if (
|
||||
!company[evo_id_elt_fieldName] ||
|
||||
!res[company[evo_id_elt_fieldName]]
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const converted = convertEltResult(
|
||||
res[company.evo_id_elt],
|
||||
res[company[evo_id_elt_fieldName]],
|
||||
company.accountid,
|
||||
toJS(this.getValues(['leasingPeriod'])),
|
||||
);
|
||||
|
||||
@ -8,12 +8,17 @@ const mapInsType = {
|
||||
osago: 100000001,
|
||||
};
|
||||
|
||||
const map_evo_id_elt_FieldName = {
|
||||
export const map_evo_id_elt_FieldName = {
|
||||
kasko: 'evo_id_elt',
|
||||
osago: 'evo_id_elt_osago',
|
||||
};
|
||||
|
||||
export const initFields = ['evo_id_elt', 'name', 'accountid'];
|
||||
export const initFields = [
|
||||
'evo_id_elt_osago',
|
||||
'evo_id_elt',
|
||||
'name',
|
||||
'accountid',
|
||||
];
|
||||
|
||||
export function initIns(this: ICalculationStore, insType) {
|
||||
const insuranceCompanies = this.getTableOptions(
|
||||
|
||||
Reference in New Issue
Block a user