Merge remote-tracking branch 'origin/develop' into 22_about_inspection
This commit is contained in:
commit
11d271d164
52 files changed
+891
-1084
No files matched your search
@@ -82,8 +82,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||||||
def fio(self):
|
def fio(self):
|
||||||
|
|
||||||
return self.user.login
|
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):
|
def names(self):
|
||||||
return DictEmployee.objects.get(login=self.username)
|
return DictEmployee.objects.get(login=self.username)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ urlpatterns = [
|
|||||||
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
path('token/verify/', TokenVerifyView.as_view(), name='token_access'),
|
path('token/verify/', TokenVerifyView.as_view(), name='token_access'),
|
||||||
path('getuser/', getuserAPIView.as_view(), name='getuserAPIView', ),
|
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.permissions import AllowAny, IsAuthenticated
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from .renderers import UserJSONRenderer
|
|
||||||
from userauth.models import *
|
from userauth.models import *
|
||||||
from navigation.models import *
|
from navigation.models import *
|
||||||
from navigation.serializers import *
|
from navigation.serializers import *
|
||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
from .models import *
|
from .models import *
|
||||||
from .serializers 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):
|
class getuserAPIView(APIView):
|
||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
"""
|
"""
|
||||||
Параметр: userlogin
|
Параметр: userlogin
|
||||||
Пример: GET /api/accounts/getuser/?userlogin=9966-00-107
|
Пример: GET /api/accounts/getuser/?userlogin=9966-00-107
|
||||||
Результат: Выдает все данные о пользователе
|
Результат: Выдает все данные о пользователе
|
||||||
"""
|
"""
|
||||||
dt=datetime.now()
|
|
||||||
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
|
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
|
||||||
r=CardUserSerializer(queryset).data
|
|
||||||
|
|
||||||
|
|
||||||
return Response(CardUserSerializer(queryset).data)
|
return Response(CardUserSerializer(queryset).data)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import *
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
@@ -1,3 +1,54 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from accounts.models import *
|
||||||
# Create your models here.
|
# 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 *
|
from .views import *
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
|
||||||
]
|
]
|
||||||
@@ -1,3 +1,33 @@
|
|||||||
from django.shortcuts import render
|
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.
|
# Create your views here.
|
||||||
@@ -3,71 +3,42 @@ from .models import *
|
|||||||
from userauth.serializers import *
|
from userauth.serializers import *
|
||||||
|
|
||||||
class BaseCriteriaAllSerializer(serializers.ModelSerializer):
|
class BaseCriteriaAllSerializer(serializers.ModelSerializer):
|
||||||
|
""" Забирает все поля из модели по хранению названия критерия оценки,
|
||||||
|
используемой иконки, рейтинга по умолчанию, и цвет для иконки
|
||||||
|
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = BaseCriteria
|
model = BaseCriteria
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RatingStatusSerializer(serializers.ModelSerializer):
|
class RatingStatusSerializer(serializers.ModelSerializer):
|
||||||
|
""" Забирает все поля из модели по хранению критерия оценки,
|
||||||
|
какую поставили по критерию, и к какому коментарию оно относится
|
||||||
|
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RatingStatus
|
model = RatingStatus
|
||||||
fields ='__all__'
|
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 FeedbackUserCommentSerializer(serializers.ModelSerializer):
|
||||||
|
""" Забирает все поля из модели, без расшифровки пользователя
|
||||||
|
Используется в представлении FeedbackAPIView в компоненте cardLike
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RatingStatus
|
model = UserComment
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def get_user(self, obj):
|
|
||||||
|
|
||||||
# obj.user
|
|
||||||
return ShortUserSerializer(DictEmployee.objects.get(login=obj.usercom)).data
|
|
||||||
|
|
||||||
|
|
||||||
class BaseCriteriaSerializer(serializers.ModelSerializer):
|
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = BaseCriteria
|
|
||||||
fields = ['id', 'name', 'ico', 'rating', 'color']
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# return super().to_representation(instance)
|
|
||||||
|
|
||||||
class UserCommentSerializer(serializers.ModelSerializer):
|
class UserCommentSerializer(serializers.ModelSerializer):
|
||||||
|
"""Используется в представлении DataForStatisticsAPIView, для сбора информации
|
||||||
|
feed - берет все поля из модели с UserComment, и добавляет информацию об авторе
|
||||||
|
"""
|
||||||
author = serializers.SerializerMethodField('get_user')
|
author = serializers.SerializerMethodField('get_user')
|
||||||
class Meta:
|
class Meta:
|
||||||
model = UserComment
|
model = UserComment
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def get_user(self, obj):
|
def get_user(self, obj):
|
||||||
|
return InfoUserCardSerializer(obj.user.user).data
|
||||||
# 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
|
|
||||||
@@ -10,9 +10,13 @@ class FeedbackAPIView(APIView):
|
|||||||
|
|
||||||
def get(self, request):
|
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")
|
nowrating = RatingStatus.objects.filter(usercom__user_id=self.request.user.id,
|
||||||
nowcomment = UserComment.objects.filter(user_id=self.request.user.id, time_create__contains=datetime.date.today())
|
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()
|
basecrit = BaseCriteria.objects.all()
|
||||||
|
|
||||||
# Сериализуем извлечённый набор записей
|
# Сериализуем извлечённый набор записей
|
||||||
@@ -21,7 +25,7 @@ class FeedbackAPIView(APIView):
|
|||||||
many=True # Указываем, что на вход подаётся именно набор записей
|
many=True # Указываем, что на вход подаётся именно набор записей
|
||||||
)
|
)
|
||||||
|
|
||||||
serializer_for_nowcomment = UserCommerializer(
|
serializer_for_nowcomment = FeedbackUserCommentSerializer(
|
||||||
instance=nowcomment, # Передаём набор записей
|
instance=nowcomment, # Передаём набор записей
|
||||||
many=True # Указываем, что на вход подаётся именно набор записей
|
many=True # Указываем, что на вход подаётся именно набор записей
|
||||||
)
|
)
|
||||||
@@ -37,14 +41,22 @@ class FeedbackAPIView(APIView):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
"""Оценка сайта.
|
"""Оценка сайта. И добавление или обновление комементария или оценки сайта
|
||||||
Параметры nowrating -
|
Параметры
|
||||||
массив объектов nowrating {id: 34, rating: 3, crit: 1, usercom: 13}
|
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}
|
объект 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']:
|
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({})
|
return Response({})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class DailyloadAPIView(APIView):
|
|||||||
"""
|
"""
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
try:
|
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')
|
dailyr = DailyRoundUp.objects.filter(todaysDate=date.today()).values_list('user', 'position__name', 'position')
|
||||||
df_user = pd.DataFrame.from_records(user)
|
df_user = pd.DataFrame.from_records(user)
|
||||||
@@ -115,11 +115,29 @@ class DailyloadAPIView(APIView):
|
|||||||
|
|
||||||
for index, row in df.iterrows ():
|
for index, row in df.iterrows ():
|
||||||
if row['department'] in result.keys():
|
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:
|
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
|
daily = result
|
||||||
|
print(daily,'dailydaily')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,23 +5,22 @@ from userauth.serializers import *
|
|||||||
|
|
||||||
|
|
||||||
class LinkSerializer(serializers.ModelSerializer):
|
class LinkSerializer(serializers.ModelSerializer):
|
||||||
|
""" Используется в представлении LinkAPIView для внешних ссылок """
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Links
|
model = Links
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
class ScoreGalleryAllSerializer(serializers.ModelSerializer):
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = ScoreGallery
|
|
||||||
fields = '__all__'
|
|
||||||
|
|
||||||
class ScoreGallerySerializer(serializers.ModelSerializer):
|
class ScoreGallerySerializer(serializers.ModelSerializer):
|
||||||
|
"""Используется для сборки оценкок, для серилизатора GallerySerializer, который нужен для NewsSerializer"""
|
||||||
user = serializers.CharField(source='author.username')
|
user = serializers.CharField(source='author.username')
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ScoreGallery
|
model = ScoreGallery
|
||||||
fields = ['like', 'user']
|
fields = ['like', 'user']
|
||||||
|
|
||||||
|
|
||||||
class GallerySerializer(serializers.ModelSerializer):
|
class GallerySerializer(serializers.ModelSerializer):
|
||||||
|
"""Используется для сборки Изображений, для серилизатора NewsSerializer"""
|
||||||
likes= serializers.SerializerMethodField('get_gallery')
|
likes= serializers.SerializerMethodField('get_gallery')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -33,6 +32,7 @@ class GallerySerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class ScoreNewsSerializer(serializers.ModelSerializer):
|
class ScoreNewsSerializer(serializers.ModelSerializer):
|
||||||
|
"""Используется для сбора оценок новости, для серилизатора NewsSerializer"""
|
||||||
user = serializers.CharField(source='author.username')
|
user = serializers.CharField(source='author.username')
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ScoreNews
|
model = ScoreNews
|
||||||
@@ -40,19 +40,22 @@ class ScoreNewsSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class CommentNewsSerializer(serializers.ModelSerializer):
|
class CommentNewsSerializer(serializers.ModelSerializer):
|
||||||
author = serializers.SerializerMethodField('get_user')
|
"""Используется для сборки комментариев, для серилизатора NewsSerializer"""
|
||||||
|
|
||||||
|
author = serializers.SerializerMethodField('get_user')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CommentNews
|
model = CommentNews
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def get_user(self, obj):
|
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):
|
class NewsSerializer(serializers.ModelSerializer):
|
||||||
|
""" Используется в представлении NewsCrossroadAPIView, собирает информацию по пользователям,
|
||||||
|
оставленным новосятим, комментариям, лайкам, изображениям
|
||||||
|
"""
|
||||||
show = serializers.SerializerMethodField('get_show')
|
show = serializers.SerializerMethodField('get_show')
|
||||||
showComment = serializers.SerializerMethodField('get_show')
|
showComment = serializers.SerializerMethodField('get_show')
|
||||||
author = serializers.SerializerMethodField('get_user')
|
author = serializers.SerializerMethodField('get_user')
|
||||||
@@ -68,7 +71,7 @@ class NewsSerializer(serializers.ModelSerializer):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def get_user(self, obj):
|
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):
|
def get_score(self, obj):
|
||||||
return ScoreNewsSerializer(obj.get_news.all(), many=True).data
|
return ScoreNewsSerializer(obj.get_news.all(), many=True).data
|
||||||
@@ -80,13 +83,10 @@ class NewsSerializer(serializers.ModelSerializer):
|
|||||||
# return 'gal'
|
# return 'gal'
|
||||||
return GallerySerializer(obj.get_gallery_news.all(), many=True).data
|
return GallerySerializer(obj.get_gallery_news.all(), many=True).data
|
||||||
|
|
||||||
class BaseSenderSerializer(serializers.ModelSerializer):
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = BaseSender
|
|
||||||
fields = '__all__'
|
|
||||||
|
|
||||||
class CarouselsSerializer(serializers.ModelSerializer):
|
class CarouselsSerializer(serializers.ModelSerializer):
|
||||||
|
""" Используется в представлении CarouselsAPIView, передает ссылки на картинки для отображения на главной страницы карусели"""
|
||||||
senders = serializers.CharField(source='sender.img')
|
senders = serializers.CharField(source='sender.img')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -101,3 +101,10 @@ class ScreensaverSerializer(serializers.ModelSerializer):
|
|||||||
model = Screensaver
|
model = Screensaver
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
class BaseSenderSerializer(serializers.ModelSerializer):
|
||||||
|
""" Получить ссылку на картинку для дня рождения. Название 'День рождения'
|
||||||
|
автоматически добавляется в таблицу, если его до этого не было """
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = BaseSender
|
||||||
|
fields = ['img']
|
||||||
@@ -102,8 +102,6 @@ class NewsCrossroadAPIView(ListAPIView):
|
|||||||
|
|
||||||
newsqueryset = newsqueryset[:10]
|
newsqueryset = newsqueryset[:10]
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
||||||
pagesel = int(request.GET.get("page"))*int(request.GET.get("countpage"))
|
pagesel = int(request.GET.get("page"))*int(request.GET.get("countpage"))
|
||||||
|
|
||||||
newsqueryset =newsqueryset[pagesel:pagesel+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
|
result = NewsSerializer(newsqueryset, many=True).data
|
||||||
|
|
||||||
|
|
||||||
return Response({"result":result, "countpage": countpage})
|
return Response({"result":result, "countpage": countpage})
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
@@ -167,27 +166,25 @@ class CarouselsAPIView(ListAPIView):
|
|||||||
result = CarouselsSerializer(queryset, many= True).data
|
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')
|
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 :
|
if len(manbrd) > 0 :
|
||||||
nowday= manbrd.filter(birthdate__day=date.today().day)
|
nowday= manbrd.filter(birthdate__day=date.today().day)
|
||||||
|
|
||||||
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
|
brdimage = BirthdayImage.objects.order_by("?")[:len(nowday)+1]
|
||||||
|
|
||||||
|
try:
|
||||||
allbirthday = {
|
allbirthday = {
|
||||||
"title":'Дни рождения',
|
"title":'Дни рождения',
|
||||||
"text": "В этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
|
"text": "В этом месяце:\n"+"\n".join([f"{x.birthdate.strftime('%d')} - {x.fio}" for x in manbrd]),
|
||||||
"link": "/media/"+str(brdimage[0].img),
|
"link": "/media/"+str(brdimage[0].img),
|
||||||
"published": 'true',
|
"published": 'true',
|
||||||
|
"sender": BaseSenderSerializer(dr_img).data,
|
||||||
"sender": "/media/default/dr.png",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if len(nowday) > 0 :
|
if len(nowday) > 0 :
|
||||||
|
|
||||||
|
|
||||||
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
|
brdtext = BirthdayText.objects.order_by("?")[:len(nowday)]
|
||||||
|
|
||||||
|
|
||||||
for k in nowday:
|
for k in nowday:
|
||||||
|
|
||||||
result.append({
|
result.append({
|
||||||
@@ -195,14 +192,15 @@ class CarouselsAPIView(ListAPIView):
|
|||||||
"text": f"{k.fio}!"+"\n"+ f"{brdtext[0].text}",
|
"text": f"{k.fio}!"+"\n"+ f"{brdtext[0].text}",
|
||||||
"link": "/media/"+str(brdimage[0].img),
|
"link": "/media/"+str(brdimage[0].img),
|
||||||
"published": 'true',
|
"published": 'true',
|
||||||
"sender": "/media/default/dr.png",
|
"sender": BaseSenderSerializer(dr_img).data,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
result.append(allbirthday)
|
result.append(allbirthday)
|
||||||
|
except:
|
||||||
|
mess = 'Добавьте открытку в панели администратора в Таблицу - "Открытки. Изображения". Либо текст поздравления в Таблицу - "Открытки. Тексты поздравлений"'
|
||||||
|
|
||||||
|
return Response({"result": result, "mess": mess})
|
||||||
return Response(result)
|
|
||||||
|
|
||||||
class ScreensaverAPIView(ListAPIView):
|
class ScreensaverAPIView(ListAPIView):
|
||||||
"""Получаем ссылку на картинку для экрана перед входом на сайт. Выбирает все записи с месяца и дня меньше и равного текущему и окончание больше или равному текущему дню и месяцу. Год не учитывается. Выбирается одна рандомная запись"""
|
"""Получаем ссылку на картинку для экрана перед входом на сайт. Выбирает все записи с месяца и дня меньше и равного текущему и окончание больше или равному текущему дню и месяцу. Год не учитывается. Выбирается одна рандомная запись"""
|
||||||
|
|||||||
@@ -65,5 +65,6 @@ urlpatterns = [
|
|||||||
path('api/feedback/', include('feedback.urls')),
|
path('api/feedback/', include('feedback.urls')),
|
||||||
path('api/general_vacation/', include('general_vacation.urls')),
|
path('api/general_vacation/', include('general_vacation.urls')),
|
||||||
path('api/about_inspection/', include('about_inspection.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)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
@@ -35,12 +35,18 @@ class OrderResponsibilitySerializer(serializers.ModelSerializer):
|
|||||||
return ResponsibilityUsersSerializer(data,many=True).data
|
return ResponsibilityUsersSerializer(data,many=True).data
|
||||||
|
|
||||||
class Committee1FilesSerializer(serializers.ModelSerializer):
|
class Committee1FilesSerializer(serializers.ModelSerializer):
|
||||||
|
"""Забирает названия файлов и их актуальность
|
||||||
|
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Committee1Files
|
model = Committee1Files
|
||||||
exclude=['id_committee1']
|
exclude=['id_committee1']
|
||||||
|
|
||||||
class Committee1Serializer(serializers.ModelSerializer):
|
class Committee1Serializer(serializers.ModelSerializer):
|
||||||
|
""" Забирает всю информацию по комиссиям с типом
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
typs = serializers.CharField(source='id_dict_committee_type.name')
|
typs = serializers.CharField(source='id_dict_committee_type.name')
|
||||||
files = serializers.SerializerMethodField('get_files')
|
files = serializers.SerializerMethodField('get_files')
|
||||||
|
|
||||||
@@ -59,6 +65,7 @@ class DictCommitteeOrderAddonSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class Committee2Serializer(serializers.ModelSerializer):
|
class Committee2Serializer(serializers.ModelSerializer):
|
||||||
|
""" Собирает информацию о комиссиях с файлами"""
|
||||||
position=serializers.CharField(source='id_dict_committee_position.name')
|
position=serializers.CharField(source='id_dict_committee_position.name')
|
||||||
|
|
||||||
name = serializers.CharField(source='id_committee1.name')
|
name = serializers.CharField(source='id_committee1.name')
|
||||||
@@ -89,11 +96,13 @@ class Committee2Serializer(serializers.ModelSerializer):
|
|||||||
return Committee1FilesSerializer(data, many=True).data
|
return Committee1FilesSerializer(data, many=True).data
|
||||||
|
|
||||||
class CardUserSerializer(serializers.ModelSerializer):
|
class CardUserSerializer(serializers.ModelSerializer):
|
||||||
|
"""Собирает все данные о пользователе
|
||||||
|
Используется в представлении getuserAPIView
|
||||||
|
В компоненте AboutInspectionPage
|
||||||
|
"""
|
||||||
responsibility = serializers.SerializerMethodField('get_responsibility')
|
responsibility = serializers.SerializerMethodField('get_responsibility')
|
||||||
committee = serializers.SerializerMethodField('get_committee')
|
committee = serializers.SerializerMethodField('get_committee')
|
||||||
|
|
||||||
# position=serializers.CharField(source='id_dict_employee.fio')
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
model = DictEmployee
|
model = DictEmployee
|
||||||
@@ -108,15 +117,12 @@ class CardUserSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
def get_committee(self, obj):
|
def get_committee(self, obj):
|
||||||
return Committee2Serializer(obj.user_committe2.all(), many=True).data
|
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
|
|
||||||
|
|
||||||
|
|
||||||
class ShortUserSerializer(serializers.ModelSerializer):
|
|
||||||
# login = serializers.CharField()
|
|
||||||
|
|
||||||
|
|
||||||
|
class InfoUserCardSerializer(serializers.ModelSerializer):
|
||||||
|
""" Собирает необходимую информацию о пользователе, содержит необходимые
|
||||||
|
поля для отрисовки карточки информации о пользователе при клике на фамилию
|
||||||
|
Необходим для компонента infoUserCard"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DictEmployee
|
model = DictEmployee
|
||||||
fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department']
|
fields = ['department', 'fio', 'post', 'email', 'tel', 'room', 'login', 'familyname', 'name', 'parentname', 'id']
|
||||||
# fields='__all__'
|
|
||||||
@@ -3,26 +3,21 @@ from rest_framework import serializers
|
|||||||
from .models import *
|
from .models import *
|
||||||
from userauth.serializers 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):
|
class VisitdateSerializer(serializers.ModelSerializer):
|
||||||
|
""" Используется в представлении Counter
|
||||||
|
выводит дату посещения страницы пользователем
|
||||||
|
"""
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CountVisitor
|
model = CountVisitor
|
||||||
fields = ['visitdate']
|
fields = ['visitdate']
|
||||||
|
|
||||||
|
|
||||||
class PagesSerializer(serializers.ModelSerializer):
|
class PagesSerializer(serializers.ModelSerializer):
|
||||||
|
"""Используется для отрисовки страницы статистики в представлении DataForStatisticsAPIView
|
||||||
|
Собирает информацию о посещенных страницах и иинформацию о пользователе из таблицы DictEmployee
|
||||||
|
с полями для отрисовки карточки пользователя
|
||||||
|
"""
|
||||||
user = serializers.SerializerMethodField('get_user')
|
user = serializers.SerializerMethodField('get_user')
|
||||||
pages = serializers.CharField(source = 'pages.page')
|
pages = serializers.CharField(source = 'pages.page')
|
||||||
fullPath = serializers.CharField(source = 'pages.fullPath')
|
fullPath = serializers.CharField(source = 'pages.fullPath')
|
||||||
@@ -33,9 +28,4 @@ class PagesSerializer(serializers.ModelSerializer):
|
|||||||
fields = ['user', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
|
fields = ['user', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
|
||||||
|
|
||||||
def get_user(self, obj):
|
def get_user(self, obj):
|
||||||
|
return InfoUserCardSerializer(obj.user.user).data
|
||||||
return ShortUserSerializer(obj.user.user).data
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -5,7 +5,4 @@ urlpatterns = [
|
|||||||
path('counter/', Counter.as_view(),name="CountVisitors"),
|
path('counter/', Counter.as_view(),name="CountVisitors"),
|
||||||
path('dataforstatistics/', DataForStatisticsAPIView.as_view(), name="DataForStatistics"),
|
path('dataforstatistics/', DataForStatisticsAPIView.as_view(), name="DataForStatistics"),
|
||||||
path('selectedlinks/', SelectedLinksAPIView.as_view(),name="SelectedLinks")
|
path('selectedlinks/', SelectedLinksAPIView.as_view(),name="SelectedLinks")
|
||||||
# path('', views.Watchuser.as_view()), selectedlinks
|
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
+32
-19
@@ -1,46 +1,45 @@
|
|||||||
from django.forms import model_to_dict
|
|
||||||
from django.shortcuts import render
|
|
||||||
from rest_framework.generics import ListAPIView
|
from rest_framework.generics import ListAPIView
|
||||||
from .models import *
|
from .models import *
|
||||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from django.views.generic import ListView
|
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
from datetime import date, datetime, timedelta
|
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 userauth.models import *
|
||||||
from feedback.models import *
|
from feedback.models import *
|
||||||
from feedback.serializers 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):
|
class Counter(ListAPIView):
|
||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
serializer_class = CountSerializer
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
"""Не используется"""
|
"""Не используется"""
|
||||||
return Response('Не используется')
|
return Response('Не используется')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
"""
|
"""
|
||||||
Представление получает информацию о ссылке на страницу, и производит создание или перезапись существующей страницы в таблицу, для тогочтобы проследить на каких страницах был пользователь в конкретный день.
|
Представление получает информацию о ссылке на страницу, и производит создание
|
||||||
|
или перезапись существующей страницы в таблицу, для того чтобы
|
||||||
|
проследить на каких страницах был пользователь в конкретный день.
|
||||||
{totalvisit: 10539, visittoday: 21, uniqtoday: 1, visitdate: '2023-12-21'}
|
{totalvisit: 10539, visittoday: 21, uniqtoday: 1, visitdate: '2023-12-21'}
|
||||||
Мы получаем информацию о том сколько всего раз была посещена страница с момента первой записи в бд, сколько было сегодня людей и сколько уникальных,
|
Мы получаем информацию о том сколько всего раз была посещена страница
|
||||||
|
с момента первой записи в бд, сколько было сегодня людей и сколько уникальных,
|
||||||
"""
|
"""
|
||||||
|
|
||||||
myfullPath = request.data['fullPath']
|
myfullPath = request.data['fullPath']
|
||||||
|
|
||||||
if "?" in myfullPath:
|
if "?" in myfullPath:
|
||||||
myfullPath= myfullPath.split("?")[0]
|
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:
|
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()
|
watch.save()
|
||||||
@@ -70,7 +69,23 @@ class SelectedLinksAPIView(ListAPIView):
|
|||||||
class DataForStatisticsAPIView(ListAPIView):
|
class DataForStatisticsAPIView(ListAPIView):
|
||||||
"""
|
"""
|
||||||
Принимает два параметра с фронта start=${}&end=${}
|
Принимает два параметра с фронта 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):
|
def get(self, request):
|
||||||
|
|
||||||
@@ -79,7 +94,6 @@ class DataForStatisticsAPIView(ListAPIView):
|
|||||||
data_rating = data_end + timedelta(days=1)
|
data_rating = data_end + timedelta(days=1)
|
||||||
beetween = data_end - (data_start - 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')
|
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()))
|
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(),
|
'staff': DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count(),
|
||||||
'feedback': {
|
'feedback': {
|
||||||
'feed': UserCommentSerializer(d, many=True).data,
|
'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')),
|
'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': {
|
'data': {
|
||||||
'score': {
|
'score': {
|
||||||
|
|||||||
Generated
+6
@@ -26,6 +26,7 @@
|
|||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"express-vue": "^5.12.0",
|
"express-vue": "^5.12.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
"ical.js": "^2.0.0",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"pinia": "^2.0.23",
|
"pinia": "^2.0.23",
|
||||||
"roboto-fontface": "*",
|
"roboto-fontface": "*",
|
||||||
@@ -9873,6 +9874,11 @@
|
|||||||
"node": ">=10.17.0"
|
"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": {
|
"node_modules/iconv-lite": {
|
||||||
"version": "0.4.24",
|
"version": "0.4.24",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"express-vue": "^5.12.0",
|
"express-vue": "^5.12.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
"ical.js": "^2.0.0",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"pinia": "^2.0.23",
|
"pinia": "^2.0.23",
|
||||||
"roboto-fontface": "*",
|
"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>
|
|
||||||
@@ -2,7 +2,11 @@
|
|||||||
<v-card max-width='400' density="compact" class="bg-transparent">
|
<v-card max-width='400' density="compact" class="bg-transparent">
|
||||||
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
|
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
|
||||||
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(comment.time_create)}}</v-card-subtitle>
|
<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>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -10,243 +10,240 @@
|
|||||||
height="400"
|
height="400"
|
||||||
class="mytable"
|
class="mytable"
|
||||||
item-value="name"
|
item-value="name"
|
||||||
@update:sortBy=customSort
|
@update:sortBy="customSort"
|
||||||
v-model:sort-by="sortBy"
|
v-model:sort-by="sortBy"
|
||||||
density="compact"
|
density="compact"
|
||||||
>
|
>
|
||||||
<template v-slot:header.name>
|
<template v-slot:header.name>
|
||||||
<!-- v-model:sort-by="sortBy" -->
|
|
||||||
<v-switch
|
<v-switch
|
||||||
:label="untot"
|
:label="untot"
|
||||||
false-value='уникальные'
|
false-value="уникальные"
|
||||||
true-value='всего'
|
true-value="всего"
|
||||||
hide-details
|
hide-details
|
||||||
v-model="untot"
|
v-model="untot"
|
||||||
class="myleft ml-n4"
|
class="myleft ml-n4"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:item.name="{ value }">
|
<template v-slot:item.name="{ value }">
|
||||||
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2">
|
<span class="font-weight-medium cursor-default text-grey-darken-3 myleft text-subtitle-2"
|
||||||
|
>
|
||||||
{{ value }}
|
{{ value }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:item.now="{ value, item }">
|
<template v-slot:item.now="{ value, item }">
|
||||||
<span class="font-weight-medium text-subtitle-2">
|
<span class="font-weight-medium text-subtitle-2">
|
||||||
<v-tooltip
|
<v-tooltip v-if="value > 0" location="bottom">
|
||||||
v-if="value>0"
|
|
||||||
location="bottom"
|
|
||||||
>
|
|
||||||
<template v-slot:activator="{ props }">
|
<template v-slot:activator="{ props }">
|
||||||
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
|
<span
|
||||||
|
v-bind="props"
|
||||||
|
:class="
|
||||||
|
'untot' == 'уникальные'
|
||||||
|
? getColorTooday1(value)
|
||||||
|
: getColorTooday2(value)
|
||||||
|
"
|
||||||
|
class="cursor-help font-weight-medium text-subtitle-1"
|
||||||
|
>
|
||||||
{{ value }}
|
{{ value }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<v-row
|
<v-row no-gutters>
|
||||||
no-gutters
|
|
||||||
>
|
|
||||||
<v-col>
|
<v-col>
|
||||||
<v-row
|
<v-row no-gutters v-for="n in item.now.unic" :key="n">
|
||||||
no-gutters v-for="n in item.now.unic"
|
|
||||||
:key="n"
|
|
||||||
>
|
|
||||||
<v-col>
|
<v-col>
|
||||||
{{ n }}
|
{{ n }}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:item.period="{ value, item }">
|
<template v-slot:item.period="{ value, item }">
|
||||||
<span class="font-weight-medium text-subtitle-2">
|
<span class="font-weight-medium text-subtitle-2">
|
||||||
<v-tooltip
|
<v-tooltip v-if="value > 0" location="bottom">
|
||||||
v-if="value>0"
|
|
||||||
location="bottom"
|
|
||||||
>
|
|
||||||
<template v-slot:activator="{ props }">
|
<template v-slot:activator="{ props }">
|
||||||
<span v-bind="props" :class="'untot'=='уникальные'?getColorPeriod1(value):getColorPeriod2(value)" class="cursor-help font-weight-medium text-subtitle-1" >
|
<span
|
||||||
|
v-bind="props"
|
||||||
|
:class="
|
||||||
|
'untot' == 'уникальные'
|
||||||
|
? getColorPeriod1(value)
|
||||||
|
: getColorPeriod2(value)
|
||||||
|
"
|
||||||
|
class="cursor-help font-weight-medium text-subtitle-1"
|
||||||
|
>
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<v-row
|
<v-row no-gutters>
|
||||||
no-gutters
|
|
||||||
>
|
|
||||||
<v-col>
|
<v-col>
|
||||||
<v-row
|
<v-row no-gutters v-for="n in item.period.unic" :key="n">
|
||||||
no-gutters v-for="n in item.period.unic"
|
|
||||||
:key="n"
|
|
||||||
>
|
|
||||||
<v-col>
|
<v-col>
|
||||||
{{ n }}
|
{{ n }}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</v-data-table-virtual>
|
</v-data-table-virtual>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</pattern-card>
|
</pattern-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from "vue";
|
||||||
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
|
import PatternCard from "@/components/UI/aboutportal/pattern-card.vue";
|
||||||
import TooltipText from '@/components/UI/tooltip-text.vue'
|
import TooltipText from "@/components/UI/tooltip-text.vue";
|
||||||
import {splitname, formatDash} from '@/utils/universal_functions'
|
import { splitname, formatDash } from "@/utils/universal_functions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
components: { TooltipText, PatternCard },
|
components: { TooltipText, PatternCard },
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
pages_count: {
|
pages_count: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
|
||||||
const sortBy = ref([
|
const sortBy = ref([
|
||||||
{
|
{
|
||||||
"key": "now",
|
key: "now",
|
||||||
"order": "desc"
|
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 = () => {
|
const datas = () => {
|
||||||
|
let data = [];
|
||||||
let data = []
|
|
||||||
props.pages_count.forEach((e) => {
|
props.pages_count.forEach((e) => {
|
||||||
|
let ind = data.findIndex((el) => el.name == e.pages);
|
||||||
let ind = data.findIndex(el=>el.name==e.pages)
|
|
||||||
if (ind == -1) {
|
if (ind == -1) {
|
||||||
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}}
|
let ob = {
|
||||||
|
name: e.pages,
|
||||||
|
now: { unic: new Set(), total: 0 },
|
||||||
|
period: { unic: new Set(), total: 0 },
|
||||||
|
};
|
||||||
if (e.visitdate == formatDash(new Date())) {
|
if (e.visitdate == formatDash(new Date())) {
|
||||||
ob.now.unic.add(splitname(e.user))
|
ob.now.unic.add(splitname(e.user));
|
||||||
ob.now.total = e.count
|
ob.now.total = e.count;
|
||||||
|
|
||||||
}
|
}
|
||||||
ob.period.unic.add(splitname(e.user))
|
ob.period.unic.add(splitname(e.user));
|
||||||
ob.period.total = e.count
|
ob.period.total = e.count;
|
||||||
data.push(ob)
|
data.push(ob);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
if (e.visitdate == formatDash(new Date())) {
|
if (e.visitdate == formatDash(new Date())) {
|
||||||
data[ind].now.unic.add(splitname(e.user))
|
data[ind].now.unic.add(splitname(e.user));
|
||||||
data[ind].now.total +=e.count
|
data[ind].now.total += e.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
data[ind].period.unic.add(splitname(e.user))
|
data[ind].period.unic.add(splitname(e.user));
|
||||||
data[ind].period.total +=e.count
|
data[ind].period.total += e.count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const modelrating = ref(false);
|
||||||
return data
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const modelrating = ref(false)
|
|
||||||
|
|
||||||
const getColorTooday1 = (pages) => {
|
const getColorTooday1 = (pages) => {
|
||||||
if (pages > 10) return 'text-green'
|
if (pages > 10) return "text-green";
|
||||||
else if (pages > 5) return 'text-orange'
|
else if (pages > 5) return "text-orange";
|
||||||
else return 'text-red'
|
else return "text-red";
|
||||||
}
|
};
|
||||||
|
|
||||||
const getColorPeriod1 = (pages) => {
|
const getColorPeriod1 = (pages) => {
|
||||||
|
if (pages > 30) return "text-green";
|
||||||
if (pages > 30) return 'text-green'
|
else if (pages > 15) return "text-orange";
|
||||||
else if (pages > 15) return 'text-orange'
|
else return "text-red";
|
||||||
else return 'text-red'
|
};
|
||||||
}
|
|
||||||
|
|
||||||
const getColorTooday2 = (pages) => {
|
const getColorTooday2 = (pages) => {
|
||||||
if (pages > 50) return 'text-green'
|
if (pages > 50) return "text-green";
|
||||||
else if (pages > 25) return 'text-orange'
|
else if (pages > 25) return "text-orange";
|
||||||
else return 'text-red'
|
else return "text-red";
|
||||||
}
|
};
|
||||||
|
|
||||||
const getColorPeriod2 = (pages) => {
|
const getColorPeriod2 = (pages) => {
|
||||||
|
if (pages > 100) return "text-green";
|
||||||
if (pages > 100) return 'text-green'
|
else if (pages > 50) return "text-orange";
|
||||||
else if (pages > 50) return 'text-orange'
|
else return "text-red";
|
||||||
else return 'text-red'
|
};
|
||||||
}
|
|
||||||
|
|
||||||
const getColorNow = (pages) => {
|
const getColorNow = (pages) => {
|
||||||
if (pages > 10) return 'text-green'
|
if (pages > 10) return "text-green";
|
||||||
else if (pages > 5) return 'text-orange'
|
else if (pages > 5) return "text-orange";
|
||||||
else return 'text-red'
|
else return "text-red";
|
||||||
}
|
};
|
||||||
|
|
||||||
const customSort = () => {
|
const customSort = () => {
|
||||||
let arr=tabledata.value
|
let arr = tabledata.value;
|
||||||
|
|
||||||
if (sortBy.value !== undefined && sortBy.value.length > 0) {
|
if (sortBy.value !== undefined && sortBy.value.length > 0) {
|
||||||
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
|
let factor = sortBy.value[0].order == "desc" ? [-1, 1] : [1, -1];
|
||||||
if (untot.value=='уникальные'){
|
if (untot.value == "уникальные") {
|
||||||
arr.sort((a, b) => {
|
arr.sort((a, b) => {
|
||||||
|
if (
|
||||||
if (a[sortBy.value[0].key].unic.size>b[sortBy.value[0].key].unic.size) return factor[0]
|
a[sortBy.value[0].key].unic.size >
|
||||||
if (a[sortBy.value[0].key].unic.size<b[sortBy.value[0].key].unic.size) return factor[1]
|
b[sortBy.value[0].key].unic.size
|
||||||
return 0 })
|
)
|
||||||
|
return factor[0];
|
||||||
|
if (
|
||||||
|
a[sortBy.value[0].key].unic.size <
|
||||||
|
b[sortBy.value[0].key].unic.size
|
||||||
|
)
|
||||||
|
return factor[1];
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
arr.sort((a, b) => {
|
arr.sort((a, b) => {
|
||||||
|
if (a[sortBy.value[0].key].total > b[sortBy.value[0].key].total)
|
||||||
if (a[sortBy.value[0].key].total>b[sortBy.value[0].key].total) return factor[0]
|
return factor[0];
|
||||||
if (a[sortBy.value[0].key].total<b[sortBy.value[0].key].total) return factor[1]
|
if (a[sortBy.value[0].key].total < b[sortBy.value[0].key].total)
|
||||||
return 0 })
|
return factor[1];
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tabledata.value=arr
|
tabledata.value = arr;
|
||||||
|
};
|
||||||
|
const tabledata = ref(datas());
|
||||||
}
|
watch(
|
||||||
const tabledata = ref(datas())
|
() => props.pages_count,
|
||||||
watch(()=>props.pages_count,(newValue)=>{
|
(newValue) => {
|
||||||
if (newValue !== []) {
|
if (newValue !== []) {
|
||||||
tabledata.value=datas()
|
tabledata.value = datas();
|
||||||
customSort()
|
customSort();
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
);
|
||||||
// tabledata.value=datas.value
|
// tabledata.value=datas.value
|
||||||
return {
|
return {
|
||||||
tabledata,
|
tabledata,
|
||||||
@@ -260,17 +257,15 @@ export default {
|
|||||||
getColorPeriod2,
|
getColorPeriod2,
|
||||||
getColorNow,
|
getColorNow,
|
||||||
headers,
|
headers,
|
||||||
datas
|
datas,
|
||||||
|
};
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.v-table {
|
.v-table {
|
||||||
flex: 1 !important;
|
flex: 1 !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mytable tr {
|
.mytable tr {
|
||||||
@@ -280,7 +275,6 @@ export default {
|
|||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.myleft {
|
.myleft {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
v-model:expanded="expanded"
|
v-model:expanded="expanded"
|
||||||
:headers="dessertHeaders"
|
:headers="dessertHeaders"
|
||||||
:items="dataActivusers"
|
:items="dataActivusers"
|
||||||
item-value="user.id"
|
item-value="user"
|
||||||
show-expand
|
show-expand
|
||||||
class="h-0 cursor-default bg-grey_white"
|
class="h-0 cursor-default bg-grey_white"
|
||||||
:sort-by="[{ key: 'info.count', order: 'desc' }]"
|
:sort-by="[{ key: 'info.count', order: 'desc' }]"
|
||||||
|
|||||||
@@ -2,17 +2,6 @@
|
|||||||
<v-row>
|
<v-row>
|
||||||
<v-col class="flex-column pr-0">
|
<v-col class="flex-column pr-0">
|
||||||
<v-card class="h-100">
|
<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" -->
|
|
||||||
<vue-cal
|
<vue-cal
|
||||||
locale="ru"
|
locale="ru"
|
||||||
xsmall
|
xsmall
|
||||||
@@ -32,32 +21,27 @@
|
|||||||
<v-icon icon="mdi-menu-right"></v-icon>
|
<v-icon icon="mdi-menu-right"></v-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #today-button>
|
<template #today-button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<v-tooltip text="Сегодня" location="bottom">
|
<v-tooltip text="Сегодня" location="bottom">
|
||||||
<template v-slot:activator="{ props }">
|
<template v-slot:activator="{ props }">
|
||||||
|
<v-icon
|
||||||
<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"/>
|
@click="selectedDate = new Date()"
|
||||||
|
v-bind="props"
|
||||||
|
icon="mdi-crosshairs-gps"
|
||||||
|
size="x-small"
|
||||||
|
class="pt-1 pr-3"
|
||||||
|
color="more_details_btn"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</vue-cal>
|
</vue-cal>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col>
|
<v-col>
|
||||||
<!-- todayButton -->
|
|
||||||
|
|
||||||
<v-card class="h-100">
|
<v-card class="h-100">
|
||||||
<v-card-title class="text-center">События на {{dayformat(selectedDate)}}</v-card-title>
|
<v-card-title class="text-center"
|
||||||
<!-- <v-card-text>ddd</v-card-text> -->
|
>События на {{ dayformat(selectedDate) }}</v-card-title
|
||||||
|
>
|
||||||
<vue-cal
|
<vue-cal
|
||||||
locale="ru"
|
locale="ru"
|
||||||
xsmall
|
xsmall
|
||||||
@@ -70,8 +54,6 @@
|
|||||||
active-view="day"
|
active-view="day"
|
||||||
:disable-views="['years', 'year', 'month', 'week']"
|
:disable-views="['years', 'year', 'month', 'week']"
|
||||||
:selected-date="selectedDate"
|
:selected-date="selectedDate"
|
||||||
|
|
||||||
|
|
||||||
>
|
>
|
||||||
<template #arrow-prev>
|
<template #arrow-prev>
|
||||||
<v-icon icon="mdi-menu-left"></v-icon>
|
<v-icon icon="mdi-menu-left"></v-icon>
|
||||||
@@ -80,112 +62,65 @@
|
|||||||
<v-icon icon="mdi-menu-right"></v-icon>
|
<v-icon icon="mdi-menu-right"></v-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #today-button>
|
<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>
|
</template>
|
||||||
</v-tooltip> -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</vue-cal>
|
</vue-cal>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VueCal from 'vue-cal'
|
import VueCal from "vue-cal";
|
||||||
import 'vue-cal/dist/vuecal.css'
|
import "vue-cal/dist/vuecal.css";
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from "vue";
|
||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
components: { VueCal },
|
components: { VueCal },
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const events = ref([
|
const events = ref([]);
|
||||||
|
|
||||||
])
|
|
||||||
function f_generalvacation() {
|
function f_generalvacation() {
|
||||||
axiosApiInstance.get('api/general_vacation/generalvacation/')
|
axiosApiInstance
|
||||||
.then(data => {
|
.get("api/general_vacation/generalvacation/")
|
||||||
|
.then((data) => {
|
||||||
|
|
||||||
for (let x in data.data) {
|
for (let x in data.data) {
|
||||||
|
|
||||||
if (x == "План-график") {
|
if (x == "План-график") {
|
||||||
data.data[x].map(e=>{
|
data.data[x].map((e) => {
|
||||||
|
events.value.push({
|
||||||
|
name: e.name,
|
||||||
events.value.push({ name: e.name, start: e.start_work_period, end: e.end_work_period, content: e.name})
|
start: e.start_work_period,
|
||||||
|
end: e.end_work_period,
|
||||||
}
|
content: e.name,
|
||||||
|
});
|
||||||
|
});
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
f_generalvacation()
|
f_generalvacation();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
const selectedDate = ref(null);
|
||||||
|
|
||||||
const selectedDate = ref(null)
|
|
||||||
|
|
||||||
function dayformat(days) {
|
function dayformat(days) {
|
||||||
const d = new Date(days)
|
const d = new Date(days);
|
||||||
let mess= 'сегодня'
|
let mess = "сегодня";
|
||||||
if (d.getFullYear() != '1970'){
|
if (d.getFullYear() != "1970") {
|
||||||
mess = `${d.getDate()} число`
|
mess = `${d.getDate()} число`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return mess;
|
||||||
return mess
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return { events, selectedDate, f_generalvacation, dayformat };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return { events, selectedDate, f_generalvacation, dayformat }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
/* Dot indicator */
|
/* Dot indicator */
|
||||||
.vuecal__cell-events-count {
|
.vuecal__cell-events-count {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
@@ -205,7 +140,7 @@ border-top-right-radius: 3px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.vuecal__title-bar {
|
.vuecal__title-bar {
|
||||||
background: var(--cards)
|
background: var(--cards);
|
||||||
/* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */
|
/* background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); */
|
||||||
}
|
}
|
||||||
.vuecal__flex .vuecal__title {
|
.vuecal__flex .vuecal__title {
|
||||||
@@ -220,7 +155,11 @@ border-top-right-radius: 3px;
|
|||||||
height: 15px;
|
height: 15px;
|
||||||
line-height: 15px;
|
line-height: 15px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8));
|
background: linear-gradient(
|
||||||
|
to top right,
|
||||||
|
rgba(19, 84, 122, 0.8),
|
||||||
|
rgba(128, 208, 199, 0.8)
|
||||||
|
);
|
||||||
color: #f8fff9 !important;
|
color: #f8fff9 !important;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
@@ -236,7 +175,7 @@ border-top-right-radius: 3px;
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
transition: box-shadow .3s,left .3s,width .3s;
|
transition: box-shadow 0.3s, left 0.3s, width 0.3s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
@@ -249,7 +188,6 @@ border-top-right-radius: 3px;
|
|||||||
background: #c2e9d78c;
|
background: #c2e9d78c;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.vuecal__cell-content {
|
.vuecal__cell-content {
|
||||||
@@ -266,11 +204,13 @@ border-top-right-radius: 3px;
|
|||||||
min-height: 20px;
|
min-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vuecal__cell--selected:before {border-color: rgba(30, 65, 49, 0.5);}
|
.vuecal__cell--selected:before {
|
||||||
|
border-color: rgba(30, 65, 49, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
.vuecal__cell--today, .vuecal__cell--current {
|
.vuecal__cell--today,
|
||||||
|
.vuecal__cell--current {
|
||||||
background-color: rgba(238, 181, 214, 0.548);
|
background-color: rgba(238, 181, 214, 0.548);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.vuecal__cell--selected:before {
|
.vuecal__cell--selected:before {
|
||||||
@@ -281,5 +221,4 @@ border-top-right-radius: 3px;
|
|||||||
background-color: #3a97694a;
|
background-color: #3a97694a;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
{{splitname(author)}}
|
{{splitname(author)}}
|
||||||
</span>
|
</span>
|
||||||
<info-user-card
|
<info-user-card
|
||||||
|
:author=author
|
||||||
:opendialog = open
|
:opendialog = open
|
||||||
:loging="author.login"
|
|
||||||
@update:opendialog="open = $event"
|
@update:opendialog="open = $event"
|
||||||
/>
|
/>
|
||||||
</div>
|
</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},
|
||||||
|
]
|
||||||
|
`
|
||||||
+14
-27
@@ -20,7 +20,7 @@
|
|||||||
cover
|
cover
|
||||||
min-height="222px"
|
min-height="222px"
|
||||||
max-height="222px"
|
max-height="222px"
|
||||||
:src="checkremote(`${spravURL}${userlinks.login}.jpg`)"
|
:src="checkremote(`${spravURL}${author.login}.jpg`)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -77,62 +77,49 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, computed, watch } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
|
||||||
import { checkremote } from '@/utils/universal_functions'
|
import { checkremote } from '@/utils/universal_functions'
|
||||||
import { spravURL } from '@/utils/axios-api'
|
import { spravURL } from '@/utils/axios-api'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
name: "InfoUserCard",
|
name: "InfoUserCard",
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
|
||||||
opendialog: {
|
opendialog: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
|
||||||
loging: {
|
author: {
|
||||||
type: String,
|
type: Object,
|
||||||
default: ''
|
default: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setup (props, {emit}) {
|
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({
|
const mydialog = computed({
|
||||||
get: () => props.opendialog,
|
get: () => props.opendialog,
|
||||||
set: (value) => emit('update:opendialog', value)
|
set: (value) => emit('update:opendialog', value)
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(()=>props.opendialog,(newValue,oldValue)=>{
|
|
||||||
if(newValue){
|
|
||||||
infouser()
|
|
||||||
}
|
|
||||||
}, {deep:true})
|
|
||||||
|
|
||||||
const basicInformation = () => [
|
const basicInformation = () => [
|
||||||
{title: 'Отдел:', info: userlinks.value.department},
|
{title: 'Отдел:', info: props.author.department},
|
||||||
{title: 'ФИО:', info: userlinks.value.fio},
|
{title: 'ФИО:', info: props.author.fio},
|
||||||
{title: 'Должность:', info: userlinks.value.post},
|
{title: 'Должность:', info: props.author.post},
|
||||||
]
|
]
|
||||||
|
|
||||||
const subInformation = () => [
|
const subInformation = () => [
|
||||||
{title: 'E-mail: ', info: userlinks.value.email},
|
{title: 'E-mail: ', info: props.author.email},
|
||||||
{title: 'Телефон: ', info: userlinks.value.tel},
|
{title: 'Телефон: ', info: props.author.tel},
|
||||||
{title: 'Комната: ', info: userlinks.value.room},
|
{title: 'Комната: ', info: props.author.room},
|
||||||
{title: 'Логин: ', info: userlinks.value.login},
|
{title: 'Логин: ', info: props.author.login},
|
||||||
]
|
]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mydialog,
|
mydialog,
|
||||||
userlinks,
|
|
||||||
infouser,
|
|
||||||
spravURL,
|
spravURL,
|
||||||
checkremote,
|
checkremote,
|
||||||
basicInformation,
|
basicInformation,
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
/>
|
/>
|
||||||
<span class="font-weight-medium text-grey-darken-3 myleft text-caption">
|
<span class="font-weight-medium text-grey-darken-3 myleft text-caption">
|
||||||
{{splitname(author)}}
|
{{splitname(author)}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
</v-chip>
|
</v-chip>
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<info-user-card
|
<info-user-card
|
||||||
|
:author="author"
|
||||||
:opendialog = open
|
:opendialog = open
|
||||||
:loging="author.login"
|
:loging="author.login"
|
||||||
@update:opendialog="open = $event"
|
@update:opendialog="open = $event"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="align-center d-flex flex-column py-1">
|
<div class="align-center d-flex flex-column py-1">
|
||||||
|
|
||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
variant="text"
|
variant="text"
|
||||||
v-for="x in onlineuser"
|
v-for="x in onlineuser"
|
||||||
@@ -16,6 +18,7 @@
|
|||||||
</v-avatar>
|
</v-avatar>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<info-user-card
|
<info-user-card
|
||||||
|
|
||||||
:opendialog = open
|
:opendialog = open
|
||||||
:loging="loging"
|
:loging="loging"
|
||||||
@update:opendialog="open = $event"
|
@update:opendialog="open = $event"
|
||||||
@@ -39,6 +42,7 @@ export default {
|
|||||||
const wsfuncs={onliner:function(data){
|
const wsfuncs={onliner:function(data){
|
||||||
let newset = new Set(data)
|
let newset = new Set(data)
|
||||||
let arr= Array.from(newset)
|
let arr= Array.from(newset)
|
||||||
|
|
||||||
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
||||||
onlineuser.value = arr
|
onlineuser.value = arr
|
||||||
}}
|
}}
|
||||||
@@ -46,7 +50,6 @@ export default {
|
|||||||
let onlineuser= ref([])
|
let onlineuser= ref([])
|
||||||
|
|
||||||
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
|
const connect = new WebSocket(baseWS+"ws/watcher/?token="+localStorage.access)
|
||||||
|
|
||||||
const whatuser=(x)=> {
|
const whatuser=(x)=> {
|
||||||
loging.value = x
|
loging.value = x
|
||||||
open.value = true
|
open.value = true
|
||||||
@@ -54,6 +57,7 @@ export default {
|
|||||||
|
|
||||||
connect.onmessage=(e)=>{
|
connect.onmessage=(e)=>{
|
||||||
let data = JSON.parse(e.data)
|
let data = JSON.parse(e.data)
|
||||||
|
|
||||||
wsfuncs[data['message']['action']](data.message.data)
|
wsfuncs[data['message']['action']](data.message.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<v-card
|
<v-card
|
||||||
class="bg-transparent"
|
class="bg-transparent"
|
||||||
|
|
||||||
density="compact"
|
density="compact"
|
||||||
:prepend-avatar="checkremote(`${spravURL}${author.login}.jpg`)"
|
:prepend-avatar="checkremote(`${spravURL}${author.login}.jpg`)"
|
||||||
:title="author.fio"
|
:title="author.fio"
|
||||||
@@ -11,6 +9,7 @@
|
|||||||
variant="text" @click="open=true"
|
variant="text" @click="open=true"
|
||||||
/>
|
/>
|
||||||
<info-user-card
|
<info-user-card
|
||||||
|
:author=author
|
||||||
:opendialog = open
|
:opendialog = open
|
||||||
:loging="author.login"
|
:loging="author.login"
|
||||||
@update:opendialog="open = $event"
|
@update:opendialog="open = $event"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import myHelper from '@/components/UI/my-helper';
|
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 TooltipText from '@/components/UI/tooltip-text.vue'
|
||||||
import AlertDefault from '@/layouts/default/alertDefault.vue'
|
import AlertDefault from '@/layouts/default/alertDefault.vue'
|
||||||
import listUser from '@/components/UI/fiousercard/listUser.vue';
|
import listUser from '@/components/UI/fiousercard/listUser.vue';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<v-menu
|
<v-menu
|
||||||
v-model="menu"
|
v-model="menu"
|
||||||
:close-on-content-click="false"
|
:close-on-content-click="false"
|
||||||
:nudge-width="500"
|
:max-width="800"
|
||||||
offset-x
|
offset-x
|
||||||
>
|
>
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<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() {
|
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
|
feedalert.alert = true
|
||||||
textFromAlert()
|
textFromAlert()
|
||||||
menusCloses()
|
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,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<v-carousel
|
<v-carousel
|
||||||
cycle
|
cycle
|
||||||
interval="10000"
|
interval="10000"
|
||||||
@@ -10,9 +9,9 @@
|
|||||||
show-arrows="hover"
|
show-arrows="hover"
|
||||||
color="white"
|
color="white"
|
||||||
>
|
>
|
||||||
|
|
||||||
<v-carousel-item
|
<v-carousel-item
|
||||||
v-for="(x, i) in carous" :key="i"
|
v-for="(x, i) in carous"
|
||||||
|
:key="i"
|
||||||
:src="`${burl}${x.link}`"
|
:src="`${burl}${x.link}`"
|
||||||
cover
|
cover
|
||||||
eager
|
eager
|
||||||
@@ -20,20 +19,22 @@
|
|||||||
<v-container
|
<v-container
|
||||||
fill-height
|
fill-height
|
||||||
fluid
|
fluid
|
||||||
pa-0 ma-0 pb-3
|
pa-0
|
||||||
|
ma-0
|
||||||
|
pb-3
|
||||||
class="flex-column h-100 d-flex"
|
class="flex-column h-100 d-flex"
|
||||||
>
|
>
|
||||||
<v-card
|
<v-card
|
||||||
v-if="x.text != '' || x.title != null"
|
v-if="x.text != '' || x.title != null"
|
||||||
class="bgCard h-100 d-flex flex-column"
|
class="bgCard h-100 d-flex flex-column"
|
||||||
>
|
>
|
||||||
|
<v-card-title
|
||||||
<v-card-title v-if="x.title != null"
|
v-if="x.title != null"
|
||||||
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0">
|
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
|
||||||
|
>
|
||||||
<v-row no-gutters>
|
<v-row no-gutters>
|
||||||
<v-col class="align-self-center">
|
<v-col class="align-self-center">
|
||||||
{{ x.title }}
|
{{ x.title }}
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="flex-grow-0">
|
<v-col class="flex-grow-0">
|
||||||
<v-img
|
<v-img
|
||||||
@@ -42,7 +43,6 @@
|
|||||||
:src="`${burl}${x.sender}`"
|
:src="`${burl}${x.sender}`"
|
||||||
cover
|
cover
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
@@ -50,11 +50,10 @@
|
|||||||
v-if="x.text != ''"
|
v-if="x.text != ''"
|
||||||
class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
|
class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
|
||||||
>
|
>
|
||||||
|
|
||||||
<v-textarea
|
<v-textarea
|
||||||
class="text-text_caroustext-black textareas font-weight-medium nocursor"
|
class="text-text_caroustext-black textareas font-weight-medium nocursor"
|
||||||
:model-value=x.text
|
:model-value="x.text"
|
||||||
variant='solo'
|
variant="solo"
|
||||||
readonly
|
readonly
|
||||||
auto-grow
|
auto-grow
|
||||||
rows="1"
|
rows="1"
|
||||||
@@ -70,30 +69,41 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref } from 'vue'
|
import { ref } from "vue";
|
||||||
import {getfromserver} from '@/utils/universal_functions'
|
import { baseURL } from "@/utils/axios-api";
|
||||||
import { baseURL } from '@/utils/axios-api'
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
|
import { useAlertStore } from "@/store/useAlertStore";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const burl = baseURL.slice(0,-1)
|
const burl = baseURL.slice(0, -1);
|
||||||
|
|
||||||
const carous=ref([{link: "newsimage/default.jpg"}])
|
const carous = ref([{ link: "newsimage/default.jpg" }]);
|
||||||
|
const feedalert = useAlertStore().alert;
|
||||||
|
|
||||||
getfromserver("api/navigation/carousels/", 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 {
|
return {
|
||||||
burl,
|
burl,
|
||||||
carous
|
carous,
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.titles {
|
.titles {
|
||||||
font-family: cursive !important;
|
font-family: cursive !important;
|
||||||
background: #ffffff8c;
|
background: #ffffff8c;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
<v-card
|
<v-card
|
||||||
v-else class="h-100 w-100 d-flex justify-center flex-column"
|
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-row class="flex-grow-0">
|
||||||
<v-col class="py-0">
|
<v-col class="py-0">
|
||||||
@@ -132,19 +132,17 @@
|
|||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
import {checkremote} from '@/utils/universal_functions'
|
import {checkremote} from '@/utils/universal_functions'
|
||||||
import { spravURL } from '@/utils/axios-api'
|
import { spravURL } from '@/utils/axios-api'
|
||||||
import CardUsers from '@/components/cardUsers.vue'
|
|
||||||
import DialogSearch from './dialog-search.vue'
|
import DialogSearch from './dialog-search.vue'
|
||||||
import { baseURL } from '@/utils/axios-api'
|
import { baseURL } from '@/utils/axios-api'
|
||||||
import {useAccountStore} from '@/store/AccountStore'
|
import {useAccountStore} from '@/store/AccountStore'
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
CardUsers,
|
|
||||||
DialogSearch
|
DialogSearch
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
const t_baseCriteria = ref([])
|
|
||||||
const t_daily = ref('')
|
const t_daily = ref('')
|
||||||
const idpos = ref('')
|
const idpos = ref('')
|
||||||
const namepos = ref('')
|
const namepos = ref('')
|
||||||
@@ -179,12 +177,6 @@ export default {
|
|||||||
|
|
||||||
const burl = baseURL.slice(0,-1)
|
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 onPickFile = (ex) => {
|
||||||
const sdata = new FormData()
|
const sdata = new FormData()
|
||||||
@@ -208,8 +200,7 @@ export default {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
dailyfun(),
|
dailyfun()
|
||||||
proba()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return {t_daily,
|
return {t_daily,
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row>
|
<v-row no-gutters class="gap ma-3 flex-column">
|
||||||
<v-col class="flex-column d-flex">
|
<v-col lg=2 class='w100 d-flex flex-column'>
|
||||||
<v-row class="flex-grow-0 mhight">
|
<v-row no-gutters class="gap">
|
||||||
<v-col class=" flex-column d-flex">
|
<v-col lg=4>
|
||||||
<v-card class="ml-2 mt-2" width="500" >
|
<v-card class="h-100">
|
||||||
<v-card-title class="text-wrap pb-3">
|
<v-card-title>
|
||||||
Ежедневная статистика по сотрудникам
|
Ежедневная статистика по сотрудникам
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-row class="flex-grow-0 align-self-end">
|
<v-row no-gutters class="gap">
|
||||||
<v-col class="d-flex">
|
<v-col class="flex-grow-0">
|
||||||
<v-card-subtitle class="mt-2 align-self-end">
|
<v-card-subtitle class="mt-2 align-self-end">
|
||||||
1. Скачать файл ежедневной статистики {{info}}
|
1. Скачать файл ежедневной статистики
|
||||||
</v-card-subtitle>
|
</v-card-subtitle>
|
||||||
|
</v-col>
|
||||||
|
<v-col class="flex-grow-0">
|
||||||
<v-icon
|
<v-icon
|
||||||
class="pt-2 pl-2"
|
|
||||||
icon="mdi-file-excel"
|
icon="mdi-file-excel"
|
||||||
color="green-darken-3"
|
color="green-darken-3"
|
||||||
@click="excelOp('excround')"
|
@click="excelOp('excround')"
|
||||||
>
|
/>
|
||||||
</v-icon>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row no-gutters class="gap mt-5">
|
||||||
<v-card-subtitle class="align-self-center ml-3">
|
<v-col class="flex-grow-0">
|
||||||
|
<v-card-subtitle class="mt-3 align-self-end">
|
||||||
2. Загрузить данные на сервер
|
2. Загрузить данные на сервер
|
||||||
</v-card-subtitle>
|
</v-card-subtitle>
|
||||||
<v-col class="pr-0">
|
</v-col>
|
||||||
|
<v-col >
|
||||||
<v-file-input
|
<v-file-input
|
||||||
accept=".xlsx"
|
accept=".xlsx"
|
||||||
v-model="dailyfiles"
|
v-model="dailyfiles"
|
||||||
@@ -35,70 +35,36 @@
|
|||||||
density="compact"
|
density="compact"
|
||||||
label="Прикрепить файл"
|
label="Прикрепить файл"
|
||||||
hide-details
|
hide-details
|
||||||
class="mr-2 pb-2"
|
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="flex-grow-0 align-self-center pl-0 pr-6">
|
<v-col class="flex-grow-0 pr-2">
|
||||||
<v-icon
|
<v-icon
|
||||||
icon="mdi-chevron-double-right"
|
icon="mdi-chevron-double-right"
|
||||||
color="blue-grey-darken-2"
|
color="blue-grey-darken-2"
|
||||||
@click="onPickFile('roundfilse')"
|
@click="onPickFile('roundfilse')"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
</v-card>
|
</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-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { baseURL } from '@/utils/axios-api'
|
import { baseURL } from '@/utils/axios-api'
|
||||||
import {getfromserver} from '@/utils/universal_functions'
|
|
||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
import { useAlertStore } from '@/store/useAlertStore'
|
import { useAlertStore } from '@/store/useAlertStore'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
|
|
||||||
const dailyfiles = ref([])
|
const dailyfiles = ref([])
|
||||||
const visiting = ref({})
|
|
||||||
const info = ref('')
|
|
||||||
const t_dailyRound = ref('')
|
|
||||||
const feedalert = useAlertStore().alert
|
const feedalert = useAlertStore().alert
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const excelOp = (ex) => {
|
const excelOp = (ex) => {
|
||||||
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
|
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
|
||||||
let link = document.createElement("a")
|
let link = document.createElement("a")
|
||||||
@@ -108,33 +74,22 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const onPickFile = (ex) => {
|
const onPickFile = (ex) => {
|
||||||
const sdata = new FormData()
|
const sdata = new FormData()
|
||||||
sdata.append('dailyfiles', dailyfiles.value[0])
|
sdata.append('dailyfiles', dailyfiles.value[0])
|
||||||
|
|
||||||
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => {
|
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => {
|
||||||
info.value = result.data['mess']
|
textFromAlert(result.data['mess'])
|
||||||
|
|
||||||
})
|
})
|
||||||
showInfo.value = true
|
|
||||||
dailyfiles.value = []
|
dailyfiles.value = []
|
||||||
feedalert.alert = true
|
|
||||||
textFromAlert()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const textFromAlert = () => {
|
const textFromAlert = (info) => {
|
||||||
if (info.value=="Файл загружен") {
|
feedalert.alert = true
|
||||||
|
if (info == "Файл загружен") {
|
||||||
feedalert.text = "Файл загружен"
|
feedalert.text = "Файл загружен"
|
||||||
feedalert.ico = "mdi-check"
|
feedalert.ico = "mdi-check"
|
||||||
feedalert.color ="green-darken-4"
|
feedalert.color ="green-darken-4"
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
feedalert.text = "Ошибка загрузки"
|
feedalert.text = "Ошибка загрузки"
|
||||||
feedalert.ico = "mdi-alert-circle-outline"
|
feedalert.ico = "mdi-alert-circle-outline"
|
||||||
@@ -142,30 +97,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const detailRound = () => {
|
|
||||||
|
|
||||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
|
|
||||||
.then(data => {
|
|
||||||
|
|
||||||
|
|
||||||
t_dailyRound.value = data.data
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const showInfo = ref(false)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
visiting,
|
|
||||||
excelOp,
|
excelOp,
|
||||||
baseURL,
|
baseURL,
|
||||||
dailyfiles,
|
dailyfiles,
|
||||||
onPickFile,
|
onPickFile,
|
||||||
info,
|
feedalert
|
||||||
detailRound,
|
|
||||||
t_dailyRound,
|
|
||||||
showInfo,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
class="d-flex pa-1 flex-column "
|
class="d-flex pa-1 flex-column "
|
||||||
>
|
>
|
||||||
<news-card :news="x"/>
|
<news-card :news="x"/>
|
||||||
|
{{aNewsAll}}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row class="flex-grow-0 ">
|
<v-row class="flex-grow-0 ">
|
||||||
@@ -69,6 +69,7 @@ export default {
|
|||||||
|
|
||||||
const loadNewsAll = () => {
|
const loadNewsAll = () => {
|
||||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||||
|
|
||||||
newsAll.value= result.data.result
|
newsAll.value= result.data.result
|
||||||
countetnews.value = result.data.countpage/countpage.value
|
countetnews.value = result.data.countpage/countpage.value
|
||||||
visiblePage.value = countetnews.value <= 1 ? 1 : countetnews.value+1
|
visiblePage.value = countetnews.value <= 1 ? 1 : countetnews.value+1
|
||||||
@@ -80,6 +81,7 @@ export default {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
newsAll,
|
newsAll,
|
||||||
|
|
||||||
countetnews,
|
countetnews,
|
||||||
page,
|
page,
|
||||||
countpage,
|
countpage,
|
||||||
|
|||||||
@@ -231,7 +231,7 @@
|
|||||||
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
|
: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 "
|
<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-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
||||||
<v-col>
|
<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"/>
|
<default-portal-menu-list :aMenuItem="supperuser"/>
|
||||||
<div v-if="getDevelopment()">
|
<div v-if="getDevelopment()">
|
||||||
|
|
||||||
@@ -223,7 +224,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
</v-list>
|
</v-list> -->
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row no-gutters class="flex-grow-0">
|
<v-row no-gutters class="flex-grow-0">
|
||||||
@@ -240,9 +241,11 @@
|
|||||||
|
|
||||||
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
<v-main v-if="accountStore.cod2user" class="d-flex bg-main_theme">
|
||||||
<router-view />
|
<router-view />
|
||||||
<v-expand-x-transition>
|
|
||||||
|
|
||||||
<alert-default />
|
<alert-default />
|
||||||
</v-expand-x-transition>
|
|
||||||
|
|
||||||
|
|
||||||
</v-main>
|
</v-main>
|
||||||
<v-main v-else class="d-flex align-center text-h3 bg-teal-lighten-2">
|
<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 PageCounter from '@/components/UI/defaultportal/page-counter.vue'
|
||||||
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
|
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
|
||||||
import {getDevelopment} from '@/utils/universal_functions'
|
import {getDevelopment} from '@/utils/universal_functions'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
@@ -357,15 +361,6 @@ export default {
|
|||||||
|
|
||||||
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
||||||
|
|
||||||
const supperuser = [
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'Панель администратора',
|
|
||||||
ico: 'mdi-wrench',
|
|
||||||
link: baseURL+'admin'
|
|
||||||
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const oRasrab = [
|
const oRasrab = [
|
||||||
{
|
{
|
||||||
@@ -447,7 +442,11 @@ export default {
|
|||||||
ico: 'mdi-city',
|
ico: 'mdi-city',
|
||||||
path: "/inspection"
|
path: "/inspection"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'ical',
|
||||||
|
ico: 'mdi-calendar',
|
||||||
|
path: "/ical"
|
||||||
|
},
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// name: 'К празднику',
|
// name: 'К празднику',
|
||||||
@@ -485,7 +484,7 @@ export default {
|
|||||||
// feedalert,
|
// feedalert,
|
||||||
alert,
|
alert,
|
||||||
burl,
|
burl,
|
||||||
supperuser,
|
|
||||||
closeinfo,
|
closeinfo,
|
||||||
baseURL,
|
baseURL,
|
||||||
getDevelopment
|
getDevelopment
|
||||||
|
|||||||
@@ -1,40 +1,88 @@
|
|||||||
<template>
|
<template>
|
||||||
<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-list-item
|
||||||
v-for="(x, key) in aMenuItem"
|
v-for="x in list"
|
||||||
:key="key"
|
:key="x"
|
||||||
:title="x.name"
|
:title="x.name"
|
||||||
:value="x.name"
|
:value="x.name"
|
||||||
:href="x.link"
|
:href="x.link"
|
||||||
:target="x.link ? '_blank' : ''"
|
:target="x.link ? '_blank' : ''"
|
||||||
slim
|
slim
|
||||||
class="text-blue-grey-lighten-1"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<v-icon :icon="x.ico" size="x_small" />
|
<v-icon :icon="x.ico" size="x_small" />
|
||||||
<v-tooltip
|
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||||
v-if="rail"
|
|
||||||
activator="parent"
|
|
||||||
location="top"
|
|
||||||
>
|
|
||||||
{{ x.name }}
|
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</v-list>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { baseURL } from "@/utils/axios-api";
|
||||||
|
import { getDevelopment } from "@/utils/universal_functions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
aMenuItem: {
|
rail: {
|
||||||
type: Array,
|
type: Boolean,
|
||||||
default: () => []
|
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>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -4,4 +4,21 @@
|
|||||||
|
|
||||||
Импорт глобальный, прописан в src/front/src/components/UI/index.js
|
Импорт глобальный, прописан в 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
|
:color=feedalert.color
|
||||||
:icon=feedalert.ico
|
:icon=feedalert.ico
|
||||||
theme="dark"
|
theme="dark"
|
||||||
max-height="40"
|
min-height="40"
|
||||||
width = "500"
|
min-width = "500"
|
||||||
position="fixed"
|
position="fixed"
|
||||||
location = "bottom"
|
location = "bottom"
|
||||||
class="mb-2"
|
class="mb-2"
|
||||||
v-model="feedalert.alert"
|
v-model="feedalert.alert"
|
||||||
:text=feedalert.text
|
:text=feedalert.text
|
||||||
variant = "tonal"
|
|
||||||
density="compact"
|
density="compact"
|
||||||
>
|
>
|
||||||
</v-alert>
|
</v-alert>
|
||||||
@@ -35,7 +35,7 @@ export default {
|
|||||||
feedalert.ico=""
|
feedalert.ico=""
|
||||||
feedalert.color=""
|
feedalert.color=""
|
||||||
feedalert.alert = false
|
feedalert.alert = false
|
||||||
}, 3000)
|
}, 8000)
|
||||||
|
|
||||||
}, {deep:true})
|
}, {deep:true})
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,15 @@ const routes = [
|
|||||||
ico: "mdi-city"
|
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';
|
const str = "hello";
|
||||||
import {useAccountStore} from '@/store/AccountStore'
|
import { useAccountStore } from "@/store/AccountStore";
|
||||||
import {useAppStore} from '@/store/app'
|
import { useAppStore } from "@/store/app";
|
||||||
import { baseURL } from '@/utils/axios-api'
|
import { baseURL } from "@/utils/axios-api";
|
||||||
import { axiosApiInstance, clearAxios } from '@/utils/axios-api'
|
import { axiosApiInstance, clearAxios } from "@/utils/axios-api";
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from "vue-router";
|
||||||
import moment from 'moment'
|
import moment from "moment";
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function formatComa(date) {
|
export function formatComa(date) {
|
||||||
return moment(date).format('DD.MM.YYYY')
|
return moment(date).format("DD.MM.YYYY");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDash(date) {
|
export function formatDash(date) {
|
||||||
return moment(date).format('YYYY-MM-DD')
|
return moment(date).format("YYYY-MM-DD");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formaComaTime(date) {
|
export function formaComaTime(date) {
|
||||||
return moment(date).format('DD.MM.YYYY H:mm')
|
return moment(date).format("DD.MM.YYYY H:mm");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checking_for_entry(where, what) {
|
export function checking_for_entry(where, what) {
|
||||||
if (!where.includes(what))
|
if (!where.includes(what)) {
|
||||||
{
|
where.push(what);
|
||||||
where.push(what)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getfromserver(path, reactive) {
|
export function getfromserver(path, reactive) {
|
||||||
try {
|
try {
|
||||||
|
axiosApiInstance.get(path).then((result) => {
|
||||||
axiosApiInstance.get(path).then(result => {
|
reactive.value = result.data;
|
||||||
reactive.value = result.data})}
|
});
|
||||||
catch(e){
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getfromserverfree(path, reactive) {
|
export function getfromserverfree(path, reactive) {
|
||||||
try {
|
try {
|
||||||
clearAxios.get(path).then(result => {
|
clearAxios.get(path).then((result) => {
|
||||||
reactive.value = result.data})}
|
reactive.value = result.data;
|
||||||
catch(e){
|
});
|
||||||
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function checkremote(filecheck) {
|
export function checkremote(filecheck) {
|
||||||
|
return process.env.NODE_ENV == "development"
|
||||||
return process.env.NODE_ENV == 'development'? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg":filecheck
|
? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
|
||||||
|
: filecheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default str;
|
export default str;
|
||||||
|
|
||||||
export function splitname(name) {
|
export function splitname(name) {
|
||||||
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
|
return name.familyname + " " + name.name[0] + "." + name.parentname[0] + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pagecounter() {
|
export function pagecounter() {
|
||||||
|
const router = useRouter();
|
||||||
const router = useRouter()
|
const accountStore = useAccountStore();
|
||||||
const accountStore = useAccountStore()
|
const appStore = useAppStore();
|
||||||
const appStore = useAppStore()
|
|
||||||
|
|
||||||
let postdata = {
|
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,
|
page: router.currentRoute.value.meta.title,
|
||||||
fullPath: router.currentRoute.value.fullPath,
|
fullPath: router.currentRoute.value.fullPath,
|
||||||
ico: router.currentRoute.value.meta.ico
|
ico: router.currentRoute.value.meta.ico,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata)
|
|
||||||
.then(result => {
|
|
||||||
|
|
||||||
appStore.countvisitor = result.data
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata).then((result) => {
|
||||||
|
appStore.countvisitor = result.data;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDevelopment() {
|
export function getDevelopment() {
|
||||||
return process.env.NODE_ENV == 'development'?true:false
|
return process.env.NODE_ENV == "development" ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useICalReader(url) {
|
||||||
|
///
|
||||||
|
const events = ref([]);
|
||||||
|
|
||||||
|
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 = () => {
|
const getInspectionDirections = () => {
|
||||||
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
|
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
|
||||||
directionworks.value = res.data
|
directionworks.value = res.data
|
||||||
console.log(directionworks.value)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ setup(){
|
|||||||
|
|
||||||
let periodusers = new Set([])
|
let periodusers = new Set([])
|
||||||
let brdata = {}
|
let brdata = {}
|
||||||
|
|
||||||
let filtr = alldata.value.period
|
let filtr = alldata.value.period
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
import CarouselList from '@/components/carousel-list.vue'
|
import CarouselList from '@/components/carousel-list.vue'
|
||||||
import CarouselNumbers from '@/components/carousel-numbers.vue'
|
import CarouselNumbers from '@/components/carousel-numbers.vue'
|
||||||
import CalendarFull from '@/components/UI/Calendar-full.vue'
|
|
||||||
|
|
||||||
import NewsHome from '@/components/news-home.vue'
|
import NewsHome from '@/components/news-home.vue'
|
||||||
import LoadRound from '@/components/load-round.vue'
|
import LoadRound from '@/components/load-round.vue'
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
CarouselList,
|
CarouselList,
|
||||||
CarouselNumbers,
|
CarouselNumbers,
|
||||||
CalendarFull,
|
|
||||||
|
|
||||||
LoadRound,
|
LoadRound,
|
||||||
DigitalLetna,
|
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() {
|
function getResponsibility() {
|
||||||
axiosApiInstance.get(`api/safety/responsibility/`).then(result => {
|
axiosApiInstance.get(`api/safety/responsibility/`).then(result => {
|
||||||
responsibility.value = result.data.users
|
responsibility.value = result.data.users
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user