This commit is contained in:
iriska-gri committed 2024-07-17 11:38:45 +03:00
1 parent 7305705e44
commit ebc1445a18
6 files changed
+94 -60

No files matched your search

@@ -151,6 +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) => {
@@ -166,10 +167,7 @@ export default {
getCalendar(); getCalendar();
const getEvents = () => { const getEvents = () => {
console.log(
idEvent.value,
"idEvent.value------------------------------------------------------------------"
);
axiosApiInstance axiosApiInstance
.get( .get(
`api/calendar_of_events/my_events/${ `api/calendar_of_events/my_events/${
@@ -177,6 +175,7 @@ export default {
}` }`
) )
.then((res) => { .then((res) => {
console.log(eventFromCalendar.value, 'eventFromCalendar.value')
eventFromCalendar.value = res.data; eventFromCalendar.value = res.data;
if (idEvent.value == null) { if (idEvent.value == null) {
@@ -191,7 +190,7 @@ export default {
calendar: null, calendar: null,
}; };
} }
console.log(eventFromCalendar.value, 'vvvvvvvvvvvvvvvvvvvvvvvvvvvvv')
} }
@@ -200,13 +199,12 @@ export default {
getEvents(); getEvents();
const createEvent = (i) => { const createEvent = () => {
if (i != undefined) {
idEvent.value = i;
getEvents()
}
showDialog.value = true; showDialog.value = true;
getCalendar(); getCalendar();
console.log('1');
// emit("getCalendar"); // emit("getCalendar");
}; };
@@ -24,8 +24,6 @@
<v-btn icon="mdi-menu-right" variant="text" @click="nextDay" /> <v-btn icon="mdi-menu-right" variant="text" @click="nextDay" />
</v-col> </v-col>
<v-col class="text-h6 align-self-center ml-n6"> <v-col class="text-h6 align-self-center ml-n6">
<!-- {{ title.charAt(0).toUpperCase() + title.slice(1) }}
-->
<span class="text-capitalize"> <span class="text-capitalize">
{{ getMonthName(monthNow + 1) }} {{ getMonthName(monthNow + 1) }}
</span> </span>
@@ -52,8 +50,18 @@
</v-col> </v-col>
</template> </template>
<template v-slot:event="{ event }"> <template v-slot:event="{ day, event }">
<v-chip <v-chip
v-show="
(!event.disable &&
new Date(day.date).setHours(0, 0, 0, 0) !=
new Date(event.end).setHours(0, 0, 0, 0)) ||
(event.disable &&
!(
new Date(day.date).setHours(0, 0, 0, 0) !=
new Date(event.end).setHours(0, 0, 0, 0)
))
"
class="w-100" class="w-100"
density="compact" density="compact"
:color="event.color" :color="event.color"
@@ -96,18 +104,23 @@ export default {
get: () => props.allEvent, get: () => props.allEvent,
set: (value) => emit("update:allEvent", value), set: (value) => emit("update:allEvent", value),
}); });
const events = ref([ const events = ref([]);
]);
const returnPeriod = computed({ const returnPeriod = computed({
get() { get() {
let select = [propsAllEvent.value]; 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) => {
// console.log(i, 'i') if (
i.period == null &&
new Date(i.date_end) > new Date(getLastDayOfMonth())
)
i.date_end = new Date(getLastDayOfMonth());
// console.log(i, "i");
let objRule = JSON.parse(i.period); let objRule = JSON.parse(i.period);
if (objRule != null) { if (objRule != null) {
@@ -117,55 +130,78 @@ export default {
until: new Date(objRule.origOptions.until), until: new Date(objRule.origOptions.until),
}); });
let actRule = rule.all(); let actRule = rule.all();
actRule.forEach((r) => {
let ev = { actRule
.filter(
(date) =>
new Date(date).getMonth() ===
new Date(selectDay.value).getMonth() &&
new Date(date).getYear() ===
new Date(selectDay.value).getYear()
)
.forEach((r) => {
let ev = {
title: i.name, title: i.name,
color: e.cl_color, color: e.cl_color,
start: new Date(r), start: new Date(r),
end: new Date(i.date_end), end: new Date(i.date_end),
id: i.id id: i.id,
disable:
new Date(r).setHours(0, 0, 0, 0) ==
new Date(i.date_end).setHours(0, 0, 0, 0),
};
} events.value.push(ev);
events.value.push(ev)
// console.log(r , "rule");
// console.log(ev , "ev");
})
});
} else {
let dates = getDatesBetweenDates(
new Date(i.date_start),
new Date(i.date_end)
);
dates.forEach((d) => {
let ev = {
title: i.name,
color: e.cl_color,
start: new Date(d),
end: new Date(i.date_end),
id: i.id,
disable:
new Date(d).setHours(0, 0, 0, 0) ==
new Date(i.date_end).setHours(0, 0, 0, 0),
};
events.value.push(ev);
});
} }
}); });
}); });
return select; return select;
}, },
}); });
// const value = computed({ const getDatesBetweenDates = (startDate, endDate) => {
let dates = [];
let currentDate = new Date(startDate);
// get() { while (currentDate <= endDate) {
dates.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}
// console.log('111111111111111111111'); return dates;
// return new Date(today.value) };
// },
// set(newValue) {
// console.log(newValue, "value===============");
// },
// });
// const dayNow = new Date(); const getLastDayOfMonth = () => {
let currentMonth = new Date(selectDay.value).getMonth();
let currentYear = new Date(selectDay.value).getFullYear();
return new Date(currentYear, currentMonth + 1, 0);
};
// const dayNow = ref(new Date(
// new Date().setDate(
// new Date().getDate() - 3
// )
// ))
// const selectDay = new Date(
// new Date().setDate(
// new Date().getDate() - 3
// )
// )
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());
@@ -239,9 +275,8 @@ export default {
}; };
const whatDay = (e) => { const whatDay = (e) => {
console.log(e.id, "---e.id---------------");
emit("getEvent", e.id)
emit("getEvent", e.id);
}; };
// const controlDate = computed({ // const controlDate = computed({
@@ -41,7 +41,7 @@ export default {
)) ))
// : (propsDateEvent.value.date_end = new Date())&&(propsDateEvent.value.date_start = new Date()) // : (propsDateEvent.value.date_end = new Date())&&(propsDateEvent.value.date_start = new Date())
emit('chekUp', newValue) emit('chekUp', newValue)
console.log(propsDateEvent.value.date_start, 'propsDateEvent.value.date_start');
}, },
}); });
@@ -240,11 +240,14 @@ export default {
// let rule = new RRule({ // let rule = new RRule({
// dtstart: objRule.origOptions.dtstart // dtstart: objRule.origOptions.dtstart
// // ...objRule.origOptions // // ...objRule.origOptions
// new Date(
// new Date().setDate(
// new Date().getDate() - 3
// }) // })
select.push(repeatRules[objRule != null?repeatRules.findIndex(e=> e.rule.freq == objRule.origOptions.freq): 0]); select.push(repeatRules[objRule != null?repeatRules.findIndex(e=> e.rule.freq == objRule.origOptions.freq): 0]);
console.log(dateEventsRules.value, "------dateEventsRules.value =");
return select; return select;
}, },
set(newValue) { set(newValue) {
@@ -253,12 +256,12 @@ export default {
dtstart: new Date(propsEvent.value.event.date_start), dtstart: new Date(propsEvent.value.event.date_start),
until: new Date(propsEvent.value.event.date_end), until: new Date(propsEvent.value.event.date_end),
}); });
propsEvent.value.event.period =
Object.keys(newValue.rule).length == 0 Object.keys(newValue.rule).length == 0
? null ? null
: JSON.stringify(newRulse); : JSON.stringify(newRulse);
dateEventsRules.value = newRulse.all(); dateEventsRules.value = newRulse.all();
console.log(dateEventsRules.value, "returnP");
}, },
}); });
@@ -348,7 +351,7 @@ export default {
const files = ref([]); const files = ref([]);
const postFiles = (f) => { const postFiles = (f) => {
files.value = f; files.value = f;
console.log(f, "postFiles");
}; };
const calendar = computed({ const calendar = computed({
@@ -431,7 +434,7 @@ export default {
const dateEvent = computed({ const dateEvent = computed({
get() { get() {
console.log("работает?");
return formatComa(new Date(propsEvent.value.event.date_start)); return formatComa(new Date(propsEvent.value.event.date_start));
}, },
@@ -59,9 +59,7 @@ export default {
participants: participant.value, participants: participant.value,
calendar: calendar.value, calendar: calendar.value,
}) })
.then((data) => {
console.log(data, "datas");
});
} }
const handleFilesUpload = (event) => { const handleFilesUpload = (event) => {
@@ -161,7 +161,7 @@ export default {
const downloadItem = (file) => { const downloadItem = (file) => {
let url = development.value ? burl + file.file_name : spravURLBase + `files/${file.typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${file.parent}/${get_name(file.file_name)}` let url = development.value ? burl + file.file_name : spravURLBase + `files/${file.typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${file.parent}/${get_name(file.file_name)}`
console.log(burl + file.file_name);
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => { axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
saveAs(response.data, get_name(decodeURI(file.file_name))); saveAs(response.data, get_name(decodeURI(file.file_name)));
}); });