diff --git a/web/src/constants.jsx b/web/src/constants.jsx
index 67c88df..debba14 100644
--- a/web/src/constants.jsx
+++ b/web/src/constants.jsx
@@ -28,3 +28,15 @@ export const EDIT_ACCESS_RUSSIAN = {
2: 'Только просмотр',
3: 'Просмотр и редактирование',
};
+
+export const SHEET_NAME = {
+ "AHR": "АХР",
+ "CAP": "КВП",
+ "OPER": "Операц",
+ "AHR_LIMIT": "АХР Лимиты",
+ "AHR_RENT": "АХР Аренда",
+ "AHR_UTILITY": "АХР Коммунальные услуги",
+ "AHR_SECURITY": "АХР Безопасность",
+ "OTCH9F": "Отчет 9ф",
+ "SMETA": "Смета"
+};
\ No newline at end of file
diff --git a/web/src/pages/FormPage.jsx b/web/src/pages/FormPage.jsx
index 84d3bf0..8387663 100644
--- a/web/src/pages/FormPage.jsx
+++ b/web/src/pages/FormPage.jsx
@@ -254,10 +254,12 @@ export default function FormPage() {
if (!form) {
return (
Эта форма не существует
@@ -268,13 +270,15 @@ export default function FormPage() {
<>
{form &&
}
-
-
+
+
Таблицы
}>
@@ -283,8 +287,8 @@ export default function FormPage() {
-
-
+
+
Отменить
@@ -349,22 +353,26 @@ export default function FormPage() {
value={newTableName}
onChange={(e) => setNewTableName(e.target.value)}
/>
-
{
setNewTableIsProject(e.target.checked ? true : false);
}}
- >
-
+ />
+
Проектная таблица
-
-
+
+
>
);
-}
+}
\ No newline at end of file
diff --git a/web/src/pages/StyledForPage.jsx b/web/src/pages/StyledForPage.jsx
index a482dc5..7db3b82 100644
--- a/web/src/pages/StyledForPage.jsx
+++ b/web/src/pages/StyledForPage.jsx
@@ -7,7 +7,7 @@ const PageContainer = styled.div`
flex-direction: column;
gap: 1.5rem;
background-color: Grey Light;
- /* height: calc(100vh - 3.75rem); */
+ height: 100%;
`;
const TasksContainer = styled.div`
diff --git a/web/src/pages/TaskPage/TaskPage.jsx b/web/src/pages/TaskPage/TaskPage.jsx
index c1c9aea..87d47c9 100644
--- a/web/src/pages/TaskPage/TaskPage.jsx
+++ b/web/src/pages/TaskPage/TaskPage.jsx
@@ -22,6 +22,7 @@ import { ModalCreateProject } from './ModalCreateProject';
import { downloadFile } from '../../utils/downloadFile';
import { ExportWithTextButton } from '../../components/common/Buttons/ButtonsActions';
import TablesList from '../../components/common/TableList/TableList';
+import { SHEET_NAME } from '../../constants';
const TaskInfo = ({ task }) => {
const formattedDateRange = `${formatDate(task.start_date)} — ${formatDate(task.end_date)}`;
@@ -58,41 +59,11 @@ export default function TaskPage() {
const [projects, setProjects] = useState([]);
useEffect(() => {
- if (!task) return;
- const fetchProjects = async () => {
- try {
- const { success, result } = await FormsApi.getProjects(task.form_id);
- success
- ? setTempProjects(result)
- : toast.error('Ошибка получения проекта');
- } catch {
- toast.error('Ошибка получения проекта');
- }
- };
-
- fetchProjects();
- }, [task]);
-
- useEffect(() => {
- if (!taskId) return;
- const fetchProjects = async () => {
- try {
- const { success, result } = await TasksApi.getProjects(taskId);
- success ? setProjects(result) : toast.error('Ошибка получения проекта');
- } catch {
- toast.error('Ошибка получения проекта');
- }
- };
-
- fetchProjects();
- }, [taskId]);
-
- useEffect(() => {
- const getTaskInfo = async () => {
+ const getSheets = async () => {
setIsLoading(true);
try {
- const data = await TasksApi.getTask(id);
- setTask(data);
+ const data = await TasksApi.getSheets(id);
+ setTables(data.result.sheets.map(table => ({ name: SHEET_NAME[table], sheet: table })));
} catch (error) {
toast.error(
error?.response?.data?.detail || 'Ошибка получения данных задачи',
@@ -104,54 +75,17 @@ export default function TaskPage() {
};
if (Number.isFinite(id)) {
- getTaskInfo();
+ getSheets();
}
}, [id]);
- useEffect(() => {
- const loadTaskTables = async () => {
- setIsLoading(true);
- try {
- const data = await TablesApi.listByTask(id);
- setTables(data.tables);
- } catch (error) {
- toast.error(
- error?.response?.data?.detail || 'Ошибка загрузки таблиц задачи',
- );
- } finally {
- setIsLoading(false);
- }
- };
-
- if (task) {
- loadTaskTables();
- }
- }, [task, id]);
-
const handleCreateProject = (projectData) => {
- TasksApi.createProjectTable(taskId, {
- form_id: task.form_id,
- id: tempProjects[0].id,
- //если есть в projectData есть Название проекта то записываем в name
- name: projectData['Название проекта'] || 'Проект задачи',
- add_projects_data: { ...projectData },
- })
- .then((data) => {
- if (data.success) {
- setProjects((prev) => [...prev, data.result.project]);
- setTables((prev) => [...prev, ...data.result.tables]);
- return;
- }
- toast.error('ошибка при создании проекта');
- })
- .catch(() => {
- toast.error('ошибка при создании проекта');
- });
+
};
// Фильтруем таблицы по query
const filteredTables = tables.filter((item) =>
- item.name?.toLowerCase().includes(query.toLowerCase()),
+ item.name.toLowerCase().includes(query.toLowerCase()),
);
if (isLoading) {
@@ -162,19 +96,6 @@ export default function TaskPage() {
);
}
- if (!task) {
- return (
-
- Задачи не существует
-
- );
- }
-
const handleExport = async () => {
try {
const response = await TasksApi.exportTask(taskId);
@@ -186,15 +107,17 @@ export default function TaskPage() {
return (
<>
-
+ {/* */}
-
-
+
+
Выберите таблицу
}>
@@ -203,32 +126,14 @@ export default function TaskPage() {
-
+
-
- {tempProjects.length > 0 && (
- <>
- {
- setModalProjectOpen(true);
- }}
- >
- Добавить проект
-
- {
- setModalProjectOpen(false);
- }}
- config={tempProjects[0].add_projects_data}
- onCreate={handleCreateProject}
- />
- >
- )}
+
+
- {/*
- {filteredTables.length === 0 && (
-
- {query
- ? 'Ничего не найдено'
- : 'Нет таблиц. Создайте новую, чтобы начать.'}
-
- )}
- {filteredTables.map(
- (table) => table.project_id === null && renderTableCard(table),
- )}
- {projects.map((project) => {
- return (
-
-
- {project.add_projects_data['Название проекта'] ||
- 'Без названия'}
-
- {filteredTables
- .filter((t) => t.project_id == project.id)
- .map((table) => renderTableCard(table))}
-
- );
- })}
- */}
diff --git a/web/src/pages/TasksPage.jsx b/web/src/pages/TasksPage.jsx
index 5b1fb6a..62453a5 100644
--- a/web/src/pages/TasksPage.jsx
+++ b/web/src/pages/TasksPage.jsx
@@ -119,24 +119,17 @@ export default function TasksPage() {
try {
const skip = (currentPage - 1) * currentLimit;
const params = {
- skip: skip,
+ offset: skip,
limit: currentLimit,
};
- const data = await TasksApi.list(params);
+ const res = await TasksApi.list(params);
+ const data = res.result;
+
+
+ setItems(data);
+ setTotalCount(res.count);
- setItems((prev) => {
- if (prev.length < currentLimit * currentPage) {
- return [...prev, ...data];
- }
- return prev;
- });
- if (data.length !== currentLimit) {
- setTotalCount((prev) => data.length + prev - currentLimit);
- setisLoadAll(true);
- } else {
- setTotalCount(data.length + currentLimit * currentPage);
- }
} catch (error) {
toast.error('Ошибка загрузки задач');
} finally {
@@ -183,11 +176,6 @@ export default function TasksPage() {
setExportList([]);
}, [exportMode]);
- // Фильтруем задачи по query
- // const filteredItems = items.filter((item) =>
- // item.title?.toLowerCase().includes(query.toLowerCase()),
- // );
-
const handleChangeToExportList = (taskId, checked) => {
if (checked) {
setExportList((prev) => [...prev, taskId]);
@@ -219,7 +207,6 @@ export default function TasksPage() {
-
{exportMode && Выделено задач: {exportList.length}}
@@ -268,14 +255,7 @@ export default function TasksPage() {
) : (
<>
- {/* {filteredItems.length === 0 && (
-
- {query
- ? 'Ничего не найдено'
- : 'Нет задач. Создайте новую, чтобы начать.'}
-
- )} */}
- {items.slice((page - 1) * limit, page * limit).map((t) => (
+ {items.map((t) => (
Название задачи
- handleFormChange('title', e.target.value)}
- />
+ /> */}
@@ -394,7 +374,7 @@ export default function TasksPage() {
size="small"
options={forms}
noOptionsText="Не найдено"
- getOptionLabel={(option) => option.title || option.name || ''}
+ getOptionLabel={(option) => option.title || option.name || option.form_type_code || ''}
value={forms.find((f) => f.id === formData.formId) || null}
onChange={(event, newValue) => {
handleFormChange('formId', newValue ? newValue.id : '');
@@ -428,7 +408,7 @@ export default function TasksPage() {
ССП/Региональный филиал
-
+ /> */}