From 3a7d147c36ee61d6afffeb70dc67c89a438cbe24 Mon Sep 17 00:00:00 2001 From: Inna Date: Tue, 23 Sep 2025 13:36:43 +0300 Subject: [PATCH] =?UTF-8?q?fix=20[P-47]:=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B8?= =?UTF-8?q?=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81?= =?UTF-8?q?=D0=BE=D0=B1=D1=8B=D1=82=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/defaultportal/uploading-file.vue | 13 +- .../calendar_of_events/BigCalendar.vue | 77 +++++++---- .../UI_calendar/CustomCalendar.vue | 14 +- .../calendar-create-select.vue | 1 - .../calendar_of_events/event-create.vue | 123 +++++++++++------- 5 files changed, 148 insertions(+), 80 deletions(-) diff --git a/src/front/src/components/UI/defaultportal/uploading-file.vue b/src/front/src/components/UI/defaultportal/uploading-file.vue index 79589b296..957dba600 100644 --- a/src/front/src/components/UI/defaultportal/uploading-file.vue +++ b/src/front/src/components/UI/defaultportal/uploading-file.vue @@ -55,9 +55,10 @@ export default { const eventFiles = computed({ get() { + if (!props.value) return [] propsFiles.value.forEach((e) => { - + arrFiles.value.push( dataURLtoFile( "data:text/plain;base64,aGVsbG8gd29ybGQ=", @@ -82,8 +83,8 @@ export default { } emit("postFiles", newFile); - - + + }, }); // @@ -101,8 +102,8 @@ export default { return new File([u8arr], filename, { type: mime }); } - - + + // const eventFiles = computed({ // get() { // if (propsFiles.value.length > 0) { @@ -141,7 +142,7 @@ export default { return { eventFiles, arrFiles, - + }; }, }; diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue index 75b09613a..ce089347f 100644 --- a/src/front/src/components/calendar_of_events/BigCalendar.vue +++ b/src/front/src/components/calendar_of_events/BigCalendar.vue @@ -4,7 +4,7 @@ - + @@ -65,33 +65,64 @@ export default { calendarStore.loadCalendars(); }; - const getEvents = (idEvent, clik) => { - axiosApiInstance - .get(`api/calendar_of_events/my_events/${idEvent === undefined ? '' : `?id=${idEvent}`}`) - .then((res) => { - if (idEvent === undefined) { - res.data.event = { - name: '', - participant: [accountStore.user.is_idEmployee], - files: [], - date_start: new Date(), - date_end: new Date(), - period: null, - description: '', - calendar: null, - }; - } + // const getEvent = (idEvent) => { + // axiosApiInstance + // .get(`api/calendar_of_events/my_events/${idEvent === undefined ? '' : `?id=${idEvent}`}`) + // .then((res) => { + // if (idEvent === undefined) { + // res.data.event = { + // name: '', + // participant: [accountStore.user.is_idEmployee], + // files: [], + // date_start: new Date(), + // date_end: new Date(), + // period: null, + // description: '', + // calendar: null, + // }; + // } + // eventFromCalendar.value = res.data; + // }); + // }; + + const getEvent = (idEvent) => { + if (!idEvent) { + eventFromCalendar.value = createEmptyEvent(); + return; + } else { + axiosApiInstance.get(`api/calendar_of_events/my_events/?id=${idEvent}`).then((res) => { eventFromCalendar.value = res.data; + calendarStore.openEventDialog(); }); + } }; - onMounted(() => { - getEvents(); + const createEmptyEvent = () => ({ + event: { + name: '', + participant: [accountStore.user.is_idEmployee], + files: [], + date_start: new Date(), + date_end: new Date(), + period: null, + description: '', + calendar: null, + }, + }); + + const openEventDialog = (selectedEvent) => { + getEvent(selectedEvent.event.id); + calendarStore.openEventDialog(); + }; + + onMounted(() => { + getEvent(); week.getWeekend(MyYear.value); }); const closeEventDialog = () => { calendarStore.closeEventDialog(); + eventFromCalendar.value = createEmptyEvent(); // Очищаем событие }; const CheckingStore = () => { @@ -102,7 +133,7 @@ export default { } }; - return { + return { selectedDate, getMonth, getYear, @@ -111,11 +142,13 @@ export default { showEventDialog, calendarForMy, getCalendar, - // getEvents, + getEvent, eventFromCalendar, calendarStore, accountStore, closeEventDialog, + openEventDialog, + createEmptyEvent, }; }, }; diff --git a/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue b/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue index 11c7df306..8e968ce82 100644 --- a/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue +++ b/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue @@ -69,7 +69,7 @@