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