From b29b5a99ffcbb00d1c3b51a5ff58156f403dac76 Mon Sep 17 00:00:00 2001 From: AkimFeopentov2003 Date: Wed, 11 Dec 2024 19:30:54 +0300 Subject: [PATCH 01/67] =?UTF-8?q?fix:=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=20?= =?UTF-8?q?=D0=B4=D0=B0=D1=82=D1=8B=20=D0=B2=D0=BE=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D1=85=20=D0=BC=D0=B5=D1=81=D1=82=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/project/NewProjectPage.vue | 20 +++- .../src/components/project/ProjectPage.vue | 12 ++- .../src/src/components/stage/AddStagePage.vue | 8 +- .../src/components/stage/StageComponent.vue | 18 +++- .../src/src/components/task/TaskAddPage.vue | 14 ++- frontend/src/src/components/task/TaskPage.vue | 96 +++++++++++-------- frontend/src/src/store/index.js | 38 +++++++- 7 files changed, 149 insertions(+), 57 deletions(-) diff --git a/frontend/src/src/components/project/NewProjectPage.vue b/frontend/src/src/components/project/NewProjectPage.vue index 9910f63..d4eb8a2 100644 --- a/frontend/src/src/components/project/NewProjectPage.vue +++ b/frontend/src/src/components/project/NewProjectPage.vue @@ -5,9 +5,19 @@

Опишите проект

Дата начала

- +

Дата конца

- +

{{ errorMessage }}

@@ -44,7 +54,11 @@ export default { this.errorMessage = 'Пожалуйста, заполните все поля'; return; } - + // Проверка на корректность дат + if (new Date(this.endDate) < new Date(this.startDate)) { + this.errorMessage = 'Дата окончания не может быть раньше даты начала'; + return; + } const dataToSend = { name: this.projectName, description: this.projectDescription, diff --git a/frontend/src/src/components/project/ProjectPage.vue b/frontend/src/src/components/project/ProjectPage.vue index fad6245..86b624f 100644 --- a/frontend/src/src/components/project/ProjectPage.vue +++ b/frontend/src/src/components/project/ProjectPage.vue @@ -120,16 +120,18 @@ export default { start_date: this.formatToDateTime(this.dateStart), end_date: this.formatToDateTime(this.dateEnd) }; - console.log(dataToSend) + // console.log(dataToSend) try { - const res = await axios.put(`/api/projects/update/${getProjectId()}`, dataToSend, { + await axios.put(`/api/projects/update/${getProjectId()}`, dataToSend, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', }, withCredentials: true, }); - console.log(res); + this.$store.commit("addStartProject", this.dateStart); + this.$store.commit("addEndProject", this.dateEnd); + // console.log(res); } catch (error) { if(error.response.status === 401){ this.$store.commit('removeUsers'); // Изменяем состояние @@ -192,7 +194,9 @@ export default { userName: contact.username, role: contact.role, })); - console.log(this.contacts); + this.$store.commit("addStartProject", this.dateStart); + this.$store.commit("addEndProject", this.dateEnd); + // console.log(this.contacts); } catch (error) { if(error.response.status === 401){ this.$store.commit('removeUsers'); // Изменяем состояние diff --git a/frontend/src/src/components/stage/AddStagePage.vue b/frontend/src/src/components/stage/AddStagePage.vue index b9dd026..3000052 100644 --- a/frontend/src/src/components/stage/AddStagePage.vue +++ b/frontend/src/src/components/stage/AddStagePage.vue @@ -18,12 +18,16 @@ v-model="newStageStartDate" :class="{'input-error': !newStageStartDate && showErrors}" type="date" + :min="$store.getters.getStartDateProject" + :max="newStageEndDate ? newStageEndDate : $store.getters.getEndDateProject" class="stage-date-input" /> @@ -67,14 +71,14 @@ export default { end_date: this.formatToDateTime(this.newStageEndDate), }; try { - const res = await axios.post(`/api/projects/${getProjectId()}/add_stage`, dataToSend, { + await axios.post(`/api/projects/${getProjectId()}/add_stage`, dataToSend, { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', }, withCredentials: true, }); - console.log(res); + console.log(this.$store.getters.getStartDateProject); alert('Этап успешно создан!'); this.$router.push(`/stages`); } catch (error) { diff --git a/frontend/src/src/components/stage/StageComponent.vue b/frontend/src/src/components/stage/StageComponent.vue index 40da60d..38d7961 100644 --- a/frontend/src/src/components/stage/StageComponent.vue +++ b/frontend/src/src/components/stage/StageComponent.vue @@ -4,8 +4,18 @@
- - + +
@@ -141,9 +151,11 @@ export default { } }, - async goToTasks() { + goToTasks() { setStageId(this.stage.stageId); setStageName(this.stage.name); + this.$store.commit('addStartStage', this.stage.startDate); + this.$store.commit('addEndStage', this.stage.endDate); this.$router.push(`/tasks`); }, }, diff --git a/frontend/src/src/components/task/TaskAddPage.vue b/frontend/src/src/components/task/TaskAddPage.vue index cf4a84c..7044f31 100644 --- a/frontend/src/src/components/task/TaskAddPage.vue +++ b/frontend/src/src/components/task/TaskAddPage.vue @@ -28,11 +28,21 @@

Начало

- +

Конец

- +
diff --git a/frontend/src/src/components/task/TaskPage.vue b/frontend/src/src/components/task/TaskPage.vue index dcbabbe..9310c43 100644 --- a/frontend/src/src/components/task/TaskPage.vue +++ b/frontend/src/src/components/task/TaskPage.vue @@ -26,11 +26,22 @@

Начало

- +

Конец

- +
@@ -55,6 +66,7 @@
+

{{ errorMessage }}

@@ -88,6 +100,7 @@ export default { originalEndDate: "", originalStatus: "", originalTaskDescription: "", + errorMessage:"", }; }, methods: { @@ -116,12 +129,6 @@ export default { clearAllCookies(); this.$router.push("/login"); } - // if (error.code === "ERR_NETWORK") { - // this.$store.commit('removeUsers'); // Изменяем состояние - // clearAllCookies(); - // this.$router.push("/login"); - // alert("Ошибка сети проверьте соединение") - // } console.error('Ошибка при загрузке Задачи:', error); } }, @@ -144,41 +151,46 @@ export default { this.isEditing = true; }, async saveEdit() { - const dataToSend = { - name: this.taskName, - description: this.taskDescription, - status: this.status, - start_date: this.formatToDateTime(this.startDate), - end_date: this.formatToDateTime(this.endDate), - }; - console.log(dataToSend) - try { - await axios.put(`/api/tasks/update_task/${getProjectId()}/${getStageId()}/${getTaskId()}`, dataToSend, { - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - }, - withCredentials: true, - }); - this.$emit('update-stage', { ...this.stage, ...this.editStageData }); - } catch (error) { - if (error.response.status === 401) { - this.$store.commit('removeUsers'); // Изменяем состояние - clearAllCookies(); - this.$router.push("/login"); - } - console.error("Ошибка сети:", error.message); - if (error.response) { - console.error("Данные ответа:", error.response.data); - // Вывод ошибки с сервера - if (error.response.data.detail) { - this.errorMessage = error.response.data.detail; // Сохраняем ошибку с сервера + if (this.taskName && this.taskDescription && this.status && this.startDate && this.endDate) { + const dataToSend = { + name: this.taskName, + description: this.taskDescription, + status: this.status, + start_date: this.formatToDateTime(this.startDate), + end_date: this.formatToDateTime(this.endDate), + }; + console.log(dataToSend) + try { + await axios.put(`/api/tasks/update_task/${getProjectId()}/${getStageId()}/${getTaskId()}`, dataToSend, { + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, + withCredentials: true, + }); + this.$emit('update-stage', { ...this.stage, ...this.editStageData }); + } catch (error) { + if (error.response.status === 401) { + this.$store.commit('removeUsers'); // Изменяем состояние + clearAllCookies(); + this.$router.push("/login"); + } + console.error("Ошибка сети:", error.message); + if (error.response) { + console.error("Данные ответа:", error.response.data); + // Вывод ошибки с сервера + if (error.response.data.detail) { + this.errorMessage = error.response.data.detail; // Сохраняем ошибку с сервера + } } } + + // console.log("Сохранено:", this.startDate, this.endDate, this.status, this.taskDescription); + this.isEditing = false; + }else { + this.errorMessage='Пожалуйста, заполните все поля.'; } - console.log("Сохранено:", this.startDate, this.endDate, this.status, this.taskDescription); - this.isEditing = false; }, cancelEdit() { this.taskName = this.originalTaskName; @@ -325,7 +337,11 @@ export default { border-radius: 15px; cursor: pointer; } - +.error-message { + color: red; + font-weight: bold; + margin-top: 10px; +} .go-to-tasks-button:hover { background-color: #4f416d; } diff --git a/frontend/src/src/store/index.js b/frontend/src/src/store/index.js index 3297791..aba3852 100644 --- a/frontend/src/src/store/index.js +++ b/frontend/src/src/store/index.js @@ -4,7 +4,11 @@ const store = createStore({ state: { // Список пользователей user: JSON.parse(localStorage.getItem('user')) || [], - workers: JSON.parse(localStorage.getItem('worker')) || [] + workers: JSON.parse(localStorage.getItem('worker')) || [], + endDateProject: JSON.parse(localStorage.getItem('endDateProject')) || [], + startDateProject: JSON.parse(localStorage.getItem('startDateProject')) || [], + startDateStage: JSON.parse(localStorage.getItem('startDateStage')) || [], + endDateStage: JSON.parse(localStorage.getItem('endDateStage')) || [], }, mutations: { // Удаление всех пользователей @@ -24,7 +28,23 @@ const store = createStore({ addSingleWorker(state, worker) { state.workers.push(worker); // Заменяем массив только одним пользователем localStorage.setItem('worker', JSON.stringify(state.workers)); // Сохраняем в localStorage - } + }, + addEndProject(state, endProject) { + state.endDateProject = endProject; + localStorage.setItem('endDateProject', JSON.stringify(endProject)); + }, + addStartProject(state, startProject) { + state.startDateProject = startProject; + localStorage.setItem('startDateProject', JSON.stringify(startProject)); + }, + addStartStage(state, stage) { + state.startDateStage = stage; + localStorage.setItem('startDateStage', JSON.stringify(stage)); + }, + addEndStage(state, endStage) { + state.endDateStage = endStage; + localStorage.setItem('endDateStage', JSON.stringify(endStage)); + }, }, getters: { // Получение всех пользователей @@ -33,7 +53,19 @@ const store = createStore({ }, getWorkers(state) { return state.workers; - } + }, + getStartDateProject(state) { + return state.startDateProject; + }, + getEndDateProject(state) { + return state.endDateProject; + }, + getStartDateStage(state) { + return state.startDateStage; + }, + getEndDateStage(state) { + return state.endDateStage; + }, } }); From 1ba4df3b1aef87eadf30ea0d4d2c848538687612 Mon Sep 17 00:00:00 2001 From: AkimFeopentov2003 Date: Wed, 11 Dec 2024 19:43:45 +0300 Subject: [PATCH 02/67] fix: url /project/:id --- frontend/src/src/components/project/ProjectComponent.vue | 2 +- frontend/src/src/router/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/src/components/project/ProjectComponent.vue b/frontend/src/src/components/project/ProjectComponent.vue index eca2686..89d34fe 100644 --- a/frontend/src/src/components/project/ProjectComponent.vue +++ b/frontend/src/src/components/project/ProjectComponent.vue @@ -53,7 +53,7 @@ export default { // Логика перехода на страницу проекта setProjectId(this.projectId); setProjectName(this.projectName); - this.$router.push(`/project`); + this.$router.push(`/project/${this.projectName}`); }, }, }; diff --git a/frontend/src/src/router/index.js b/frontend/src/src/router/index.js index c5877d4..3f19779 100644 --- a/frontend/src/src/router/index.js +++ b/frontend/src/src/router/index.js @@ -28,7 +28,7 @@ const routes = [ { path: '/register', component: RegisterPage }, { path: '/main', component: MainPage }, { path: '/new-project', component: NewProjectPage}, - { path: '/project', component: ProjectPage}, + { path: '/project/:id', component: ProjectPage}, { path: '/stages', component: StagesPage}, { path: '/risks', component: RisksPage}, { path: '/procurements', component: ProcurementsPage}, From 017f61b7b52ca34c2805861f9957d6121a5d49d3 Mon Sep 17 00:00:00 2001 From: dlexeyn Date: Wed, 11 Dec 2024 20:59:17 +0300 Subject: [PATCH 03/67] feat: add docker-compose.dev.yml --- docker-compose.dev.yml | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 docker-compose.dev.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..feeb342 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,47 @@ +services: + db: + image: mongo:8.0.3 + container_name: mongo_db + environment: + - MONGO_INITDB_ROOT_USERNAME=admin + - MONGO_INITDB_ROOT_PASSWORD=password123 + - MONGO_INITDB_DATABASE=fastapi + volumes: + - mongo:/data/db + networks: + - app-network + + app-backend: + container_name: repair-backend + restart: on-failure + ports: + - "127.0.0.1:8000:8000" + volumes: + - "./backend:/app" + build: ./backend + depends_on: + - db + networks: + - app-network + + app-frontend: + container_name: repair-frontend + restart: on-failure + build: ./frontend + ports: + - "127.0.0.1:8080:8080" + networks: + - app-network + volumes: + - "./frontend:/app" + - "/app/node_modules" + + +volumes: + mongo: + +networks: + app-network: + driver: bridge + + From f8cf50d2652fd6e2f4c88e1899944d0ab052eb70 Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Wed, 11 Dec 2024 21:26:15 +0300 Subject: [PATCH 04/67] Update ContentComponent.vue --- .../src/src/components/ContentComponent.vue | 86 +++++++++++++++++-- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/frontend/src/src/components/ContentComponent.vue b/frontend/src/src/components/ContentComponent.vue index b05b7b8..b47548e 100644 --- a/frontend/src/src/components/ContentComponent.vue +++ b/frontend/src/src/components/ContentComponent.vue @@ -2,12 +2,32 @@
@@ -120,6 +140,60 @@ export default { border-radius: 4px; } +.filter-container { + display: flex; + align-items: center; + justify-content: flex-start; + gap: 20px; + margin-left: 20px; +} + +.date-filter, +.project-filter, +.status-filter { + display: flex; + align-items: center; + gap: 10px; +} + +.date-filter input { + margin-left: 5px; +} + +.project-filter label, +.status-filter label { + margin-right: 10px; +} + +.large-input { + padding: 10px; + margin-left: 5px; + border: 1px solid #ccc; + border-radius: 5px; + font-size: 16px; +} + +input, +select { + padding: 5px; + border: 1px solid #ccc; + border-radius: 5px; +} + +button { + background-color: #6e6b93; + color: white; + padding: 8px 15px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: 10px; +} + +button:hover { + background-color: #5c5583; +} + .projects-container { display: flex; flex-wrap: wrap; From ffaba704ab3855a4c2cf544fd64bc068fb8a1fa3 Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Wed, 11 Dec 2024 21:36:33 +0300 Subject: [PATCH 05/67] Update ContentComponent.vue --- frontend/src/src/components/ContentComponent.vue | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/frontend/src/src/components/ContentComponent.vue b/frontend/src/src/components/ContentComponent.vue index b47548e..82fbaad 100644 --- a/frontend/src/src/components/ContentComponent.vue +++ b/frontend/src/src/components/ContentComponent.vue @@ -8,15 +8,12 @@ -
-
- - -
+
+ - + +
+ +
+ + +
+ +
- @@ -167,4 +183,57 @@ export default { .add-stage-button:hover { background-color: #4e4168; } + +.filter-container { + display: flex; + align-items: center; + justify-content: flex-start; + gap: 20px; +} + +.date-filter, +.project-filter, +.status-filter { + display: flex; + align-items: center; + gap: 10px; +} + +.date-filter input { + margin-left: 5px; +} + +.project-filter label, +.status-filter label { + margin-right: 10px; +} + +.large-input { + padding: 10px; + margin-left: 5px; + border: 1px solid #ccc; + border-radius: 5px; + font-size: 16px; +} + +input, +select { + padding: 5px; + border: 1px solid #ccc; + border-radius: 5px; +} + +button { + background-color: #6e6b93; + color: white; + padding: 8px 15px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: 10px; +} + +button:hover { + background-color: #5c5583; +} From 3c9fecf0639f6b2276f137bd39bb0b0cfd4a999a Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:25:36 +0300 Subject: [PATCH 07/67] Update RisksPage.vue --- .../src/src/components/risk/RisksPage.vue | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/frontend/src/src/components/risk/RisksPage.vue b/frontend/src/src/components/risk/RisksPage.vue index e213a58..b2465f1 100644 --- a/frontend/src/src/components/risk/RisksPage.vue +++ b/frontend/src/src/components/risk/RisksPage.vue @@ -7,7 +7,24 @@
@@ -176,4 +193,57 @@ sidebar-component { border: 1px solid #ccc; border-radius: 4px; } + +.filter-container { + display: flex; + align-items: center; + justify-content: flex-start; + gap: 20px; +} + +.date-filter, +.project-filter, +.status-filter { + display: flex; + align-items: center; + gap: 10px; +} + +.date-filter input { + margin-left: 5px; +} + +.project-filter label, +.status-filter label { + margin-right: 10px; +} + +.large-input { + padding: 10px; + margin-left: 5px; + border: 1px solid #ccc; + border-radius: 5px; + font-size: 16px; +} + +input, +select { + padding: 5px; + border: 1px solid #ccc; + border-radius: 5px; +} + +button { + background-color: #6e6b93; + color: white; + padding: 8px 15px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: 10px; +} + +button:hover { + background-color: #5c5583; +} From 1cbcac679f6d8141b57abbecb42c56918f24268c Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:26:21 +0300 Subject: [PATCH 08/67] Update ProcurementsPage.vue --- .../components/material/ProcurementsPage.vue | 82 +++++++++++++++++-- 1 file changed, 76 insertions(+), 6 deletions(-) diff --git a/frontend/src/src/components/material/ProcurementsPage.vue b/frontend/src/src/components/material/ProcurementsPage.vue index 2d51e48..467204e 100644 --- a/frontend/src/src/components/material/ProcurementsPage.vue +++ b/frontend/src/src/components/material/ProcurementsPage.vue @@ -9,12 +9,29 @@
- +
+
+ + - + +
+ +
+ + +
+ +
@@ -153,4 +170,57 @@ export default { .materials-list { margin-top: 20px; } + +.filter-container { + display: flex; + align-items: center; + justify-content: flex-start; + gap: 20px; +} + +.date-filter, +.project-filter, +.status-filter { + display: flex; + align-items: center; + gap: 10px; +} + +.date-filter input { + margin-left: 5px; +} + +.project-filter label, +.status-filter label { + margin-right: 10px; +} + +.large-input { + padding: 10px; + margin-left: 5px; + border: 1px solid #ccc; + border-radius: 5px; + font-size: 16px; +} + +input, +select { + padding: 5px; + border: 1px solid #ccc; + border-radius: 5px; +} + +button { + background-color: #6e6b93; + color: white; + padding: 8px 15px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: 10px; +} + +button:hover { + background-color: #5c5583; +} From 399ce6d9a17c94cc5f390afa35d3a234b01c4181 Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:27:50 +0300 Subject: [PATCH 09/67] Update TasksListPage.vue --- .../src/src/components/task/TasksListPage.vue | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/frontend/src/src/components/task/TasksListPage.vue b/frontend/src/src/components/task/TasksListPage.vue index 99faee9..c9227b7 100644 --- a/frontend/src/src/components/task/TasksListPage.vue +++ b/frontend/src/src/components/task/TasksListPage.vue @@ -2,11 +2,19 @@
-

Задачи этапа: {{ stageName }}

+
+

Задачи этапа: {{ stageName }}

+ +
-
+
@@ -17,8 +25,8 @@ -
- +
@@ -48,7 +56,7 @@ import HeaderComponent from '../bars/HeaderComponent.vue'; import SidebarComponent from '../bars/SidebarComponent.vue'; import axios from 'axios'; import {clearAllCookies, useCookies} from '@/src/js/useCookies'; -const { getProjectId, getStageId, getStageName,setTaskId } = useCookies(); +const { getProjectId, getStageId, getStageName, setTaskId } = useCookies(); export default { components: { @@ -59,11 +67,18 @@ export default { return { taskName: '', stageName: getStageName(), - tasks: [ - ], - selectedTaskId: null // для отслеживания выбранной задачи + tasks: [], + selectedTaskId: null, // для отслеживания выбранной задачи + searchQuery: '' // для поиска задачи по названию }; }, + computed: { + filteredTasks() { + return this.tasks.filter(task => + task.taskName.toLowerCase().includes(this.searchQuery.toLowerCase()) + ); + } + }, methods: { addTask() { this.$router.push(`/add_task`); // переход на страницу новой задачи @@ -89,7 +104,6 @@ export default { console.error(error); } } - }, viewTask() { setTaskId(this.selectedTaskId); @@ -137,6 +151,19 @@ export default { margin-top: 60px; } +.search-input { + width: 300px; + padding-left: 10px; + font-size: 16px; + border: 1px solid #ccc; + border-radius: 4px; +} + +.search-header{ + gap: 20px; + display: flex; +} + .task-table { width: 100%; border-collapse: collapse; From b9a38ac1cc2da76194294610b8653ad4556ca3c0 Mon Sep 17 00:00:00 2001 From: dlexeyn Date: Wed, 11 Dec 2024 22:55:38 +0300 Subject: [PATCH 10/67] feat: add inner port for bd in docker-compose.dev.yml --- docker-compose.dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index feeb342..4094e7f 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -8,6 +8,8 @@ services: - MONGO_INITDB_DATABASE=fastapi volumes: - mongo:/data/db + ports: + - "27017:27017" networks: - app-network From bd4acc3caf426ba8afde37821869951aa70c393c Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:08:00 +0300 Subject: [PATCH 11/67] Update TaskCard.vue --- .../src/components/main_content/TaskCard.vue | 260 +++++++++--------- 1 file changed, 128 insertions(+), 132 deletions(-) diff --git a/frontend/src/src/components/main_content/TaskCard.vue b/frontend/src/src/components/main_content/TaskCard.vue index 5e66506..67dc0a0 100644 --- a/frontend/src/src/components/main_content/TaskCard.vue +++ b/frontend/src/src/components/main_content/TaskCard.vue @@ -1,143 +1,136 @@ - - - \ No newline at end of file + From 5e27567657b8fc2b3ad67981934196c9e4e1a1e6 Mon Sep 17 00:00:00 2001 From: AkimFeopentov2003 Date: Wed, 11 Dec 2024 23:14:41 +0300 Subject: [PATCH 12/67] =?UTF-8?q?fix:=20url=20/project/:id=20=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=B9=20=D1=80=D0=B5=D0=BB=D0=B8=D0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/src/components/bars/SidebarComponent.vue | 9 +++++---- frontend/src/src/components/message/AddContactPage.vue | 6 +++--- .../src/src/components/project/ContactsComponent.vue | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/frontend/src/src/components/bars/SidebarComponent.vue b/frontend/src/src/components/bars/SidebarComponent.vue index a74c5f6..cf367ab 100644 --- a/frontend/src/src/components/bars/SidebarComponent.vue +++ b/frontend/src/src/components/bars/SidebarComponent.vue @@ -36,7 +36,8 @@ From a9aca5b5b4f99e51d81d52bc6f1d48f5a12da4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=93=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Thu, 12 Dec 2024 15:34:48 +0300 Subject: [PATCH 42/67] =?UTF-8?q?fix:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=20=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=83?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BA=D1=83=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/dao/project.py | 11 ++++++++--- backend/routers/procurement.py | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/backend/dao/project.py b/backend/dao/project.py index caf1396..6474d61 100644 --- a/backend/dao/project.py +++ b/backend/dao/project.py @@ -7,7 +7,7 @@ from schemas.project import ProjectCreate, ProjectResponse, Procurement, ProjectStatus, Stage, Risk, ProcurementResponse, \ RiskResponse, \ StageResponse, ProjectUpdate, RiskUpdate, ProcurementUpdate, StageUpdate -from schemas.user import User, Contact, ContactResponse +from schemas.user import Role, User, Contact, ContactResponse from schemas.utils import object_id_to_str, generate_id, get_date_now @@ -172,7 +172,7 @@ async def delete_procurement(cls, project_id: str, procurement_id: str) -> str | ) @classmethod - async def get_procurements_by_project_id(cls, project_id: str, name: str = "", state: bool = None, + async def get_procurements_by_project_id(cls, project_id: str, name: str = "", creator_role: Role = None, state: bool = None, start_date: datetime = None, end_date: datetime = None) -> list[ProcurementResponse] | list[None] | None: procurements = [] @@ -185,6 +185,11 @@ async def get_procurements_by_project_id(cls, project_id: str, name: str = "", s else: name_match = True + if creator_role: + role_match = procurement["created_by"]["role"] == creator_role + else: + role_match = True + if state is not None: state_match = procurement["inStock"] == state else: @@ -201,7 +206,7 @@ async def get_procurements_by_project_id(cls, project_id: str, name: str = "", s else: end_date_match = True - if name_match and state_match and start_date_match and end_date_match: + if name_match and state_match and role_match and start_date_match and end_date_match: procurements.append( ProcurementResponse(id=procurement_id, **procurement) ) diff --git a/backend/routers/procurement.py b/backend/routers/procurement.py index a4892a6..fb7eb66 100644 --- a/backend/routers/procurement.py +++ b/backend/routers/procurement.py @@ -3,7 +3,7 @@ from dao.project import ProjectDao from schemas.project import ProjectResponse, Procurement, ProcurementResponse, ProcurementUpdate -from schemas.user import Contact, User +from schemas.user import Contact, Role, User from utils.role import get_foreman_role from utils.token import get_current_user @@ -26,10 +26,10 @@ async def add_procurement(project_id: str, procurement_data: Procurement, forema @router.get("/{project_id}/get_procurements", response_model=dict[str, list[ProcurementResponse] | list[None]]) -async def get_procurements(project_id: str, name: str = "", state: bool = None, - start_date: datetime = None, end_date: datetime = None, +async def get_procurements(project_id: str, name: str = "", creator_role: Role = None, + state: bool = None, start_date: datetime = None, end_date: datetime = None, user: User = Depends(get_current_user)): - procurements = await ProjectDao.get_procurements_by_project_id(project_id, name, state, start_date, end_date) + procurements = await ProjectDao.get_procurements_by_project_id(project_id, name, creator_role, state, start_date, end_date) if procurements is None: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, From 83e9f0fc9c0e884c6a00dd6566bb26fe6e0f3828 Mon Sep 17 00:00:00 2001 From: Sochkov Ilya Semenovich <90711926+IlyaSochkov@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:36:28 +0300 Subject: [PATCH 43/67] Update ProcurementsPage.vue --- .../components/material/ProcurementsPage.vue | 121 +++++++++++------- 1 file changed, 73 insertions(+), 48 deletions(-) diff --git a/frontend/src/src/components/material/ProcurementsPage.vue b/frontend/src/src/components/material/ProcurementsPage.vue index 0f089d4..8e6bffa 100644 --- a/frontend/src/src/components/material/ProcurementsPage.vue +++ b/frontend/src/src/components/material/ProcurementsPage.vue @@ -1,39 +1,54 @@ @@ -57,13 +46,11 @@ export default { }, data() { return { - jsonData:[], lastname: '', name: '', middelname: '', selectedRole: '', - users: [ - ], + users: [], }; }, computed: { @@ -73,124 +60,21 @@ export default { }, }, methods: { - triggerFileInput() { - this.$refs.fileInput.click(); - }, - async importBD(event) { - const file = event.target.files[0]; - if (!file) { - alert("Файл не выбран!"); - return; - } - - const reader = new FileReader(); - - reader.onload = async (e) => { - try { - const importedData = JSON.parse(e.target.result); - - // Проверяем наличие поля `users` и его содержимого - if (!importedData.user || !Array.isArray(importedData.user) || importedData.user.length === 0) { - throw new Error("Коллекция `user` должна существовать и содержать данные!"); - } - - const formData = new FormData(); - formData.append("file", file); - - // Удаляем `Content-Type` из заголовков, так как браузер сам установит правильный - try { - const res = await axios.post(`api/data/import`, formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - withCredentials: true, - }); - console.log(res); - this.showErrors = false; - alert('Данные успешно импортированы!'); - } catch (error) { - if (error.response && error.response.status === 401) { - this.$store.commit('removeUsers'); // Изменяем состояние - clearAllCookies(); - this.$router.push("/login"); - } - if (error.response && error.response.status === 400) { - alert('Бд не пуста'); - } - console.error("Ошибка сети:", error); - if (error.response && error.response.data.detail) { - this.errorMessage = error.response.data.detail; - } - } - } catch (error) { - console.error("Ошибка импорта:", error); - alert(error.message || "Произошла ошибка при импорте данных."); - } - }; - - reader.onerror = () => { - alert("Ошибка чтения файла!"); - }; - - reader.readAsText(file); - }, - async exportBD() { - try { - const response = await axios.get(`api/data/export/json`); - this.jsonData = response.data; - } catch (error) { - if (error.response?.status === 401) { - this.$store.commit('removeUsers'); - clearAllCookies(); - this.$router.push("/login"); - } - console.error('Ошибка при загрузке контактов:', error); - if (error.response?.data?.detail) { - this.errorMessage = error.response.data.detail; - } - return; - } - - console.log(this.jsonData); - - if (Object.keys(this.jsonData).length > 0) { - // Преобразуем Proxy в обычный объект, если требуется - const normalizedData = JSON.parse(JSON.stringify(this.jsonData)); - - const json = JSON.stringify(normalizedData, null, 2); // Преобразуем объект в JSON строку - const blob = new Blob([json], { type: "application/json" }); // Создаём Blob объект - const url = URL.createObjectURL(blob); // Генерируем URL - - // Создаём временный элемент для скачивания файла - const link = document.createElement("a"); - link.href = url; - link.download = `dumpBd.json`; // Имя файла - document.body.appendChild(link); // Добавляем в DOM, чтобы клик сработал - link.click(); // Программно кликаем по ссылке - document.body.removeChild(link); // Удаляем элемент ссылки из DOM - - // Освобождаем память - URL.revokeObjectURL(url); - } else { - alert("У вас нет данных БД, которые можно экспортировать"); - } - }, async searchUsers() { this.users = []; try { - const params = new URLSearchParams({ - }); + const params = new URLSearchParams({}); if (this.selectedRole) { params.append('role', this.selectedRole); } - if(this.name){ + if (this.name) { params.append('name', this.name); } if (this.middelname) { - params.append('middlename', this.middlename); + params.append('middlename', this.middelname); } - if(this.lastname){ + if (this.lastname) { params.append('lastname', this.lastname); } const response = await axios.get(`/api/user/find/?${params.toString()}`); @@ -202,7 +86,7 @@ export default { role: user.role, })); } catch (error) { - if(error.response.status === 401){ + if (error.response.status === 401) { this.$store.commit('removeUsers'); clearAllCookies(); this.$router.push("/login"); @@ -219,6 +103,13 @@ export default { setChatId(""); this.$router.push(`/chat`); }, + resetFilters() { + this.lastname = ''; + this.name = ''; + this.middelname = ''; + this.selectedRole = ''; + this.searchUsers(); + } }, }; @@ -229,13 +120,6 @@ export default { padding-top: 60px; } -.header-buttons { - display: flex; - align-items: center; - gap: 15px; - margin-bottom: 50px; -} - .search-filters { display: flex; gap: 15px; @@ -289,7 +173,6 @@ export default { gap: 10px; } -.header-buttons button, .user-item button { background-color: #625b71; color: #fff; @@ -323,4 +206,4 @@ export default { .search-filters button:active { transform: scale(1); } - + \ No newline at end of file diff --git a/frontend/src/src/router/index.js b/frontend/src/src/router/index.js index 3f19779..f5d8bc7 100644 --- a/frontend/src/src/router/index.js +++ b/frontend/src/src/router/index.js @@ -21,6 +21,7 @@ import AddTaskPage from '../components/task/TaskAddPage.vue'; import AddContactPage from "@/src/components/message/AddContactPage.vue"; import StatisticsPage from '../components/statics/StatisticsPage.vue'; import AddWorkerNewPage from "@/src/components/message/AddWorkerNewPage.vue"; +import AdminPage from '../components/AdminComponent.vue'; const routes = [ { path: '/', component: LoginPage }, // Начальная страница - страница логина @@ -47,6 +48,7 @@ const routes = [ { path: '/statistics', component: StatisticsPage }, {path: '/add_worker', component: AddWorkerPage}, {path: '/add_new_worker', component: AddWorkerNewPage}, + {path: '/admin', component: AdminPage}, ]; const router = createRouter({ From 1ff8083abcad4a6424f60d6a0980d279ac6df0b7 Mon Sep 17 00:00:00 2001 From: AkimFeopentov2003 Date: Thu, 12 Dec 2024 20:34:24 +0300 Subject: [PATCH 58/67] =?UTF-8?q?feat:=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D1=80=D1=8B=20=D0=BD=D0=B0=20=D1=8D=D1=82=D0=B0=D0=BF=D0=B0?= =?UTF-8?q?=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/src/components/stage/StagesPage.vue | 84 +++++++++++++++---- 1 file changed, 70 insertions(+), 14 deletions(-) diff --git a/frontend/src/src/components/stage/StagesPage.vue b/frontend/src/src/components/stage/StagesPage.vue index 3a04391..18cb2af 100644 --- a/frontend/src/src/components/stage/StagesPage.vue +++ b/frontend/src/src/components/stage/StagesPage.vue @@ -12,11 +12,11 @@
- + - - +
- +