diff --git a/web/src/components/RealtimeTable/Cell/EditCell/EditCell.jsx b/web/src/components/RealtimeTable/Cell/EditCell/EditCell.jsx index 696b8ef..cae8b17 100644 --- a/web/src/components/RealtimeTable/Cell/EditCell/EditCell.jsx +++ b/web/src/components/RealtimeTable/Cell/EditCell/EditCell.jsx @@ -101,6 +101,18 @@ const EditCell = memo(({ refCell, onChange, disabled, value, tableId, cellId, ta return () => observer.disconnect(); }, [state.currentValue]); + useEffect(() => { + // Небольшая задержка для гарантии, что DOM полностью готов + const timeoutId = setTimeout(() => { + if (textareaRef.current && !disabled) { + textareaRef.current.focus(); + textareaRef.current.select(); + } + }, 50); + + return () => clearTimeout(timeoutId); + }, [disabled]); + const handleSave = useCallback(() => { const { currentValue } = state; diff --git a/web/src/components/RealtimeTable/RealtimeTable.jsx b/web/src/components/RealtimeTable/RealtimeTable.jsx index 82edac6..c26ea96 100644 --- a/web/src/components/RealtimeTable/RealtimeTable.jsx +++ b/web/src/components/RealtimeTable/RealtimeTable.jsx @@ -77,6 +77,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => { error: wsError, updateCell: contextUpdateCell, addRow: contextAddRow, + deleteRow: contextDeleteRow, startEditing: contextStartEditing, addProgram: contextAddProgram, addProject: contextAddProject, diff --git a/web/src/components/RealtimeTable/utils/cellUtils.js b/web/src/components/RealtimeTable/utils/cellUtils.js index 2208601..d340080 100644 --- a/web/src/components/RealtimeTable/utils/cellUtils.js +++ b/web/src/components/RealtimeTable/utils/cellUtils.js @@ -84,12 +84,8 @@ export function updateCells(data, newRows) { ) { if (newData && typeof newData === "object") { Object.keys(newData).forEach((key) => { - if (row.data && row.data[key]) { - if (typeof row.data[key] === "object") { - row.data[key] = deepMerge(row.data[key], newData[key]); - } else { - row.data[key] = newData[key]; - } + if (row.data && row.data[key] !== undefined) { + row.data[key] = deepMerge(row.data[key], newData[key]); } else if (row[key]) { row[key] = newData[key]; } @@ -112,7 +108,6 @@ export function updateCells(data, newRows) { findAndUpdate(updatedRows); }); - return updatedRows; } @@ -216,7 +211,7 @@ export function deleteRow(data, lineId) { rows.splice(i, 1); i--; } - + if ((rowDeleteSortOrder > 0) & (row.sort_order >= rowDeleteSortOrder)) { row.sort_order = row.sort_order - 1; } diff --git a/web/src/constants/constants.jsx b/web/src/constants/constants.jsx index 65e8351..f532ec9 100644 --- a/web/src/constants/constants.jsx +++ b/web/src/constants/constants.jsx @@ -53,5 +53,6 @@ export const SHEET_NAME = { "AHR_UTILITY": "АХР Коммунальные услуги", "AHR_SECURITY": "АХР Безопасность", "OTCH9F": "Отчет 9ф", - "SMETA": "Смета" + "SMETA": "Смета", + 'STRUCTURE': 'Структура' }; \ No newline at end of file diff --git a/web/src/pages/ProjectsPage/ProjectsPage.jsx b/web/src/pages/ProjectsPage/ProjectsPage.jsx index f9e6df7..f79a6d9 100644 --- a/web/src/pages/ProjectsPage/ProjectsPage.jsx +++ b/web/src/pages/ProjectsPage/ProjectsPage.jsx @@ -76,7 +76,7 @@ export default function ProjectsPage() { useEffect(() => { if (!user) return; if (user.role_id == ROLES_NAME_ID.admin) { - SspApi.getAll({is_active: true}).then(data => { + SspApi.getAll({ is_active: true }).then(data => { if (data.success) { setProjectData(prev => ({ ...prev, 'ССП/РФ': { @@ -248,11 +248,9 @@ export default function ProjectsPage() { getItemId={(project) => project.id} getItemTitle={(project) => project.name || 'Проект'} extraActions={ - user.role_id === ROLES_NAME_ID.admin && ( - } height='2.5rem' > - Создать проект - - ) + } height='2.5rem' > + Создать проект + } filterActions={