diff --git a/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx b/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx index a6e1619..d6d26d7 100644 --- a/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx +++ b/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx @@ -49,7 +49,6 @@ export const TreeFilterDropdown: React.FC = ({ if (isMatch || filteredChildren.length > 0) { return { ...node, - // ВАЖНО: мы оставляем родителя, но обрезаем его детей до найденных children: filteredChildren.length > 0 ? filteredChildren : undefined, }; } @@ -142,6 +141,14 @@ export const TreeFilterDropdown: React.FC = ({ if (info.checked) { newKeys.add(node.key); childrens?.forEach((elem) => newKeys.add(elem)); + const parentNode = findParentByKey(treeData, node.key); + if (parentNode?.key) { + const childrens = getAllDescendants(parentNode as OptionType); + const isAllChildrenSelected = childrens.every((childKey) => newKeys.has(childKey)); + if(!isAllChildrenSelected){ + newKeys.delete(parentNode.key) + } + } } else { const parentNode = findParentByKey(treeData, node.key); if (parentNode?.key) { diff --git a/web/src/widgets/ConsolidatedChessContent/ConsolidatedChessContent.tsx b/web/src/widgets/ConsolidatedChessContent/ConsolidatedChessContent.tsx index b1ca29d..09fa07d 100644 --- a/web/src/widgets/ConsolidatedChessContent/ConsolidatedChessContent.tsx +++ b/web/src/widgets/ConsolidatedChessContent/ConsolidatedChessContent.tsx @@ -72,9 +72,11 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => { return () => document.removeEventListener('fullscreenchange', handleFullscreenChange); }, []); + const isHalfFiltered = (debit.length > 0 && credit.length === 0) || (debit.length === 0 && credit.length > 0); + const loadData = useCallback( async (vId: string, dIds: string[], cIds: string[], isActual: () => boolean) => { - if ((dIds.length > 0 && cIds.length === 0) || (dIds.length === 0 && cIds.length > 0)) { + if (isHalfFiltered) { notification.info({ description: 'Для сравнений по Дт и Кт нужно заполнить оба фильтра' }); return; } @@ -99,7 +101,7 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => { } } }, - [notification], + [notification, isHalfFiltered], ); const loadResData = useCallback( async (vid: string) => { @@ -252,7 +254,7 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => { />
-