Merge remote-tracking branch 'origin/develop' into 22_about_inspection
This commit is contained in:
commit
63e20c22ec
53 files changed
+1309
-1502
No files matched your search
@@ -82,8 +82,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||
def fio(self):
|
||||
|
||||
return self.user.login
|
||||
# return ShortUserSerializer(DictEmployee.objects.get(login=self.username)).data
|
||||
# return DictEmployee.objects.using('user_directory').get(login=self.username).fio
|
||||
|
||||
|
||||
def names(self):
|
||||
return DictEmployee.objects.get(login=self.username)
|
||||
|
||||
@@ -14,7 +14,6 @@ urlpatterns = [
|
||||
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||
path('token/verify/', TokenVerifyView.as_view(), name='token_access'),
|
||||
path('getuser/', getuserAPIView.as_view(), name='getuserAPIView', ),
|
||||
path('test/', testView.as_view(), name='test')
|
||||
|
||||
|
||||
]
|
||||
@@ -1,86 +1,26 @@
|
||||
from rest_framework import status
|
||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from .renderers import UserJSONRenderer
|
||||
from userauth.models import *
|
||||
from navigation.models import *
|
||||
from navigation.serializers import *
|
||||
from userauth.serializers import *
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class testView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
"""Пример"""
|
||||
|
||||
|
||||
newsqueryset = News.objects.all().order_by('cdate')
|
||||
|
||||
|
||||
|
||||
for x in newsqueryset:
|
||||
a=model_to_dict(x)
|
||||
# a['link']= str(x.link.url)
|
||||
# a['show'] = False
|
||||
# a['showComment'] = False
|
||||
# a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username))
|
||||
a['scores'] = [{"score":y.score, "user":y.author.username} for y in x.get_news.all()]
|
||||
a['comment'] = [{"author":model_to_dict(k.author.user),
|
||||
"cdate":k.cdate,
|
||||
"text":k.text,
|
||||
"id": k.pk
|
||||
} for k in x.get_comment_news.all()
|
||||
]
|
||||
|
||||
return Response(NewsSerializer(newsqueryset, many=True).data)
|
||||
# from .serializers import RegistrationSerializer
|
||||
|
||||
# class RegistrationAPIView(APIView):
|
||||
# """
|
||||
# Разрешить всем пользователям (аутентифицированным и нет) доступ к данному эндпоинту.
|
||||
# """
|
||||
# permission_classes = (AllowAny,)
|
||||
# serializer_class = RegistrationSerializer
|
||||
# renderer_classes = (UserJSONRenderer,)
|
||||
|
||||
# def post(self, request):
|
||||
# user = request.data.get("user",{})
|
||||
# # Паттерн создания сериализатора, валидации и сохранения - довольно
|
||||
# # стандартный, и его можно часто увидеть в реальных проектах.
|
||||
|
||||
# serializer = self.serializer_class(data=user)
|
||||
# serializer.is_valid(raise_exception=True)
|
||||
# serializer.save()
|
||||
|
||||
# return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||
|
||||
class UserAPIView(APIView):
|
||||
permission_classes = (IsAuthenticated,)
|
||||
# serializer_class = RegistrationSerializer
|
||||
def get(self, request):
|
||||
# serializer = self.serializer_class(data=request.user)
|
||||
# serializer.is_valid(raise_exception=True)
|
||||
return Response('user')
|
||||
|
||||
class getuserAPIView(APIView):
|
||||
permission_classes = (AllowAny,)
|
||||
|
||||
|
||||
|
||||
|
||||
def get(self, request):
|
||||
"""
|
||||
Параметр: userlogin
|
||||
Пример: GET /api/accounts/getuser/?userlogin=9966-00-107
|
||||
Результат: Выдает все данные о пользователе
|
||||
"""
|
||||
dt=datetime.now()
|
||||
|
||||
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
|
||||
r=CardUserSerializer(queryset).data
|
||||
|
||||
|
||||
|
||||
return Response(CardUserSerializer(queryset).data)
|
||||
|
||||
@@ -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.
|
||||
@@ -3,71 +3,42 @@ from .models import *
|
||||
from userauth.serializers import *
|
||||
|
||||
class BaseCriteriaAllSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
""" Забирает все поля из модели по хранению названия критерия оценки,
|
||||
используемой иконки, рейтинга по умолчанию, и цвет для иконки
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
class Meta:
|
||||
model = BaseCriteria
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
|
||||
class RatingStatusSerializer(serializers.ModelSerializer):
|
||||
|
||||
""" Забирает все поля из модели по хранению критерия оценки,
|
||||
какую поставили по критерию, и к какому коментарию оно относится
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
class Meta:
|
||||
model = RatingStatus
|
||||
fields ='__all__'
|
||||
|
||||
class RatingStatusStatSerializer(serializers.ModelSerializer):
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
time_create = serializers.DateTimeField(source='usercom.time_create')
|
||||
# comment = serializers.CharField(source='usercom.comment')
|
||||
# utility = serializers.CharField(source='usercom.utility')
|
||||
namecrit = serializers.CharField(source='crit.name')
|
||||
ico = serializers.CharField(source='crit.ico')
|
||||
color = serializers.CharField(source='crit.color')
|
||||
|
||||
class Meta:
|
||||
model = RatingStatus
|
||||
fields ='__all__'
|
||||
|
||||
def get_user(self, obj):
|
||||
|
||||
# obj.user
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.usercom)).data
|
||||
|
||||
|
||||
class BaseCriteriaSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
class FeedbackUserCommentSerializer(serializers.ModelSerializer):
|
||||
""" Забирает все поля из модели, без расшифровки пользователя
|
||||
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||
"""
|
||||
class Meta:
|
||||
model = BaseCriteria
|
||||
fields = ['id', 'name', 'ico', 'rating', 'color']
|
||||
|
||||
|
||||
|
||||
# return super().to_representation(instance)
|
||||
model = UserComment
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class UserCommentSerializer(serializers.ModelSerializer):
|
||||
"""Используется в представлении DataForStatisticsAPIView, для сбора информации
|
||||
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
||||
"""
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
class Meta:
|
||||
model = UserComment
|
||||
fields = '__all__'
|
||||
|
||||
def get_user(self, obj):
|
||||
|
||||
# obj.user
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
|
||||
|
||||
class UserCommerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = UserComment
|
||||
fields = '__all__'
|
||||
|
||||
class UserGetSerializer(serializers.ModelSerializer):
|
||||
|
||||
get_rating = RatingStatusSerializer(many=True)
|
||||
|
||||
class Meta:
|
||||
fields = ['id', 'user', 'time_create', 'comment', 'get_rating']
|
||||
model = UserComment
|
||||
return InfoUserCardSerializer(obj.user.user).data
|
||||
+27
-15
@@ -5,14 +5,18 @@ from .models import *
|
||||
|
||||
from rest_framework.views import APIView
|
||||
|
||||
|
||||
|
||||
class FeedbackAPIView(APIView):
|
||||
|
||||
|
||||
def get(self, request):
|
||||
"""Оценка сайта. Собираем информацию о критериях оценки, поставленный рейтинг и коментарий"""
|
||||
# Получаем набор всех записей из таблицы Capital
|
||||
nowrating = RatingStatus.objects.filter(usercom__user_id=self.request.user.id, usercom__time_create__contains=datetime.date.today()).order_by("crit_id")
|
||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id, time_create__contains=datetime.date.today())
|
||||
|
||||
nowrating = RatingStatus.objects.filter(usercom__user_id=self.request.user.id,
|
||||
usercom__time_create__contains=datetime.date.today()
|
||||
).order_by("crit_id")
|
||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id,
|
||||
time_create__contains=datetime.date.today()
|
||||
)
|
||||
basecrit = BaseCriteria.objects.all()
|
||||
|
||||
# Сериализуем извлечённый набор записей
|
||||
@@ -21,7 +25,7 @@ class FeedbackAPIView(APIView):
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
|
||||
serializer_for_nowcomment = UserCommerializer(
|
||||
serializer_for_nowcomment = FeedbackUserCommentSerializer(
|
||||
instance=nowcomment, # Передаём набор записей
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
@@ -31,20 +35,28 @@ class FeedbackAPIView(APIView):
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
|
||||
return Response({"basecrit":serializer_for_basecrit.data,
|
||||
"nowrating":serializer_for_nowrating.data,
|
||||
return Response({"basecrit": serializer_for_basecrit.data,
|
||||
"nowrating": serializer_for_nowrating.data,
|
||||
"nowcomment": serializer_for_nowcomment.data[0] if len(nowcomment)>0 else None
|
||||
})
|
||||
})
|
||||
|
||||
def post(self, request):
|
||||
"""Оценка сайта.
|
||||
Параметры nowrating -
|
||||
массив объектов nowrating {id: 34, rating: 3, crit: 1, usercom: 13}
|
||||
объектnowcomment {id: 13, time_create: '2024-03-18T13:38:41.421851+03:00', comment: '', utility: true, user: 22}
|
||||
"""Оценка сайта. И добавление или обновление комементария или оценки сайта
|
||||
Параметры
|
||||
nowrating - массив объектов nowrating {id: 34, rating: 3, crit: 1, usercom: 13}
|
||||
объект nowcomment {id: 13, time_create: '2024-03-18T13:38:41.421851+03:00', comment: '', utility: true, user: 22}
|
||||
"""
|
||||
comment, created = UserComment.objects.update_or_create(id=request.data['nowcomment']['id'],user_id=self.request.user.id, defaults={'comment':request.data['nowcomment']['comment'], 'time_create':datetime.datetime.now()})
|
||||
comment, created = UserComment.objects.update_or_create(id = request.data['nowcomment']['id'],
|
||||
user_id = self.request.user.id,
|
||||
defaults = {'comment':request.data['nowcomment']['comment'],
|
||||
'time_create':datetime.datetime.now()
|
||||
})
|
||||
for x in request.data['nowrating']:
|
||||
RatingStatus.objects.update_or_create(id=x['id'], defaults={'rating':x['rating'], 'crit_id':x['crit'], 'usercom_id':comment.id})
|
||||
RatingStatus.objects.update_or_create(id=x['id'],
|
||||
defaults={'rating':x['rating'],
|
||||
'crit_id':x['crit'],
|
||||
'usercom_id':comment.id
|
||||
})
|
||||
return Response({})
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class DailyloadAPIView(APIView):
|
||||
"""
|
||||
def get(self, request):
|
||||
try:
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'fio', 'post').order_by('id_dict_department__order_department', 'id_dict_position__order_position', 'fio')
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'fio', 'post', 'email', 'tel', 'room').order_by('id_dict_department__order_department', 'id_dict_position__order_position', 'fio')
|
||||
|
||||
dailyr = DailyRoundUp.objects.filter(todaysDate=date.today()).values_list('user', 'position__name', 'position')
|
||||
df_user = pd.DataFrame.from_records(user)
|
||||
@@ -115,11 +115,29 @@ class DailyloadAPIView(APIView):
|
||||
|
||||
for index, row in df.iterrows ():
|
||||
if row['department'] in result.keys():
|
||||
result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']})
|
||||
result[row['department']].append({'login':row['login'],
|
||||
'fio':row['fio'],
|
||||
'post':row['post'],
|
||||
'pos':row['pos'],
|
||||
'email':row['email'],
|
||||
'department':row['department'],
|
||||
'tel':row['tel'],
|
||||
'room':row['room']
|
||||
|
||||
})
|
||||
else:
|
||||
result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}]
|
||||
result[row['department']]=[{'login':row['login'],
|
||||
'fio':row['fio'],
|
||||
'post':row['post'],
|
||||
'pos':row['pos'],
|
||||
'email':row['email'],
|
||||
'department':row['department'],
|
||||
'tel':row['tel'],
|
||||
'room':row['room']
|
||||
}]
|
||||
|
||||
daily = result
|
||||
print(daily,'dailydaily')
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,23 +5,22 @@ from userauth.serializers import *
|
||||
|
||||
|
||||
class LinkSerializer(serializers.ModelSerializer):
|
||||
""" Используется в представлении LinkAPIView для внешних ссылок """
|
||||
class Meta:
|
||||
model = Links
|
||||
fields = '__all__'
|
||||
|
||||
class ScoreGalleryAllSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = ScoreGallery
|
||||
fields = '__all__'
|
||||
|
||||
class ScoreGallerySerializer(serializers.ModelSerializer):
|
||||
"""Используется для сборки оценкок, для серилизатора GallerySerializer, который нужен для NewsSerializer"""
|
||||
user = serializers.CharField(source='author.username')
|
||||
class Meta:
|
||||
model = ScoreGallery
|
||||
fields = ['like', 'user']
|
||||
|
||||
|
||||
class GallerySerializer(serializers.ModelSerializer):
|
||||
"""Используется для сборки Изображений, для серилизатора NewsSerializer"""
|
||||
likes= serializers.SerializerMethodField('get_gallery')
|
||||
|
||||
class Meta:
|
||||
@@ -33,6 +32,7 @@ class GallerySerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
class ScoreNewsSerializer(serializers.ModelSerializer):
|
||||
"""Используется для сбора оценок новости, для серилизатора NewsSerializer"""
|
||||
user = serializers.CharField(source='author.username')
|
||||
class Meta:
|
||||
model = ScoreNews
|
||||
@@ -40,19 +40,22 @@ class ScoreNewsSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
class CommentNewsSerializer(serializers.ModelSerializer):
|
||||
"""Используется для сборки комментариев, для серилизатора NewsSerializer"""
|
||||
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
|
||||
|
||||
class Meta:
|
||||
model = CommentNews
|
||||
fields = '__all__'
|
||||
|
||||
def get_user(self, obj):
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.author.username)).data
|
||||
return InfoUserCardSerializer(DictEmployee.objects.get(login=obj.author.username)).data
|
||||
|
||||
|
||||
class NewsSerializer(serializers.ModelSerializer):
|
||||
|
||||
""" Используется в представлении NewsCrossroadAPIView, собирает информацию по пользователям,
|
||||
оставленным новосятим, комментариям, лайкам, изображениям
|
||||
"""
|
||||
show = serializers.SerializerMethodField('get_show')
|
||||
showComment = serializers.SerializerMethodField('get_show')
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
@@ -68,7 +71,7 @@ class NewsSerializer(serializers.ModelSerializer):
|
||||
return False
|
||||
|
||||
def get_user(self, obj):
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.author.username)).data
|
||||
return InfoUserCardSerializer(DictEmployee.objects.get(login=obj.author.username)).data
|
||||
|
||||
def get_score(self, obj):
|
||||
return ScoreNewsSerializer(obj.get_news.all(), many=True).data
|
||||
@@ -80,13 +83,10 @@ class NewsSerializer(serializers.ModelSerializer):
|
||||
# return 'gal'
|
||||
return GallerySerializer(obj.get_gallery_news.all(), many=True).data
|
||||
|
||||
class BaseSenderSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = BaseSender
|
||||
fields = '__all__'
|
||||
|
||||
class CarouselsSerializer(serializers.ModelSerializer):
|
||||
""" Используется в представлении CarouselsAPIView, передает ссылки на картинки для отображения на главной страницы карусели"""
|
||||
senders = serializers.CharField(source='sender.img')
|
||||
|
||||
class Meta:
|
||||
@@ -101,3 +101,10 @@ class ScreensaverSerializer(serializers.ModelSerializer):
|
||||
model = Screensaver
|
||||
fields = '__all__'
|
||||
|
||||
class BaseSenderSerializer(serializers.ModelSerializer):
|
||||
""" Получить ссылку на картинку для дня рождения. Название 'День рождения'
|
||||
автоматически добавляется в таблицу, если его до этого не было """
|
||||
|
||||
class Meta:
|
||||
model = BaseSender
|
||||
fields = ['img']
|
||||
@@ -102,8 +102,6 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
|
||||
newsqueryset = newsqueryset[:10]
|
||||
else:
|
||||
|
||||
|
||||
pagesel = int(request.GET.get("page"))*int(request.GET.get("countpage"))
|
||||
|
||||
newsqueryset =newsqueryset[pagesel:pagesel+int(request.GET.get("countpage"))]
|
||||
@@ -111,6 +109,7 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
|
||||
result = NewsSerializer(newsqueryset, many=True).data
|
||||
|
||||
|
||||
return Response({"result":result, "countpage": countpage})
|
||||
|
||||
def post(self, request):
|
||||
@@ -141,7 +140,7 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
} for y in CommentNews.objects.filter(news_id=request.data['news']))}
|
||||
|
||||
return Response(back)
|
||||
|
||||
|
||||
class CarouselsAPIView(ListAPIView):
|
||||
|
||||
"""
|
||||
@@ -167,42 +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)
|
||||
@@ -35,12 +35,18 @@ class OrderResponsibilitySerializer(serializers.ModelSerializer):
|
||||
return ResponsibilityUsersSerializer(data,many=True).data
|
||||
|
||||
class Committee1FilesSerializer(serializers.ModelSerializer):
|
||||
"""Забирает названия файлов и их актуальность
|
||||
|
||||
"""
|
||||
class Meta:
|
||||
model = Committee1Files
|
||||
exclude=['id_committee1']
|
||||
|
||||
class Committee1Serializer(serializers.ModelSerializer):
|
||||
""" Забирает всю информацию по комиссиям с типом
|
||||
|
||||
|
||||
"""
|
||||
typs = serializers.CharField(source='id_dict_committee_type.name')
|
||||
files = serializers.SerializerMethodField('get_files')
|
||||
|
||||
@@ -59,6 +65,7 @@ class DictCommitteeOrderAddonSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
class Committee2Serializer(serializers.ModelSerializer):
|
||||
""" Собирает информацию о комиссиях с файлами"""
|
||||
position=serializers.CharField(source='id_dict_committee_position.name')
|
||||
|
||||
name = serializers.CharField(source='id_committee1.name')
|
||||
@@ -77,22 +84,24 @@ class Committee2Serializer(serializers.ModelSerializer):
|
||||
fields = '__all__'
|
||||
|
||||
def get_master(self, obj):
|
||||
return Committee1Serializer(obj.id_committee1.id_master).data
|
||||
return Committee1Serializer(obj.id_committee1.id_master).data
|
||||
|
||||
|
||||
def get_addons(self, obj):
|
||||
data=DictCommitteeOrderAddon.objects.filter(id_committee1=obj.id_committee1)
|
||||
return DictCommitteeOrderAddonSerializer(data, many=True).data
|
||||
data=DictCommitteeOrderAddon.objects.filter(id_committee1=obj.id_committee1)
|
||||
return DictCommitteeOrderAddonSerializer(data, many=True).data
|
||||
|
||||
def get_files(self, obj):
|
||||
data=Committee1Files.objects.filter(id_committee1=obj.id_committee1)
|
||||
return Committee1FilesSerializer(data, many=True).data
|
||||
data=Committee1Files.objects.filter(id_committee1=obj.id_committee1)
|
||||
return Committee1FilesSerializer(data, many=True).data
|
||||
|
||||
class CardUserSerializer(serializers.ModelSerializer):
|
||||
"""Собирает все данные о пользователе
|
||||
Используется в представлении getuserAPIView
|
||||
В компоненте AboutInspectionPage
|
||||
"""
|
||||
responsibility = serializers.SerializerMethodField('get_responsibility')
|
||||
committee = serializers.SerializerMethodField('get_committee')
|
||||
|
||||
# position=serializers.CharField(source='id_dict_employee.fio')
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -107,16 +116,13 @@ class CardUserSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
def get_committee(self, obj):
|
||||
return Committee2Serializer(obj.user_committe2.all(), many=True).data
|
||||
# [Committee2Serializer(x.id_dict_committee_position).data for x in obj.user_committe2.all()]
|
||||
# Committee2Serializer(obj.user_committe2.get().id_dict_committee_position).data
|
||||
return Committee2Serializer(obj.user_committe2.all(), many=True).data
|
||||
|
||||
|
||||
class ShortUserSerializer(serializers.ModelSerializer):
|
||||
# login = serializers.CharField()
|
||||
|
||||
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department']
|
||||
# fields='__all__'
|
||||
class InfoUserCardSerializer(serializers.ModelSerializer):
|
||||
""" Собирает необходимую информацию о пользователе, содержит необходимые
|
||||
поля для отрисовки карточки информации о пользователе при клике на фамилию
|
||||
Необходим для компонента infoUserCard"""
|
||||
class Meta:
|
||||
model = DictEmployee
|
||||
fields = ['department', 'fio', 'post', 'email', 'tel', 'room', 'login', 'familyname', 'name', 'parentname', 'id']
|
||||
@@ -3,39 +3,29 @@ from rest_framework import serializers
|
||||
from .models import *
|
||||
from userauth.serializers import *
|
||||
|
||||
class CountSerializer(serializers.ModelSerializer):
|
||||
author = serializers.SerializerMethodField('get_user')
|
||||
pages = serializers.CharField(source='pages.page')
|
||||
fullPath = serializers.CharField(source='pages.fullPath')
|
||||
ico = serializers.CharField(source='pages.ico')
|
||||
|
||||
class Meta:
|
||||
model = CountVisitor
|
||||
fields = ['author', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
|
||||
|
||||
def get_user(self, obj):
|
||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
|
||||
|
||||
class VisitdateSerializer(serializers.ModelSerializer):
|
||||
""" Используется в представлении Counter
|
||||
выводит дату посещения страницы пользователем
|
||||
"""
|
||||
class Meta:
|
||||
model = CountVisitor
|
||||
fields = ['visitdate']
|
||||
|
||||
|
||||
class PagesSerializer(serializers.ModelSerializer):
|
||||
"""Используется для отрисовки страницы статистики в представлении DataForStatisticsAPIView
|
||||
Собирает информацию о посещенных страницах и иинформацию о пользователе из таблицы DictEmployee
|
||||
с полями для отрисовки карточки пользователя
|
||||
"""
|
||||
user = serializers.SerializerMethodField('get_user')
|
||||
pages = serializers.CharField(source='pages.page')
|
||||
fullPath = serializers.CharField(source='pages.fullPath')
|
||||
ico = serializers.CharField(source='pages.ico')
|
||||
pages = serializers.CharField(source = 'pages.page')
|
||||
fullPath = serializers.CharField(source = 'pages.fullPath')
|
||||
ico = serializers.CharField(source = 'pages.ico')
|
||||
|
||||
class Meta:
|
||||
model = CountVisitor
|
||||
fields = ['user', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
|
||||
|
||||
def get_user(self, obj):
|
||||
|
||||
return ShortUserSerializer(obj.user.user).data
|
||||
|
||||
|
||||
|
||||
|
||||
return InfoUserCardSerializer(obj.user.user).data
|
||||
@@ -5,7 +5,4 @@ urlpatterns = [
|
||||
path('counter/', Counter.as_view(),name="CountVisitors"),
|
||||
path('dataforstatistics/', DataForStatisticsAPIView.as_view(), name="DataForStatistics"),
|
||||
path('selectedlinks/', SelectedLinksAPIView.as_view(),name="SelectedLinks")
|
||||
# path('', views.Watchuser.as_view()), selectedlinks
|
||||
|
||||
|
||||
]
|
||||
+37
-24
@@ -1,56 +1,55 @@
|
||||
from django.forms import model_to_dict
|
||||
from django.shortcuts import render
|
||||
from rest_framework.generics import ListAPIView
|
||||
from .models import *
|
||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
from django.views.generic import ListView
|
||||
from .serializers import *
|
||||
from datetime import date, datetime, timedelta
|
||||
from django.db.models import Sum, Q, Count, Avg, F, Max
|
||||
from django.db.models import Sum, Q, Avg, F
|
||||
from userauth.models import *
|
||||
from feedback.models import *
|
||||
from feedback.serializers import *
|
||||
import pandas as pd
|
||||
# Create your views here. visitdate__year='2023', visitdate__month='01', visitdate__day='21'
|
||||
|
||||
|
||||
class Counter(ListAPIView):
|
||||
permission_classes = (AllowAny,)
|
||||
serializer_class = CountSerializer
|
||||
|
||||
|
||||
|
||||
def get(self, request):
|
||||
"""Не используется"""
|
||||
return Response('Не используется')
|
||||
|
||||
|
||||
|
||||
def post(self, request):
|
||||
"""
|
||||
Представление получает информацию о ссылке на страницу, и производит создание или перезапись существующей страницы в таблицу, для тогочтобы проследить на каких страницах был пользователь в конкретный день.
|
||||
Представление получает информацию о ссылке на страницу, и производит создание
|
||||
или перезапись существующей страницы в таблицу, для того чтобы
|
||||
проследить на каких страницах был пользователь в конкретный день.
|
||||
{totalvisit: 10539, visittoday: 21, uniqtoday: 1, visitdate: '2023-12-21'}
|
||||
Мы получаем информацию о том сколько всего раз была посещена страница с момента первой записи в бд, сколько было сегодня людей и сколько уникальных,
|
||||
Мы получаем информацию о том сколько всего раз была посещена страница
|
||||
с момента первой записи в бд, сколько было сегодня людей и сколько уникальных,
|
||||
"""
|
||||
|
||||
myfullPath = request.data['fullPath']
|
||||
|
||||
if "?" in myfullPath:
|
||||
myfullPath= myfullPath.split("?")[0]
|
||||
|
||||
page, create = Pages.objects.get_or_create(page=request.data['page'], fullPath=myfullPath, ico=request.data['ico'])
|
||||
page, create = Pages.objects.get_or_create(page=request.data['page'],
|
||||
fullPath=myfullPath,
|
||||
ico=request.data['ico'])
|
||||
|
||||
if request.data['user__id'] is not None:
|
||||
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),pages=page, visitdate=date.today())
|
||||
watch, create = CountVisitor.objects.get_or_create(user = User(id = request.data['user__id']),
|
||||
pages = page,
|
||||
visitdate = date.today()
|
||||
)
|
||||
|
||||
watch.count+=1
|
||||
watch.count += 1
|
||||
watch.save()
|
||||
|
||||
datavisit = CountVisitor.objects.filter(pages=page.id).earliest('visitdate')
|
||||
datavisit = CountVisitor.objects.filter(pages = page.id).earliest('visitdate')
|
||||
|
||||
res = {"totalvisit": CountVisitor.objects.filter(pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"visittoday":CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count(),
|
||||
"visitdate" : VisitdateSerializer(datavisit).data['visitdate']
|
||||
"visittoday":CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).aggregate(Sum('count'))['count__sum'],
|
||||
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count(),
|
||||
"visitdate" : VisitdateSerializer(datavisit).data['visitdate']
|
||||
}
|
||||
|
||||
return Response(res)
|
||||
@@ -70,7 +69,23 @@ class SelectedLinksAPIView(ListAPIView):
|
||||
class DataForStatisticsAPIView(ListAPIView):
|
||||
"""
|
||||
Принимает два параметра с фронта start=${}&end=${}
|
||||
Данные берет из фильтра и собираем всю необходимую информацию для отрисовки страницы. http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/issues/12 подробное описание с работой собранного объекта
|
||||
Данные берет из фильтра и собираем всю необходимую информацию для отрисовки страницы.
|
||||
http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/issues/12 подробное описание с работой собранного объекта
|
||||
Возвращяет
|
||||
beforperiod - забирает данные за два периода назад для расчета удержания
|
||||
period - собирает информацию о пользователе, сколько раз и когда он посетил конкретную страницу
|
||||
staff - количество сотрудников на конец периода
|
||||
feedback - ключ для блока с обратной связью, он содержит:
|
||||
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
||||
criteria - среднее значение по критерию с иконкой и цветом
|
||||
data:
|
||||
score - оценки
|
||||
title - наименование
|
||||
all - за все время
|
||||
period - за период
|
||||
comment - комментарии
|
||||
'------'
|
||||
last_comment - дата последнего комментария
|
||||
"""
|
||||
def get(self, request):
|
||||
|
||||
@@ -79,7 +94,6 @@ class DataForStatisticsAPIView(ListAPIView):
|
||||
data_rating = data_end + timedelta(days=1)
|
||||
beetween = data_end - (data_start - timedelta(days=1))
|
||||
|
||||
#
|
||||
res = CountVisitor.objects.filter(visitdate__lt = request.GET.get("start"), visitdate__gte=data_start - beetween*2).distinct().values('visitdate','user__user_id')
|
||||
per = CountVisitor.objects.filter(Q(visitdate__lte = request.GET.get("end"), visitdate__gte =request.GET.get("start")) | Q(visitdate=date.today()))
|
||||
|
||||
@@ -94,7 +108,6 @@ class DataForStatisticsAPIView(ListAPIView):
|
||||
'staff': DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count(),
|
||||
'feedback': {
|
||||
'feed': UserCommentSerializer(d, many=True).data,
|
||||
|
||||
'criteria': list(rating.values('crit__name').annotate(ratings=Avg('rating'), name=F('crit__name'), ico=F('crit__ico'), color=F('crit__color')).values('ratings', 'name', 'ico', 'color')),
|
||||
'data': {
|
||||
'score': {
|
||||
|
||||
Generated
+6
@@ -26,6 +26,7 @@
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"ical.js": "^2.0.0",
|
||||
"moment": "^2.30.1",
|
||||
"pinia": "^2.0.23",
|
||||
"roboto-fontface": "*",
|
||||
@@ -9873,6 +9874,11 @@
|
||||
"node": ">=10.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ical.js": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ical.js/-/ical.js-2.0.0.tgz",
|
||||
"integrity": "sha512-eb/KPJlF1IxRNvbjkGtt3lXQg1TeGEh8RzmCQk65qIFw5p+SONy8FUCFoclsfxpX1CFjyShzO/Lm0bdig7vFPg=="
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"date-fns": "^2.30.0",
|
||||
"express-vue": "^5.12.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"ical.js": "^2.0.0",
|
||||
"moment": "^2.30.1",
|
||||
"pinia": "^2.0.23",
|
||||
"roboto-fontface": "*",
|
||||
|
||||
@@ -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>
|
||||
@@ -8,7 +8,7 @@
|
||||
<v-row no-gutters v-if="top.comment[0].time_create != '1990-01-01'">
|
||||
<v-col lg=5 class="bg-teal-lighten-4 align-self-center">
|
||||
<list-user
|
||||
:author= "top.author"
|
||||
:author= "top.author"
|
||||
:from_which="'top_comment'"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -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>
|
||||
@@ -12,7 +12,7 @@
|
||||
v-model:expanded="expanded"
|
||||
:headers="dessertHeaders"
|
||||
:items="dataActivusers"
|
||||
item-value="user.id"
|
||||
item-value="user"
|
||||
show-expand
|
||||
class="h-0 cursor-default bg-grey_white"
|
||||
:sort-by="[{ key: 'info.count', order: 'desc' }]"
|
||||
@@ -169,7 +169,7 @@ export default {
|
||||
let res = []
|
||||
|
||||
props.activusers.forEach((e) => {
|
||||
|
||||
|
||||
let ind = res.findIndex(el => el.user.id == e.user.id)
|
||||
if (ind == -1) {
|
||||
res.push({user: e.user,
|
||||
|
||||
@@ -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>
|
||||
@@ -10,8 +10,8 @@
|
||||
{{splitname(author)}}
|
||||
</span>
|
||||
<info-user-card
|
||||
:author=author
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# H1 Для отрисовки карточки, необходимы поля от пользователя
|
||||
|
||||
department
|
||||
fio
|
||||
post
|
||||
email
|
||||
tel
|
||||
room
|
||||
login
|
||||
|
||||
Использовать серриализатор InfoUserCardSerializer из userauth для сбора
|
||||
|
||||
Пример
|
||||
```
|
||||
class PagesSerializer(serializers.ModelSerializer):
|
||||
user = serializers.SerializerMethodField('get_user')
|
||||
pages = serializers.CharField(source='pages.page')
|
||||
fullPath = serializers.CharField(source='pages.fullPath')
|
||||
ico = serializers.CharField(source='pages.ico')
|
||||
|
||||
class Meta:
|
||||
model = CountVisitor
|
||||
fields = ['user', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
|
||||
|
||||
def get_user(self, obj):
|
||||
|
||||
return InfoUserCardSerializer(obj.user.user).data
|
||||
```
|
||||
`
|
||||
const basicInformation = () => [
|
||||
{title: 'Отдел:', info: department},
|
||||
{title: 'ФИО:', info: fio},
|
||||
{title: 'Должность:', info: post},
|
||||
]
|
||||
|
||||
const subInformation = () => [
|
||||
{title: 'E-mail: ', info: email},
|
||||
{title: 'Телефон: ', info: tel},
|
||||
{title: 'Комната: ', info: room},
|
||||
{title: 'Логин: ', info: login},
|
||||
]
|
||||
`
|
||||
+15
-28
@@ -20,7 +20,7 @@
|
||||
cover
|
||||
min-height="222px"
|
||||
max-height="222px"
|
||||
:src="checkremote(`${spravURL}${userlinks.login}.jpg`)"
|
||||
:src="checkremote(`${spravURL}${author.login}.jpg`)"
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
@@ -77,62 +77,49 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { computed } from 'vue'
|
||||
import { checkremote } from '@/utils/universal_functions'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
|
||||
export default {
|
||||
|
||||
name: "InfoUserCard",
|
||||
|
||||
props: {
|
||||
|
||||
opendialog: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
||||
loging: {
|
||||
type: String,
|
||||
default: ''
|
||||
author: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
|
||||
setup (props, {emit}) {
|
||||
const userlinks = ref([])
|
||||
|
||||
const infouser = () => {
|
||||
axiosApiInstance.get('api/accounts/getuser/?userlogin='+props.loging).then(res => {
|
||||
userlinks.value=res.data
|
||||
})}
|
||||
|
||||
const mydialog = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit('update:opendialog', value)
|
||||
})
|
||||
|
||||
watch(()=>props.opendialog,(newValue,oldValue)=>{
|
||||
if(newValue){
|
||||
infouser()
|
||||
}
|
||||
}, {deep:true})
|
||||
|
||||
const basicInformation = () => [
|
||||
{title: 'Отдел:', info: userlinks.value.department},
|
||||
{title: 'ФИО:', info: userlinks.value.fio},
|
||||
{title: 'Должность:', info: userlinks.value.post},
|
||||
{title: 'Отдел:', info: props.author.department},
|
||||
{title: 'ФИО:', info: props.author.fio},
|
||||
{title: 'Должность:', info: props.author.post},
|
||||
]
|
||||
|
||||
const subInformation = () => [
|
||||
{title: 'E-mail: ', info: userlinks.value.email},
|
||||
{title: 'Телефон: ', info: userlinks.value.tel},
|
||||
{title: 'Комната: ', info: userlinks.value.room},
|
||||
{title: 'Логин: ', info: userlinks.value.login},
|
||||
{title: 'E-mail: ', info: props.author.email},
|
||||
{title: 'Телефон: ', info: props.author.tel},
|
||||
{title: 'Комната: ', info: props.author.room},
|
||||
{title: 'Логин: ', info: props.author.login},
|
||||
]
|
||||
|
||||
return {
|
||||
mydialog,
|
||||
userlinks,
|
||||
infouser,
|
||||
spravURL,
|
||||
checkremote,
|
||||
basicInformation,
|
||||
@@ -31,6 +31,7 @@
|
||||
/>
|
||||
<span class="font-weight-medium text-grey-darken-3 myleft text-caption">
|
||||
{{splitname(author)}}
|
||||
|
||||
</span>
|
||||
</v-chip>
|
||||
|
||||
@@ -49,6 +50,7 @@
|
||||
|
||||
|
||||
<info-user-card
|
||||
:author="author"
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<div class="align-center d-flex flex-column py-1">
|
||||
|
||||
|
||||
<v-btn
|
||||
variant="text"
|
||||
v-for="x in onlineuser"
|
||||
@@ -16,6 +18,7 @@
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
<info-user-card
|
||||
|
||||
:opendialog = open
|
||||
:loging="loging"
|
||||
@update:opendialog="open = $event"
|
||||
@@ -39,6 +42,7 @@ export default {
|
||||
const wsfuncs={onliner:function(data){
|
||||
let newset = new Set(data)
|
||||
let arr= Array.from(newset)
|
||||
|
||||
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
||||
onlineuser.value = arr
|
||||
}}
|
||||
@@ -46,7 +50,6 @@ export default {
|
||||
let onlineuser= ref([])
|
||||
|
||||
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
|
||||
|
||||
const whatuser=(x)=> {
|
||||
loging.value = x
|
||||
open.value = true
|
||||
@@ -54,6 +57,7 @@ export default {
|
||||
|
||||
connect.onmessage=(e)=>{
|
||||
let data = JSON.parse(e.data)
|
||||
|
||||
wsfuncs[data['message']['action']](data.message.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<v-card
|
||||
class="bg-transparent"
|
||||
|
||||
density="compact"
|
||||
:prepend-avatar="checkremote(`${spravURL}${author.login}.jpg`)"
|
||||
:title="author.fio"
|
||||
@@ -11,6 +9,7 @@
|
||||
variant="text" @click="open=true"
|
||||
/>
|
||||
<info-user-card
|
||||
:author=author
|
||||
:opendialog = open
|
||||
:loging="author.login"
|
||||
@update:opendialog="open = $event"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import myHelper from '@/components/UI/my-helper';
|
||||
import InfoUserCard from '@/components/UI/infoUserCard.vue';
|
||||
import InfoUserCard from '@/components/UI/fiousercard/infoUserCard.vue';
|
||||
import TooltipText from '@/components/UI/tooltip-text.vue'
|
||||
import AlertDefault from '@/layouts/default/alertDefault.vue'
|
||||
import listUser from '@/components/UI/fiousercard/listUser.vue';
|
||||
|
||||
@@ -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 }">
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <my-helper :pretext="kl" /> -->
|
||||
<v-btn @click="useICalReader"> ical</v-btn>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 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>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -123,7 +123,10 @@ export default {
|
||||
|
||||
function feedSend() {
|
||||
|
||||
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
|
||||
axiosApiInstance.post(`api/feedback/feedbackdata/`, {
|
||||
nowrating: feedbackdata.value.nowrating,
|
||||
nowcomment: feedbackdata.value.nowcomment
|
||||
}).then(data => {})
|
||||
feedalert.alert = true
|
||||
textFromAlert()
|
||||
menusCloses()
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="getUserDialog"
|
||||
persistent
|
||||
width="600">
|
||||
<v-card >
|
||||
|
||||
|
||||
|
||||
|
||||
<v-card-actions class="align-self-end pt-0 ">
|
||||
<v-btn
|
||||
color="modal_btn"
|
||||
variant="text"
|
||||
@click="menusCloses()"
|
||||
>
|
||||
Закрыть {{UserDialog}}
|
||||
</v-btn>
|
||||
|
||||
|
||||
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { clearAxios } from '@/utils/axios-api'
|
||||
import { ref, computed } from 'vue'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
|
||||
export default {
|
||||
|
||||
props: {
|
||||
UserDialog: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
||||
loging: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
const userlinks = ref([])
|
||||
const tab = ref(false)
|
||||
|
||||
const loadlinksUser=async()=>{
|
||||
|
||||
const res = await clearAxios.get('api/accounts/getuser/?userlogin='+props.loging)
|
||||
userlinks.value=res.data
|
||||
}
|
||||
|
||||
const basicInformation = () => [
|
||||
{title: 'Отдел:', info: userlinks.value.department},
|
||||
{title: 'ФИО:', info: userlinks.value.fio},
|
||||
{title: 'Должность:', info: userlinks.value.post},
|
||||
]
|
||||
|
||||
const subInformation = () => [
|
||||
{title: 'E-mail: ', info: userlinks.value.email},
|
||||
{title: 'Телефон: ', info: userlinks.value.tel},
|
||||
{title: 'Комната: ', info: userlinks.value.room},
|
||||
{title: 'Логин: ', info: userlinks.value.login},
|
||||
]
|
||||
|
||||
function menusCloses() {
|
||||
props.UserDialog=false
|
||||
|
||||
}
|
||||
|
||||
const getUserDialog = computed({
|
||||
|
||||
get: () => props.UserDialog,
|
||||
set: (value) => emit('update:UserDialog', value)
|
||||
})
|
||||
|
||||
loadlinksUser()
|
||||
|
||||
return {
|
||||
menusCloses,
|
||||
userlinks,
|
||||
accountStore,
|
||||
basicInformation,
|
||||
subInformation,
|
||||
checkremote,
|
||||
spravURL,
|
||||
tab,
|
||||
getUserDialog,
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.custom_subtitle .v-list-item-subtitle {
|
||||
opacity: 1!important;
|
||||
}
|
||||
|
||||
.highttext {
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.isActiveTab {
|
||||
background-color: #68c3ff70;
|
||||
}
|
||||
</style>
|
||||
@@ -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>
|
||||
@@ -45,7 +45,7 @@
|
||||
</v-card>
|
||||
<v-card
|
||||
v-else class="h-100 w-100 d-flex justify-center flex-column"
|
||||
:image="`${burl}/media/newsimage/2023/09/28/sea.jpg`">
|
||||
:image="`${burl}/media/default/sea.jpg`">
|
||||
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="py-0">
|
||||
@@ -55,7 +55,7 @@
|
||||
class="pl-3 d-flex justify-end"
|
||||
color="white"
|
||||
@click="changeData=!changeData">
|
||||
</v-switch>
|
||||
</v-switch>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="ma-3">
|
||||
@@ -132,19 +132,17 @@
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
import CardUsers from '@/components/cardUsers.vue'
|
||||
|
||||
import DialogSearch from './dialog-search.vue'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
export default {
|
||||
|
||||
components: {
|
||||
CardUsers,
|
||||
DialogSearch
|
||||
DialogSearch
|
||||
},
|
||||
|
||||
setup(){
|
||||
const t_baseCriteria = ref([])
|
||||
const t_daily = ref('')
|
||||
const idpos = ref('')
|
||||
const namepos = ref('')
|
||||
@@ -179,12 +177,6 @@ export default {
|
||||
|
||||
const burl = baseURL.slice(0,-1)
|
||||
|
||||
function proba(){
|
||||
axiosApiInstance.get('api/feedback/feedbackdata/')
|
||||
.then(data => {
|
||||
t_baseCriteria.value = data.data.results
|
||||
})
|
||||
}
|
||||
|
||||
const onPickFile = (ex) => {
|
||||
const sdata = new FormData()
|
||||
@@ -208,8 +200,7 @@ export default {
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
dailyfun(),
|
||||
proba()
|
||||
dailyfun()
|
||||
})
|
||||
|
||||
return {t_daily,
|
||||
|
||||
@@ -1,103 +1,69 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row class="flex-grow-0 mhight">
|
||||
<v-col class=" flex-column d-flex">
|
||||
<v-card class="ml-2 mt-2" width="500" >
|
||||
<v-card-title class="text-wrap pb-3">
|
||||
Ежедневная статистика по сотрудникам
|
||||
</v-card-title>
|
||||
<v-row class="flex-grow-0 align-self-end">
|
||||
<v-col class="d-flex">
|
||||
<v-card-subtitle class="mt-2 align-self-end">
|
||||
1. Скачать файл ежедневной статистики {{info}}
|
||||
</v-card-subtitle>
|
||||
<v-icon
|
||||
class="pt-2 pl-2"
|
||||
icon="mdi-file-excel"
|
||||
color="green-darken-3"
|
||||
@click="excelOp('excround')"
|
||||
>
|
||||
</v-icon>
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-card-subtitle class="align-self-center ml-3">
|
||||
2. Загрузить данные на сервер
|
||||
</v-card-subtitle>
|
||||
<v-col class="pr-0">
|
||||
|
||||
<v-file-input
|
||||
accept=".xlsx"
|
||||
v-model="dailyfiles"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
label="Прикрепить файл"
|
||||
hide-details
|
||||
class="mr-2 pb-2"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0 align-self-center pl-0 pr-6">
|
||||
<v-icon
|
||||
icon="mdi-chevron-double-right"
|
||||
color="blue-grey-darken-2"
|
||||
@click="onPickFile('roundfilse')"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
|
||||
</v-card>
|
||||
|
||||
</v-col>
|
||||
|
||||
<v-col class=" flex-column d-flex">
|
||||
|
||||
|
||||
</v-col>
|
||||
<v-col></v-col>
|
||||
<v-col></v-col>
|
||||
<v-col></v-col>
|
||||
<v-col></v-col>
|
||||
|
||||
<!-- <v-alert
|
||||
width = "500"
|
||||
position="fixed"
|
||||
class="bottom-alert"
|
||||
:type='info=="Файл загружен"?"success":"error"'
|
||||
:title='info=="Файл загружен"?"Успех!":"Упс!"'
|
||||
:text="info"
|
||||
v-model="alert"
|
||||
|
||||
:color='info=="Файл загружен"?"teal-darken-2":"red-darken-2"'
|
||||
closable
|
||||
></v-alert> -->
|
||||
</v-row>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
<v-row no-gutters class="gap ma-3 flex-column">
|
||||
<v-col lg=2 class='w100 d-flex flex-column'>
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col lg=4>
|
||||
<v-card class="h-100">
|
||||
<v-card-title>
|
||||
Ежедневная статистика по сотрудникам
|
||||
</v-card-title>
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col class="flex-grow-0">
|
||||
<v-card-subtitle class="mt-2 align-self-end">
|
||||
1. Скачать файл ежедневной статистики
|
||||
</v-card-subtitle>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0">
|
||||
<v-icon
|
||||
icon="mdi-file-excel"
|
||||
color="green-darken-3"
|
||||
@click="excelOp('excround')"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="gap mt-5">
|
||||
<v-col class="flex-grow-0">
|
||||
<v-card-subtitle class="mt-3 align-self-end">
|
||||
2. Загрузить данные на сервер
|
||||
</v-card-subtitle>
|
||||
</v-col>
|
||||
<v-col >
|
||||
<v-file-input
|
||||
accept=".xlsx"
|
||||
v-model="dailyfiles"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
label="Прикрепить файл"
|
||||
hide-details
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-grow-0 pr-2">
|
||||
<v-icon
|
||||
icon="mdi-chevron-double-right"
|
||||
color="blue-grey-darken-2"
|
||||
@click="onPickFile('roundfilse')"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import {getfromserver} from '@/utils/universal_functions'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useAlertStore } from '@/store/useAlertStore'
|
||||
|
||||
export default {
|
||||
|
||||
setup(){
|
||||
|
||||
const dailyfiles = ref([])
|
||||
const visiting = ref({})
|
||||
const info = ref('')
|
||||
const t_dailyRound = ref('')
|
||||
const feedalert = useAlertStore().alert
|
||||
|
||||
|
||||
|
||||
|
||||
const excelOp = (ex) => {
|
||||
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
|
||||
@@ -105,70 +71,41 @@ export default {
|
||||
link.href = baseURL+result.data.path
|
||||
link.click()
|
||||
link.remove()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const onPickFile = (ex) => {
|
||||
const sdata = new FormData()
|
||||
sdata.append('dailyfiles', dailyfiles.value[0])
|
||||
|
||||
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => {
|
||||
info.value = result.data['mess']
|
||||
|
||||
})
|
||||
showInfo.value = true
|
||||
dailyfiles.value = []
|
||||
feedalert.alert = true
|
||||
textFromAlert()
|
||||
|
||||
|
||||
|
||||
}
|
||||
textFromAlert(result.data['mess'])
|
||||
})
|
||||
dailyfiles.value = []
|
||||
}
|
||||
|
||||
const textFromAlert = () => {
|
||||
if (info.value=="Файл загружен") {
|
||||
feedalert.text = "Файл загружен"
|
||||
feedalert.ico = "mdi-check"
|
||||
feedalert.color="green-darken-4"
|
||||
}
|
||||
|
||||
else {
|
||||
feedalert.text = "Ошибка загрузки"
|
||||
feedalert.ico = "mdi-alert-circle-outline"
|
||||
feedalert.color="pink-accent-4"
|
||||
}
|
||||
}
|
||||
|
||||
const detailRound = () => {
|
||||
|
||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
|
||||
.then(data => {
|
||||
|
||||
|
||||
t_dailyRound.value = data.data
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const showInfo = ref(false)
|
||||
const textFromAlert = (info) => {
|
||||
feedalert.alert = true
|
||||
if (info == "Файл загружен") {
|
||||
feedalert.text = "Файл загружен"
|
||||
feedalert.ico = "mdi-check"
|
||||
feedalert.color ="green-darken-4"
|
||||
}
|
||||
else {
|
||||
feedalert.text = "Ошибка загрузки"
|
||||
feedalert.ico = "mdi-alert-circle-outline"
|
||||
feedalert.color="pink-accent-4"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
visiting,
|
||||
excelOp,
|
||||
baseURL,
|
||||
dailyfiles,
|
||||
onPickFile,
|
||||
info,
|
||||
detailRound,
|
||||
t_dailyRound,
|
||||
showInfo,
|
||||
|
||||
}
|
||||
feedalert
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class="d-flex pa-1 flex-column "
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
|
||||
{{aNewsAll}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0 ">
|
||||
@@ -69,6 +69,7 @@ export default {
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage/countpage.value
|
||||
visiblePage.value = countetnews.value <= 1 ? 1 : countetnews.value+1
|
||||
@@ -80,6 +81,7 @@ export default {
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
|
||||
|
||||
>
|
||||
<!-- <my-helper :pretext = newsFull /> -->
|
||||
|
||||
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
|
||||
|
||||
>
|
||||
|
||||
@@ -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,96 +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 => {
|
||||
export function getDevelopment() {
|
||||
return process.env.NODE_ENV == "development" ? true : false;
|
||||
}
|
||||
|
||||
appStore.countvisitor = result.data
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
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 = {}
|
||||
|
||||
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,
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
Сотрудники
|
||||
{{userlinks}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {pagecounter} from '@/utils/universal_functions'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import { clearAxios } from '@/utils/axios-api'
|
||||
import { ref } from 'vue'
|
||||
export default {
|
||||
|
||||
props: {
|
||||
|
||||
loging: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
|
||||
setup(props, context){
|
||||
const accountStore = useAccountStore()
|
||||
const userlinks = ref([])
|
||||
const login =ref('')
|
||||
|
||||
const loadlinksUser=async()=>{
|
||||
if (props.loging==""){
|
||||
login.value=accountStore.user.login
|
||||
}
|
||||
else {
|
||||
login.value=props.loging
|
||||
|
||||
}
|
||||
|
||||
const res = await clearAxios.get('api/accounts/getuser/?userlogin='+login.value)
|
||||
userlinks.value=res.data
|
||||
}
|
||||
|
||||
pagecounter()
|
||||
loadlinksUser()
|
||||
|
||||
|
||||
return {
|
||||
|
||||
userlinks,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -132,7 +132,6 @@ const responsibility = ref([])
|
||||
function getResponsibility() {
|
||||
axiosApiInstance.get(`api/safety/responsibility/`).then(result => {
|
||||
responsibility.value = result.data.users
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user