fix [P-290]: модалка просмотра события
This commit is contained in:
1 parent
0d404e533b
commit
8c2eb5d040
6 files changed
+591
-17
No files matched your search
@@ -4,7 +4,7 @@
|
||||
<mini-calendar />
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<custom-calendar @openEventDialog="openEventDialog" />
|
||||
<custom-calendar @openEventDialog="openEventDialog" @openEventView="openEventView" />
|
||||
</v-col>
|
||||
|
||||
<v-dialog v-model="showEventDialog" max-width="700">
|
||||
@@ -18,11 +18,19 @@
|
||||
:key="eventKey"
|
||||
/>
|
||||
</v-dialog>
|
||||
|
||||
<event-calendar-show
|
||||
v-model:show="showViewDialog"
|
||||
:all-calendars="allCalendars"
|
||||
:event-data="selectedEventForView"
|
||||
@close="handleViewDialogClose"
|
||||
:employees="calendarStore.employees"
|
||||
/>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { ref, onMounted, watch, computed } from 'vue';
|
||||
import { useWeekendsStore } from '@/store/WeekendsStore';
|
||||
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
||||
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
||||
@@ -31,9 +39,10 @@ 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';
|
||||
import EventCalendarShow from '@/components/calendar_of_events/event-calendar-show.vue';
|
||||
|
||||
export default {
|
||||
components: { EventCreate, MiniCalendar, CustomCalendar },
|
||||
components: { EventCreate, MiniCalendar, CustomCalendar, EventCalendarShow },
|
||||
setup() {
|
||||
const week = useWeekendsStore();
|
||||
const selectdate = ref(new Date());
|
||||
@@ -45,6 +54,8 @@ export default {
|
||||
|
||||
const calendarStore = useCalendarStore();
|
||||
const accountStore = useAccountStore();
|
||||
const showViewDialog = ref(false);
|
||||
const selectedEventForView = ref({});
|
||||
|
||||
const { selectedDate, showEventDialog } = storeToRefs(calendarStore); // синхронизируем с date-picker
|
||||
|
||||
@@ -60,9 +71,18 @@ export default {
|
||||
};
|
||||
|
||||
const getDictEmployee = () => {
|
||||
calendarStore.loadDictEmployees();
|
||||
};
|
||||
|
||||
const getEmployees = () => {
|
||||
calendarStore.loadEmployees();
|
||||
};
|
||||
|
||||
const allCalendars = computed(() => [
|
||||
...calendarStore.myCalendars,
|
||||
...calendarStore.subscribedCalendars,
|
||||
]);
|
||||
|
||||
const getEvent = (idEvent) => {
|
||||
if (!idEvent) {
|
||||
eventFromCalendar.value = createEmptyEvent();
|
||||
@@ -104,6 +124,7 @@ export default {
|
||||
week.getWeekend(MyYear.value);
|
||||
getDictEmployee();
|
||||
getCalendar();
|
||||
getEmployees();
|
||||
});
|
||||
|
||||
const closeEventDialog = () => {
|
||||
@@ -140,6 +161,31 @@ export default {
|
||||
},
|
||||
);
|
||||
|
||||
const getEventForView = (idEvent) => {
|
||||
if (!idEvent) {
|
||||
selectedEventForView.value = {};
|
||||
return;
|
||||
}
|
||||
|
||||
axiosApiInstance.get(`api/calendar_of_events/my_events/?id=${idEvent}`).then((res) => {
|
||||
selectedEventForView.value = res.data;
|
||||
showViewDialog.value = true;
|
||||
});
|
||||
};
|
||||
|
||||
const openEventView = (eventId) => {
|
||||
if (eventId) {
|
||||
getEventForView(eventId);
|
||||
} else {
|
||||
console.log('❌ No event ID provided');
|
||||
}
|
||||
};
|
||||
|
||||
// Закрытие модалки
|
||||
const handleViewDialogClose = () => {
|
||||
showViewDialog.value = false;
|
||||
};
|
||||
|
||||
return {
|
||||
selectedDate,
|
||||
getMonth,
|
||||
@@ -158,6 +204,11 @@ export default {
|
||||
createEmptyEvent,
|
||||
eventKey,
|
||||
getDictEmployee,
|
||||
openEventView,
|
||||
handleViewDialogClose,
|
||||
showViewDialog,
|
||||
selectedEventForView,
|
||||
allCalendars,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ export default {
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
emits: ['openEventDialog'],
|
||||
emits: ['openEventDialog', 'openEventView'],
|
||||
setup(props, { emit }) {
|
||||
const currentView = ref('dayGridMonth');
|
||||
const currentTitle = ref('Календарь');
|
||||
@@ -113,7 +113,9 @@ export default {
|
||||
const handleEventClick = (info) => {
|
||||
if (calendarStore.canEditEvent(info.event.id)) {
|
||||
emit('openEventDialog', info);
|
||||
}
|
||||
} else {
|
||||
emit('openEventView', info.event.id);
|
||||
}
|
||||
};
|
||||
|
||||
const calendarOptions = ref({
|
||||
|
||||
@@ -97,6 +97,7 @@ import calendarCreateSelect from '@/components/calendar_of_events/calendar-creat
|
||||
import { useAlertStore } from '@/store/UseAlertStore';
|
||||
import DialogCreate from './UI_calendar/dialogCreate.vue';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import { useCalendarStore } from '../../store/calendarStore';
|
||||
|
||||
export default {
|
||||
components: { calendarCreateSelect, DialogCreate },
|
||||
@@ -110,6 +111,7 @@ export default {
|
||||
|
||||
setup(props, { emit }) {
|
||||
const accountStore = useAccountStore();
|
||||
const calendarStore = useCalendarStore()
|
||||
|
||||
const calendarAuthorId = computed(() => {
|
||||
// Для нового календаря - текущий пользователь
|
||||
|
||||
@@ -0,0 +1,513 @@
|
||||
<template>
|
||||
<v-dialog v-model="internalShow" max-width="800">
|
||||
<v-card class="pa-4" min-height="400">
|
||||
<!-- Заголовок -->
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between pb-3">
|
||||
<span class="text-h5 font-weight-medium">Просмотр события</span>
|
||||
<v-icon
|
||||
icon="mdi-close"
|
||||
size="small"
|
||||
color="grey"
|
||||
class="cursor-pointer"
|
||||
@click="closeDialog"
|
||||
/>
|
||||
</v-card-title>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<!-- Контент -->
|
||||
<v-card-text class="px-2">
|
||||
<v-row no-gutters class="flex-column">
|
||||
<!-- Название события -->
|
||||
<v-row no-gutters class="align-center border-bottom">
|
||||
<v-col
|
||||
style="font-size: 1.1rem; line-height: 1.4"
|
||||
class="text-body-1 text-text_grey font-weight-medium"
|
||||
lg="3"
|
||||
>
|
||||
Название
|
||||
</v-col>
|
||||
<v-col>
|
||||
<div class="text-body-1" style="font-size: 1.1rem; line-height: 1.4">
|
||||
{{ eventData.event?.name || 'Без названия' }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Календарь -->
|
||||
<v-row no-gutters class="align-center pb-3 mb-3 border-bottom">
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium" lg="3"> Календарь </v-col>
|
||||
<v-col>
|
||||
<div class="d-flex align-center">
|
||||
<v-avatar size="20" :color="calendarColor" class="mr-3" />
|
||||
<span class="text-body-1">{{ calendarName }}</span>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Участники -->
|
||||
<v-row
|
||||
no-gutters
|
||||
class="align-start pb-3 mb-3 border-bottom"
|
||||
v-if="participantsList.length > 0"
|
||||
>
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium pt-1" lg="3">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<div class="participants-list">
|
||||
<div
|
||||
v-for="participant in participantsList"
|
||||
:key="participant.id"
|
||||
class="text-body-1 mb-1"
|
||||
>
|
||||
• {{ participant.title }}
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Дата и время -->
|
||||
<v-row no-gutters class="align-top pb-3 mb-3 border-bottom">
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium pt-1" lg="3">
|
||||
Дата и время
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<div class="d-flex align-center gap">
|
||||
<div class="text-body-1 font-weight-medium">
|
||||
{{ formatDateTime(eventData.event?.date_start, eventData.event?.allday) }}
|
||||
</div>
|
||||
<v-icon icon="mdi-minus" color="grey" class="mx-3" />
|
||||
<div class="text-body-1 font-weight-medium">
|
||||
{{ formatDateTime(eventData.event?.date_end, eventData.event?.allday) }}
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Повторение -->
|
||||
<v-row
|
||||
no-gutters
|
||||
class="align-center pb-3 mb-3 border-bottom"
|
||||
v-if="eventData.event?.period"
|
||||
>
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium" lg="3"> Повтор события </v-col>
|
||||
<v-col>
|
||||
<div class="text-body-1">{{ recurrenceText }}</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Окончание события -->
|
||||
<v-row no-gutters class="align-center pb-3 mb-3 border-bottom" v-if="showRepeatEnd">
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium" lg="3">
|
||||
Окончание события
|
||||
</v-col>
|
||||
<v-col>
|
||||
<div class="text-body-1">
|
||||
{{ formatRepeatEndDate }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Файлы -->
|
||||
<v-row
|
||||
no-gutters
|
||||
class="align-top pb-3 mb-3 border-bottom"
|
||||
v-if="eventData.event?.files?.length"
|
||||
>
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium" lg="3"> Файлы </v-col>
|
||||
<v-col>
|
||||
<div class="files-list">
|
||||
<div
|
||||
v-for="file in eventData.event.files"
|
||||
:key="file.id"
|
||||
class="d-flex align-center mb-2 cursor-pointer"
|
||||
@click="downloadFile(file)"
|
||||
>
|
||||
<v-icon :icon="getFileIcon(file)" color="primary" class="mr-2" size="small" />
|
||||
<span class="text-body-1 text-primary text-decoration-underline">
|
||||
{{ truncateFileName(getFileName(file)) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Описание -->
|
||||
<v-row no-gutters class="align-top pb-3" v-if="eventData.event?.description">
|
||||
<v-col class="text-body-1 text-text_grey font-weight-medium" lg="3"> Описание </v-col>
|
||||
<v-col>
|
||||
<div class="text-body-1 description-text">
|
||||
{{ eventData.event.description }}
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Если нет данных -->
|
||||
<v-row v-if="!eventData.event?.name" class="justify-center mt-8">
|
||||
<v-col class="text-center">
|
||||
<v-icon size="64" color="grey-lighten-1">mdi-calendar-remove</v-icon>
|
||||
<div class="text-h6 text-grey mt-2">Нет данных о событии</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
|
||||
<!-- Кнопки -->
|
||||
<v-card-actions class="justify-end pa-4 pt-0">
|
||||
<v-btn
|
||||
width="120"
|
||||
@click="closeDialog"
|
||||
color="grey-darken-1"
|
||||
variant="tonal"
|
||||
class="text-body-1"
|
||||
>
|
||||
Закрыть
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useRecurrence } from '@/components/calendar_of_events/composables/useReccurrence';
|
||||
import { RRule } from 'rrule';
|
||||
|
||||
export default {
|
||||
name: 'EventCalendarShow',
|
||||
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
eventData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
allCalendars: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
employees: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
|
||||
emits: ['update:show', 'close'],
|
||||
|
||||
setup(props, { emit }) {
|
||||
const internalShow = ref(props.show);
|
||||
const { parseRecurrenceOptions, isRecurringEvent } = useRecurrence();
|
||||
|
||||
// Синхронизация с внешним состоянием
|
||||
watch(
|
||||
() => props.show,
|
||||
(newVal) => {
|
||||
internalShow.value = newVal;
|
||||
},
|
||||
);
|
||||
|
||||
watch(internalShow, (newVal) => {
|
||||
if (!newVal) {
|
||||
emit('update:show', false);
|
||||
emit('close');
|
||||
}
|
||||
});
|
||||
|
||||
const closeDialog = () => {
|
||||
internalShow.value = false;
|
||||
};
|
||||
|
||||
// Информация о календаре - ИСПРАВЛЕНО
|
||||
const calendarInfo = computed(() => {
|
||||
const calendarId = props.eventData.event?.calendar;
|
||||
return props.allCalendars.find((cal) => cal.id == calendarId) || {};
|
||||
});
|
||||
|
||||
const calendarName = computed(() => calendarInfo.value.cl_name || 'Неизвестный календарь');
|
||||
const calendarColor = computed(() => calendarInfo.value.cl_color || 'grey');
|
||||
|
||||
// Участники - ИСПРАВЛЕНО
|
||||
const participantsList = computed(() => {
|
||||
const participantIds = props.eventData.event?.participant || [];
|
||||
|
||||
// Собираем всех сотрудников
|
||||
const allEmployees = props.employees.flatMap((dept) => dept.employees || []);
|
||||
|
||||
return participantIds
|
||||
.map((id) => {
|
||||
const employee = allEmployees.find((emp) => emp.id == id);
|
||||
return employee
|
||||
? {
|
||||
id: employee.id,
|
||||
title: employee.title,
|
||||
}
|
||||
: null;
|
||||
})
|
||||
.filter(Boolean);
|
||||
});
|
||||
|
||||
// Форматирование даты
|
||||
const formatDateTime = (dateString, isAllDay) => {
|
||||
if (!dateString) return 'Не указано';
|
||||
|
||||
try {
|
||||
const date = new Date(dateString);
|
||||
|
||||
if (isAllDay) {
|
||||
return date.toLocaleDateString('ru-RU', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
});
|
||||
}
|
||||
|
||||
return date.toLocaleString('ru-RU', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
} catch {
|
||||
return 'Неверный формат даты';
|
||||
}
|
||||
};
|
||||
|
||||
// Определяем показывать ли окончание повтора
|
||||
const showRepeatEnd = computed(() => {
|
||||
const period = props.eventData.event?.period;
|
||||
if (!period || !isRecurringEvent(props.eventData.event)) return false;
|
||||
|
||||
try {
|
||||
const options = parseRecurrenceOptions(period, props.eventData.event?.date_start);
|
||||
return !!options?.until;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Форматируем дату окончания повтора
|
||||
const formatRepeatEndDate = computed(() => {
|
||||
const period = props.eventData.event?.period;
|
||||
if (!period || !isRecurringEvent(props.eventData.event)) return '';
|
||||
|
||||
try {
|
||||
const options = parseRecurrenceOptions(period, props.eventData.event?.date_start);
|
||||
if (options?.until) {
|
||||
return new Date(options.until).toLocaleDateString('ru-RU', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error parsing repeat end date:', error);
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
// Текст повторения с использованием composable
|
||||
const recurrenceText = computed(() => {
|
||||
const period = props.eventData.event?.period;
|
||||
if (!period || !isRecurringEvent(props.eventData.event)) return '';
|
||||
|
||||
try {
|
||||
const options = parseRecurrenceOptions(period, props.eventData.event?.date_start);
|
||||
if (!options) return 'Повторяющееся событие';
|
||||
|
||||
const freq = options.freq;
|
||||
const interval = options.interval || 1;
|
||||
|
||||
switch (freq) {
|
||||
case RRule.DAILY:
|
||||
return interval === 1 ? 'Каждый день' : `Каждые ${interval} дней`;
|
||||
|
||||
case RRule.WEEKLY:
|
||||
if (interval === 1) {
|
||||
if (options.byweekday && options.byweekday.length > 0) {
|
||||
const dayNames = options.byweekday
|
||||
.map((day) => {
|
||||
const dayMap = {
|
||||
[RRule.MO]: 'понедельник',
|
||||
[RRule.TU]: 'вторник',
|
||||
[RRule.WE]: 'среду',
|
||||
[RRule.TH]: 'четверг',
|
||||
[RRule.FR]: 'пятницу',
|
||||
[RRule.SA]: 'субботу',
|
||||
[RRule.SU]: 'воскресенье',
|
||||
};
|
||||
return dayMap[day] || '';
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
if (dayNames.length === 1) return `Каждую ${dayNames[0]}`;
|
||||
if (dayNames.length > 1) return `По ${dayNames.join(', ')}`;
|
||||
}
|
||||
return 'Каждую неделю';
|
||||
}
|
||||
return `Каждые ${interval} недель`;
|
||||
|
||||
case RRule.MONTHLY:
|
||||
if (interval === 1) {
|
||||
if (options.bymonthday && options.bymonthday.length > 0) {
|
||||
const day = options.bymonthday[0];
|
||||
return `Каждое ${day}-е число`;
|
||||
}
|
||||
return 'Каждый месяц';
|
||||
}
|
||||
return interval === 3 ? 'Каждый квартал' : `Каждые ${interval} месяцев`;
|
||||
|
||||
case RRule.YEARLY:
|
||||
if (interval === 1) {
|
||||
if (options.bymonth && options.bymonthday) {
|
||||
const month = options.bymonth[0];
|
||||
const day = options.bymonthday[0];
|
||||
const monthNames = [
|
||||
'января',
|
||||
'февраля',
|
||||
'марта',
|
||||
'апреля',
|
||||
'мая',
|
||||
'июня',
|
||||
'июля',
|
||||
'августа',
|
||||
'сентября',
|
||||
'октября',
|
||||
'ноября',
|
||||
'декабря',
|
||||
];
|
||||
return `Каждый год ${day} ${monthNames[month - 1]}`;
|
||||
}
|
||||
return 'Каждый год';
|
||||
}
|
||||
return `Каждые ${interval} лет`;
|
||||
|
||||
default:
|
||||
return 'Повторяющееся событие';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error parsing recurrence:', error);
|
||||
return 'Повторяющееся событие';
|
||||
}
|
||||
});
|
||||
|
||||
// Функции для файлов
|
||||
const getFileName = (fileData) => {
|
||||
if (fileData.file) {
|
||||
const fileName = fileData.file.split('/').pop();
|
||||
return decodeURIComponent(fileName) || 'Файл';
|
||||
}
|
||||
return fileData.name || 'Файл';
|
||||
};
|
||||
|
||||
const getFileIcon = (fileData) => {
|
||||
const fileName = getFileName(fileData);
|
||||
const extension = fileName.split('.').pop()?.toLowerCase() || '';
|
||||
|
||||
const iconMap = {
|
||||
pdf: 'mdi-file-pdf',
|
||||
doc: 'mdi-file-word',
|
||||
docx: 'mdi-file-word',
|
||||
xls: 'mdi-file-excel',
|
||||
xlsx: 'mdi-file-excel',
|
||||
jpg: 'mdi-file-image',
|
||||
jpeg: 'mdi-file-image',
|
||||
png: 'mdi-file-image',
|
||||
zip: 'mdi-folder-zip',
|
||||
rar: 'mdi-folder-zip',
|
||||
txt: 'mdi-file-document',
|
||||
};
|
||||
|
||||
return iconMap[extension] || 'mdi-file';
|
||||
};
|
||||
|
||||
const downloadFile = (file) => {
|
||||
try {
|
||||
const fileUrl = file.file.startsWith('http')
|
||||
? file.file
|
||||
: `${window.location.origin}${file.file}`;
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.href = fileUrl;
|
||||
link.download = getFileName(file);
|
||||
link.style.display = 'none';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(link);
|
||||
}, 100);
|
||||
} catch (error) {
|
||||
console.error('Ошибка скачивания файла:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const truncateFileName = (fileName) => {
|
||||
if (!fileName) return 'Файл';
|
||||
|
||||
if (fileName.length <= 30) return fileName;
|
||||
|
||||
const extension = fileName.split('.').pop();
|
||||
const nameWithoutExt = fileName.slice(0, -(extension.length + 1));
|
||||
|
||||
if (nameWithoutExt.length <= 20) return fileName;
|
||||
|
||||
return `${nameWithoutExt.slice(0, 20)}...${extension ? '.' + extension : ''}`;
|
||||
};
|
||||
|
||||
return {
|
||||
internalShow,
|
||||
closeDialog,
|
||||
calendarName,
|
||||
calendarColor,
|
||||
participantsList,
|
||||
formatDateTime,
|
||||
recurrenceText,
|
||||
getFileName,
|
||||
getFileIcon,
|
||||
downloadFile,
|
||||
truncateFileName,
|
||||
showRepeatEnd,
|
||||
formatRepeatEndDate,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.participants-list {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.description-text {
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.6;
|
||||
background-color: #fafafa;
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
border-left: 3px solid #00897b;
|
||||
}
|
||||
|
||||
.gap {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* Убираем стандартные отступы Vuetify для более чистого вида */
|
||||
:deep(.v-card-text) {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
:deep(.v-card-title) {
|
||||
padding: 16px 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -191,6 +191,7 @@ import PeriodEvents from '@/components/calendar_of_events/UI_calendar/periodEven
|
||||
import { useAlertStore } from '@/store/UseAlertStore';
|
||||
import { RRule } from 'rrule';
|
||||
import { useRecurrence } from '@/components/calendar_of_events/composables/useReccurrence';
|
||||
import { useCalendarStore } from '../../store/calendarStore';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -215,6 +216,7 @@ export default {
|
||||
|
||||
setup(props, { emit }) {
|
||||
const accountStore = useAccountStore();
|
||||
const calendarStore = useCalendarStore();
|
||||
const createDialog = ref(null);
|
||||
|
||||
const { parseRecurrenceOptions, isRecurringEvent } = useRecurrence();
|
||||
@@ -227,8 +229,6 @@ export default {
|
||||
set: (value) => emit('update:eventCalendar', value),
|
||||
});
|
||||
|
||||
const staff = ref([]);
|
||||
|
||||
const currentCalendarAuthorId = computed(() => {
|
||||
if (isNewEvent.value) {
|
||||
// Для нового события - автор текущего выбранного календаря
|
||||
@@ -243,10 +243,6 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
axiosApiInstance.get('api/calendar_of_events/get_employees/').then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
});
|
||||
|
||||
const newStaff = computed({
|
||||
get() {
|
||||
let filteredStaff = [];
|
||||
@@ -257,7 +253,7 @@ export default {
|
||||
const calendarParticipantIds = new Set(participants.map((p) => p.participant_calendar));
|
||||
|
||||
// Мутируем И фильтруем для НОВОГО события
|
||||
filteredStaff = staff.value
|
||||
filteredStaff = calendarStore.employees
|
||||
.map((department) => {
|
||||
// ФИЛЬТРУЕМ сотрудников - оставляем только тех, кто в календаре
|
||||
const filteredEmployees = department.employees.filter((employee) =>
|
||||
@@ -288,7 +284,7 @@ export default {
|
||||
const eventParticipantIds = new Set(propsEvent.value.event.participant || []);
|
||||
|
||||
// Мутируем И фильтруем для СУЩЕСТВУЮЩЕГО события
|
||||
filteredStaff = staff.value
|
||||
filteredStaff = calendarStore.employees
|
||||
.map((department) => {
|
||||
// ФИЛЬТРУЕМ сотрудников - оставляем только тех, кто в календаре
|
||||
const filteredEmployees = department.employees.filter((employee) =>
|
||||
@@ -584,7 +580,6 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
axiosApiInstance.post('api/calendar_of_events/my_events/', postEvent).then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
@@ -690,7 +685,6 @@ export default {
|
||||
menudate,
|
||||
titleCard,
|
||||
propsEvent,
|
||||
staff,
|
||||
newStaff,
|
||||
returnIdParticant,
|
||||
postFiles,
|
||||
|
||||
@@ -17,6 +17,7 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
||||
const holidays = ref([]);
|
||||
const dictEmployees = ref([]);
|
||||
const dictEmployeesLoaded = ref(false);
|
||||
const employees = ref([])
|
||||
|
||||
// Массив ID скрытых календарей. Загружаем из localStorage при инициализации.
|
||||
const hiddenCalendarIds = ref([]);
|
||||
@@ -92,7 +93,7 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadEmployees = async () => {
|
||||
const loadDictEmployees = async () => {
|
||||
try {
|
||||
const response = await axiosApiInstance.get(`api/vote/getdictemployee/`);
|
||||
dictEmployees.value = response.data;
|
||||
@@ -103,6 +104,15 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const loadEmployees = async () => {
|
||||
try {
|
||||
const response = await axiosApiInstance.get('api/calendar_of_events/get_employees/');
|
||||
employees.value = response.data;
|
||||
} catch (error) {
|
||||
console.error('Ошибка получения всех сотрудников:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleCalendarVisibility = (calendarId) => {
|
||||
const index = hiddenCalendarIds.value.indexOf(calendarId);
|
||||
if (index === -1) {
|
||||
@@ -258,6 +268,7 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
||||
calendarColorMap,
|
||||
|
||||
dictEmployees,
|
||||
employees,
|
||||
editableEvents,
|
||||
canEditEvent,
|
||||
|
||||
@@ -272,6 +283,7 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
||||
toggleCalendarVisibility,
|
||||
fetchHolidays,
|
||||
isNonWorkingDay,
|
||||
loadEmployees,
|
||||
loadDictEmployees,
|
||||
loadEmployees
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user