This commit is contained in:
iriska-gri committed 2024-07-17 13:20:01 +03:00
1 parent 5b942ba862
commit 33dbb9c772
2 files changed
+16 -21

No files matched your search

@@ -127,8 +127,8 @@ export default {
const MyMonth = ref(selectdate.value.getMonth() + 1); const MyMonth = ref(selectdate.value.getMonth() + 1);
const calendarForMy = ref([]); const calendarForMy = ref([]);
const eventFromCalendar = ref({}); const eventFromCalendar = ref({});
const idEvent = ref(null);
// const idEvent = ref(27)
// const rule = new RRule({ // const rule = new RRule({
// freq: RRule.WEEKLY, // freq: RRule.WEEKLY,
@@ -151,7 +151,7 @@ export default {
}; };
const getCalendar = () => { const getCalendar = () => {
console.log(idEvent.value, " idEvent.value");
axiosApiInstance axiosApiInstance
.get(`api/calendar_of_events/my_calendars/`) .get(`api/calendar_of_events/my_calendars/`)
.then((res) => { .then((res) => {
@@ -160,24 +160,24 @@ export default {
(e.visible = accountStore.calendar.includes(e.id) ? false : true) (e.visible = accountStore.calendar.includes(e.id) ? false : true)
); );
calendarForMy.value = res.data; calendarForMy.value = res.data;
// console.log(calendarForMy.value , 'eventFromCalendar.value-----------------------')
}); });
}; };
getCalendar(); getCalendar();
const getEvents = () => { const getEvents = (idEvent) => {
console.log(idEvent.value, "idEvent.value----------------"); console.log(idEvent, 'idEvent-------------------')
axiosApiInstance axiosApiInstance
.get( .get(
`api/calendar_of_events/my_events/${ `api/calendar_of_events/my_events/${
idEvent.value == null ? "" : `?id=${idEvent.value}` idEvent == null ? "" : `?id=${idEvent}`
}` }`
) )
.then((res) => { .then((res) => {
eventFromCalendar.value = res.data; eventFromCalendar.value = res.data;
if (idEvent.value == null) { if (idEvent == null) {
eventFromCalendar.value.event = { eventFromCalendar.value.event = {
name: "", name: "",
participant: [accountStore.user.is_idEmployee], participant: [accountStore.user.is_idEmployee],
@@ -195,8 +195,9 @@ export default {
getEvents(); getEvents();
const createEvent = (idEv) => { const createEvent = (idEv) => {
console.log(idEv, '222222222222')
showDialog.value = true; showDialog.value = true;
// getEvents(); getEvents(idEv);
}; };
const weekendsData = () => { const weekendsData = () => {
@@ -2,7 +2,7 @@
<v-locale-provider locale="ru"> <v-locale-provider locale="ru">
<v-calendar <v-calendar
ref="calendar" ref="calendar"
:events="events" :events="returnPeriod"
:view-mode="type" :view-mode="type"
:month="monthNow" :month="monthNow"
:year="YearNow" :year="YearNow"
@@ -28,8 +28,8 @@
{{ getMonthName(monthNow + 1) }} {{ getMonthName(monthNow + 1) }}
</span> </span>
{{ YearNow }} г. <my-helper :pretext="returnPeriod" /> {{ YearNow }} г.
<my-helper :pretext="events" /> <!-- <my-helper :pretext="returnPeriod" /> -->
</v-col> </v-col>
<v-col class="text-end align-self-center"> <v-col class="text-end align-self-center">
<v-btn <v-btn
@@ -104,14 +104,13 @@ export default {
get: () => props.allEvent, get: () => props.allEvent,
set: (value) => emit("update:allEvent", value), set: (value) => emit("update:allEvent", value),
}); });
const events = ref([]);
const returnPeriod = computed({ const returnPeriod = computed({
get() { get() {
let select = []; let select = [];
propsAllEvent.value.forEach((e) => { propsAllEvent.value.forEach((e) => {
// console.log(e, "e"); // console.log(e, "e");
e.events.forEach((i) => { e.events.forEach((i) => {
if ( if (
@@ -151,8 +150,7 @@ export default {
new Date(i.date_end).setHours(0, 0, 0, 0), new Date(i.date_end).setHours(0, 0, 0, 0),
}; };
events.value.push(ev); select.push(ev);
}); });
} else { } else {
let dates = getDatesBetweenDates( let dates = getDatesBetweenDates(
@@ -171,9 +169,8 @@ export default {
new Date(d).setHours(0, 0, 0, 0) == new Date(d).setHours(0, 0, 0, 0) ==
new Date(i.date_end).setHours(0, 0, 0, 0), new Date(i.date_end).setHours(0, 0, 0, 0),
}; };
events.value.push(ev); select.push(ev);
}); });
} }
}); });
}); });
@@ -201,7 +198,6 @@ export default {
return new Date(currentYear, currentMonth + 1, 0); return new Date(currentYear, currentMonth + 1, 0);
}; };
const selectDay = ref([new Date()]); const selectDay = ref([new Date()]);
const monthNow = ref(new Date().getMonth()); const monthNow = ref(new Date().getMonth());
const YearNow = ref(new Date().getFullYear()); const YearNow = ref(new Date().getFullYear());
@@ -275,7 +271,6 @@ export default {
}; };
const whatDay = (e) => { const whatDay = (e) => {
emit("getEvent", e.id); emit("getEvent", e.id);
}; };
@@ -296,7 +291,6 @@ export default {
type, type,
types, types,
switchCalendar, switchCalendar,
events,
monthNow, monthNow,
YearNow, YearNow,