Merge pull request '38_calendar_back' (#92) from 38_calendar_back into develop
Reviewed-on: http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/pulls/92 Reviewed-by: lexxik753 <lexx@a.com> Reviewed-by: aphilippov <philippov129@gmail.com> Reviewed-by: Nukeap <kuroedovo@narod.ru>
This commit is contained in:
commit
db7c263d35
24 files changed
+977
-922
No files matched your search
@@ -1,3 +1,4 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import *
|
||||
# Register your models here.
|
||||
|
||||
@@ -1,3 +1,54 @@
|
||||
from django.db import models
|
||||
|
||||
from accounts.models import *
|
||||
# Create your models here.
|
||||
from django.conf import settings
|
||||
from enum import Enum
|
||||
from ckeditor_uploader.fields import RichTextUploadingField
|
||||
|
||||
class FilesEvent(models.Model):
|
||||
""" Прикрепленные файлы к событию"""
|
||||
name = models.CharField(max_length=300, verbose_name='Название файла')
|
||||
link = models.FileField(upload_to='documents/%Y/%m/%d')
|
||||
|
||||
class CalendarEventsName(models.Model):
|
||||
""" Глобавльное название календаря"""
|
||||
name=models.CharField(max_length=300, verbose_name='Название Календаря')
|
||||
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
|
||||
|
||||
class EnumChoice(Enum):
|
||||
@classmethod
|
||||
def get_choices(cls):
|
||||
return [(enum_.name, enum_.value) for enum_ in cls]
|
||||
|
||||
class FrequencyEvents(EnumChoice):
|
||||
default = "Без периода"
|
||||
daily = "Ежедневно"
|
||||
weekly = "Еженедельно"
|
||||
monthly = "Ежемесячно"
|
||||
annually = "Ежегодно"
|
||||
twice_a_year = "Два раза в год"
|
||||
|
||||
class CalendarEvents(models.Model):
|
||||
""" Основные данные по событиям"""
|
||||
name=models.CharField(max_length=300, verbose_name='Название события')
|
||||
description = RichTextUploadingField(null=True, blank= True, verbose_name='Описание события')
|
||||
cdate =models.DateTimeField(default=datetime.now, verbose_name='Дата создания')
|
||||
enddate = models.DateTimeField(null=True, blank= True, default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации')
|
||||
frequency = models.CharField(verbose_name='Периодичность', null=True, blank= True, max_length=255, db_index=True, choices=FrequencyEvents.get_choices(), default=FrequencyEvents.get_choices()[0][1])
|
||||
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор события')
|
||||
docfile = models.ForeignKey(FilesEvent, on_delete=models.PROTECT, null=True, blank= True, related_name='get_files_events', verbose_name='Прикрепеленные файлы')
|
||||
place = models.CharField(null=True, blank= True, max_length=500, verbose_name='Место проведения события')
|
||||
calendarname = models.ForeignKey(CalendarEventsName, on_delete=models.PROTECT, related_name='get_calendar_events_name', verbose_name='Название для календаря')
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Календарь событий"
|
||||
verbose_name_plural = "Календарь событий"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
class ParticipantsEvent(models.Model):
|
||||
""" Участники события """
|
||||
participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
|
||||
event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, related_name='get_calendar_events', verbose_name='Событие')
|
||||
@@ -0,0 +1,3 @@
|
||||
from rest_framework import serializers
|
||||
from .models import *
|
||||
from userauth.serializers import *
|
||||
@@ -4,5 +4,5 @@ from rest_framework.routers import DefaultRouter
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
|
||||
]
|
||||
@@ -1,3 +1,33 @@
|
||||
from django.shortcuts import render
|
||||
from .serializers import *
|
||||
from .models import *
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
|
||||
class CalendarEventsAPIView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
return Response('ku')
|
||||
|
||||
def post(self, request):
|
||||
|
||||
namecalendar, created = CalendarEventsName.objects.update_or_create(name=request.data['participants'],
|
||||
defaults = {'name':request.data['participants'], 'author_id': self.request.user.id})
|
||||
# print(self.request.user.id, '111111111111111111111111111111111111111111111111')
|
||||
|
||||
for cal in request.data['calendar']:
|
||||
CalendarEvents.objects.update_or_create(calendarname_id=namecalendar.pk,
|
||||
name = cal['summary'],
|
||||
author_id = self.request.user.id,
|
||||
defaults = {'name': cal['summary'],
|
||||
'description': cal['description'],
|
||||
'cdate':cal['start'],
|
||||
'enddate': cal['end'],
|
||||
'author_id': self.request.user.id,
|
||||
'place': cal['location'],
|
||||
'calendarname_id': namecalendar.pk
|
||||
})
|
||||
# print(cal['summary'],'1---------------------------')
|
||||
# print(cal['description'],'2---------------------------')
|
||||
return Response('ru')
|
||||
# Create your views here.
|
||||
@@ -101,3 +101,10 @@ class ScreensaverSerializer(serializers.ModelSerializer):
|
||||
model = Screensaver
|
||||
fields = '__all__'
|
||||
|
||||
class BaseSenderSerializer(serializers.ModelSerializer):
|
||||
""" Получить ссылку на картинку для дня рождения. Название 'День рождения'
|
||||
автоматически добавляется в таблицу, если его до этого не было """
|
||||
|
||||
class Meta:
|
||||
model = BaseSender
|
||||
fields = ['img']
|
||||
@@ -140,7 +140,7 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
} for y in CommentNews.objects.filter(news_id=request.data['news']))}
|
||||
|
||||
return Response(back)
|
||||
|
||||
|
||||
class CarouselsAPIView(ListAPIView):
|
||||
|
||||
"""
|
||||
@@ -166,41 +166,41 @@ class CarouselsAPIView(ListAPIView):
|
||||
result = CarouselsSerializer(queryset, many= True).data
|
||||
|
||||
manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month, birthdate__day__gte=date.today().day).order_by('birthdate__day')
|
||||
dr_img = BaseSender.objects.update_or_create(name="День рождения", defaults={'name':"День рождения"})
|
||||
mess = ''
|
||||
if len(manbrd) > 0 :
|
||||
nowday= manbrd.filter(birthdate__day=date.today().day)
|
||||
|
||||
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
|
||||
|
||||
allbirthday = {
|
||||
"title":'Дни рождения',
|
||||
"text": "В этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
|
||||
"link": "/media/"+str(brdimage[0].img),
|
||||
"published": 'true',
|
||||
"sender": "/media/default/dr.png",
|
||||
}
|
||||
|
||||
|
||||
if len(nowday) > 0 :
|
||||
|
||||
try:
|
||||
allbirthday = {
|
||||
"title":'Дни рождения',
|
||||
"text": "В этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
|
||||
"link": "/media/"+str(brdimage[0].img),
|
||||
"published": 'true',
|
||||
"sender": BaseSenderSerializer(dr_img).data,
|
||||
}
|
||||
|
||||
if len(nowday) > 0 :
|
||||
|
||||
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
|
||||
|
||||
for k in nowday:
|
||||
|
||||
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
|
||||
|
||||
|
||||
for k in nowday:
|
||||
|
||||
result.append({
|
||||
"title":'Поздравляем:',
|
||||
"text": f"{k.fio}!"+"\n"+ f"{brdtext[0].text}",
|
||||
"link": "/media/"+str(brdimage[0].img),
|
||||
"published": 'true',
|
||||
"sender": "/media/default/dr.png",
|
||||
})
|
||||
result.append({
|
||||
"title":'Поздравляем:',
|
||||
"text": f"{k.fio}!"+"\n"+ f"{brdtext[0].text}",
|
||||
"link": "/media/"+str(brdimage[0].img),
|
||||
"published": 'true',
|
||||
"sender": BaseSenderSerializer(dr_img).data,
|
||||
})
|
||||
|
||||
|
||||
result.append(allbirthday)
|
||||
result.append(allbirthday)
|
||||
except:
|
||||
mess = 'Добавьте открытку в панели администратора в Таблицу - "Открытки. Изображения". Либо текст поздравления в Таблицу - "Открытки. Тексты поздравлений"'
|
||||
|
||||
|
||||
return Response(result)
|
||||
return Response({"result": result, "mess": mess})
|
||||
|
||||
class ScreensaverAPIView(ListAPIView):
|
||||
"""Получаем ссылку на картинку для экрана перед входом на сайт. Выбирает все записи с месяца и дня меньше и равного текущему и окончание больше или равному текущему дню и месяцу. Год не учитывается. Выбирается одна рандомная запись"""
|
||||
|
||||
@@ -65,5 +65,6 @@ urlpatterns = [
|
||||
path('api/feedback/', include('feedback.urls')),
|
||||
path('api/general_vacation/', include('general_vacation.urls')),
|
||||
path('api/about_inspection/', include('about_inspection.urls')),
|
||||
path('api/calendar_of_events/', include('calendar_of_events.urls')),
|
||||
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
@@ -1,198 +0,0 @@
|
||||
<template>
|
||||
<full-calendar :options="calendarOptions" />
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {reactive, ref, onMounted} from 'vue'
|
||||
|
||||
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'calendar-full',
|
||||
|
||||
props: {
|
||||
initial: {
|
||||
type: String,
|
||||
default: 'multiMonthYear'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
setup(props) {
|
||||
|
||||
const calendarOptions = reactive({
|
||||
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin, listPlugin, multiMonthPlugin ],
|
||||
initialView: props.initial,
|
||||
dayMaxEventRows: 3
|
||||
,
|
||||
locale: 'ru',
|
||||
buttonText: {
|
||||
today: 'Сегодня',
|
||||
month: 'Месяц',
|
||||
week: 'Неделя',
|
||||
day: 'День',
|
||||
list: 'Список',
|
||||
year: 'Год'
|
||||
},
|
||||
firstDay:'1',
|
||||
events: [],
|
||||
|
||||
|
||||
editable: true,
|
||||
headerToolbar: {
|
||||
left: 'prev',
|
||||
center: 'title',
|
||||
right: 'next'
|
||||
}
|
||||
|
||||
,
|
||||
|
||||
aspectRatio: 1,
|
||||
multiMonthMaxColumns: 2,
|
||||
displayEventEnd: true,
|
||||
height: '100%',
|
||||
stickyHeaderDates: true,
|
||||
dayMaxEventRows: 2,
|
||||
moreLinkContent: function(arg) {
|
||||
return arg.shortText + ' события'
|
||||
},
|
||||
views: {
|
||||
multiMonthYear: {
|
||||
|
||||
moreLinkContent: function(arg) {
|
||||
return arg.num
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
allDayText: 'Весь день',
|
||||
noEventsContent: 'На сегодня событий нет',
|
||||
selectable: true,
|
||||
|
||||
})
|
||||
|
||||
function f_generalvacation() {
|
||||
axiosApiInstance.get('api/general_vacation/generalvacation/')
|
||||
.then(data => {
|
||||
|
||||
for (let x in data.data) {
|
||||
|
||||
if (x=="План-график") {
|
||||
data.data[x].map(e=>{
|
||||
|
||||
|
||||
calendarOptions.events.push({ description: 'description for All Day Event', title: e.name, start: e.start_work_period, end: e.end_work_period})
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
f_generalvacation()
|
||||
|
||||
|
||||
})
|
||||
// genvacation.value[0].planned_date
|
||||
|
||||
|
||||
|
||||
return { calendarOptions }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#fc-dom-1:first-letter {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.fc-toolbar {
|
||||
/* padding: 0px; */
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.fc-day-header {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
.fc-day {
|
||||
border: none;
|
||||
}
|
||||
.fc-time-grid-event {
|
||||
background-color: #e6e6e6;
|
||||
border: none;
|
||||
color: #000;
|
||||
}
|
||||
.fc-event-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fc .fc-toolbar.fc-header-toolbar {
|
||||
padding-bottom: 0.2em;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.fc .fc-popover {
|
||||
top: 0px!important
|
||||
;
|
||||
left: 450px!important;
|
||||
overflow: auto;
|
||||
min-width: 500px;
|
||||
height: 380px;
|
||||
}
|
||||
|
||||
.fc-h-event .fc-event-title {
|
||||
display: initial!important;
|
||||
}
|
||||
|
||||
/* .fc .fc-daygrid-day-events {
|
||||
margin-top: -7px;
|
||||
} */
|
||||
.fc {
|
||||
/* background-color: #ffffff; */
|
||||
background-color: var('bg-main_theme');
|
||||
}
|
||||
|
||||
.fc-button {
|
||||
|
||||
padding: 1px!important;
|
||||
border-radius: 1em!important;
|
||||
line-height: 0!important;
|
||||
background-color: transparent!important;
|
||||
border-color: transparent!important;
|
||||
|
||||
}
|
||||
|
||||
.fc-icon {
|
||||
color: #000;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.fc-button:focus, .fc-icon {
|
||||
outline: none!important;
|
||||
}
|
||||
|
||||
.fc-button,
|
||||
.fc-buttonactive,
|
||||
.fc-button:focus {
|
||||
border:none!important;
|
||||
}
|
||||
|
||||
.fc-header-toolbar {
|
||||
background: white !important;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@@ -2,7 +2,11 @@
|
||||
<v-card max-width='400' density="compact" class="bg-transparent">
|
||||
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
|
||||
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(comment.time_create)}}</v-card-subtitle>
|
||||
<v-card-title>{{comment.comment}}</v-card-title>
|
||||
|
||||
<v-card-text class="text-caption">
|
||||
{{comment.comment}}
|
||||
</v-card-text>
|
||||
<!-- <v-card-title class="text-wrap"></v-card-title> -->
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,287 +1,281 @@
|
||||
<template>
|
||||
<pattern-card
|
||||
:title="'Рейтинг посещаемости страниц портала'"
|
||||
:ico="'mdi-chart-bar'"
|
||||
>
|
||||
<template v-slot:filling>
|
||||
<v-data-table-virtual
|
||||
:headers="headers"
|
||||
:items="tabledata"
|
||||
height="400"
|
||||
class="mytable"
|
||||
item-value="name"
|
||||
@update:sortBy=customSort
|
||||
v-model:sort-by="sortBy"
|
||||
density="compact"
|
||||
<pattern-card
|
||||
:title="'Рейтинг посещаемости страниц портала'"
|
||||
:ico="'mdi-chart-bar'"
|
||||
>
|
||||
<template v-slot:header.name>
|
||||
<!-- v-model:sort-by="sortBy" -->
|
||||
<v-switch
|
||||
:label="untot"
|
||||
false-value='уникальные'
|
||||
true-value='всего'
|
||||
hide-details
|
||||
v-model="untot"
|
||||
class="myleft ml-n4"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
<template v-slot:item.name="{ value }">
|
||||
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2">
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.now="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2 ">
|
||||
<v-tooltip
|
||||
v-if="value>0"
|
||||
location="bottom"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
|
||||
{{value}}
|
||||
</span>
|
||||
</template>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col>
|
||||
<v-row
|
||||
no-gutters v-for="n in item.now.unic"
|
||||
:key="n"
|
||||
>
|
||||
<v-col >
|
||||
{{n}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-tooltip>
|
||||
|
||||
</span>
|
||||
|
||||
</template>
|
||||
<template v-slot:item.period="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2">
|
||||
<v-tooltip
|
||||
v-if="value>0"
|
||||
location="bottom"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props" :class="'untot'=='уникальные'?getColorPeriod1(value):getColorPeriod2(value)" class="cursor-help font-weight-medium text-subtitle-1" >
|
||||
{{value}}
|
||||
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
|
||||
</span>
|
||||
</template>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col>
|
||||
<v-row
|
||||
no-gutters v-for="n in item.period.unic"
|
||||
:key="n"
|
||||
>
|
||||
<v-col>
|
||||
{{n}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-tooltip>
|
||||
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-data-table-virtual>
|
||||
|
||||
<template v-slot:filling>
|
||||
<v-data-table-virtual
|
||||
:headers="headers"
|
||||
:items="tabledata"
|
||||
height="400"
|
||||
class="mytable"
|
||||
item-value="name"
|
||||
@update:sortBy="customSort"
|
||||
v-model:sort-by="sortBy"
|
||||
density="compact"
|
||||
>
|
||||
<template v-slot:header.name>
|
||||
<v-switch
|
||||
:label="untot"
|
||||
false-value="уникальные"
|
||||
true-value="всего"
|
||||
hide-details
|
||||
v-model="untot"
|
||||
class="myleft ml-n4"
|
||||
/>
|
||||
</template>
|
||||
</pattern-card>
|
||||
<template v-slot:item.name="{ value }">
|
||||
<span class="font-weight-medium cursor-default text-grey-darken-3 myleft text-subtitle-2"
|
||||
>
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.now="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2">
|
||||
<v-tooltip v-if="value > 0" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
:class="
|
||||
'untot' == 'уникальные'
|
||||
? getColorTooday1(value)
|
||||
: getColorTooday2(value)
|
||||
"
|
||||
class="cursor-help font-weight-medium text-subtitle-1"
|
||||
>
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-row no-gutters v-for="n in item.now.unic" :key="n">
|
||||
<v-col>
|
||||
{{ n }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.period="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2">
|
||||
<v-tooltip v-if="value > 0" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
:class="
|
||||
'untot' == 'уникальные'
|
||||
? getColorPeriod1(value)
|
||||
: getColorPeriod2(value)
|
||||
"
|
||||
class="cursor-help font-weight-medium text-subtitle-1"
|
||||
>
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-row no-gutters v-for="n in item.period.unic" :key="n">
|
||||
<v-col>
|
||||
{{ n }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
</v-data-table-virtual>
|
||||
</template>
|
||||
</pattern-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, watch } from 'vue'
|
||||
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
|
||||
import TooltipText from '@/components/UI/tooltip-text.vue'
|
||||
import {splitname, formatDash} from '@/utils/universal_functions'
|
||||
import { ref, watch } from "vue";
|
||||
import PatternCard from "@/components/UI/aboutportal/pattern-card.vue";
|
||||
import TooltipText from "@/components/UI/tooltip-text.vue";
|
||||
import { splitname, formatDash } from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
components: { TooltipText, PatternCard },
|
||||
|
||||
components: { TooltipText, PatternCard },
|
||||
|
||||
props: {
|
||||
pages_count: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
|
||||
}
|
||||
props: {
|
||||
pages_count: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
|
||||
const sortBy = ref([
|
||||
{
|
||||
"key": "now",
|
||||
"order": "desc"
|
||||
}
|
||||
])
|
||||
setup(props) {
|
||||
const sortBy = ref([
|
||||
{
|
||||
key: "now",
|
||||
order: "desc",
|
||||
},
|
||||
]);
|
||||
|
||||
const untot=ref('уникальные')
|
||||
let headers = ref([
|
||||
{ title: '', align: 'start', key: 'name' },
|
||||
{ title: 'сегодня', align: 'center', key: 'now',
|
||||
value: item => `${untot.value=='уникальные'?item.now.unic.size:item.now.total}`,
|
||||
},
|
||||
{ title: 'за период', align: 'center', key: 'period',
|
||||
value: item => `${untot.value=='уникальные'?item.period.unic.size:item.period.total}` },
|
||||
])
|
||||
const untot = ref("уникальные");
|
||||
let headers = ref([
|
||||
{ title: "", align: "start", key: "name" },
|
||||
{
|
||||
title: "сегодня",
|
||||
align: "center",
|
||||
key: "now",
|
||||
value: (item) =>
|
||||
`${
|
||||
untot.value == "уникальные" ? item.now.unic.size : item.now.total
|
||||
}`,
|
||||
},
|
||||
{
|
||||
title: "за период",
|
||||
align: "center",
|
||||
key: "period",
|
||||
value: (item) =>
|
||||
`${
|
||||
untot.value == "уникальные"
|
||||
? item.period.unic.size
|
||||
: item.period.total
|
||||
}`,
|
||||
},
|
||||
]);
|
||||
|
||||
const datas = ()=>{
|
||||
|
||||
let data = []
|
||||
props.pages_count.forEach((e) => {
|
||||
|
||||
let ind = data.findIndex(el=>el.name==e.pages)
|
||||
if(ind==-1){
|
||||
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}}
|
||||
if (e.visitdate == formatDash(new Date())){
|
||||
ob.now.unic.add(splitname(e.user))
|
||||
ob.now.total = e.count
|
||||
|
||||
}
|
||||
ob.period.unic.add(splitname(e.user))
|
||||
ob.period.total = e.count
|
||||
data.push(ob)
|
||||
}
|
||||
else{
|
||||
if (e.visitdate == formatDash(new Date())){
|
||||
data[ind].now.unic.add(splitname(e.user))
|
||||
data[ind].now.total +=e.count
|
||||
}
|
||||
|
||||
data[ind].period.unic.add(splitname(e.user))
|
||||
data[ind].period.total +=e.count
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const modelrating = ref(false)
|
||||
|
||||
const getColorTooday1 = (pages) => {
|
||||
if (pages > 10) return 'text-green'
|
||||
else if (pages > 5) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorPeriod1 = (pages) => {
|
||||
|
||||
if (pages > 30) return 'text-green'
|
||||
else if (pages > 15) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorTooday2 = (pages) => {
|
||||
if (pages > 50) return 'text-green'
|
||||
else if (pages > 25) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorPeriod2 = (pages) => {
|
||||
|
||||
if (pages > 100) return 'text-green'
|
||||
else if (pages > 50) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorNow = (pages) => {
|
||||
if (pages > 10) return 'text-green'
|
||||
else if (pages > 5) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const customSort= ()=> {
|
||||
let arr=tabledata.value
|
||||
|
||||
if (sortBy.value!==undefined && sortBy.value.length>0){
|
||||
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
|
||||
if (untot.value=='уникальные'){
|
||||
arr.sort((a,b)=>{
|
||||
|
||||
if (a[sortBy.value[0].key].unic.size>b[sortBy.value[0].key].unic.size) return factor[0]
|
||||
if (a[sortBy.value[0].key].unic.size<b[sortBy.value[0].key].unic.size) return factor[1]
|
||||
return 0 })
|
||||
}else{
|
||||
arr.sort((a,b)=>{
|
||||
|
||||
if (a[sortBy.value[0].key].total>b[sortBy.value[0].key].total) return factor[0]
|
||||
if (a[sortBy.value[0].key].total<b[sortBy.value[0].key].total) return factor[1]
|
||||
return 0 })
|
||||
const datas = () => {
|
||||
let data = [];
|
||||
props.pages_count.forEach((e) => {
|
||||
let ind = data.findIndex((el) => el.name == e.pages);
|
||||
if (ind == -1) {
|
||||
let ob = {
|
||||
name: e.pages,
|
||||
now: { unic: new Set(), total: 0 },
|
||||
period: { unic: new Set(), total: 0 },
|
||||
};
|
||||
if (e.visitdate == formatDash(new Date())) {
|
||||
ob.now.unic.add(splitname(e.user));
|
||||
ob.now.total = e.count;
|
||||
}
|
||||
ob.period.unic.add(splitname(e.user));
|
||||
ob.period.total = e.count;
|
||||
data.push(ob);
|
||||
} else {
|
||||
if (e.visitdate == formatDash(new Date())) {
|
||||
data[ind].now.unic.add(splitname(e.user));
|
||||
data[ind].now.total += e.count;
|
||||
}
|
||||
|
||||
data[ind].period.unic.add(splitname(e.user));
|
||||
data[ind].period.total += e.count;
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
const modelrating = ref(false);
|
||||
|
||||
const getColorTooday1 = (pages) => {
|
||||
if (pages > 10) return "text-green";
|
||||
else if (pages > 5) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorPeriod1 = (pages) => {
|
||||
if (pages > 30) return "text-green";
|
||||
else if (pages > 15) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorTooday2 = (pages) => {
|
||||
if (pages > 50) return "text-green";
|
||||
else if (pages > 25) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorPeriod2 = (pages) => {
|
||||
if (pages > 100) return "text-green";
|
||||
else if (pages > 50) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorNow = (pages) => {
|
||||
if (pages > 10) return "text-green";
|
||||
else if (pages > 5) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const customSort = () => {
|
||||
let arr = tabledata.value;
|
||||
|
||||
if (sortBy.value !== undefined && sortBy.value.length > 0) {
|
||||
let factor = sortBy.value[0].order == "desc" ? [-1, 1] : [1, -1];
|
||||
if (untot.value == "уникальные") {
|
||||
arr.sort((a, b) => {
|
||||
if (
|
||||
a[sortBy.value[0].key].unic.size >
|
||||
b[sortBy.value[0].key].unic.size
|
||||
)
|
||||
return factor[0];
|
||||
if (
|
||||
a[sortBy.value[0].key].unic.size <
|
||||
b[sortBy.value[0].key].unic.size
|
||||
)
|
||||
return factor[1];
|
||||
return 0;
|
||||
});
|
||||
} else {
|
||||
arr.sort((a, b) => {
|
||||
if (a[sortBy.value[0].key].total > b[sortBy.value[0].key].total)
|
||||
return factor[0];
|
||||
if (a[sortBy.value[0].key].total < b[sortBy.value[0].key].total)
|
||||
return factor[1];
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
tabledata.value=arr
|
||||
|
||||
|
||||
}
|
||||
const tabledata = ref(datas())
|
||||
watch(()=>props.pages_count,(newValue)=>{
|
||||
if (newValue!==[]){
|
||||
tabledata.value=datas()
|
||||
customSort()
|
||||
}
|
||||
tabledata.value = arr;
|
||||
};
|
||||
const tabledata = ref(datas());
|
||||
watch(
|
||||
() => props.pages_count,
|
||||
(newValue) => {
|
||||
if (newValue !== []) {
|
||||
tabledata.value = datas();
|
||||
customSort();
|
||||
}
|
||||
})
|
||||
// tabledata.value=datas.value
|
||||
return {
|
||||
tabledata,
|
||||
sortBy,
|
||||
customSort,
|
||||
untot,
|
||||
modelrating,
|
||||
getColorTooday1,
|
||||
getColorPeriod1,
|
||||
getColorTooday2,
|
||||
getColorPeriod2,
|
||||
getColorNow,
|
||||
headers,
|
||||
datas
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
// tabledata.value=datas.value
|
||||
return {
|
||||
tabledata,
|
||||
sortBy,
|
||||
customSort,
|
||||
untot,
|
||||
modelrating,
|
||||
getColorTooday1,
|
||||
getColorPeriod1,
|
||||
getColorTooday2,
|
||||
getColorPeriod2,
|
||||
getColorNow,
|
||||
headers,
|
||||
datas,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.v-table {
|
||||
flex: 1!important;
|
||||
|
||||
.v-table {
|
||||
flex: 1 !important;
|
||||
}
|
||||
|
||||
.mytable tr {
|
||||
font-size: 13px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.mytable i{
|
||||
font-size: 10px;
|
||||
.mytable i {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
|
||||
.myleft {
|
||||
float: left;
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -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>
|
||||
@@ -3,7 +3,7 @@
|
||||
<v-menu
|
||||
v-model="menu"
|
||||
:close-on-content-click="false"
|
||||
:nudge-width="500"
|
||||
:max-width="800"
|
||||
offset-x
|
||||
>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
|
||||
@@ -1,10 +1,85 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <my-helper :pretext="kl" /> -->
|
||||
<v-btn @click="useICalReader"> ical</v-btn>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
// import {useICalReader} from '@/utils/universal_functions'
|
||||
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
|
||||
import { ref } from 'vue';
|
||||
import ical from "ical.js";
|
||||
import { formatDash } from '@/utils/universal_functions'
|
||||
|
||||
const burl = baseURL.slice(0,-1)
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const participant = ref('')
|
||||
const calendar = ref('')
|
||||
const useICalReader = async () => {
|
||||
const response = await fetch(`${burl}/media/ical/calendar.ics`);
|
||||
const data = await response.text();
|
||||
const jcalData = ical.parse(data);
|
||||
const icalComponent = new ical.Component(jcalData);
|
||||
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
|
||||
|
||||
const events = icalComponent
|
||||
.getAllSubcomponents("vevent")
|
||||
.map((vevent) => new ical.Event(vevent));
|
||||
|
||||
const calendarEvents = events.map((event) => {
|
||||
return {
|
||||
summary: event.summary,
|
||||
description: event.description,
|
||||
organizer: event.organizer,
|
||||
start: event.startDate.toJSDate(),
|
||||
end: event.endDate.toJSDate(),
|
||||
location: event.location,
|
||||
attendees: event.attendees
|
||||
}
|
||||
})
|
||||
participant.value = name
|
||||
calendar.value = calendarEvents
|
||||
console.log(name, 'name')
|
||||
console.log(calendarEvents, 'calendarEventse')
|
||||
f_feedbackdata()
|
||||
// return {
|
||||
// type: "calendar",
|
||||
// title: name,
|
||||
// calendar: calendarEvents,
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// const s= useICalReader(`${burl}/media/ical/calendar.ics`)
|
||||
// console.log(s.value, 'ddddddddd')
|
||||
function f_feedbackdata() {
|
||||
axiosApiInstance.post(`api/calendar_of_events/calendarEvents/`, {
|
||||
participants: participant.value,
|
||||
calendar: calendar.value
|
||||
})
|
||||
.then(data => {
|
||||
console.log(data,'datas')
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
useICalReader
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,109 +1,119 @@
|
||||
<template>
|
||||
|
||||
<v-carousel
|
||||
cycle
|
||||
interval="10000"
|
||||
cover
|
||||
height="450"
|
||||
hide-delimiters
|
||||
hide-delimiter-background
|
||||
show-arrows="hover"
|
||||
color="white"
|
||||
<v-carousel
|
||||
cycle
|
||||
interval="10000"
|
||||
cover
|
||||
height="450"
|
||||
hide-delimiters
|
||||
hide-delimiter-background
|
||||
show-arrows="hover"
|
||||
color="white"
|
||||
>
|
||||
<v-carousel-item
|
||||
v-for="(x, i) in carous"
|
||||
:key="i"
|
||||
:src="`${burl}${x.link}`"
|
||||
cover
|
||||
eager
|
||||
>
|
||||
|
||||
<v-carousel-item
|
||||
v-for="(x, i) in carous" :key="i"
|
||||
:src="`${burl}${x.link}`"
|
||||
cover
|
||||
eager
|
||||
<v-container
|
||||
fill-height
|
||||
fluid
|
||||
pa-0
|
||||
ma-0
|
||||
pb-3
|
||||
class="flex-column h-100 d-flex"
|
||||
>
|
||||
<v-card
|
||||
v-if="x.text != '' || x.title != null"
|
||||
class="bgCard h-100 d-flex flex-column"
|
||||
>
|
||||
<v-container
|
||||
fill-height
|
||||
fluid
|
||||
pa-0 ma-0 pb-3
|
||||
class="flex-column h-100 d-flex"
|
||||
>
|
||||
<v-card
|
||||
v-if="x.text != '' || x.title != null"
|
||||
class="bgCard h-100 d-flex flex-column"
|
||||
>
|
||||
|
||||
<v-card-title v-if="x.title != null"
|
||||
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0">
|
||||
<v-row no-gutters >
|
||||
<v-col class="align-self-center">
|
||||
{{x.title}}
|
||||
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0">
|
||||
<v-img
|
||||
width="50"
|
||||
:aspect-ratio="1"
|
||||
:src="`${burl}${x.sender}`"
|
||||
cover
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
<v-card-text
|
||||
v-if="x.text != ''"
|
||||
class=" w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
|
||||
>
|
||||
|
||||
<v-textarea
|
||||
class="text-text_caroustext-black textareas font-weight-medium nocursor"
|
||||
:model-value=x.text
|
||||
variant='solo'
|
||||
readonly
|
||||
auto-grow
|
||||
rows="1"
|
||||
hide-details
|
||||
flat
|
||||
bg-color="transparent"
|
||||
/>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-container>
|
||||
</v-carousel-item>
|
||||
</v-carousel>
|
||||
<v-card-title
|
||||
v-if="x.title != null"
|
||||
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
|
||||
>
|
||||
<v-row no-gutters>
|
||||
<v-col class="align-self-center">
|
||||
{{ x.title }}
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0">
|
||||
<v-img
|
||||
width="50"
|
||||
:aspect-ratio="1"
|
||||
:src="`${burl}${x.sender}`"
|
||||
cover
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
<v-card-text
|
||||
v-if="x.text != ''"
|
||||
class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
|
||||
>
|
||||
<v-textarea
|
||||
class="text-text_caroustext-black textareas font-weight-medium nocursor"
|
||||
:model-value="x.text"
|
||||
variant="solo"
|
||||
readonly
|
||||
auto-grow
|
||||
rows="1"
|
||||
hide-details
|
||||
flat
|
||||
bg-color="transparent"
|
||||
/>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-container>
|
||||
</v-carousel-item>
|
||||
</v-carousel>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import {getfromserver} from '@/utils/universal_functions'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import { ref } from "vue";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { useAlertStore } from "@/store/useAlertStore";
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const burl = baseURL.slice(0, -1);
|
||||
|
||||
setup() {
|
||||
const burl = baseURL.slice(0,-1)
|
||||
const carous = ref([{ link: "newsimage/default.jpg" }]);
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const carous=ref([{link: "newsimage/default.jpg"}])
|
||||
|
||||
getfromserver("api/navigation/carousels/", carous)
|
||||
|
||||
return {
|
||||
burl,
|
||||
carous
|
||||
const getfromserver = () => {
|
||||
axiosApiInstance.get("api/navigation/carousels/").then((result) => {
|
||||
if (result.data.mess != "") {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.color = "red-darken-2";
|
||||
feedalert.ico = "mdi-alert-outline";
|
||||
}
|
||||
}
|
||||
carous.value = result.data.result;
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
getfromserver();
|
||||
|
||||
return {
|
||||
burl,
|
||||
carous,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.titles {
|
||||
font-family: cursive!important;
|
||||
background: #ffffff8c;
|
||||
font-family: cursive !important;
|
||||
background: #ffffff8c;
|
||||
}
|
||||
|
||||
.textareas .v-field__input {
|
||||
font-size: 1.3em!important;
|
||||
font-size: 1.3em !important;
|
||||
}
|
||||
|
||||
.nocursor textarea {
|
||||
cursor: default !important;
|
||||
cursor: default !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -214,7 +214,8 @@
|
||||
|
||||
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
||||
<v-col>
|
||||
<v-list nav density active-class="noneoutline">
|
||||
<default-portal-menu-list :rail=rail />
|
||||
<!-- <v-list nav density="compact" active-class="noneoutline">
|
||||
<default-portal-menu-list :aMenuItem="supperuser"/>
|
||||
<div v-if="getDevelopment()">
|
||||
|
||||
@@ -223,7 +224,7 @@
|
||||
|
||||
|
||||
|
||||
</v-list>
|
||||
</v-list> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="flex-grow-0">
|
||||
@@ -240,9 +241,11 @@
|
||||
|
||||
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
||||
<router-view />
|
||||
<v-expand-x-transition>
|
||||
|
||||
|
||||
<alert-default />
|
||||
</v-expand-x-transition>
|
||||
|
||||
|
||||
|
||||
</v-main>
|
||||
<v-main v-else class="d-flex align-center text-h3 bg-teal-lighten-2">
|
||||
@@ -299,6 +302,7 @@ import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
|
||||
import PageCounter from '@/components/UI/defaultportal/page-counter.vue'
|
||||
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
|
||||
import {getDevelopment} from '@/utils/universal_functions'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
@@ -357,15 +361,6 @@ export default {
|
||||
|
||||
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
||||
|
||||
const supperuser = [
|
||||
|
||||
{
|
||||
name: 'Панель администратора',
|
||||
ico: 'mdi-wrench',
|
||||
link: baseURL+'admin'
|
||||
|
||||
},
|
||||
]
|
||||
|
||||
const oRasrab = [
|
||||
{
|
||||
@@ -447,7 +442,11 @@ export default {
|
||||
ico: 'mdi-city',
|
||||
path: "/inspection"
|
||||
},
|
||||
|
||||
{
|
||||
name: 'ical',
|
||||
ico: 'mdi-calendar',
|
||||
path: "/ical"
|
||||
},
|
||||
|
||||
// {
|
||||
// name: 'К празднику',
|
||||
@@ -485,7 +484,7 @@ export default {
|
||||
// feedalert,
|
||||
alert,
|
||||
burl,
|
||||
supperuser,
|
||||
|
||||
closeinfo,
|
||||
baseURL,
|
||||
getDevelopment
|
||||
|
||||
@@ -1,40 +1,88 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-list-item
|
||||
v-for="(x, key) in aMenuItem"
|
||||
:key="key"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:href="x.link"
|
||||
:target="x.link?'_blank':''"
|
||||
slim
|
||||
class="text-blue-grey-lighten-1"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="x_small"/>
|
||||
<v-tooltip
|
||||
v-if="rail"
|
||||
activator="parent"
|
||||
location="top"
|
||||
>
|
||||
{{ x.name }}
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</div>
|
||||
<div>
|
||||
<v-list nav density="compact" class="text-blue-grey-lighten-1">
|
||||
<div v-for="(list, key) in aMenuItem" :key="key">
|
||||
<div v-if="showProm(key)">
|
||||
<v-list-item
|
||||
v-for="x in list"
|
||||
:key="x"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:href="x.link"
|
||||
:target="x.link ? '_blank' : ''"
|
||||
slim
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="x_small" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</div>
|
||||
</div>
|
||||
</v-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { getDevelopment } from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
aMenuItem: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
props: {
|
||||
rail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
setup() {
|
||||
const gittlink = () => {
|
||||
const link =
|
||||
baseURL == "http://127.0.0.1:8000/"
|
||||
? "http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/projects"
|
||||
: "http://maestro.cod2.regions.tax.nalog.ru:3333/COD2/PORTAL_COD2/projects/22";
|
||||
return link;
|
||||
};
|
||||
const aMenuItem = {
|
||||
prom: [
|
||||
{
|
||||
name: "Панель администратора",
|
||||
ico: "mdi-wrench",
|
||||
link: baseURL + "admin",
|
||||
},
|
||||
}
|
||||
}
|
||||
],
|
||||
my: [
|
||||
{
|
||||
name: "Gitt",
|
||||
ico: "mdi-github",
|
||||
link: gittlink(),
|
||||
},
|
||||
{
|
||||
name: "Swagger",
|
||||
ico: "mdi-puzzle",
|
||||
link: "http://127.0.0.1:8000/swagger/",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const showProm = (data) => {
|
||||
let show = true;
|
||||
|
||||
if (data == "my" && getDevelopment() == false) {
|
||||
show = false;
|
||||
}
|
||||
|
||||
return show;
|
||||
};
|
||||
|
||||
return {
|
||||
aMenuItem,
|
||||
getDevelopment,
|
||||
showProm,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
@@ -4,4 +4,21 @@
|
||||
|
||||
Импорт глобальный, прописан в src/front/src/components/UI/index.js
|
||||
|
||||
*Описание входящих параметров в useAlertStore.md*
|
||||
#### Строка импорта:
|
||||
```
|
||||
import { useAlertStore } from '@/store/useAlertStore'
|
||||
|
||||
```
|
||||
|
||||
#### Переменная в setup:
|
||||
```
|
||||
const feedalert = useAlertStore().alert
|
||||
```
|
||||
|
||||
#### Переменная alert содержит ключи:
|
||||
|Ключ|Тип|Значение по умолчанию|Описание|
|
||||
|-|--------|--------|--------|
|
||||
|alert|boolean|false|Запуск/скрытие отоборажения на экране|
|
||||
|text|string|''|Тект, который будет отображаться в алерте|
|
||||
|ico|string|'mdi-plus'|Замена иконки, отображаемой слева от текста|
|
||||
|color|string|''|Замена цвета|
|
||||
@@ -4,14 +4,14 @@
|
||||
:color=feedalert.color
|
||||
:icon=feedalert.ico
|
||||
theme="dark"
|
||||
max-height="40"
|
||||
width = "500"
|
||||
min-height="40"
|
||||
min-width = "500"
|
||||
position="fixed"
|
||||
location = "bottom"
|
||||
class="mb-2"
|
||||
v-model="feedalert.alert"
|
||||
:text=feedalert.text
|
||||
variant = "tonal"
|
||||
|
||||
density="compact"
|
||||
>
|
||||
</v-alert>
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
feedalert.ico=""
|
||||
feedalert.color=""
|
||||
feedalert.alert = false
|
||||
}, 3000)
|
||||
}, 8000)
|
||||
|
||||
}, {deep:true})
|
||||
|
||||
|
||||
@@ -136,6 +136,15 @@ const routes = [
|
||||
ico: "mdi-city"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/ical',
|
||||
name: 'UsersInfoPage',
|
||||
component: () => import('@/components/calendar_of_events/load-ical.vue'),
|
||||
meta:{
|
||||
title:"Для работы над календарем",
|
||||
ico: "mdi-account"
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -1,94 +1,161 @@
|
||||
const str = 'hello';
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import {useAppStore} from '@/store/app'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import { axiosApiInstance, clearAxios } from '@/utils/axios-api'
|
||||
import { useRouter } from 'vue-router'
|
||||
import moment from 'moment'
|
||||
const str = "hello";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import { useAppStore } from "@/store/app";
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
|
||||
import { useRouter } from "vue-router";
|
||||
import moment from "moment";
|
||||
import { ref, onMounted } from "vue";
|
||||
|
||||
|
||||
|
||||
export function formatComa(date) {
|
||||
return moment(date).format('DD.MM.YYYY')
|
||||
}
|
||||
|
||||
export function formatDash(date) {
|
||||
return moment(date).format('YYYY-MM-DD')
|
||||
}
|
||||
|
||||
export function formaComaTime(date) {
|
||||
return moment(date).format('DD.MM.YYYY H:mm')
|
||||
}
|
||||
|
||||
export function checking_for_entry (where, what) {
|
||||
if (!where.includes(what))
|
||||
{
|
||||
where.push(what)
|
||||
}
|
||||
return moment(date).format("DD.MM.YYYY");
|
||||
}
|
||||
|
||||
export function getfromserver(path, reactive){
|
||||
try{
|
||||
|
||||
axiosApiInstance.get(path).then(result => {
|
||||
reactive.value = result.data})}
|
||||
catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
export function formatDash(date) {
|
||||
return moment(date).format("YYYY-MM-DD");
|
||||
}
|
||||
|
||||
export function formaComaTime(date) {
|
||||
return moment(date).format("DD.MM.YYYY H:mm");
|
||||
}
|
||||
|
||||
export function checking_for_entry(where, what) {
|
||||
if (!where.includes(what)) {
|
||||
where.push(what);
|
||||
}
|
||||
}
|
||||
|
||||
export function getfromserverfree(path, reactive){
|
||||
try{
|
||||
clearAxios.get(path).then(result => {
|
||||
reactive.value = result.data})}
|
||||
catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
export function getfromserver(path, reactive) {
|
||||
try {
|
||||
axiosApiInstance.get(path).then((result) => {
|
||||
reactive.value = result.data;
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export function checkremote(filecheck){
|
||||
|
||||
return process.env.NODE_ENV == 'development'? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg":filecheck
|
||||
|
||||
export function getfromserverfree(path, reactive) {
|
||||
try {
|
||||
clearAxios.get(path).then((result) => {
|
||||
reactive.value = result.data;
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export function checkremote(filecheck) {
|
||||
return process.env.NODE_ENV == "development"
|
||||
? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
|
||||
: filecheck;
|
||||
}
|
||||
|
||||
export default str;
|
||||
|
||||
export function splitname (name) {
|
||||
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
|
||||
}
|
||||
|
||||
export function pagecounter(){
|
||||
|
||||
const router = useRouter()
|
||||
const accountStore = useAccountStore()
|
||||
const appStore = useAppStore()
|
||||
export function splitname(name) {
|
||||
return name.familyname + " " + name.name[0] + "." + name.parentname[0] + ".";
|
||||
}
|
||||
|
||||
export function pagecounter() {
|
||||
const router = useRouter();
|
||||
const accountStore = useAccountStore();
|
||||
const appStore = useAppStore();
|
||||
|
||||
let postdata = {
|
||||
user__id: "user" in accountStore &&"id" in accountStore.user? accountStore.user.id: null,
|
||||
user__id:
|
||||
"user" in accountStore && "id" in accountStore.user
|
||||
? accountStore.user.id
|
||||
: null,
|
||||
page: router.currentRoute.value.meta.title,
|
||||
fullPath: router.currentRoute.value.fullPath,
|
||||
ico: router.currentRoute.value.meta.ico
|
||||
}
|
||||
ico: router.currentRoute.value.meta.ico,
|
||||
};
|
||||
|
||||
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata).then((result) => {
|
||||
appStore.countvisitor = result.data;
|
||||
});
|
||||
}
|
||||
|
||||
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata)
|
||||
.then(result => {
|
||||
appStore.countvisitor = result.data
|
||||
})
|
||||
export function getDevelopment() {
|
||||
return process.env.NODE_ENV == "development" ? true : false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
export function useICalReader(url) {
|
||||
///
|
||||
const events = ref([]);
|
||||
|
||||
export function getDevelopment() {
|
||||
return process.env.NODE_ENV == 'development'?true:false
|
||||
}
|
||||
const loadICalFile = async () => {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const data = await response.text();
|
||||
const jcalData = ical.parse(data);
|
||||
const icalComponent = new ical.Component(jcalData);
|
||||
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
|
||||
|
||||
const events = icalComponent
|
||||
.getAllSubcomponents("vevent")
|
||||
.map((vevent) => new ical.Event(vevent));
|
||||
|
||||
const calendarEvents = events.map((event) => {
|
||||
return {
|
||||
summary: event.summary,
|
||||
description: event.description,
|
||||
organizer: event.organizer,
|
||||
attendee_count: event.attendees.length,
|
||||
duration_seconds: event.duration.toSeconds(),
|
||||
start: event.startDate.toJSDate().getTime() / 1000,
|
||||
end: event.endDate.toJSDate().getTime() / 1000,
|
||||
location: event.location,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
type: "calendar",
|
||||
title: name,
|
||||
calendar: calendarEvents,
|
||||
}
|
||||
|
||||
// const vevents = comp.getAllSubcomponents('vevent')
|
||||
// const eventsData = vevents.map(vevent => ({
|
||||
// vevent: vevent,
|
||||
|
||||
// summary: vevent.getFirstPropertyValue('summary'),
|
||||
// start: vevent.getFirstPropertyValue('dtstart'),
|
||||
// end: vevent.getFirstPropertyValue('dtend')
|
||||
// }))
|
||||
// events.value = eventsData
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadICalFile();
|
||||
});
|
||||
|
||||
return {
|
||||
events,
|
||||
};
|
||||
}
|
||||
|
||||
// export function useICalReader(filePath) {
|
||||
// const icsContent = ref('')
|
||||
|
||||
// const fetchICalFile = async () => {
|
||||
// try {
|
||||
// const response = await fetch(filePath)
|
||||
// if (!response.ok) {
|
||||
// throw new Error('Ошибка при загрузке файла')
|
||||
// }
|
||||
// const data = await response.text()
|
||||
// icsContent.value = data
|
||||
// } catch (error) {
|
||||
// console.error('Ошибка при чтении файла:', error)
|
||||
// }
|
||||
// }
|
||||
|
||||
// return { icsContent, fetchICalFile }
|
||||
// }
|
||||
@@ -172,7 +172,6 @@ export default {
|
||||
const getInspectionDirections = () => {
|
||||
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
|
||||
directionworks.value = res.data
|
||||
console.log(directionworks.value)
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -170,7 +170,6 @@ setup(){
|
||||
|
||||
let periodusers = new Set([])
|
||||
let brdata = {}
|
||||
console.log(alldata.value.staff, 'alldata.value.periodalldata.value.periodalldata.value.periodalldata.value.period')
|
||||
let filtr = alldata.value.period
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
import CarouselList from '@/components/carousel-list.vue'
|
||||
import CarouselNumbers from '@/components/carousel-numbers.vue'
|
||||
import CalendarFull from '@/components/UI/Calendar-full.vue'
|
||||
|
||||
|
||||
import NewsHome from '@/components/news-home.vue'
|
||||
import LoadRound from '@/components/load-round.vue'
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
CarouselList,
|
||||
CarouselNumbers,
|
||||
CalendarFull,
|
||||
|
||||
|
||||
LoadRound,
|
||||
DigitalLetna,
|
||||
|
||||
Reference in new issue
Block a user