From 6b69addc8b054024e86182280a4a5720ff8c9a19 Mon Sep 17 00:00:00 2001 From: Denzel Date: Mon, 3 Mar 2025 10:35:48 +0300 Subject: [PATCH] =?UTF-8?q?refactor=20[P-36]:=20=D0=B4=D0=B5=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=BE=D0=B7=D0=B8=D1=86=D0=B8=D1=8F=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D0=BE=D1=80=D0=B0=20?= =?UTF-8?q?+=20=D0=B0=D0=B4=D0=B0=D0=BF=D1=82=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/UI/SearcEmployess.vue | 108 ++++++++++++++++++ .../src/components/testing/CatalogTest.vue | 25 +--- .../vote/ConstructorVote/MainInfo.vue | 103 +---------------- src/front/src/views/TestHomePage.vue | 84 +++++++++++++- src/front/src/views/VoteHomePage.vue | 1 - 5 files changed, 191 insertions(+), 130 deletions(-) create mode 100644 src/front/src/components/UI/SearcEmployess.vue diff --git a/src/front/src/components/UI/SearcEmployess.vue b/src/front/src/components/UI/SearcEmployess.vue new file mode 100644 index 000000000..5444e86a3 --- /dev/null +++ b/src/front/src/components/UI/SearcEmployess.vue @@ -0,0 +1,108 @@ + + + diff --git a/src/front/src/components/testing/CatalogTest.vue b/src/front/src/components/testing/CatalogTest.vue index 563605fa2..29fe22bc1 100644 --- a/src/front/src/components/testing/CatalogTest.vue +++ b/src/front/src/components/testing/CatalogTest.vue @@ -66,30 +66,7 @@ export default { }, testingCard: { type: Array, - default: () => [ - { - id: 1, - name: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий', - type: 'test', - description: 'Краткое описание тестирования', - file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg', - dateend: new Date(), - question_count: 20, - time: 20, - attemps_number: 3, - }, - { - id: 2, - name: 'Удобство раздела тестирования', - type: 'test', - description: 'Опрос среди сотрудников ЦОД МФ', - file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg', - dateend: new Date(), - question_count: 28, - time: 15, - attemps_number: 1, - }, - ], + default: () => [], }, }, setup(props) { diff --git a/src/front/src/components/vote/ConstructorVote/MainInfo.vue b/src/front/src/components/vote/ConstructorVote/MainInfo.vue index ed362e9a7..3a3f7bd4f 100644 --- a/src/front/src/components/vote/ConstructorVote/MainInfo.vue +++ b/src/front/src/components/vote/ConstructorVote/MainInfo.vue @@ -40,63 +40,7 @@ color="primary" :label="localForm.appoint ? 'да' : 'нет'" > - - - - - +
Дата и время:
@@ -142,15 +86,16 @@ import DateSelect from '@/components/UI/date-select.vue'; import { ref, watch, computed } from 'vue'; import { checkremote } from '@/utils/universal_functions.js'; -import { getEmployees, spravURL } from '@/utils/axios-api.js'; +import { spravURL } from '@/utils/axios-api.js'; import { useRoute } from 'vue-router'; +import SearcEmployess from '@/components/UI/SearcEmployess.vue'; export default { methods: { spravURL() { return spravURL }, checkremote }, - components: { DateSelect }, + components: { SearcEmployess, DateSelect }, props: { form: Object, rules: { @@ -180,12 +125,6 @@ export default { } ); - const groupedEmployees = ref([]); - const allEmployees = computed(() => [...groupedEmployees.value]); - const selectedEmployees = ref([]); - - getEmployees().then((r) => (groupedEmployees.value = r)); - // Отправляем изменения в родителя watch( localForm, @@ -240,47 +179,13 @@ export default { return `${hours}:${minutes}`; }); - const allEmployeesgroupedbydep = computed(() => { - let groupped = []; - for (let x of allEmployees.value.sort( - (a, b) => a.id_dict_department - b.id_dict_department, - )) { - if (!groupped.includes(x.department)) groupped.push(x.department); - groupped.push(x); - } - return groupped; - }); - - const onEmployeesChange = (employeeId) => { - const index = selectedEmployees.value.indexOf(employeeId); - if (index !== -1) { - selectedEmployees.value.splice(index, 1); - } else { - selectedEmployees.value.push(employeeId); - } - }; - - const handleSelectAll = () => { - if (selectedEmployees.value.length === allEmployees.value.length) { - selectedEmployees.value = []; - } else { - selectedEmployees.value = allEmployees.value.map(emp => emp.id); - } - }; - - return { localForm, returnstart, returnend, - allEmployeesgroupedbydep, selectedTimeStart, selectedTimeEnd, timeOptions, - selectedEmployees, - allEmployees, - onEmployeesChange, - handleSelectAll, isTestRoute }; }, diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index 244cb8d2f..10024ac15 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -15,11 +15,10 @@ + - - + - +