P-51
This commit is contained in:
1 parent
5c6c672a1b
commit
f9fae62ae6
2 files changed
+154
-46
No files matched your search
@@ -124,8 +124,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(null)
|
||||||
const idEvent = ref(2)
|
// const idEvent = ref(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -159,6 +159,7 @@ 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-----------------------')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -172,6 +173,7 @@ export default {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
eventFromCalendar.value = res.data
|
eventFromCalendar.value = res.data
|
||||||
|
|
||||||
|
|
||||||
if (idEvent.value==null) {
|
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}
|
eventFromCalendar.value.event = {name:'', participant: [accountStore.user.is_idEmployee], files: [], date_start: new Date(), date_end: new Date(), period: null, description: '', calendar: null}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<v-sheet>
|
|
||||||
<v-locale-provider locale="ru">
|
<v-locale-provider locale="ru">
|
||||||
|
{{ selectDay }}
|
||||||
<v-calendar
|
<v-calendar
|
||||||
ref="calendar"
|
ref="calendar"
|
||||||
v-model="value"
|
|
||||||
:events="events"
|
:events="events"
|
||||||
:view-mode="type"
|
:view-mode="type"
|
||||||
:weekdays="weekday"
|
:month="monthNow"
|
||||||
|
:year="YearNow"
|
||||||
|
:model-value="selectDay"
|
||||||
>
|
>
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
<template v-slot:header="{ title }">
|
<template v-slot:header="{ title }">
|
||||||
<v-col class="d-flex flex-column p">
|
<v-col class="d-flex flex-column p">
|
||||||
<v-row no-gutters class="gap">
|
<v-row no-gutters class="gap">
|
||||||
<v-col class="flex-grow-0" lg="2">
|
<v-col class="flex-grow-0" lg="2">
|
||||||
<v-btn class="text-subtitle-1" variant="outlined">
|
<v-btn
|
||||||
|
class="text-subtitle-1"
|
||||||
|
variant="outlined"
|
||||||
|
@click="todayDay"
|
||||||
|
>
|
||||||
Сегодня
|
Сегодня
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon="mdi-menu-left" variant="text" />
|
<v-btn icon="mdi-menu-left" variant="text" @click="returnDate" />
|
||||||
|
|
||||||
<v-btn icon="mdi-menu-right" variant="text" />
|
<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) }}
|
<!-- {{ title.charAt(0).toUpperCase() + title.slice(1) }}
|
||||||
|
-->
|
||||||
|
<span class="text-capitalize">
|
||||||
|
{{ getMonthName(monthNow + 1) }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{{ YearNow }} г.
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="text-end align-self-center">
|
<v-col class="text-end align-self-center">
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -40,27 +52,25 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- {{title}}
|
<template v-slot:event="{ day, allDay, event }">
|
||||||
<v-btn @click="prev">
|
<v-btn @click="whatDay(day)"> </v-btn>
|
||||||
d :class="'font-weight-regular'"
|
---------------
|
||||||
</v-btn>
|
{{ allDay }}
|
||||||
-->
|
|
||||||
|
---------------------
|
||||||
|
{{ event }}
|
||||||
</template>
|
</template>
|
||||||
</v-calendar>
|
</v-calendar>
|
||||||
</v-locale-provider>
|
</v-locale-provider>
|
||||||
</v-sheet>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { useDate } from "vuetify";
|
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const adapter = useDate();
|
|
||||||
|
|
||||||
const type = ref("month");
|
const type = ref("month");
|
||||||
const types = [
|
const types = [
|
||||||
{ type: "day", text: "День" },
|
{ type: "day", text: "День" },
|
||||||
@@ -69,39 +79,139 @@ export default {
|
|||||||
{ type: "modntdh", text: "Год" },
|
{ type: "modntdh", text: "Год" },
|
||||||
{ type: "modnth", text: "Расписание" },
|
{ type: "modnth", text: "Расписание" },
|
||||||
];
|
];
|
||||||
const weekday = [1, 2, 3, 4, 5, 6, 0];
|
|
||||||
|
|
||||||
const switchCalendar = (t) => {
|
const switchCalendar = (t) => {
|
||||||
type.value = t;
|
type.value = t;
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = [new Date()];
|
// const value = computed({
|
||||||
const events = [];
|
|
||||||
const colors = [
|
// get() {
|
||||||
"blue",
|
|
||||||
"indigo",
|
// console.log('111111111111111111111');
|
||||||
"deep-purple",
|
// return new Date(today.value)
|
||||||
"cyan",
|
// },
|
||||||
"green",
|
// set(newValue) {
|
||||||
"orange",
|
// console.log(newValue, "value===============");
|
||||||
"grey darken-1",
|
// },
|
||||||
];
|
// });
|
||||||
const titles = [
|
|
||||||
"Meeting",
|
// const dayNow = new Date();
|
||||||
"Holiday",
|
|
||||||
"PTO",
|
// const dayNow = ref(new Date(
|
||||||
"Travel",
|
// new Date().setDate(
|
||||||
"Event",
|
// new Date().getDate() - 3
|
||||||
"Birthday",
|
// )
|
||||||
"Conference",
|
// ))
|
||||||
"Party",
|
|
||||||
|
// 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 {
|
return {
|
||||||
weekday,
|
|
||||||
type,
|
type,
|
||||||
types,
|
types,
|
||||||
switchCalendar,
|
switchCalendar,
|
||||||
|
events,
|
||||||
|
|
||||||
|
monthNow,
|
||||||
|
YearNow,
|
||||||
|
returnDate,
|
||||||
|
getMonthName,
|
||||||
|
|
||||||
|
whatDay,
|
||||||
|
nextDay,
|
||||||
|
todayDay,
|
||||||
|
selectDay,
|
||||||
|
|
||||||
|
// controlDate
|
||||||
};
|
};
|
||||||
// const getEvents = ({ start, end }) => {
|
// const getEvents = ({ start, end }) => {
|
||||||
// const events = []
|
// const events = []
|
||||||
@@ -133,10 +243,6 @@ export default {
|
|||||||
// const getEventColor = (event) => {
|
// const getEventColor = (event) => {
|
||||||
// return event.value.color
|
// return event.value.color
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// const rnd = (a, b) => {
|
|
||||||
// return Math.floor((b - a + 1) * Math.random()) + a
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in new issue
Block a user