From 5a9fa50127a0aa5b2dce67dde32c569f1427c24a Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Thu, 30 May 2024 12:47:00 +0300 Subject: [PATCH 1/7] =?UTF-8?q?P-42=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BB=D1=8E=D0=B4=D0=B5=D0=B9=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/back/calendar_of_events/views.py | 2 +- .../calendar_of_events/BigCalendar.vue | 60 +++---- .../calendar-create-select.vue | 146 ++++++++++-------- src/front/src/store/WeekendsStore.js | 28 ++-- 4 files changed, 117 insertions(+), 119 deletions(-) diff --git a/src/back/calendar_of_events/views.py b/src/back/calendar_of_events/views.py index edbf72a6f..2086ef05f 100644 --- a/src/back/calendar_of_events/views.py +++ b/src/back/calendar_of_events/views.py @@ -17,7 +17,7 @@ class ExclusionDatesAPIView(APIView): exclude = ExclusionDates.objects.filter(exclusiondate__year=year) months = {} for i in range(1,12): - months[i] = exclude.filter(exclusiondate__month=i).values_list("exclusiondate") + months[i] = exclude.filter(exclusiondate__month=i).values_list("exclusiondate", flat=True) return Response({year:months}) diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue index a6fec713f..ac29ce4b9 100644 --- a/src/front/src/components/calendar_of_events/BigCalendar.vue +++ b/src/front/src/components/calendar_of_events/BigCalendar.vue @@ -49,9 +49,8 @@ - - + + {{ drawer_right }} @@ -76,42 +75,23 @@ + + diff --git a/src/front/src/components/calendar_of_events/calendar-create-select.vue b/src/front/src/components/calendar_of_events/calendar-create-select.vue index 9d81693fd..f45be7143 100644 --- a/src/front/src/components/calendar_of_events/calendar-create-select.vue +++ b/src/front/src/components/calendar_of_events/calendar-create-select.vue @@ -12,39 +12,23 @@ class="max-height-select" return-object > - - @@ -87,18 +61,29 @@ import { ref, onMounted, computed } from "vue"; export default { setup() { - - const staff = ref([ { department: "ОКТП", id: 1, - staff: [{ fio: "ГИС", id: 1 }, { fio: "СВВ", id: 2 }, { fio: "ФА", id: 3 }, { fio: "АА", id: 4 }], + staff: [ + { fio: "ГИС", id: 1 }, + { fio: "СВВ", id: 2 }, + { fio: "ФА", id: 3 }, + { fio: "АА", id: 4 }, + ], + }, + { + department: "ОВТП", + id: 2, + staff: [ + { fio: "ЩВ", id: 1 }, + { fio: "ДК", id: 2 }, + ], }, - { department: "ОВТП", id: 2, staff: [{ fio: "ЩВ", id: 1 }, { fio: "ДК", id: 2 }] }, ]); const selectedStaff = ref([]); + const selectDepartnment = ref({}); const allStaff = computed( () => selectedStaff.value.length === staff.value.length @@ -115,16 +100,89 @@ export default { } function selectFIO(user, dep) { - let ob = staff.value.find(el => el.id == dep) + staff.value.forEach((e) => { + if (!selectDepartnment.value[e.id]) { + selectDepartnment.value[e.id] = []; + } + }); + // selectDepartnment.forEach((e) => { - ob['chek'] = false - let indx = selectedStaff.value.findIndex((i) => i.id == dep) - if (indx ==-1) { - selectedStaff.value.push(ob) - } - - - console.log(ob, 'ki') + // if (!ob[e.author.id]) { + // ob[e.author.id] = 0 + // } + // ob[e.author.id] += 1 + // }) + + let ob = staff.value.find((el) => el.id == dep); + + if(selectDepartnment.value[dep].includes(user.fio)) { + let inddep = selectDepartnment.value[dep].indexOf(user.fio) + selectDepartnment.value[dep].splice(inddep, 1); + } + else { + selectDepartnment.value[dep].push(user.fio) + + // if(selectDepartnment.value[dep].length == ob.staff.length){ + // selectDepartnment.value[dep]['dep'] = ob.department + // } + // else { + // selectDepartnment.value[dep]['dep'] = '' + // } + + } + + if (selectedStaff.value.includes(user.fio)) { + let index = selectedStaff.value.indexOf(user.fio); + selectedStaff.value.splice(index, 1); + } + else { + if (selectDepartnment.value[dep].length == ob.staff.length) { + selectedStaff.value.filter( ( el ) => !~selectDepartnment.value[dep].indexOf( el ) ) + selectedStaff.value.push(ob.department) + + } + else { + selectedStaff.value.push(user.fio); + } + // + } + // selectedStaff.value = selectDepartnment.value[dep] + // console.log(selectedStaff.value, '------------'); + // selectedStaff.value.push(selectDepartnment.value[dep]) + + // if (selectedStaff.value.includes(user.fio)) { + + // let index = selectedStaff.value.indexOf(user.fio); + // selectedStaff.value.splice(index, 1); + + // let inddep = selectDepartnment.value[dep].indexOf(user.fio) + // selectDepartnment.value[dep].splice(inddep, 1); + + + // } else { + // selectDepartnment.value[dep].push(user.fio); + // if (selectDepartnment.value[dep].length == ob.staff.length) { + // selectDepartnment.value[dep] = [] + // selectedStaff.value.push(ob.department); + + // } else { + // selectedStaff.value.push(user.fio); + // } + // } + console.log(selectedStaff.value, 'selectedStaff.valueselectedStaff.value') + console.log(selectDepartnment.value, selectDepartnment.value[dep].length == ob.staff.length, "11111111111111111"); + // + // userDep.department = ob.department + // userDep.staff = user + + // ob['chek'] = false + // let indx = selectedStaff.value.findIndex((i) => i.id == dep) + // if (indx ==-1) { + + // selectedStaff.value.push(ob) + // } + + // console.log(userDep, 'ki') } return { @@ -133,10 +191,8 @@ export default { allStaff, onePlusStaff, selectFIO, - + selectDepartnment, toggle, - - }; }, }; From 85463be081511bb1cd5c5eeb85807bc8f88276bd Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Fri, 31 May 2024 09:47:33 +0300 Subject: [PATCH 3/7] =?UTF-8?q?P-42=20=D0=9E=D0=BD=D0=BE=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82.=20=D0=94=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D1=87=D0=B5=D0=BA=D0=91=D0=BE?= =?UTF-8?q?=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calendar-create-select.vue | 110 +++++++++++------- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/src/front/src/components/calendar_of_events/calendar-create-select.vue b/src/front/src/components/calendar_of_events/calendar-create-select.vue index f45be7143..faaf13992 100644 --- a/src/front/src/components/calendar_of_events/calendar-create-select.vue +++ b/src/front/src/components/calendar_of_events/calendar-create-select.vue @@ -58,6 +58,7 @@