P-51
This commit is contained in:
1 parent
5c6c672a1b
commit
f9fae62ae6
2 files changed
+189
-81
No files matched your search
@@ -73,7 +73,7 @@
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-col >
|
||||
<calendar-full />
|
||||
<!-- <v-btn @click="drawer_right = !drawer_right">
|
||||
{{ drawer_right }}y
|
||||
@@ -124,8 +124,8 @@ export default {
|
||||
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
||||
const calendarForMy = ref([]);
|
||||
const eventFromCalendar = ref({})
|
||||
// const idEvent = ref(null)
|
||||
const idEvent = ref(2)
|
||||
const idEvent = ref(null)
|
||||
// const idEvent = ref(2)
|
||||
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ export default {
|
||||
(e.visible = accountStore.calendar.includes(e.id) ? false : true)
|
||||
);
|
||||
calendarForMy.value = res.data;
|
||||
console.log(calendarForMy.value , 'eventFromCalendar.value-----------------------')
|
||||
});
|
||||
};
|
||||
|
||||
@@ -171,6 +172,7 @@ export default {
|
||||
.get(`api/calendar_of_events/my_events/${idEvent.value==null?'':`?id=${idEvent.value}`}`)
|
||||
.then((res) => {
|
||||
eventFromCalendar.value = res.data
|
||||
|
||||
|
||||
if (idEvent.value==null) {
|
||||
eventFromCalendar.value.event = {name:'', participant: [accountStore.user.is_idEmployee], files: [], date_start: new Date(), date_end: new Date(), period: null, description: '', calendar: null}
|
||||
|
||||
@@ -1,66 +1,76 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-sheet>
|
||||
<v-locale-provider locale="ru">
|
||||
<v-calendar
|
||||
ref="calendar"
|
||||
v-model="value"
|
||||
:events="events"
|
||||
:view-mode="type"
|
||||
:weekdays="weekday"
|
||||
>
|
||||
<template v-slot:header="{ title }">
|
||||
<v-col class="d-flex flex-column p">
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col class="flex-grow-0" lg="2">
|
||||
<v-btn class="text-subtitle-1" variant="outlined">
|
||||
Сегодня
|
||||
</v-btn>
|
||||
<v-btn icon="mdi-menu-left" variant="text" />
|
||||
<v-locale-provider locale="ru">
|
||||
{{ selectDay }}
|
||||
<v-calendar
|
||||
ref="calendar"
|
||||
:events="events"
|
||||
:view-mode="type"
|
||||
:month="monthNow"
|
||||
:year="YearNow"
|
||||
:model-value="selectDay"
|
||||
>
|
||||
<!-- -->
|
||||
|
||||
<v-btn icon="mdi-menu-right" variant="text" />
|
||||
</v-col>
|
||||
<v-col class="text-h6 align-self-center ml-n6">
|
||||
{{ title.charAt(0).toUpperCase() + title.slice(1) }}
|
||||
</v-col>
|
||||
<v-col class="text-end align-self-center">
|
||||
<v-btn
|
||||
v-for="x in types"
|
||||
:key="x"
|
||||
:active="type != null && type == x.type"
|
||||
variant="text"
|
||||
@click="switchCalendar(x.type)"
|
||||
class="text-subtitle-1"
|
||||
:color="
|
||||
type != null && type == x.type ? 'btn_text' : 'text_grey'
|
||||
"
|
||||
>
|
||||
{{ x.text }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<template v-slot:header="{ title }">
|
||||
<v-col class="d-flex flex-column p">
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col class="flex-grow-0" lg="2">
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
variant="outlined"
|
||||
@click="todayDay"
|
||||
>
|
||||
Сегодня
|
||||
</v-btn>
|
||||
<v-btn icon="mdi-menu-left" variant="text" @click="returnDate" />
|
||||
|
||||
<v-btn icon="mdi-menu-right" variant="text" @click="nextDay" />
|
||||
</v-col>
|
||||
<v-col class="text-h6 align-self-center ml-n6">
|
||||
<!-- {{ title.charAt(0).toUpperCase() + title.slice(1) }}
|
||||
-->
|
||||
<span class="text-capitalize">
|
||||
{{ getMonthName(monthNow + 1) }}
|
||||
</span>
|
||||
|
||||
<!-- {{title}}
|
||||
<v-btn @click="prev">
|
||||
d :class="'font-weight-regular'"
|
||||
</v-btn>
|
||||
-->
|
||||
</template>
|
||||
</v-calendar>
|
||||
</v-locale-provider>
|
||||
</v-sheet>
|
||||
</div>
|
||||
{{ YearNow }} г.
|
||||
</v-col>
|
||||
<v-col class="text-end align-self-center">
|
||||
<v-btn
|
||||
v-for="x in types"
|
||||
:key="x"
|
||||
:active="type != null && type == x.type"
|
||||
variant="text"
|
||||
@click="switchCalendar(x.type)"
|
||||
class="text-subtitle-1"
|
||||
:color="
|
||||
type != null && type == x.type ? 'btn_text' : 'text_grey'
|
||||
"
|
||||
>
|
||||
{{ x.text }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</template>
|
||||
|
||||
<template v-slot:event="{ day, allDay, event }">
|
||||
<v-btn @click="whatDay(day)"> </v-btn>
|
||||
---------------
|
||||
{{ allDay }}
|
||||
|
||||
---------------------
|
||||
{{ event }}
|
||||
</template>
|
||||
</v-calendar>
|
||||
</v-locale-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useDate } from "vuetify";
|
||||
import { ref, computed } from "vue";
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const adapter = useDate();
|
||||
|
||||
const type = ref("month");
|
||||
const types = [
|
||||
{ type: "day", text: "День" },
|
||||
@@ -69,39 +79,139 @@ export default {
|
||||
{ type: "modntdh", text: "Год" },
|
||||
{ type: "modnth", text: "Расписание" },
|
||||
];
|
||||
const weekday = [1, 2, 3, 4, 5, 6, 0];
|
||||
|
||||
const switchCalendar = (t) => {
|
||||
type.value = t;
|
||||
};
|
||||
|
||||
const value = [new Date()];
|
||||
const events = [];
|
||||
const colors = [
|
||||
"blue",
|
||||
"indigo",
|
||||
"deep-purple",
|
||||
"cyan",
|
||||
"green",
|
||||
"orange",
|
||||
"grey darken-1",
|
||||
];
|
||||
const titles = [
|
||||
"Meeting",
|
||||
"Holiday",
|
||||
"PTO",
|
||||
"Travel",
|
||||
"Event",
|
||||
"Birthday",
|
||||
"Conference",
|
||||
"Party",
|
||||
// const value = computed({
|
||||
|
||||
// get() {
|
||||
|
||||
// console.log('111111111111111111111');
|
||||
// return new Date(today.value)
|
||||
// },
|
||||
// set(newValue) {
|
||||
// console.log(newValue, "value===============");
|
||||
// },
|
||||
// });
|
||||
|
||||
// const dayNow = new Date();
|
||||
|
||||
// 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 monthNow = ref(new Date().getMonth());
|
||||
const YearNow = ref(new Date().getFullYear());
|
||||
|
||||
const events = [
|
||||
{
|
||||
title: "Крот",
|
||||
start: new Date("2024-07-16T15:00:00+03:00"),
|
||||
end: new Date("2024-07-25T16:00:00+03:00"),
|
||||
color: "green",
|
||||
allDay: false,
|
||||
},
|
||||
];
|
||||
|
||||
const returnDate = () => {
|
||||
if (type.value == "month") {
|
||||
if (monthNow.value != 0) {
|
||||
monthNow.value--;
|
||||
} else {
|
||||
monthNow.value = 11;
|
||||
YearNow.value -= 1;
|
||||
}
|
||||
} else {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() - 1
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const nextDay = () => {
|
||||
if (type.value == "month") {
|
||||
if (monthNow.value < 11) {
|
||||
monthNow.value++;
|
||||
} else {
|
||||
monthNow.value = 0;
|
||||
YearNow.value += 1;
|
||||
}
|
||||
} else if (type.value == "day") {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() + 1
|
||||
)
|
||||
);
|
||||
} else {
|
||||
selectDay.value = new Date(
|
||||
new Date(selectDay.value).setDate(
|
||||
new Date(selectDay.value).getDate() + 4
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const todayDay = () => {
|
||||
monthNow.value = new Date().getMonth();
|
||||
YearNow.value = new Date().getFullYear();
|
||||
selectDay.value = new Date()
|
||||
};
|
||||
|
||||
const getMonthName = (monthNumber) => {
|
||||
const date = new Date();
|
||||
date.setMonth(monthNumber - 1);
|
||||
|
||||
return date.toLocaleString("ru", {
|
||||
month: "long",
|
||||
});
|
||||
};
|
||||
|
||||
const whatDay = (e) => {
|
||||
console.log(e, "------------------");
|
||||
};
|
||||
|
||||
// const controlDate = computed({
|
||||
// get() {
|
||||
// // let yearOfDate = new Date(dayNow.value).getFullYear();
|
||||
// // let monthOfDate = new Date(dayNow.value).getMonth();
|
||||
|
||||
// return dayNow.value
|
||||
|
||||
// },
|
||||
// set(newValue) {
|
||||
|
||||
// }
|
||||
// })
|
||||
|
||||
return {
|
||||
weekday,
|
||||
type,
|
||||
types,
|
||||
switchCalendar,
|
||||
events,
|
||||
|
||||
monthNow,
|
||||
YearNow,
|
||||
returnDate,
|
||||
getMonthName,
|
||||
|
||||
whatDay,
|
||||
nextDay,
|
||||
todayDay,
|
||||
selectDay,
|
||||
|
||||
// controlDate
|
||||
};
|
||||
// const getEvents = ({ start, end }) => {
|
||||
// const events = []
|
||||
@@ -133,10 +243,6 @@ export default {
|
||||
// const getEventColor = (event) => {
|
||||
// return event.value.color
|
||||
// }
|
||||
|
||||
// const rnd = (a, b) => {
|
||||
// return Math.floor((b - a + 1) * Math.random()) + a
|
||||
// }
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user