fix [P-57]: связка календарей
This commit is contained in:
1 parent
4897db2399
commit
3143d266ee
5 files changed
+390
-263
No files matched your search
@@ -15,9 +15,9 @@
|
||||
rail
|
||||
>
|
||||
</v-navigation-drawer> -->
|
||||
<v-dialog v-model="showDialog" max-width="700">
|
||||
<v-dialog v-model="showEventDialog" max-width="700">
|
||||
<event-create
|
||||
@closeDialog="showDialog = false"
|
||||
@closeDialog="closeEventDialog"
|
||||
:eventCalendar="eventFromCalendar"
|
||||
@getCalendar="getCalendar"
|
||||
@update:eventCalendar="eventFromCalendar = $event"
|
||||
@@ -31,17 +31,16 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useWeekendsStore } from '@/store/WeekendsStore';
|
||||
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
||||
// import { useAccountStore } from '@/store/AccountStore';
|
||||
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
||||
import { useCalendarStore } from '@/store/calendarStore';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import MiniCalendar from '@/components/calendar_of_events/UI_calendar/MiniCalendar.vue';
|
||||
import { axiosApiInstance } from '@/utils/axios-api';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
|
||||
export default {
|
||||
components: { EventCreate, MiniCalendar, CustomCalendar },
|
||||
setup() {
|
||||
// const accountStore = useAccountStore();
|
||||
const showDialog = ref(false);
|
||||
const week = useWeekendsStore();
|
||||
const selectdate = ref(new Date());
|
||||
const MyYear = ref(selectdate.value.getFullYear());
|
||||
@@ -51,8 +50,9 @@ export default {
|
||||
const createEvents = ref(null);
|
||||
|
||||
const calendarStore = useCalendarStore();
|
||||
const accountStore = useAccountStore();
|
||||
|
||||
const { selectedDate } = storeToRefs(calendarStore); // синхронизируем с date-picker
|
||||
const { selectedDate, showEventDialog } = storeToRefs(calendarStore); // синхронизируем с date-picker
|
||||
|
||||
const handleSaveEvent = (eventData) => {
|
||||
if (eventData.id) {
|
||||
@@ -70,17 +70,40 @@ export default {
|
||||
};
|
||||
|
||||
const getCalendar = () => {
|
||||
|
||||
calendarStore.loadCalendars();
|
||||
};
|
||||
|
||||
getCalendar();
|
||||
|
||||
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,
|
||||
};
|
||||
}
|
||||
eventFromCalendar.value = res.data;
|
||||
});
|
||||
};
|
||||
|
||||
getEvents();
|
||||
|
||||
onMounted(() => {
|
||||
week.getWeekend(MyYear.value);
|
||||
});
|
||||
|
||||
const closeEventDialog = () => {
|
||||
calendarStore.closeEventDialog();
|
||||
};
|
||||
|
||||
const CheckingStore = () => {
|
||||
if (MyYear.value in week.week) {
|
||||
@@ -96,44 +119,19 @@ export default {
|
||||
getYear,
|
||||
week,
|
||||
CheckingStore,
|
||||
showDialog,
|
||||
showEventDialog,
|
||||
calendarForMy,
|
||||
// accountStore,
|
||||
getCalendar,
|
||||
getEvents,
|
||||
eventFromCalendar,
|
||||
createEvents,
|
||||
calendarStore,
|
||||
handleSaveEvent,
|
||||
accountStore,
|
||||
closeEventDialog,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.minCal:deep(.v-date-picker-month__days) {
|
||||
/* display: grid !important;
|
||||
grid-template-columns: repeat(7, 32px) !important;
|
||||
gap: 3px !important;
|
||||
width: 250px !important;
|
||||
justify-content: center !important;
|
||||
margin: 0 auto !important; */
|
||||
}
|
||||
|
||||
.minCal .v-date-picker-monWth__day {
|
||||
height: 31px;
|
||||
width: 31px;
|
||||
}
|
||||
|
||||
.minCal .v-btn--icon.v-btn--density-default {
|
||||
width: calc(var(--v-btn-height) + 12px);
|
||||
height: calc(var(--v-btn-height) + 6px);
|
||||
}
|
||||
|
||||
.minCal .v-btn__content {
|
||||
font-weight: 410;
|
||||
}
|
||||
|
||||
.minCal:deep(.v-date-picker-years__content) {
|
||||
gap: 0;
|
||||
}
|
||||
</style>
|
||||
<style scoped></style>
|
||||
@@ -97,6 +97,9 @@ export default {
|
||||
week: 'numeric',
|
||||
},
|
||||
weekNumberCalculation: 'ISO', // ISO стандарт (понедельник - первый день)
|
||||
selectable: true,
|
||||
unselectAuto: false,
|
||||
selectMirror: false,
|
||||
views: {
|
||||
timeGridDay: {
|
||||
type: 'timeGrid',
|
||||
@@ -172,70 +175,75 @@ export default {
|
||||
{
|
||||
title: '10:00 Лотус',
|
||||
start: new Date('September, 26, 2025').setHours(10, 0, 0),
|
||||
end: new Date('September, 28, 2025').setHours(11, 0, 0),
|
||||
end: new Date('September, 26, 2025').setHours(11, 0, 0),
|
||||
color: '#1867C0',
|
||||
},
|
||||
{
|
||||
title: '14:00 Совещание',
|
||||
start: new Date('September, 20, 2025').setHours(14, 0, 0),
|
||||
end: new Date('September, 20, 2025').setHours(15, 0, 0),
|
||||
start: new Date('September, 26, 2025').setHours(14, 0, 0),
|
||||
end: new Date('September, 26, 2025').setHours(15, 0, 0),
|
||||
color: '#1867C0',
|
||||
},
|
||||
{
|
||||
title: '11:00 Конференция',
|
||||
start: new Date('October, 02, 2025').setHours(14, 0, 0),
|
||||
end: new Date('October, 02, 2025').setHours(15, 0, 0),
|
||||
color: '#1867C0',
|
||||
},
|
||||
|
||||
// ПРАЗДНИКИ РОССИИ 2025
|
||||
{
|
||||
title: '🎄 Новый год',
|
||||
start: '2025-01-01',
|
||||
end: '2025-01-08', // Новогодние каникулы
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
display: 'background',
|
||||
textColor: 'white',
|
||||
},
|
||||
{
|
||||
title: '🎅 Рождество',
|
||||
start: '2025-01-07',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
},
|
||||
{
|
||||
title: '🪆 День защитника Отечества',
|
||||
start: '2025-02-23',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
},
|
||||
{
|
||||
title: '🌸 Международный женский день',
|
||||
start: '2025-03-08',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
},
|
||||
{
|
||||
title: '🌷 Майские праздники',
|
||||
start: '2025-05-01',
|
||||
end: '2025-05-05',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
display: 'background',
|
||||
},
|
||||
{
|
||||
title: '🎆 День Победы',
|
||||
start: '2025-05-09',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
},
|
||||
{
|
||||
title: '🇷🇺 День России',
|
||||
start: '2025-06-12',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
},
|
||||
{
|
||||
title: '🤝 День народного единства',
|
||||
start: '2025-11-04',
|
||||
allDay: true,
|
||||
className: 'holiday-event',
|
||||
},
|
||||
// {
|
||||
// title: '🎄 Новый год',
|
||||
// start: '2025-01-01',
|
||||
// end: '2025-01-08', // Новогодние каникулы
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// display: 'background',
|
||||
// },
|
||||
// {
|
||||
// title: '🎅 Рождество',
|
||||
// start: '2025-01-07',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// },
|
||||
// {
|
||||
// title: '🪆 День защитника Отечества',
|
||||
// start: '2025-02-23',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// },
|
||||
// {
|
||||
// title: '🌸 Международный женский день',
|
||||
// start: '2025-03-08',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// },
|
||||
// {
|
||||
// title: '🌷 Майские праздники',
|
||||
// start: '2025-05-01',
|
||||
// end: '2025-05-05',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// display: 'background',
|
||||
// },
|
||||
// {
|
||||
// title: '🎆 День Победы',
|
||||
// start: '2025-05-09',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// },
|
||||
// {
|
||||
// title: '🇷🇺 День России',
|
||||
// start: '2025-06-12',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// },
|
||||
// {
|
||||
// title: '🤝 День народного единства',
|
||||
// start: '2025-11-04',
|
||||
// allDay: true,
|
||||
// className: 'holiday-event',
|
||||
// },
|
||||
],
|
||||
|
||||
eventClick: (info) => {
|
||||
@@ -243,8 +251,10 @@ export default {
|
||||
},
|
||||
|
||||
dateClick: (info) => {
|
||||
selectedDate.value - info.dateStr;
|
||||
calendarStore.setSelectedDateFromCalendar(info);
|
||||
handleDateSelection(info.dateStr);
|
||||
handleCalendarDateClick(info);
|
||||
calendarApi.value?.unselect();
|
||||
},
|
||||
|
||||
datesSet: (info) => {
|
||||
@@ -263,15 +273,11 @@ export default {
|
||||
} else {
|
||||
currentTitle.value = info.view.title;
|
||||
}
|
||||
|
||||
if (selectedDate.value) {
|
||||
handleDateSelection(selectedDate.value);
|
||||
}
|
||||
},
|
||||
|
||||
dayCellContent: () => {},
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
if (calendarRef.value) {
|
||||
calendarApi.value = calendarRef.value.getApi();
|
||||
}
|
||||
});
|
||||
|
||||
const handleCalendarDateClick = (info) => {
|
||||
@@ -281,37 +287,88 @@ export default {
|
||||
|
||||
const handleToday = () => {
|
||||
calendarApi.value?.today();
|
||||
// Получаем текущую дату из календаря и передаем в стор
|
||||
const currentDate = calendarApi.value?.getDate();
|
||||
if (currentDate) {
|
||||
// Создаем объект похожий на info из FullCalendar
|
||||
const todayInfo = {
|
||||
dateStr: currentDate.toISOString().split('T')[0],
|
||||
};
|
||||
calendarStore.setSelectedDateFromCalendar(todayInfo);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePrev = () => {
|
||||
calendarApi.value?.prev();
|
||||
const currentDate = calendarApi.value?.getDate();
|
||||
if (currentDate) {
|
||||
const dateInfo = {
|
||||
dateStr: currentDate.toISOString().split('T')[0],
|
||||
};
|
||||
calendarStore.setSelectedDateFromCalendar(dateInfo);
|
||||
}
|
||||
};
|
||||
|
||||
const handleNext = () => {
|
||||
calendarApi.value?.next();
|
||||
|
||||
const currentDate = calendarApi.value?.getDate();
|
||||
if (currentDate) {
|
||||
const dateInfo = {
|
||||
dateStr: currentDate.toISOString().split('T')[0],
|
||||
};
|
||||
calendarStore.setSelectedDateFromCalendar(dateInfo);
|
||||
}
|
||||
};
|
||||
|
||||
// Функция обновления выделения
|
||||
const handleDateSelection = (dateStr) => {
|
||||
// Убираем предыдущее выделение
|
||||
const previousSelected = document.querySelectorAll('.fc-day-selected-custom');
|
||||
previousSelected.forEach((el) => el.classList.remove('fc-day-selected-custom'));
|
||||
|
||||
// Добавляем новое выделение
|
||||
const dayElements = document.querySelectorAll(`[data-date="${dateStr}"]`);
|
||||
dayElements.forEach((el) => el.classList.add('fc-day-selected-custom'));
|
||||
|
||||
selectedDate.value = dateStr;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
if (calendarRef.value && calendarRef.value.getApi) {
|
||||
calendarApi.value = calendarRef.value.getApi();
|
||||
}
|
||||
|
||||
if (selectedDate.value) {
|
||||
handleDateSelection(selectedDate.value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
watch(currentView, (newView) => {
|
||||
calendarApi.value?.changeView(newView);
|
||||
});
|
||||
// Единый watcher для selectedDate
|
||||
watch(
|
||||
currentView,
|
||||
(newView) => {
|
||||
calendarApi.value?.changeView(newView);
|
||||
selectedDate,
|
||||
(newDate, oldDate) => {
|
||||
if (!newDate || newDate === oldDate) return;
|
||||
|
||||
// Небольшая задержка для гарантии что FullCalendar обновил DOM
|
||||
setTimeout(() => {
|
||||
if (calendarApi.value && lastUpdatedBy.value !== 'calendar') {
|
||||
try {
|
||||
calendarApi.value.gotoDate(newDate);
|
||||
} catch (error) {
|
||||
console.warn('Ошибка при переходе к дате:', error);
|
||||
}
|
||||
}
|
||||
}, 50);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(selectedDate, (newDate) => {
|
||||
if (!newDate) return;
|
||||
|
||||
nextTick(() => {
|
||||
if (calendarApi.value && lastUpdatedBy.value !== 'calendar')
|
||||
try {
|
||||
calendarApi.value.gotoDate(newDate);
|
||||
} catch (error) {
|
||||
console.warn('Ошибка при переходе к дате:', error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
currentTitle,
|
||||
calendarRef,
|
||||
@@ -321,22 +378,109 @@ export default {
|
||||
handleNext,
|
||||
handlePrev,
|
||||
handleCalendarDateClick,
|
||||
handleDateSelection,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
:deep(.fc-daygrid-day-number) {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
margin: 0 !important;
|
||||
padding: 0.6rem !important;
|
||||
}
|
||||
|
||||
/* текущая дата обводка */
|
||||
:deep(.fc-day-today) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
:deep(.fc-day-today .fc-daygrid-day-number) {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
color: #00897b;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px solid #00897b;
|
||||
border-radius: 50%;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Выбранная дата заливка */
|
||||
|
||||
:deep(.fc-day-selected-custom) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
:deep(.fc-day-selected-custom .fc-daygrid-day-number) {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
:deep(.fc-day-selected-custom .fc-daygrid-day-number::before) {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-color: #00897b;
|
||||
border-radius: 50%;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
:deep(.fc-multiMonthYear-view) {
|
||||
.fc-day-today .fc-daygrid-day-number::before,
|
||||
.fc-day-selected-custom .fc-daygrid-day-number::before {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.v-btn--active) {
|
||||
background-color: transparent !important;
|
||||
color: #00897b !important;
|
||||
}
|
||||
/* Изменение фона текущего дня */
|
||||
:deep(.fc .fc-daygrid-day.fc-day-today) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
:deep(.fc .fc-timegrid-col.fc-day-today) {
|
||||
background-color: #e0f2f1 !important;
|
||||
}
|
||||
|
||||
:deep(.fc-highlight) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
/* :deep(.fc-daygrid-day-frame) {
|
||||
position: relative;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
:deep(.fc-daygrid-more-link) {
|
||||
position: absolute;
|
||||
bottom: -6px;
|
||||
right: 2px;
|
||||
font-size: 11px;
|
||||
padding: 1px 3px;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
border-radius: 3px;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
:deep(.fc-popover) {
|
||||
|
||||
} */
|
||||
</style>
|
||||
@@ -21,7 +21,7 @@
|
||||
color="btn_text"
|
||||
block
|
||||
elevation="1"
|
||||
@click="createEvent()"
|
||||
@click="openEventDialog"
|
||||
>Создать событие</v-btn
|
||||
>
|
||||
<!-- {{eventFromCalendar}} -->
|
||||
@@ -43,12 +43,11 @@
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
|
||||
<v-col>
|
||||
<!-- :calendars="myCalendars.filter((e) => e.author != user.is_idEmployee)" -->
|
||||
<calendar-my :calendars="subscribedCalendars" title="Подписки" />
|
||||
<!-- :calendars="myCalendars.filter((e) => e.author == user.is_idEmployee)" -->
|
||||
<calendar-my
|
||||
:calendars="calendarForMy.filter((e) => e.author != user.is_idEmployee)"
|
||||
title="Подписки"
|
||||
/>
|
||||
<calendar-my
|
||||
:calendars="calendarForMy.filter((e) => e.author == user.is_idEmployee)"
|
||||
:calendars="myCalendars"
|
||||
title="Мои календари"
|
||||
@getCalendar="loadCalendars"
|
||||
/>
|
||||
@@ -62,7 +61,7 @@
|
||||
import { useCalendarStore } from '@/store/calendarStore';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
export default {
|
||||
@@ -71,32 +70,72 @@ export default {
|
||||
setup() {
|
||||
const calendarStore = useCalendarStore();
|
||||
const accountStore = useAccountStore();
|
||||
const calendarForMy = ref([]);
|
||||
const { selectedDate } = storeToRefs(calendarStore);
|
||||
// const calendarForMy = ref([]);
|
||||
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
|
||||
|
||||
const { user } = storeToRefs(accountStore);
|
||||
|
||||
const createEvent = () => {
|
||||
calendarStore.openEventDialog();
|
||||
};
|
||||
|
||||
const loadCalendars = () => {
|
||||
calendarStore.loadCalendars();
|
||||
};
|
||||
|
||||
const handleDateClick = (date) => {
|
||||
calendarStore.setSelectedDateFromPicker(date);
|
||||
};
|
||||
|
||||
const openEventDialog = () => {
|
||||
calendarStore.openEventDialog();
|
||||
};
|
||||
|
||||
const loadCalendars = async () => {
|
||||
calendarStore.loadCalendars();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadCalendars();
|
||||
});
|
||||
|
||||
// Реакция на изменения пользователя
|
||||
watch(user, (newUser) => {
|
||||
if (newUser) {
|
||||
loadCalendars();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
accountStore,
|
||||
user,
|
||||
myCalendars,
|
||||
subscribedCalendars,
|
||||
selectedDate,
|
||||
calendarForMy,
|
||||
createEvent,
|
||||
openEventDialog,
|
||||
loadCalendars,
|
||||
handleDateClick,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
/* .minCal:deep(.v-date-picker-month__days) {
|
||||
display: grid !important;
|
||||
grid-template-columns: repeat(7, 32px) !important;
|
||||
gap: 3px !important;
|
||||
width: 250px !important;
|
||||
justify-content: center !important;
|
||||
margin: 0 auto !important;
|
||||
} */
|
||||
|
||||
.minCal .v-date-picker-monWth__day {
|
||||
height: 31px;
|
||||
width: 31px;
|
||||
}
|
||||
|
||||
.minCal .v-btn--icon.v-btn--density-default {
|
||||
width: calc(var(--v-btn-height) + 12px);
|
||||
height: calc(var(--v-btn-height) + 6px);
|
||||
}
|
||||
|
||||
.minCal .v-btn__content {
|
||||
font-weight: 410;
|
||||
}
|
||||
|
||||
.minCal:deep(.v-date-picker-years__content) {
|
||||
gap: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
:newOrOld="newEvent"
|
||||
@postData="postData"
|
||||
@closeDialog="$emit('closeDialog')"
|
||||
@delObject="delEvent(propsEvent.event.id)"
|
||||
@delObject="delEvent(propsEvent?.event?.id)"
|
||||
ref="createDialog"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
@@ -13,9 +13,7 @@
|
||||
<v-row no-gutters class="align-center">
|
||||
<!-- <my-helper :pretext="propsEvent.event" /> -->
|
||||
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Название </v-col>
|
||||
|
||||
<v-col>
|
||||
<v-textarea
|
||||
@@ -30,9 +28,7 @@
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2"> Участники </v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:staff="newStaff"
|
||||
@@ -57,11 +53,7 @@
|
||||
:disabled="'id' in propsEvent.event"
|
||||
>
|
||||
<template v-slot:selection="{ item }">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
size="8"
|
||||
:color="item.raw.cl_color"
|
||||
/>
|
||||
<v-avatar class="cursor-pointer" size="8" :color="item.raw.cl_color" />
|
||||
<span class="pl-2">
|
||||
{{ item.title }}
|
||||
</span>
|
||||
@@ -74,11 +66,7 @@
|
||||
@click.stop="calendar = item"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
size="8"
|
||||
:color="item.raw.cl_color"
|
||||
/>
|
||||
<v-avatar class="cursor-pointer" size="8" :color="item.raw.cl_color" />
|
||||
</template>
|
||||
{{ item.title }}
|
||||
</v-list-item>
|
||||
@@ -87,17 +75,11 @@
|
||||
</v-col></v-row
|
||||
>
|
||||
<v-row no-gutters class="align-top">
|
||||
<v-col class="text-body-2 text-text_grey pt-3" lg="2">
|
||||
Дата и время
|
||||
</v-col>
|
||||
<v-col class="text-body-2 text-text_grey pt-3" lg="2"> Дата и время </v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap">
|
||||
<time-select
|
||||
:rule="
|
||||
returnPeriod != repeatRules[0].type
|
||||
? returnPeriod.rule.freq
|
||||
: -1
|
||||
"
|
||||
:rule="returnPeriod != repeatRules[0].type ? returnPeriod.rule.freq : -1"
|
||||
:chek="propsEvent.event.allday"
|
||||
:order="[2, 1]"
|
||||
:dateEvent="String(propsEvent.event.date_start)"
|
||||
@@ -108,11 +90,7 @@
|
||||
<v-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
||||
</v-col>
|
||||
<time-select
|
||||
:rule="
|
||||
returnPeriod != repeatRules[0].type
|
||||
? returnPeriod.rule.freq
|
||||
: -1
|
||||
"
|
||||
:rule="returnPeriod != repeatRules[0].type ? returnPeriod.rule.freq : -1"
|
||||
:chek="propsEvent.event.allday"
|
||||
:order="[4, 5]"
|
||||
:dateEvent="String(propsEvent.event.date_end)"
|
||||
@@ -151,9 +129,7 @@
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-row no-gutters class="align-top flex-grow-0">
|
||||
<v-col class="text-body-2 text-text_grey pt-3 h-0" lg="2">
|
||||
Напоминание
|
||||
</v-col>
|
||||
<v-col class="text-body-2 text-text_grey pt-3 h-0" lg="2"> Напоминание </v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap flex-grow-0">
|
||||
<reminder-event />
|
||||
@@ -198,18 +174,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
import TimeSelect from "@/components/calendar_of_events/UI_calendar/timeSelect.vue";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import UploadingFile from "@/components/UI/defaultportal/uploading-file.vue";
|
||||
import ReminderEvent from "@/components/calendar_of_events/UI_calendar/reminderEvent.vue";
|
||||
import PeriodEvents from "@/components/calendar_of_events/UI_calendar/periodEvents.vue";
|
||||
import { useAlertStore } from "@/store/UseAlertStore";
|
||||
import { RRule } from "rrule";
|
||||
import { computed, ref } from 'vue';
|
||||
import { axiosApiInstance } from '@/utils/axios-api';
|
||||
import DialogCreate from '@/components/calendar_of_events/UI_calendar/dialogCreate.vue';
|
||||
import calendarCreateSelect from '@/components/calendar_of_events/calendar-create-select.vue';
|
||||
import { formatComa } from '@/utils/universal_functions';
|
||||
import TimeSelect from '@/components/calendar_of_events/UI_calendar/timeSelect.vue';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import UploadingFile from '@/components/UI/defaultportal/uploading-file.vue';
|
||||
import ReminderEvent from '@/components/calendar_of_events/UI_calendar/reminderEvent.vue';
|
||||
import PeriodEvents from '@/components/calendar_of_events/UI_calendar/periodEvents.vue';
|
||||
import { useAlertStore } from '@/store/UseAlertStore';
|
||||
import { RRule } from 'rrule';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -236,33 +212,27 @@ export default {
|
||||
return props.eventCalendar;
|
||||
},
|
||||
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
set: (value) => emit('update:eventCalendar', value),
|
||||
});
|
||||
|
||||
const repeatRules = [
|
||||
{ type: "Не повторять", rule: {}, id: 1 },
|
||||
{ type: "Каждый день", rule: { freq: 3 }, id: 2 },
|
||||
{ type: "Каждую неделю", rule: { freq: 2 }, id: 3 },
|
||||
{ type: "Каждый месяц", rule: { freq: 1 }, id: 4 },
|
||||
{ type: "Каждый год", rule: { freq: 0 }, id: 5 },
|
||||
{ type: 'Не повторять', rule: {}, id: 1 },
|
||||
{ type: 'Каждый день', rule: { freq: 3 }, id: 2 },
|
||||
{ type: 'Каждую неделю', rule: { freq: 2 }, id: 3 },
|
||||
{ type: 'Каждый месяц', rule: { freq: 1 }, id: 4 },
|
||||
{ type: 'Каждый год', rule: { freq: 0 }, id: 5 },
|
||||
];
|
||||
|
||||
const returnPeriod = computed({
|
||||
get() {
|
||||
let select = "";
|
||||
let select = '';
|
||||
if (propsEvent.value.event.period != null) {
|
||||
let objRule = JSON.parse(propsEvent.value.event.period);
|
||||
if (objRule != null) {
|
||||
drawingRule(objRule.origOptions);
|
||||
repeatRules.findIndex(
|
||||
(e) => e.rule.freq == objRule.origOptions.freq
|
||||
);
|
||||
repeatRules.findIndex((e) => e.rule.freq == objRule.origOptions.freq);
|
||||
select =
|
||||
repeatRules[
|
||||
repeatRules.findIndex(
|
||||
(e) => e.rule.freq == objRule.origOptions.freq
|
||||
)
|
||||
];
|
||||
repeatRules[repeatRules.findIndex((e) => e.rule.freq == objRule.origOptions.freq)];
|
||||
}
|
||||
} else {
|
||||
select = repeatRules[0].type;
|
||||
@@ -315,20 +285,12 @@ export default {
|
||||
: (propsEvent.value.event.period = JSON.stringify(newRulse));
|
||||
};
|
||||
|
||||
const rulleWeek = [
|
||||
RRule.SU,
|
||||
RRule.MO,
|
||||
RRule.TU,
|
||||
RRule.WE,
|
||||
RRule.TH,
|
||||
RRule.FR,
|
||||
RRule.SA,
|
||||
];
|
||||
const rulleWeek = [RRule.SU, RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR, RRule.SA];
|
||||
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const req = (val) => {
|
||||
return !!val || "Поле обязательно";
|
||||
return !!val || 'Поле обязательно';
|
||||
};
|
||||
|
||||
const rules = {
|
||||
@@ -337,12 +299,9 @@ export default {
|
||||
|
||||
const staff = ref([]);
|
||||
|
||||
axiosApiInstance
|
||||
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
});
|
||||
axiosApiInstance.get('api/calendar_of_events/get_employees/').then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
});
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
|
||||
@@ -350,9 +309,7 @@ export default {
|
||||
get() {
|
||||
let ns = [];
|
||||
|
||||
let indCal = propsEvent.value.mycalendars.findIndex(
|
||||
(e) => e.id == calendar.value[0].id
|
||||
);
|
||||
let indCal = propsEvent.value.mycalendars.findIndex((e) => e.id == calendar.value[0].id);
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
let emp = { ...e };
|
||||
@@ -365,7 +322,7 @@ export default {
|
||||
}
|
||||
|
||||
return propsEvent.value.mycalendars[indCal].participant.some(
|
||||
(part) => part.id === n.id
|
||||
(part) => part.id === n.id,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -376,16 +333,14 @@ export default {
|
||||
});
|
||||
|
||||
const delEvent = (idev) => {
|
||||
axiosApiInstance
|
||||
.delete(`api/calendar_of_events/my_events/?delid=${idev}`)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "orange-accent-1";
|
||||
emit("getCalendar");
|
||||
});
|
||||
emit("closeDialog");
|
||||
axiosApiInstance.delete(`api/calendar_of_events/my_events/?delid=${idev}`).then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = 'mdi-check';
|
||||
feedalert.color = 'orange-accent-1';
|
||||
emit('getCalendar');
|
||||
});
|
||||
emit('closeDialog');
|
||||
};
|
||||
|
||||
const files = ref([]);
|
||||
@@ -398,7 +353,7 @@ export default {
|
||||
let selected = [];
|
||||
if (propsEvent.value.event.calendar) {
|
||||
let ind = propsEvent.value.mycalendars.findIndex(
|
||||
(e) => e.id == propsEvent.value.event.calendar
|
||||
(e) => e.id == propsEvent.value.event.calendar,
|
||||
);
|
||||
selected.push({
|
||||
cl_name: propsEvent.value.mycalendars[ind].cl_name,
|
||||
@@ -423,30 +378,25 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
const titleCard = ref("");
|
||||
const titleCard = ref('');
|
||||
const newEvent = ref(false);
|
||||
|
||||
const calendarNewOrOld = () => {
|
||||
if (propsEvent.value.event.hasOwnProperty("id")) {
|
||||
titleCard.value = "Редактирование события";
|
||||
if (propsEvent.value.event.hasOwnProperty('id')) {
|
||||
titleCard.value = 'Редактирование события';
|
||||
newEvent.value = false;
|
||||
} else {
|
||||
titleCard.value = "Новое событие";
|
||||
titleCard.value = 'Новое событие';
|
||||
newEvent.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const returnIdParticant = (idPart) => {
|
||||
idPart.staff.forEach((e) => {
|
||||
if (
|
||||
e.selected == true &&
|
||||
!propsEvent.value.event.participant.includes(e.id)
|
||||
) {
|
||||
if (e.selected == true && !propsEvent.value.event.participant.includes(e.id)) {
|
||||
propsEvent.value.event.participant.push(e.id);
|
||||
} else {
|
||||
let ind = propsEvent.value.event.participant.findIndex(
|
||||
(l) => l == e.id
|
||||
);
|
||||
let ind = propsEvent.value.event.participant.findIndex((l) => l == e.id);
|
||||
|
||||
if (ind != -1) {
|
||||
propsEvent.value.event.participant.splice(ind, 1);
|
||||
@@ -457,12 +407,12 @@ export default {
|
||||
|
||||
const cbSelect = (item, arr) => {
|
||||
item.forEach((e) => {
|
||||
if (!("employees" in e)) {
|
||||
if (!('employees' in e)) {
|
||||
if (!propsEvent.value.event.participant.includes(e.id)) {
|
||||
propsEvent.value.event.participant.push(e.id);
|
||||
}
|
||||
}
|
||||
if ("employees" in e) {
|
||||
if ('employees' in e) {
|
||||
cbSelect(e.employees);
|
||||
}
|
||||
});
|
||||
@@ -474,7 +424,7 @@ export default {
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
let dateParts = newValue.split(".");
|
||||
let dateParts = newValue.split('.');
|
||||
|
||||
// let d = new Date(propsEvent.value.event.date_start).setFullYear(parseInt(dateParts[2], 10), parseInt(dateParts[1], 10), parseInt(dateParts[0], 10))
|
||||
// let d = new Date(propsEvent.value.event.date_start).setDate(new Date(2024,01,01))
|
||||
@@ -487,24 +437,19 @@ export default {
|
||||
const postData = (validate) => {
|
||||
if (validate) {
|
||||
let postEvent = new FormData();
|
||||
postEvent.append(
|
||||
"event",
|
||||
JSON.stringify({ ...propsEvent.value.event })
|
||||
);
|
||||
postEvent.append('event', JSON.stringify({ ...propsEvent.value.event }));
|
||||
if (propsEvent.value.event.files !== null) {
|
||||
files.value.forEach((e) => postEvent.append("files", e));
|
||||
files.value.forEach((e) => postEvent.append('files', e));
|
||||
}
|
||||
|
||||
axiosApiInstance
|
||||
.post("api/calendar_of_events/my_events/", postEvent)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "green-darken-4";
|
||||
emit("getCalendar");
|
||||
emit("closeDialog");
|
||||
});
|
||||
axiosApiInstance.post('api/calendar_of_events/my_events/', postEvent).then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = 'mdi-check';
|
||||
feedalert.color = 'green-darken-4';
|
||||
emit('getCalendar');
|
||||
emit('closeDialog');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -590,7 +535,7 @@ export default {
|
||||
};
|
||||
|
||||
const what = (w) => {
|
||||
console.log(w, "?????????????????????????????????");
|
||||
console.log(w, '?????????????????????????????????');
|
||||
};
|
||||
|
||||
const periodDisplayRule = (idItem) => {
|
||||
|
||||
@@ -51,6 +51,7 @@ export const useCalendarStore = defineStore('calendar', () => {
|
||||
currentView.value = view;
|
||||
};
|
||||
|
||||
|
||||
// Загрузка календарей пользователя
|
||||
const loadCalendars = async () => {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user