fix get fake entities
This commit is contained in:
parent
9f763682a9
commit
1ac2b3d89c
@ -13,45 +13,53 @@ const reactionEffects: IReactionEffect[] = [
|
||||
x => x.value === leadId,
|
||||
);
|
||||
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'opportunity',
|
||||
fields: undefined,
|
||||
where: { opportunityid: lead?.evo_opportunityid },
|
||||
})
|
||||
.then(opportunities => {
|
||||
calculationStore.setOptions('selectOpportunity', opportunities);
|
||||
calculationStore.setValue(
|
||||
'opportunity',
|
||||
opportunities[0].opportunityid,
|
||||
);
|
||||
if (lead)
|
||||
CalculationService.getEntityOptions({
|
||||
entityName: 'opportunity',
|
||||
fields: undefined,
|
||||
where: { opportunityid: lead.evo_opportunityid || null },
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
.then(opportunities => {
|
||||
console.log(
|
||||
'opportunities',
|
||||
lead?.evo_opportunityid || '',
|
||||
opportunities,
|
||||
);
|
||||
if (opportunities) {
|
||||
calculationStore.setOptions('selectOpportunity', opportunities);
|
||||
calculationStore.setValue(
|
||||
'opportunity',
|
||||
opportunities[0] ? opportunities[0].opportunityid : null,
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
if (leadId && lead?.evo_opportunityid) {
|
||||
const opportunity = calculationStore.options.selectOpportunity?.find(
|
||||
o => o.value === lead?.evo_opportunityid,
|
||||
);
|
||||
if (opportunity) {
|
||||
calculationStore.setValue('opportunity', opportunity.value);
|
||||
} else {
|
||||
calculationStore.setValue('opportunity', null);
|
||||
}
|
||||
} else {
|
||||
calculationStore.setValue('opportunity', null);
|
||||
}
|
||||
// if (leadId && lead?.evo_opportunityid) {
|
||||
// const opportunity = calculationStore.options.selectOpportunity?.find(
|
||||
// o => o.value === lead?.evo_opportunityid,
|
||||
// );
|
||||
// if (opportunity) {
|
||||
// calculationStore.setValue('opportunity', opportunity.value);
|
||||
// } else {
|
||||
// calculationStore.setValue('opportunity', null);
|
||||
// }
|
||||
// } else {
|
||||
// calculationStore.setValue('opportunity', null);
|
||||
// }
|
||||
|
||||
if (leadId && lead) {
|
||||
calculationStore.setFilter('selectQuote', quotes => {
|
||||
return quotes.filter(q => q.evo_leadid === leadId);
|
||||
});
|
||||
} else {
|
||||
calculationStore.setFilter('selectQuote', quotes => {
|
||||
return [];
|
||||
});
|
||||
calculationStore.setValue('quote', null);
|
||||
}
|
||||
// if (leadId && lead) {
|
||||
// calculationStore.setFilter('selectQuote', quotes => {
|
||||
// return quotes.filter(q => q.evo_leadid === leadId);
|
||||
// });
|
||||
// } else {
|
||||
// calculationStore.setFilter('selectQuote', quotes => {
|
||||
// return [];
|
||||
// });
|
||||
// calculationStore.setValue('quote', null);
|
||||
// }
|
||||
},
|
||||
}),
|
||||
|
||||
|
||||
@ -18,10 +18,11 @@ function _getFakeEntities(entityName, fields?, where?, wherein?): IOption[] {
|
||||
if (Object.keys(totalWhere).length > 0)
|
||||
entities = entities.filter(entity => {
|
||||
for (let w in totalWhere) {
|
||||
return entity[w] === totalWhere[w];
|
||||
if (entity[w] !== totalWhere[w]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
return entities;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user