Переработанный календарь
This commit is contained in:
1 parent
0e9e0f0934
commit
3fe102b6da
9 files changed
+506
-89
No files matched your search
@@ -48,7 +48,7 @@
|
||||
<v-col>
|
||||
<v-card class="h-100">
|
||||
<v-card-title class="text-center"
|
||||
>События на {{ dayformat(selectedDate) }}</v-card-title
|
||||
>События на {{selData }}</v-card-title
|
||||
>
|
||||
|
||||
<vue-cal
|
||||
@@ -61,8 +61,9 @@
|
||||
hide-view-selector
|
||||
:time="false"
|
||||
:events="events"
|
||||
:on-event-dblclick="onEventClick"
|
||||
|
||||
>
|
||||
<!-- :on-event-dblclick="onEventClick" -->
|
||||
<template #cell-content="{ view, events }">
|
||||
<v-img
|
||||
v-if="['week', 'day'].includes(view.id) && !events.length"
|
||||
@@ -72,7 +73,16 @@
|
||||
cover
|
||||
/>
|
||||
<v-card v-else>
|
||||
{{events}}
|
||||
|
||||
<v-list lines="one">
|
||||
<v-list-item
|
||||
@click="onEventClick(n)"
|
||||
v-for="n in events"
|
||||
:key="n.pk"
|
||||
:title="n.name"
|
||||
:subtitle="n.description"
|
||||
></v-list-item>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</template>
|
||||
</vue-cal>
|
||||
@@ -84,7 +94,7 @@
|
||||
<script>
|
||||
import VueCal from "vue-cal";
|
||||
import "vue-cal/dist/vuecal.css";
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { formaDashTime } from "@/utils/universal_functions";
|
||||
@@ -99,35 +109,26 @@ export default {
|
||||
const burl = baseURL.slice(0, -1);
|
||||
const events = ref([]);
|
||||
|
||||
const onEventClick = (event, e) => {
|
||||
selectedEvent.value = event;
|
||||
const onEventClick = (n) => {
|
||||
|
||||
selectedEvent.value = n;
|
||||
showDialog.value = true;
|
||||
e.stopPropagation();
|
||||
|
||||
};
|
||||
|
||||
function f_generalvacation() {
|
||||
events.value = [];
|
||||
// events.value = [];
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/calendarEvents/")
|
||||
.then((data) => {
|
||||
for (let key in data.data) {
|
||||
for (let x in data.data[key].event) {
|
||||
events.value.push({
|
||||
bigname: data.data[key].name,
|
||||
pk: data.data[key].event[x].pk,
|
||||
start: formaDashTime(data.data[key].event[x].startdate),
|
||||
end: formaDashTime(data.data[key].event[x].startdate),
|
||||
title: data.data[key].event[x].name,
|
||||
contentFull: data.data[key].event[x].description,
|
||||
content: data.data[key].event[x].content,
|
||||
icon: "mdi-book-open",
|
||||
class: "bg-indigo-lighten-5 border-sm",
|
||||
place: data.data[key].event[x].place,
|
||||
cdate: data.data[key].event[x].cdate,
|
||||
enddate: formaDashTime(data.data[key].event[x].enddate),
|
||||
});
|
||||
}
|
||||
}
|
||||
data.data.forEach((e)=>{
|
||||
e.start = formaDashTime(e.start)
|
||||
e.end = e.start
|
||||
})
|
||||
events.value=data.data
|
||||
// icon: "mdi-book-open",
|
||||
// class: "bg-indigo-lighten-5 border-sm",
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -139,27 +140,33 @@ export default {
|
||||
|
||||
const selectedDate = ref(null);
|
||||
|
||||
function dayformat(days) {
|
||||
const d = new Date(days);
|
||||
|
||||
const selData = computed({
|
||||
get: () => {
|
||||
const d = new Date(selectedDate.value);
|
||||
let mess = "сегодня";
|
||||
if (d.getFullYear() != "1970") {
|
||||
mess = `${d.getDate()} число`;
|
||||
}
|
||||
|
||||
return mess;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
return {
|
||||
selectedEvent,
|
||||
events,
|
||||
selectedDate,
|
||||
f_generalvacation,
|
||||
dayformat,
|
||||
showDialog,
|
||||
onEventClick,
|
||||
eventsCssClasses,
|
||||
burl,
|
||||
returnUpdateData,
|
||||
selData
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<v-card>
|
||||
{{dataToEdit}}
|
||||
|
||||
<v-card-title>
|
||||
<v-textarea
|
||||
v-model="dataToEdit.bigname"
|
||||
rows="1"
|
||||
placeholder="Название календаря"
|
||||
/>
|
||||
<v-text-field v-model="dataToEdit.title" placeholder="Заголовок" />
|
||||
<v-text-field v-model="dataToEdit.name" placeholder="Заголовок" />
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
<v-menu
|
||||
@@ -52,10 +53,14 @@
|
||||
</v-menu>
|
||||
</v-card-subtitle>
|
||||
<v-card-text class="pt-2">
|
||||
<v-textarea v-model="dataToEdit.content" placeholder="Описание события" />
|
||||
<!-- <v-textarea v-model="dataToEdit.description" placeholder="Описание события" /> -->
|
||||
<ckeditor :editor="editor" v-model="dataToEdit.description" :config="{
|
||||
placeholder:'Описание события',
|
||||
language: 'ru'
|
||||
|
||||
}"></ckeditor>
|
||||
<v-textarea
|
||||
v-model="dataToEdit.contentFull"
|
||||
v-model="dataToEdit.content"
|
||||
placeholder="Полное описание события"
|
||||
/>
|
||||
|
||||
@@ -95,16 +100,22 @@
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
import { ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
|
||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
|
||||
import '@ckeditor/ckeditor5-build-classic/build/translations/ru';
|
||||
export default {
|
||||
props: {
|
||||
event: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
components: {
|
||||
// Use the <ckeditor> component in this view.
|
||||
ckeditor: CKEditor.component
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const menudate = ref(false);
|
||||
@@ -127,18 +138,7 @@ export default {
|
||||
|
||||
|
||||
const confirmation = () => {
|
||||
console.log('11111111111111')
|
||||
// const calendar ={
|
||||
// cdate: dataToEdit.value.cdate,
|
||||
// summary: dataToEdit.value.title,
|
||||
// description: dataToEdit.value.contentFull,
|
||||
// content: dataToEdit.value.content,
|
||||
// start: dataToEdit.value.start,
|
||||
// end: dataToEdit.value.start,
|
||||
// location: dataToEdit.value.place,
|
||||
// pk: dataToEdit.value.pk
|
||||
|
||||
// }
|
||||
|
||||
|
||||
const participants = dataToEdit.value.bigname
|
||||
|
||||
@@ -154,6 +154,7 @@ export default {
|
||||
}
|
||||
|
||||
return {
|
||||
editor: ClassicEditor,
|
||||
menudate,
|
||||
formatComa,
|
||||
startTime,
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<v-card-title>
|
||||
<v-icon color="indigo-darken-3" class="pb-1">{{ event.icon }}</v-icon>
|
||||
|
||||
<span class="pl-3"> {{ event.title }}</span>
|
||||
<span class="pl-3"> {{ event.name }}</span>
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
<strong>{{ event.start && event.start.format("DD.MM.YYYY") }}</strong>
|
||||
</v-card-subtitle>
|
||||
<v-card-text class="pt-2">
|
||||
<p class="pb-3" v-html="formatText(event.contentFull)" />
|
||||
<p class="pb-3" v-html="formatText(event.content)" />
|
||||
<strong>Время:</strong>
|
||||
|
||||
<ul class="pl-5">
|
||||
|
||||
@@ -13,12 +13,17 @@
|
||||
</v-card-title>
|
||||
</v-card>
|
||||
<!-- mdi-check-->
|
||||
<event-dialog-edit
|
||||
<!-- <event-dialog-edit
|
||||
v-if="editEvent"
|
||||
:event="event"
|
||||
@returnUpdateData="returnUpdateData"
|
||||
/> -->
|
||||
<!-- <event-dialog-info :event="event" v-else /> -->
|
||||
<component
|
||||
:is = "editEvent ? 'eventDialogEdit':'eventDialogInfo'"
|
||||
:event="event"
|
||||
@returnUpdateData="returnUpdateData"
|
||||
/>
|
||||
<event-dialog-info :event="event" v-else />
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
@@ -52,11 +57,8 @@ export default {
|
||||
|
||||
|
||||
const modeEvent = () => {
|
||||
if (editEvent.value) {
|
||||
editEvent.value = false;
|
||||
} else {
|
||||
editEvent.value = true;
|
||||
}
|
||||
editEvent.value=!editEvent.value
|
||||
|
||||
}
|
||||
|
||||
const chekEvent = () => {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<script>
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { ref } from "vue";
|
||||
import { ref, computed } from "vue";
|
||||
import ical from "ical.js";
|
||||
|
||||
|
||||
@@ -53,13 +53,12 @@ export default {
|
||||
|
||||
const readFile = (file) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = (event) => {
|
||||
const text = event.target.result;
|
||||
parseICS(text);
|
||||
reader.readAsText(file);
|
||||
reader.onload = (event) => {
|
||||
parseICS(event.target.result);
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
|
||||
};
|
||||
const parseICS = (text) => {
|
||||
const jcalData = ical.parse(text);
|
||||
@@ -74,16 +73,15 @@ export default {
|
||||
let attendees = [];
|
||||
event.attendees.map((att) => {
|
||||
attendees.push(att.jCal[1].cn);
|
||||
});
|
||||
|
||||
});
|
||||
return {
|
||||
summary: event.summary,
|
||||
name: event.summary,
|
||||
description: event.description,
|
||||
organizer: event.organizer,
|
||||
start: event.startDate.toJSDate(),
|
||||
end: event.endDate.toJSDate(),
|
||||
location: event.location,
|
||||
attendees: attendees,
|
||||
// organizer: event.organizer, Может, удалить?
|
||||
startdate: event.startDate.toJSDate(),
|
||||
enddate: event.endDate.toJSDate(),
|
||||
place: event.location,
|
||||
// attendees: attendees, ? Такая же история 0 в базе нет
|
||||
cdate: new Date(event.component.jCal[1][6][3]),
|
||||
content: ''
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user