fix [P-57]: фикс заголовков календаря

This commit is contained in:
Inna committed 2025-09-11 16:27:00 +03:00
1 parent 3726bf4afa
commit 4897db2399
1 file changed
+32 -8
@@ -55,14 +55,13 @@
<div class="flex-grow-1">
<!-- VCalendar -->
<FullCalendar ref="calendarRef" :options="calendarOptions" class="compact-calendar" />
<!-- @datesSet="handleDatesSet" -->
</div>
</v-card-text>
</v-card>
</v-col>
</template>
<script>
import { ref, computed, watch, nextTick } from 'vue';
import { ref, watch, nextTick, computed } from 'vue';
import { storeToRefs } from 'pinia';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
@@ -79,6 +78,7 @@ export default {
const calendarRef = ref(null);
const currentView = ref('dayGridMonth');
const calendarApi = ref(null);
const currentTitle = ref('Календарь');
const calendarStore = useCalendarStore();
const { selectedDate, lastUpdatedBy } = storeToRefs(calendarStore);
@@ -131,6 +131,11 @@ export default {
allDaySlot: false,
expandRows: true,
dayHeaderFormat: { weekday: 'short', day: 'numeric' },
titleFormat: {
day: 'numeric',
month: 'long',
omitCommas: true,
},
},
dayGridMonth: {
type: 'dayGrid',
@@ -238,8 +243,29 @@ export default {
},
dateClick: (info) => {
selectedDate.value - info.dateStr;
handleCalendarDateClick(info);
},
datesSet: (info) => {
if (info.view.type === 'listWeek' && selectedDate.value) {
const date = new Date(selectedDate.value);
const options = {
weekday: 'long',
day: 'numeric',
month: 'long',
year: 'numeric',
};
const formattedDate = date.toLocaleDateString('ru-RU', options);
currentTitle.value = `Расписание на ${formattedDate}`;
} else {
currentTitle.value = info.view.title;
}
},
dayCellContent: () => {},
});
onMounted(() => {
@@ -250,6 +276,7 @@ export default {
const handleCalendarDateClick = (info) => {
calendarStore.setSelectedDateFromCalendar(info);
currentTitle.value = info.view.title;
};
const handleToday = () => {
@@ -264,10 +291,6 @@ export default {
calendarApi.value?.next();
};
const currentTitle = computed(() => {
return calendarApi.value ? calendarApi.value.view.title : 'Календарь';
});
watch(
currentView,
(newView) => {
@@ -304,15 +327,16 @@ export default {
</script>
<style scoped>
:deep(.v-btn--active) {
background-color: #e0f2f1 !important;
background-color: transparent !important;
color: #00897b !important;
}
/* Изменение фона текущего дня */
:deep(.fc .fc-daygrid-day.fc-day-today) {
background-color: #e0f2f1 !important;
background-color: transparent !important;
}
:deep(.fc .fc-timegrid-col.fc-day-today) {
background-color: #e0f2f1 !important;
}
</style>