Compare commits
3 Commits
b23f2d0d1c
...
5498bf4935
| Author | SHA1 | Date | |
|---|---|---|---|
| 5498bf4935 | |||
|
|
f3473677d6 | ||
|
|
0acf66b2b5 |
@ -101,6 +101,18 @@ const EditCell = memo(({ refCell, onChange, disabled, value, tableId, cellId, ta
|
|||||||
return () => observer.disconnect();
|
return () => observer.disconnect();
|
||||||
}, [state.currentValue]);
|
}, [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 handleSave = useCallback(() => {
|
||||||
const { currentValue } = state;
|
const { currentValue } = state;
|
||||||
|
|
||||||
|
|||||||
@ -77,6 +77,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
error: wsError,
|
error: wsError,
|
||||||
updateCell: contextUpdateCell,
|
updateCell: contextUpdateCell,
|
||||||
addRow: contextAddRow,
|
addRow: contextAddRow,
|
||||||
|
deleteRow: contextDeleteRow,
|
||||||
startEditing: contextStartEditing,
|
startEditing: contextStartEditing,
|
||||||
addProgram: contextAddProgram,
|
addProgram: contextAddProgram,
|
||||||
addProject: contextAddProject,
|
addProject: contextAddProject,
|
||||||
|
|||||||
@ -84,12 +84,8 @@ export function updateCells(data, newRows) {
|
|||||||
) {
|
) {
|
||||||
if (newData && typeof newData === "object") {
|
if (newData && typeof newData === "object") {
|
||||||
Object.keys(newData).forEach((key) => {
|
Object.keys(newData).forEach((key) => {
|
||||||
if (row.data && row.data[key]) {
|
if (row.data && row.data[key] !== undefined) {
|
||||||
if (typeof row.data[key] === "object") {
|
row.data[key] = deepMerge(row.data[key], newData[key]);
|
||||||
row.data[key] = deepMerge(row.data[key], newData[key]);
|
|
||||||
} else {
|
|
||||||
row.data[key] = newData[key];
|
|
||||||
}
|
|
||||||
} else if (row[key]) {
|
} else if (row[key]) {
|
||||||
row[key] = newData[key];
|
row[key] = newData[key];
|
||||||
}
|
}
|
||||||
@ -112,7 +108,6 @@ export function updateCells(data, newRows) {
|
|||||||
|
|
||||||
findAndUpdate(updatedRows);
|
findAndUpdate(updatedRows);
|
||||||
});
|
});
|
||||||
|
|
||||||
return updatedRows;
|
return updatedRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,5 +53,6 @@ export const SHEET_NAME = {
|
|||||||
"AHR_UTILITY": "АХР Коммунальные услуги",
|
"AHR_UTILITY": "АХР Коммунальные услуги",
|
||||||
"AHR_SECURITY": "АХР Безопасность",
|
"AHR_SECURITY": "АХР Безопасность",
|
||||||
"OTCH9F": "Отчет 9ф",
|
"OTCH9F": "Отчет 9ф",
|
||||||
"SMETA": "Смета"
|
"SMETA": "Смета",
|
||||||
|
'STRUCTURE': 'Структура'
|
||||||
};
|
};
|
||||||
@ -76,7 +76,7 @@ export default function ProjectsPage() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!user) return;
|
if (!user) return;
|
||||||
if (user.role_id == ROLES_NAME_ID.admin) {
|
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) {
|
if (data.success) {
|
||||||
setProjectData(prev => ({
|
setProjectData(prev => ({
|
||||||
...prev, 'ССП/РФ': {
|
...prev, 'ССП/РФ': {
|
||||||
@ -248,11 +248,9 @@ export default function ProjectsPage() {
|
|||||||
getItemId={(project) => project.id}
|
getItemId={(project) => project.id}
|
||||||
getItemTitle={(project) => project.name || 'Проект'}
|
getItemTitle={(project) => project.name || 'Проект'}
|
||||||
extraActions={
|
extraActions={
|
||||||
user.role_id === ROLES_NAME_ID.admin && (
|
<PrimaryButton onClick={openModal} startIcon={<WhitePlus />} height='2.5rem' >
|
||||||
<PrimaryButton onClick={openModal} startIcon={<WhitePlus />} height='2.5rem' >
|
Создать проект
|
||||||
Создать проект
|
</PrimaryButton>
|
||||||
</PrimaryButton>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
filterActions={
|
filterActions={
|
||||||
<Box sx={{ display: 'flex', gap: 1.5, flexWrap: 'wrap', alignItems: 'center', height: '2.5rem' }}>
|
<Box sx={{ display: 'flex', gap: 1.5, flexWrap: 'wrap', alignItems: 'center', height: '2.5rem' }}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user