From 43b3c77ac14eff3cc05b63aee5d9ec08cb76f1f8 Mon Sep 17 00:00:00 2001 From: "gorbenko.pavel" Date: Tue, 13 Oct 2026 09:50:04 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D1=8F?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B2=D1=8B=D0=B1=D1=80=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=B3=D0=B0=D0=BB=D0=BE=D1=87=D0=BA=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B2=D0=BA=D0=BB=D0=B0=D0=B4=D0=BA=D0=B5=20=C2=AB?= =?UTF-8?q?=D0=92=D1=8B=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B0=20=D0=BC=D0=B0?= =?UTF-8?q?=D1=80=D1=88=D1=80=D1=83=D1=82=D0=BE=D0=B2=C2=BB=20=D0=B2=20loc?= =?UTF-8?q?alStorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- .../components/screens/RoutesExportScreen.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/webparts/approvalAdmin/components/screens/RoutesExportScreen.tsx b/frontend/src/webparts/approvalAdmin/components/screens/RoutesExportScreen.tsx index f0c5270..5407a06 100644 --- a/frontend/src/webparts/approvalAdmin/components/screens/RoutesExportScreen.tsx +++ b/frontend/src/webparts/approvalAdmin/components/screens/RoutesExportScreen.tsx @@ -3,6 +3,7 @@ import { ApprovalRouteApi } from '../../services/api'; import { PortalDictionaryClient } from '../../services/portalDictionary'; import { texts } from '../../texts'; import { useRequestTypes } from '../../hooks/useRequestTypes'; +import { useLocalStorageState } from '../../hooks/useLocalStorageState'; import { usePortalEmployees } from '../../hooks/usePortalEmployees'; import { usePortalDictionaries } from '../../hooks/usePortalDictionaries'; import { reportError } from '../../utils/errors'; @@ -15,6 +16,10 @@ export interface IRoutesExportScreenProps { dictionary?: PortalDictionaryClient; } +// Выбранные типы заявок переживают перезагрузку страницы — выгрузку обычно +// делают по одному и тому же набору типов. +const SELECTED_STORAGE_KEY = 'approvalAdmin.routesExport.selected'; + function download(blob: Blob, fileName: string): void { const url = URL.createObjectURL(blob); const link = document.createElement('a'); @@ -31,15 +36,17 @@ export const RoutesExportScreen: React.FC = ({ api, di const employees = usePortalEmployees(dictionary); const portalDictionaries = usePortalDictionaries(dictionary); - const [selected, setSelected] = React.useState([]); + const [storedSelected, setSelected] = useLocalStorageState(SELECTED_STORAGE_KEY, []); const [isBusy, setIsBusy] = React.useState(false); const [error, setError] = React.useState(); const allIds = requestTypes.items.map(rt => rt.id); + // Удалённые с тех пор типы из сохранённого выбора не считаем. + const selected = storedSelected.filter(id => allIds.indexOf(id) !== -1); const allSelected = allIds.length > 0 && allIds.every(id => selected.indexOf(id) !== -1); const toggle = (id: number, checked: boolean): void => - setSelected(current => (checked ? [...current, id] : current.filter(x => x !== id))); + setSelected(current => (checked ? [...current.filter(x => x !== id), id] : current.filter(x => x !== id))); const runExport = (): void => { setError(undefined);