This commit is contained in:
vchikalkin 2022-04-15 15:13:06 +03:00
commit 3e75a4d2dd
6 changed files with 85 additions and 20 deletions

4
.env
View File

@ -1,3 +1,5 @@
REACT_APP_COLOR_PRIMARY=#BF3676
REACT_APP_COLOR_SECONDARY=#FD4047
REACT_APP_COLOR_TERTIARTY=#FF9112
REACT_APP_COLOR_TERTIARTY=#FF9112
WDS_SOCKET_HOST=localhost

View File

@ -8,6 +8,7 @@ import Layout from './Layout';
message.config({
top: 70,
maxCount: 3,
});
function App() {

View File

@ -1,7 +1,6 @@
import { notification } from 'antd';
import { ArgsProps, NotificationInstance } from 'antd/lib/notification';
import { NOTIFICATION_DEBOUNCE } from 'core/constants/debounce';
import { debounce } from 'lodash';
const defaultOptions: Partial<ArgsProps> = {
placement: 'bottomRight',
@ -11,7 +10,9 @@ type NotificationOptions = ArgsProps & {
type: keyof NotificationInstance;
};
export const openNotification = debounce((options: NotificationOptions) => {
if (!options.key) options.key = JSON.stringify(options);
notification[options.type]({ ...defaultOptions, ...options });
}, NOTIFICATION_DEBOUNCE);
export const openNotification = (options: NotificationOptions) => {
setTimeout(() => {
if (!options.key) options.key = JSON.stringify(options);
notification[options.type]({ ...defaultOptions, ...options });
}, NOTIFICATION_DEBOUNCE);
};

View File

@ -1142,10 +1142,28 @@ const reactionEffects: IReactionEffect[] = [
calculationStore => ({
expression: () => {
const { product, leasingPeriod, deliveryTime } = calculationStore.values;
return { product_evo_id: product, leasingPeriod, deliveryTime };
const {
product,
leasingPeriod,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
} = calculationStore.values;
return {
product_evo_id: product,
leasingPeriod,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
};
},
effect: ({ product_evo_id, leasingPeriod, deliveryTime }) => {
effect: ({
product_evo_id,
leasingPeriod,
deliveryTime,
firstPaymentPerc,
lastPaymentPerc,
}) => {
if (product_evo_id && leasingPeriod && deliveryTime) {
const product = calculationStore.getOption('selectProduct', {
evo_id: product_evo_id,
@ -1154,11 +1172,13 @@ const reactionEffects: IReactionEffect[] = [
const tarif = calculationStore.options.selectTarif?.find(
x =>
x.evo_baseproductid === product.evo_baseproductid &&
x.evo_min_period &&
x.evo_min_period <= leasingPeriod &&
x.evo_max_period &&
x.evo_max_period >= leasingPeriod &&
x.evo_delivery_time?.includes(deliveryTime),
x.evo_delivery_time?.includes(deliveryTime) &&
x.evo_min_first_payment <= firstPaymentPerc &&
x.evo_max_first_payment >= firstPaymentPerc &&
x.evo_min_last_payment <= lastPaymentPerc &&
x.evo_max_last_payment >= lastPaymentPerc,
);
calculationStore.setValue('tarif', tarif?.evo_tarifid);
}
@ -1562,18 +1582,52 @@ const reactionEffects: IReactionEffect[] = [
},
}),
/**
*
* @description
#1
* DYN-190 При выборе значения в поле selectSubsidy необходимо добавить
* фильтрацию в полях при условии что selectSubsidy не равно null:
Тип предмета лизинга selectLeaseObjectType
если с записью Субсидия нет связанных Типов предмета лизинга,
то указываются все записи согласно текущей фильтрации,
иначе указываются те записи, которые связаны с Субсидией, указанной в поле selectSubsidy
#2
* На изменение поля Продукт selectProduct добавляем фильтрацию списков:
в поле Тип предмета лизинга selectLeaseObjectType - указываются те, которые связаны с продуктом.
Если с Продуктом нет связанных Типов предмета лизинга,
то указывается весь список. Это надо добавить в текущие условия фильтрации данного поля
*/
calculationStore => ({
expression: () => {
return calculationStore.getOption('selectSubsidy');
return {
product: calculationStore.getOption('selectProduct'),
subsidy: calculationStore.getOption('selectSubsidy'),
};
},
effect: subsidy => {
effect: ({ product, subsidy }) => {
calculationStore.setFilter('selectLeaseObjectType', types =>
types.filter(
type =>
!subsidy?.evo_leasingobject_types?.length ||
subsidy.evo_leasingobject_types.filter(
x => x.evo_leasingobject_typeid === type.evo_leasingobject_typeid,
)?.length,
pipe(
type =>
(!product?.evo_leasingobject_types?.length ||
product.evo_leasingobject_types.filter(
x =>
x.evo_leasingobject_typeid ===
type?.evo_leasingobject_typeid,
)?.length) &&
type,
type =>
type &&
(!subsidy?.evo_leasingobject_types?.length ||
subsidy.evo_leasingobject_types.filter(
x =>
x.evo_leasingobject_typeid ===
type.evo_leasingobject_typeid,
)?.length),
),
),
);

View File

@ -1,3 +1,3 @@
export const DEFAULT_DEBOUNCE_DELAY = 350;
export const NOTIFICATION_DEBOUNCE = 750;
export const NOTIFICATION_DEBOUNCE = 100;
export const ACTION_DELAY = 1200;

View File

@ -172,6 +172,13 @@ query GetMainOptions(
evo_leasingobject_typeid
}
evo_delivery_time
evo_graphtype_exception
evo_seasons_type_exception
evo_min_decreasing_perc
evo_min_first_payment
evo_max_first_payment
evo_min_last_payment
evo_max_last_payment
}
selectRate: evo_rates(
statecode: $statecode