fix run selectModel filter reaction

This commit is contained in:
Chika 2021-06-08 13:40:52 +03:00
parent 1d41272600
commit 7f9673e79c

View File

@ -1686,34 +1686,33 @@ const reactionEffects: IReactionEffect[] = [
leaseObjectType ? ElementStatus.Default : ElementStatus.Disabled,
);
if (calculationStore.getOptions('selectBrand'))
calculationStore.setFilter('selectBrand', options =>
options.filter(
compose(
option => {
if (
product &&
product.evo_brands &&
product.evo_brands.length > 0
) {
return (
product.evo_brands
.map(x => x.evo_brandid)
.includes(option.evo_brandid) && option
);
}
return option;
},
calculationStore.setFilter('selectBrand', options =>
options.filter(
compose(
option => {
if (
product &&
product.evo_brands &&
product.evo_brands.length > 0
) {
return (
product.evo_brands
.map(x => x.evo_brandid)
.includes(option.evo_brandid) && option
);
}
return option;
},
option =>
option.evo_vehicle_type &&
intersection(
option.evo_vehicle_type?.filter(x => x > 0),
leaseObjectType.evo_vehicle_type,
).length > 0,
),
option =>
option.evo_vehicle_type &&
intersection(
option.evo_vehicle_type?.filter(x => x > 0),
leaseObjectType.evo_vehicle_type,
).length > 0,
),
);
),
);
},
options: {
fireImmediately: true,
@ -1722,7 +1721,10 @@ const reactionEffects: IReactionEffect[] = [
calculationStore => ({
expression: () => {
return calculationStore.getOption('selectBrand');
return {
selectBrandOptions: calculationStore.getOption('selectBrand'),
selectBrandFilter: calculationStore.getFilter('selectBrand'),
};
},
effect: () => {
const leaseObjectType = calculationStore.getOption(