Вывод на экран

This commit is contained in:
iriska-gri committed 2024-04-16 09:07:59 +03:00
1 parent 62b4bcd597
commit 109ab871be
1 file changed
+158 -219
+158 -219
View File
@@ -1,191 +1,126 @@
<template>
<v-row>
<v-row>
<v-col class="flex-column pr-0">
<v-card class="h-100">
<!-- xsmall
:time="false"
hide-view-selector
active-view="month"
:disable-views="['years', 'year', 'week', 'day']"
@cell-focus="selectedDate = $event"
:events="events"
class="vuecal--blue-theme vuecal--rounded-theme" -->
<v-card class="h-100">
<vue-cal
locale="ru"
xsmall
:time="false"
hide-view-selector
:disable-views="['years', 'year', 'week', 'day']"
events-count-on-year-view
active-view="month"
:events="events"
todayButton
@cell-focus="selectedDate = $event"
locale="ru"
xsmall
:time="false"
hide-view-selector
:disable-views="['years', 'year', 'week', 'day']"
events-count-on-year-view
active-view="month"
:events="events"
todayButton
@cell-focus="selectedDate = $event"
>
<template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon>
</template>
<template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
<template #today-button>
<v-tooltip text="Сегодня" location="bottom">
<template v-slot:activator="{ props }">
<v-icon @click="selectedDate =new Date()" v-bind="props" icon="mdi-crosshairs-gps" size="x-small" class="pt-1 pr-3" color="more_details_btn"/>
</template>
</v-tooltip>
</template>
<template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon>
</template>
<template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
<template #today-button>
<v-tooltip text="Сегодня" location="bottom">
<template v-slot:activator="{ props }">
<v-icon
@click="selectedDate = new Date()"
v-bind="props"
icon="mdi-crosshairs-gps"
size="x-small"
class="pt-1 pr-3"
color="more_details_btn"
/>
</template>
</v-tooltip>
</template>
</vue-cal>
</v-card>
</v-card>
</v-col>
<v-col>
<!-- todayButton -->
<v-card class="h-100">
<v-card-title class="text-center">События на {{dayformat(selectedDate)}}</v-card-title>
<!-- <v-card-text>ddd</v-card-text> -->
<vue-cal
locale="ru"
xsmall
:time="false"
hide-view-selector
hideTitleBar
split
header-format= "DD"
:events="events"
active-view="day"
:disable-views="['years', 'year', 'month', 'week']"
:selected-date="selectedDate"
<v-card class="h-100">
<v-card-title class="text-center"
>События на {{ dayformat(selectedDate) }}</v-card-title
>
<template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon>
</template>
<template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
<template #today-button>
<!-- <v-tooltip text="Сегодня" location="bottom">
<template v-slot:activator="{ props }">
<v-icon v-bind="props" icon="mdi-crosshairs-gps" size="x-small" class="pt-1 pr-3" color="more_details_btn"/>
</template>
</v-tooltip> -->
</template>
<vue-cal
locale="ru"
xsmall
:time="false"
hide-view-selector
hideTitleBar
split
header-format="DD"
:events="events"
active-view="day"
:disable-views="['years', 'year', 'month', 'week']"
:selected-date="selectedDate"
>
<template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon>
</template>
<template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
<template #today-button>
</template>
</vue-cal>
</v-card>
</v-card>
</v-col>
</v-row>
</v-row>
</template>
<script>
import VueCal from 'vue-cal'
import 'vue-cal/dist/vuecal.css'
import { ref, onMounted } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
import VueCal from "vue-cal";
import "vue-cal/dist/vuecal.css";
import { ref, onMounted } from "vue";
import { axiosApiInstance } from "@/utils/axios-api";
export default {
components: { VueCal },
components: { VueCal },
setup() {
const events = ref([
])
function f_generalvacation() {
axiosApiInstance.get('api/general_vacation/generalvacation/')
.then(data => {
for (let x in data.data) {
if (x=="План-график") {
data.data[x].map(e=>{
events.value.push({ name: e.name, start: e.start_work_period, end: e.end_work_period, content: e.name})
}
)
}
}
})
}
onMounted(() => {
f_generalvacation()
})
const selectedDate = ref(null)
function dayformat(days) {
const d = new Date(days)
let mess= 'сегодня'
if (d.getFullYear() != '1970'){
mess = `${d.getDate()} число`
setup() {
const events = ref([]);
function f_generalvacation() {
axiosApiInstance
.get("api/general_vacation/generalvacation/")
.then((data) => {
for (let x in data.data) {
if (x == "План-график") {
data.data[x].map((e) => {
events.value.push({
name: e.name,
start: e.start_work_period,
end: e.end_work_period,
content: e.name,
});
});
}
}
});
}
return mess
}
onMounted(() => {
f_generalvacation();
});
const selectedDate = ref(null);
function dayformat(days) {
const d = new Date(days);
let mess = "сегодня";
if (d.getFullYear() != "1970") {
mess = `${d.getDate()} число`;
}
return mess;
}
return { events, selectedDate, f_generalvacation, dayformat }
}
}
return { events, selectedDate, f_generalvacation, dayformat };
},
};
</script>
<style>
/* Dot indicator */
.vuecal__cell-events-count {
width: 20px;
@@ -196,90 +131,94 @@ export default {
}
.vuecal {
border-radius: 6px;
border-radius: 6px;
}
.vuecal__title-bar {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.vuecal__title-bar {
background: var(--cards)
/* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */
background: var(--cards);
/* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */
}
.vuecal__flex .vuecal__title {
font-family: sans-serif;
font-family: sans-serif;
}
.vuecal__cell-events-count {
position: absolute;
left: 50%;
top: 65%;
transform: translate(-50%);
min-width: 15px;
height: 15px;
line-height: 15px;
padding: 0;
background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8));
color: #f8fff9!important;
border-radius: 12px;
font-size: 10px;
box-sizing: border-box;
position: absolute;
left: 50%;
top: 65%;
transform: translate(-50%);
min-width: 15px;
height: 15px;
line-height: 15px;
padding: 0;
background: linear-gradient(
to top right,
rgba(19, 84, 122, 0.8),
rgba(128, 208, 199, 0.8)
);
color: #f8fff9 !important;
border-radius: 12px;
font-size: 10px;
box-sizing: border-box;
}
.vuecal__event {
color: #666;
background-color: transparent;
padding: 10px;
position: relative;
box-sizing: border-box;
left: 0;
width: 100%;
z-index: 1;
transition: box-shadow .3s,left .3s,width .3s;
overflow: hidden;
text-align: justify;
color: #666;
background-color: transparent;
padding: 10px;
position: relative;
box-sizing: border-box;
left: 0;
width: 100%;
z-index: 1;
transition: box-shadow 0.3s, left 0.3s, width 0.3s;
overflow: hidden;
text-align: justify;
}
.vuecal--rounded-theme .vuecal__cell-content {
width: 30px;
height: 30px;
flex-grow: 0;
border: 1px solid #00a5bc00;
background: #c2e9d78c;
border-radius: 30px;
color: #333;
width: 30px;
height: 30px;
flex-grow: 0;
border: 1px solid #00a5bc00;
background: #c2e9d78c;
border-radius: 30px;
color: #333;
}
.vuecal__cell-content {
cursor: pointer;
cursor: pointer;
}
.vuecal__body {
position: relative;
overflow: auto;
height: 0;
position: relative;
overflow: auto;
height: 0;
}
.vuecal--no-time .vuecal__event {
min-height: 20px;
}
.vuecal__cell--selected:before {border-color: rgba(30, 65, 49, 0.5);}
.vuecal__cell--today, .vuecal__cell--current {
background-color: rgba(238, 181, 214, 0.548);
min-height: 20px;
}
.vuecal__cell--selected:before {
border-color: rgba(30, 65, 49, 0);
border-color: rgba(30, 65, 49, 0.5);
}
.vuecal__cell--today,
.vuecal__cell--current {
background-color: rgba(238, 181, 214, 0.548);
}
.vuecal__cell--selected:before {
border-color: rgba(30, 65, 49, 0);
}
.vuecal__cell--selected {
background-color: #3a97694a;
z-index: 2;
background-color: #3a97694a;
z-index: 2;
}
</style>
</style>