Merge branch 'razrab'

This commit is contained in:
iriska-gri committed 2024-03-06 16:56:35 +03:00
commit 91d24946a8
100 files changed
+3609 -1174

No files matched your search

+45 -32
View File
@@ -1,11 +1,14 @@
[Общие работы по проекту](/COD2/PORTAL_COD2/projects/22)
# IS#26 Портал ЦОД-2
Живет на 60м сервере. Тестовый отсутствует
Prod Portal9966/ (10.252.44.28)
Test Potal-t/ (10.252.44.60)
## Стэк ##
1. Python 3.10
2. Vuetify3
3. Временная схема - файловая БД SQLITE
3. MySQL
4. Redis
## Особенности веток ##
@@ -16,34 +19,31 @@ npm version patch производится на ветке razrab
окончательная сборка - на main
## Схема ##
стрелки надо передумать
```mermaid
flowchart TD
A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx}
C <-->|Фронт| F[Vuetify]
F<-->D[Gunicorn]
D <-->|Виртуальное окружение | E{manage.py}
E <--> |Вспомогательная БД портала| P[dbsqlite]
E-->|Сервер Авторизации|G[10.252.44.13]
G <-->|Active directory|AD
G <--> |БД Справочника| J[БД 10.252.44.33]
C <--> H[Daphne]
H <--> I[Redis]
E <--> I
E<-->|БД Справочника| J
A[Клиент] <-->|Запрос к серверу PORTAL9966/ или PORTAL-t/| B{Nginx:80}
B <-->|Фронт /| C[Vuetify 3 <br/> /var/www/PORTAL_COD2/src/front/dist]
B <-->|бэк <br/> /api <br/> /admin <br/> /ws| D{Daphne :9966}
D<--> |/ws| E[Django channels]
E<-->F[Redis :6379]
D<-->|Admin|G{Django}
G<-->|10.252.44.13:8005|H[Авторизация FAST API сервер]
H<-->J[Active Directory]
G<-->|10.252.44.33:3306|I[MySQL <br/> БД Справочник]
B<-->|/static <br/> /media|K[Файлы <br/> /var/www/PORTAL_COD2/src/media <br/> /var/www/PORTAL_COD2/src/static/ ]
```
## Установка и настройка ##
### Первоначальная установка после клонирования в папку. В случае неисправностей, идти примерно по этому же пути ###
Инициализация проекта:
- Инициализировать git
- Выполнить git clone
1. В каталоге проекта Создаем окружение
``` python3.10 -m venv env ```
@@ -57,13 +57,26 @@ A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx}
``` cd sys ```
```pip install -r r.txt --proxy= http://...```
Если нет proxy:
На машине разработки выполнить команду ```pip download -r ../r.txt```
Команда для установки python
```pip install --no-index --find-links /Путь_К_Папке_С_Пакетами/ -r r.txt```
Запушить изменения в ветку
Синхронизировать ветку на сервере
``` git pull ```
Если произошла ошибка: ``` git reset --hard ```
4. переходим в каталог src
``` cd ../src/```
5. В каталог src разархивируем portal.zip из sys
Бд живет на том же сервере, что и проект (60)
5. В каталог src разархивируем portal.zip из sys
Прописываем подключения в settings.py
@@ -77,16 +90,12 @@ A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx}
На этом работы непосредственно с бэкэндом завершены
### Порты ###
!ВНИМАТЕЛЬНО ПОСМОТРЕТЬ NGINX API proxy ?!
Vuetify : 9966
Gunicorn: 9965
Daphne: 9967
Daphne: 9966
### Настройка NGINX, GUNICORN, Vuetify, Daphne ###
В каталоге sys расположены примерные файлы конфигов для тестового и боевого серверов
Тестовый сервер: /sys/test_server
При копировании убедиться, что пути соответствуют системе
#### NGINX Vuetify ####
@@ -94,7 +103,11 @@ A[PORTAL COD2] <-->|Запрос к серверу| C{Nginx}
/etc/nginx/sites-enabled
#### GUNICORN, Daphne ####
#### Daphne ####
Файлы .service кладем в каталог /etc/systemd/system
Проверяем путь виртуального окружения и порт в файле на соответствие с конфигурацией Nginx
#### Запуск сервера ####
Запускаем Daphne ``` Start portaldaphne ```
Перезагружаем Nginx ``` Restart nginx ```
+1 -2
View File
@@ -89,8 +89,7 @@ class CustomAuth(ModelBackend):
homeuser.last_login=user.last_login
user.id=homeuser.id
homeuser.userinfo = user
# print("OOOOOOOOOOOOOOOOOOOO")
# print(homeuser)
return homeuser
# except Exception as e:
-1
View File
@@ -15,7 +15,6 @@ class UserJSONRenderer(JSONRenderer):
if token is not None and isinstance(token, bytes):
# Как говорится выше, декодирует token если он имеет тип bytes.
data['token'] = token.decode('utf-8')
# print(data)
# Наконец, мы можем отобразить наши данные в простанстве имен 'user'.
return json.dumps({
'user': data,
+1 -1
View File
@@ -76,7 +76,7 @@ class getuserAPIView(APIView):
dt=datetime.now()
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
r=CardUserSerializer(queryset).data
print(datetime.now()-dt)
return Response(CardUserSerializer(queryset).data)
+10 -5
View File
@@ -19,9 +19,9 @@ class RatingStatusSerializer(serializers.ModelSerializer):
class RatingStatusStatSerializer(serializers.ModelSerializer):
author = serializers.SerializerMethodField('get_user')
time_create = serializers.CharField(source='usercom.time_create')
comment = serializers.CharField(source='usercom.comment')
utility = serializers.CharField(source='usercom.utility')
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')
@@ -48,10 +48,15 @@ class BaseCriteriaSerializer(serializers.ModelSerializer):
# return super().to_representation(instance)
class UserCommentSerializer(serializers.ModelSerializer):
author = serializers.SerializerMethodField('get_user')
class Meta:
model = UserComment
fields = ['id', 'user', 'time_create']
fields = '__all__'
def get_user(self, obj):
# obj.user
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
class UserCommerializer(serializers.ModelSerializer):
-1
View File
@@ -36,7 +36,6 @@ class FeedbackAPIView(APIView):
def post(self, request):
comment, created = UserComment.objects.update_or_create(id=request.data['nowcomment']['id'],user_id=self.request.user.id, defaults={'comment':request.data['nowcomment']['comment'], 'time_create':datetime.datetime.now()})
for x in request.data['nowrating']:
RatingStatus.objects.update_or_create(id=x['id'], defaults={'rating':x['rating'], 'crit_id':x['crit'], 'usercom_id':comment.id})
return Response({})
+274 -26
View File
@@ -1,22 +1,27 @@
{
"name": "front",
"version": "0.0.47",
"version": "0.0.53",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "front",
"version": "0.0.47",
"version": "0.0.53",
"dependencies": {
"-": "^0.0.1",
"@mdi/font": "7.0.96",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.3",
"adapter": "^1.0.0-beta.10",
"axios": "^1.4.0",
"chart.js": "^4.4.1",
"chartjs": "^0.3.24",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-datalabels": "^2.2.0",
"date-fns": "^2.30.0",
"express-vue": "^5.12.0",
"moment": "^2.29.4",
"file-saver": "^2.0.5",
"moment": "^2.30.1",
"pinia": "^2.0.23",
"roboto-fontface": "*",
"v-tooltip": "^2.1.3",
@@ -24,6 +29,7 @@
"vue-cal": "^4.8.1",
"vue-chartjs": "^5.3.0",
"vue-jwt-decode": "^0.1.0",
"vue-pdf-embed": "^2.0.2",
"vue-router": "^4.0.0",
"vue3-autocounter": "^1.0.6",
"vuelidate": "^0.7.7",
@@ -49,6 +55,11 @@
"vite-plugin-vuetify": "^1.0.0"
}
},
"node_modules/-": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz",
"integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ=="
},
"node_modules/@aashutoshrathi/word-wrap": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
@@ -3039,6 +3050,26 @@
"resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz",
"integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw=="
},
"node_modules/@mapbox/node-pre-gyp": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz",
"integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==",
"optional": true,
"dependencies": {
"detect-libc": "^2.0.0",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.7",
"nopt": "^5.0.0",
"npmlog": "^5.0.1",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"tar": "^6.1.11"
},
"bin": {
"node-pre-gyp": "bin/node-pre-gyp"
}
},
"node_modules/@mdi/font": {
"version": "7.0.96",
"resolved": "https://registry.npmjs.org/@mdi/font/-/font-7.0.96.tgz",
@@ -6009,6 +6040,12 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"optional": true
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -6070,6 +6107,11 @@
"node": ">=0.4.0"
}
},
"node_modules/adapter": {
"version": "1.0.0-beta.10",
"resolved": "https://registry.npmjs.org/adapter/-/adapter-1.0.0-beta.10.tgz",
"integrity": "sha512-4O3XRzPNeYfaEGFF+lIImH3tVJQEbA45+9oxGE0Y5PnqVmIoenmtvX/JA65n6Zt5TidRHcixLgb/1JcUuugK8w=="
},
"node_modules/address": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/address/-/address-1.2.2.tgz",
@@ -6083,7 +6125,7 @@
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"dev": true,
"devOptional": true,
"dependencies": {
"debug": "4"
},
@@ -6200,6 +6242,19 @@
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
},
"node_modules/are-we-there-yet": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
"integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
"optional": true,
"dependencies": {
"delegates": "^1.0.0",
"readable-stream": "^3.6.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@@ -7325,6 +7380,21 @@
}
]
},
"node_modules/canvas": {
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.0",
"nan": "^2.17.0",
"simple-get": "^3.0.3"
},
"engines": {
"node": ">=6"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -7365,6 +7435,20 @@
"pnpm": ">=7"
}
},
"node_modules/chartjs": {
"version": "0.3.24",
"resolved": "https://registry.npmjs.org/chartjs/-/chartjs-0.3.24.tgz",
"integrity": "sha512-h6G9qcDqmFYnSWqjWCzQMeOLiypS+pM6Fq2Rj7LPty8Kjx5yHonwwJ7oEHImZpQ2u9Pu36XGYfardvvBiQVrhg=="
},
"node_modules/chartjs-adapter-moment": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/chartjs-adapter-moment/-/chartjs-adapter-moment-1.0.1.tgz",
"integrity": "sha512-Uz+nTX/GxocuqXpGylxK19YG4R3OSVf8326D+HwSTsNw1LgzyIGRo+Qujwro1wy6X+soNSnfj5t2vZ+r6EaDmA==",
"peerDependencies": {
"chart.js": ">=3.0.0",
"moment": "^2.10.2"
}
},
"node_modules/chartjs-plugin-datalabels": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz",
@@ -7416,7 +7500,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
"integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
"dev": true,
"devOptional": true,
"engines": {
"node": ">=10"
}
@@ -7847,6 +7931,15 @@
"color-name": "^1.0.0"
}
},
"node_modules/color-support": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
"optional": true,
"bin": {
"color-support": "bin.js"
}
},
"node_modules/color/node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
@@ -8034,6 +8127,12 @@
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
"integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="
},
"node_modules/console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
"optional": true
},
"node_modules/consolidate": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/consolidate/-/consolidate-0.15.1.tgz",
@@ -8620,6 +8719,18 @@
"node": ">=0.10"
}
},
"node_modules/decompress-response": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",
"integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",
"optional": true,
"dependencies": {
"mimic-response": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/deep-equal": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz",
@@ -8770,6 +8881,12 @@
"node": ">=0.4.0"
}
},
"node_modules/delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
"optional": true
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
@@ -8838,6 +8955,15 @@
"node": ">=8"
}
},
"node_modules/detect-libc": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz",
"integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
"optional": true,
"engines": {
"node": ">=8"
}
},
"node_modules/detect-node-es": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz",
@@ -10577,6 +10703,11 @@
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/file-saver": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
"integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
},
"node_modules/file-system-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/file-system-cache/-/file-system-cache-2.3.0.tgz",
@@ -10963,7 +11094,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
"dev": true,
"devOptional": true,
"dependencies": {
"minipass": "^3.0.0"
},
@@ -10975,7 +11106,7 @@
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"dev": true,
"devOptional": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -11058,6 +11189,26 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/gauge": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz",
"integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==",
"optional": true,
"dependencies": {
"aproba": "^1.0.3 || ^2.0.0",
"color-support": "^1.1.2",
"console-control-strings": "^1.0.0",
"has-unicode": "^2.0.1",
"object-assign": "^4.1.1",
"signal-exit": "^3.0.0",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1",
"wide-align": "^1.1.2"
},
"engines": {
"node": ">=10"
}
},
"node_modules/gensync": {
"version": "1.0.0-beta.2",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
@@ -11440,6 +11591,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
"optional": true
},
"node_modules/has-value": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
@@ -11617,7 +11774,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
"dev": true,
"devOptional": true,
"dependencies": {
"agent-base": "6",
"debug": "4"
@@ -13193,7 +13350,7 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"devOptional": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -13492,6 +13649,18 @@
"node": ">=6"
}
},
"node_modules/mimic-response": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",
"integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==",
"optional": true,
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/minimalistic-assert": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
@@ -13525,7 +13694,7 @@
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
"dev": true,
"devOptional": true,
"engines": {
"node": ">=8"
}
@@ -13534,7 +13703,7 @@
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"dev": true,
"devOptional": true,
"dependencies": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
@@ -13547,7 +13716,7 @@
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"dev": true,
"devOptional": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -13659,9 +13828,9 @@
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
@@ -13804,7 +13973,7 @@
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"dev": true,
"devOptional": true,
"dependencies": {
"whatwg-url": "^5.0.0"
},
@@ -13988,6 +14157,21 @@
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
"integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ=="
},
"node_modules/nopt": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
"optional": true,
"dependencies": {
"abbrev": "1"
},
"bin": {
"nopt": "bin/nopt.js"
},
"engines": {
"node": ">=6"
}
},
"node_modules/normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
@@ -14051,6 +14235,18 @@
"node": ">=8"
}
},
"node_modules/npmlog": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
"integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
"optional": true,
"dependencies": {
"are-we-there-yet": "^2.0.0",
"console-control-strings": "^1.1.0",
"gauge": "^3.0.0",
"set-blocking": "^2.0.0"
}
},
"node_modules/nth-check": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
@@ -14607,6 +14803,15 @@
"node": ">=8"
}
},
"node_modules/path2d-polyfill": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.0.1.tgz",
"integrity": "sha512-ad/3bsalbbWhmBo0D6FZ4RNMwsLsPpL6gnvhuSaU5Vm7b06Kr5ubSltQQ0T7YKsiJQO+g22zJ4dJKNTXIyOXtA==",
"optional": true,
"engines": {
"node": ">=8"
}
},
"node_modules/pathe": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz",
@@ -14628,6 +14833,18 @@
"node": ">=0.12"
}
},
"node_modules/pdfjs-dist": {
"version": "3.11.174",
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz",
"integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==",
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"canvas": "^2.11.2",
"path2d-polyfill": "^2.0.1"
}
},
"node_modules/peek-stream": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz",
@@ -19089,7 +19306,7 @@
"version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"devOptional": true,
"dependencies": {
"lru-cache": "^6.0.0"
},
@@ -19322,6 +19539,17 @@
}
]
},
"node_modules/simple-get": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz",
"integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==",
"optional": true,
"dependencies": {
"decompress-response": "^4.2.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
}
},
"node_modules/simple-update-notifier": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
@@ -20240,7 +20468,7 @@
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz",
"integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==",
"dev": true,
"devOptional": true,
"dependencies": {
"chownr": "^2.0.0",
"fs-minipass": "^2.0.0",
@@ -20291,7 +20519,7 @@
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true,
"devOptional": true,
"bin": {
"mkdirp": "bin/cmd.js"
},
@@ -20777,7 +21005,7 @@
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"dev": true
"devOptional": true
},
"node_modules/traverse-chain": {
"version": "0.1.0",
@@ -21687,6 +21915,17 @@
"node": ">=4.0.0"
}
},
"node_modules/vue-pdf-embed": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/vue-pdf-embed/-/vue-pdf-embed-2.0.2.tgz",
"integrity": "sha512-Zxzv3DaNRj1NwJKIA/CMjvcA/Q0mlA8ASDBUVzYQ62o/s2WgF/Au/ZC4jlMr/P8CLznlyL8tIY7kqXHD7HLcAg==",
"dependencies": {
"pdfjs-dist": "^3.11.174"
},
"peerDependencies": {
"vue": "^3.3.0"
}
},
"node_modules/vue-pronto": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/vue-pronto/-/vue-pronto-2.4.0.tgz",
@@ -22708,9 +22947,9 @@
}
},
"node_modules/vuetify": {
"version": "3.4.10",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.4.10.tgz",
"integrity": "sha512-tObGoumCJxuK26OpS/CLZZIJAgDtN2cnd31vJscVhpuf6jeMD7wh8IsgfZownAOXU1FcKWVQwn1RSDsoXk5cJA==",
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.5.2.tgz",
"integrity": "sha512-H/g9+8Loykt50qe9mruHkwWsAIgfQ8gO+SPTAV2uaCFmfYPSFRfu0aGcZ42iWu4bZ9ZkgswIIDaVsfnKINd8yg==",
"engines": {
"node": "^12.20 || >=14.13"
},
@@ -23079,7 +23318,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"dev": true
"devOptional": true
},
"node_modules/webpack": {
"version": "4.47.0",
@@ -23387,7 +23626,7 @@
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"dev": true,
"devOptional": true,
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
@@ -23470,6 +23709,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/wide-align": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
"integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
"optional": true,
"dependencies": {
"string-width": "^1.0.2 || 2 || 3 || 4"
}
},
"node_modules/with": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz",
@@ -23700,7 +23948,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"dev": true
"devOptional": true
},
"node_modules/yargs": {
"version": "13.3.2",
+8 -2
View File
@@ -1,6 +1,6 @@
{
"name": "front",
"version": "0.0.47",
"version": "0.0.53",
"scripts": {
"dev": "vite",
"build": "vite build",
@@ -10,15 +10,20 @@
"build-storybook": "storybook build"
},
"dependencies": {
"-": "^0.0.1",
"@mdi/font": "7.0.96",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.3",
"adapter": "^1.0.0-beta.10",
"axios": "^1.4.0",
"chart.js": "^4.4.1",
"chartjs": "^0.3.24",
"chartjs-adapter-moment": "^1.0.1",
"chartjs-plugin-datalabels": "^2.2.0",
"date-fns": "^2.30.0",
"express-vue": "^5.12.0",
"moment": "^2.29.4",
"file-saver": "^2.0.5",
"moment": "^2.30.1",
"pinia": "^2.0.23",
"roboto-fontface": "*",
"v-tooltip": "^2.1.3",
@@ -26,6 +31,7 @@
"vue-cal": "^4.8.1",
"vue-chartjs": "^5.3.0",
"vue-jwt-decode": "^0.1.0",
"vue-pdf-embed": "^2.0.2",
"vue-router": "^4.0.0",
"vue3-autocounter": "^1.0.6",
"vuelidate": "^0.7.7",
+4 -3
View File
@@ -45,9 +45,7 @@ import {useAccountStore} from '@/store/AccountStore'
background: rgb(var(--v-theme-scrollbar))
}
.pointer {
cursor:pointer
}
.bggrad {
background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8));
@@ -68,4 +66,7 @@ import {useAccountStore} from '@/store/AccountStore'
gap: 5px;
}
.w100 {
max-width: 100%!important
}
</style>
@@ -0,0 +1,52 @@
<template>
<!-- :title="'Оставлено комментариев'" -->
<pattern-card-feed
:title="data.title"
>
<template v-slot:filling_feedback>
<v-row no-gutters class="flex-column gap">
<v-col>
<v-table density="compact" class="px-7">
<thead>
<tr >
<th class="text-center text-subtitle-1 font-weight-regular">
всего
</th>
<th class="text-center text-subtitle-1 font-weight-regular">
за период
</th>
</tr>
</thead>
<tbody >
<tr >
<th class="text-center text-h6 font-weight-bold">{{data.all}}</th>
<th class="text-center text-h6 font-weight-bold">{{data.period}}</th>
</tr>
</tbody>
</v-table>
</v-col>
</v-row>
</template>
</pattern-card-feed>
</template>
<script>
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
export default {
components: {
PatternCardFeed,
},
props: {
data: {
type: Object,
default: () => {}
},
}
}
</script>
<style>
</style>
@@ -0,0 +1,120 @@
<template>
<pattern-card-feed
:title="'Самый активный критик'"
>
<template v-slot:filling_feedback>
<v-row no-gutters v-if="top.comment[0].time_create != '1990-01-01'">
<v-col lg=5 class="bg-teal-lighten-4 align-self-center">
<list-user :author= "top.author" :from_which="'top_comment'"/>
</v-col>
<v-col class="align-self-center pl-0">
<v-table density="compact" class="pa-0">
<thead>
<tr >
<th class="text-center text-caption font-weight-medium">
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<span v-bind="props">
<v-icon
class="cursor-help"
icon="mdi-comment-text-outline"
color='cyan-darken-4'
size="x-large"
/>
</span>
</template>
<v-card max-width='400' density="compact" class="bg-transparent">
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(top.comment[0].time_create)}}</v-card-subtitle>
<v-card-title>{{top.comment[0].comment}}</v-card-title>
</v-card>
</v-tooltip>
</th>
<th class="text-center text-caption font-weight-medium">
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<span v-bind="props">
<v-icon
class="cursor-help"
icon="mdi-star"
color="orange"
size="x-large"
/>
</span>
</template>
Поставлено оценок
</v-tooltip>
</th>
</tr>
</thead>
<tbody >
<tr >
<th class="text-center text-h6 font-weight-bold">{{top.comment.length}}</th>
<th class="text-center text-h6 font-weight-bold">{{top.score}}</th>
</tr>
</tbody>
</v-table>
</v-col>
</v-row>
<v-row v-else
class="align-center flex-column
gap mt-n2"
no-gutters
>
<v-col
class="text-h6 pt-8 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
За выбранный период активных критиков нет
</v-col>
</v-row>
</template>
</pattern-card-feed>
</template>
<script>
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
import ListUser from '@/components/UI/fiousercard/listUser.vue'
import TooltipText from '@/components/UI/tooltip-text.vue'
import {formaComaTime} from '@/utils/universal_functions'
// import CardFeedback from '@/components/UI/aboutportal/card-feedback.vue'
export default {
components: {
PatternCardFeed,
ListUser,
TooltipText
},
props:
{
top: {
type: Object,
default: () => {}
},
},
setup(props) {
// console.log(props.top.comment, 'top.comment');
return {
formaComaTime
}
}
}
</script>
<style>
</style>
@@ -1,38 +1,69 @@
<template>
<v-card
<v-card class="text-center text-blue-grey-darken-4 d-flex h-100 flex-column cursor-default justify-center">
class="text-center d-flex flex-column"
height="150px"
>
<v-card-text>
<v-row no-gutters class="ma-0">
<v-col class="text-h5">
{{name}}
</v-col>
</v-row>
<v-row no-gutters class="h-100 pb-5">
<v-col class="text-h2 text-center align-self-center">
{{total}}
</v-col>
</v-row>
</v-card-text>
<v-row no-gutters class="flex-grow-0 ">
<v-col class="text-h5 font-weight-bold pl-5">
{{indicator.title}}
<v-tooltip width="250">
<template v-slot:activator="{ props }">
<v-icon
icon="mdi-information"
color="cyan-darken-3"
size="12"
v-bind="props"
class="align-self-end pr-2 pb-5 cursor-help"
/>
</template>
<span class="text-caption" >
{{indicator.tooltip}}
</span>
</v-tooltip>
</v-col>
</v-row>
<v-row no-gutters class="flex-grow-0">
<v-col class="text-h6 font-weight-medium">
{{indicator.abb}}
</v-col>
</v-row>
<v-row no-gutters class="flex-grow-0 pt-3">
<v-col class="text-h3 text-grey-darken-3 text-center font-weight-regular align-self-center">
<vue3-autocounter
v-if="!Number.isNaN(indicator.data)"
ref='counter'
:startAmount='0'
:endAmount='indicator.data'
:duration='1'
:decimals="Number.isInteger(indicator.data)?0:2"
:suffix="indicator.abb=='(PPV)'?'':'%'"
/>
<div v-else>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Данных нет
</v-col>
</v-row>
</div>
<!-- -->
</v-col>
</v-row>
</v-card>
</template>
<script>
export default {
props: {
name: {
type: String,
default: ''
},
total: {
type: Number,
default: 0
}
props: {
indicator: {
type: Object,
default: {}
},
}
}
</script>
@@ -1,156 +1,120 @@
<template>
<v-row no-gutters class="h-100">
<v-col class="d-flex flex-column gap" >
<div>
<card-total
name="Всего поставлено оценок"
:total="total"
/>
</div>
<div class="h-100">
<v-card class="pa-3 pt-4 pl-7 h-100">
<star-like
v-if="Object.keys(forstar).length>0"
:criteria=forstar
:rating=forstar
/>
<v-row v-else class="h-100">
<v-col class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">
Оценок за выбранный период нет
</v-col>
</v-row>
<pattern-card
:title="'Обратная связь'"
:ico="'mdi-comment-multiple-outline'"
>
<template v-slot:filling>
<v-row no-gutters class="flex-column gap">
<v-col lg=1 class="w100">
<v-card variant="flat" class="text-subtitle-1 font-weight-regular">
Последний комментарий оставлен: <br> <span class="text-subtitle-1 font-weight-bold">{{formaComaTime(feedback.last_comment.time_create)}}</span>
</v-card>
</div>
<div>
<card-total
name="Всего оставлено комментариев"
:total="crit.total"
</v-col>
<v-col lg=2 class="w100">
<star-like
:criteria=feedback.criteria
:ratings=feedback.criteria
/>
</div>
<div>
<top-user
name= "Самый активный критик"
:users=crit
ico="mdi-comment-account-outline"
/>
</div>
</v-col>
</v-row>
</v-col>
<v-col
lg=2 class="w100"
v-for=" x in feedback.data"
:key=x
>
<card-feedback :data="x"/>
</v-col>
<v-col class="d-flex flex-column">
<card-top-comment :top=dataTopUser />
</v-col>
</v-row>
<!--
-->
</template>
</pattern-card>
</template>
<script>
import { ref, watch } from 'vue'
import {splitname} from '@/utils/universal_functions'
import { ref, watch, computed } from 'vue'
import {formaComaTime, splitname} from '@/utils/universal_functions'
import starLike from '@/components/UI/feedback/star-like.vue'
import CardTotal from '@/components/UI/aboutportal/card-total.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue'
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
import CardFeedback from '@/components/UI/aboutportal/card-feedback.vue'
import CardTopComment from '@/components/UI/aboutportal/card-top-comment.vue'
export default {
components: {
starLike,
CardTotal,
TopUser
TopUser,
PatternCard,
CardFeedback,
CardTopComment
},
props: {
props:
{
feedback: {
type: Array,
default: () => []
},
name: {
type: String,
default: ''
type: Object,
default: () => {return {feed:[], last_comment:{time_create:'1990-01-01'}}}
}
},
setup(props, {emit}) {
const total = ref(0)
const crit = ref({count:0, login:'', fio: '', post: '', info: [], total: 0})
const forstar = ref({})
setup(props) {
const average = () => {
let tot = new Set()
let us = {}
let t = 0
const avgfeed =
props.feedback
.reduce((acc, item) => {
if (!acc[item.namecrit]) {
acc[item.namecrit] = {rating: [], ico: '', color: '', name: ''}
}
acc[item.namecrit]['rating'].push(item.rating)
acc[item.namecrit]['ico'] = item.ico
acc[item.namecrit]['color'] = item.color
acc[item.namecrit]['name'] = item.namecrit
tot.add(item.usercom)
if (!us[splitname(item.author)]) {
us[splitname(item.author)] = {login: '', fio: '', post: '', info: new Set()}
}
if (item.comment.length > 0) {
us[splitname(item.author)]['fio']= splitname(item.author)
us[splitname(item.author)]['info'].add(item.comment)
us[splitname(item.author)]['login'] = item.author.login
us[splitname(item.author)]['post'] = item.author.post
}
const dataTopUser = computed({
get() {
let ob = {}
let tuser = {comment:[{time_create:'1990-01-01', comment: ''}], score: 0}
props.feedback.feed.forEach((e) => {
return acc
}, {})
for (let [key,val] of Object.entries(avgfeed))
{
avgfeed[key]['rating'] = (val.rating.reduce((a,b)=>{
return a+b
}, 0)/val.rating.length).toFixed(1)
}
const sorted = Object.values(us)
.sort((a,b) => (b.info.size - a.info.size))
for (let val of sorted) {
t += val.info.size
}
if (sorted[0] === undefined) {
crit.value = {
count: 0, login: '', fio: '', post: '', info: '', total: 0
if (!ob[e.author.id]) {
ob[e.author.id] = 0
}
ob[e.author.id] += 1
})
if (Object.keys(ob).length > 0){
let top = Object.keys(ob).reduce((a,b) => ob[a] > ob[b] ? a: b)
let puser = props.feedback.feed.filter(e=> e.author.id == top)
tuser=Object.assign({},puser[puser.length-1])
tuser.fio=splitname(tuser.author)
tuser.score = puser.length
console.log(puser, ' top');
tuser.comment = puser.filter(e=>e.comment.length>0).sort((a,b)=> {return b.id-a.id})
}
return tuser
}
else {
crit.value = {
count: sorted[0].info.size, login: sorted[0].login, fio: sorted[0].fio, post: sorted[0].post, info: sorted[0].info, total: 0
}
}
crit.value.total = t
total.value = tot.size
return avgfeed
}
watch(()=>props.feedback ,(newValue,oldValue)=>{
if(newValue){
forstar.value = average()
}
}, {deep:true})
})
return {
average,
total,
crit,
forstar
formaComaTime,
dataTopUser
}
}
}
@@ -1,105 +1,305 @@
<template>
<line-graph :data="data" :options="options"/>
<v-card class="h-100 ">
<!-- <line-graph v-if="data!==null" :data="data" ref ='linear' :options="options"/> -->
<Line v-if="data!==null" :data="data" ref ='linear' :options="options" />
</v-card>
</template>
<script>
import lineGraph from '@/components/graph/line-graph.vue'
import {computed } from 'vue'
import {format1, splitname} from '@/utils/universal_functions'
// import lineGraph from '@/components/graph/line-graph.vue'
import moment from 'moment'
import {computed, onMounted, ref, watch } from 'vue'
import { usePortalFilterStore } from '@/store/AboutPortalFilter'
import {formatComa, splitname} from '@/utils/universal_functions'
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
TimeScale
} from 'chart.js'
import { Line } from 'vue-chartjs'
import ChartDataLabels from 'chartjs-plugin-datalabels'
import 'chartjs-adapter-moment'
ChartJS.register(
ChartDataLabels,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
TimeScale
)
export default {
components: {
lineGraph,
Line,
},
props: {
visiting: {
type: Array,
default: () => []
dataLineChart: {
type: Object,
default: () => {}
},
period: {
type: Object,
default: () => {}
},
filter: {
type: String,
default: 'd'
}
},
setup(props, {emit}) {
const arrlines = {}
// const customLabel = []
const data = computed({
get() {
arrlines.value = {
labels: [],
const filterStore = usePortalFilterStore()
const between = ref(0)
const arrlines = {
// labels: [''],
datasets: [
{
label: 'Посещений всего',
backgroundColor: 'crimson',
borderColor: 'crimson',
label: 'Открыто страниц',
backgroundColor: '#C62828',
borderColor: '#C62828',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
tooltips: false
data: [],
func: (val)=>{return val.count},
datakey: "count",
tooltips: false ,
yAxisID: 'y'
},
{
label: 'Уникальные посещения',
label: 'Активные пользователи',
backgroundColor: 'teal',
borderColor: 'teal',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
func: (val)=>{return val.unic.length},
datakey: "unic",
hidden: true,
customlabel: [],
tooltips: true
tooltips: true,
yAxisID: 'y'
}
,
{
label: 'CRR',
backgroundColor: '#673AB7',
borderColor: '#673AB7',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
func: (val, key)=>{ return parseFloat(crrfunc(key).toFixed(2))
},
datakey: "crr",
customlabel: [],
tooltips: true,
yAxisID: 'y1'
}
,
{
label: 'BR',
backgroundColor: '#283593',
borderColor: '#283593',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
func: (val)=>{return parseFloat((val.br/val.unic.length*100).toFixed(2))},
datakey: "br",
hidden: true,
customlabel: [],
tooltips: true,
yAxisID: 'y1'
}
,
{
label: 'PPV',
backgroundColor: '#EF9A9A',
borderColor: '#EF9A9A',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
func: (val)=>{return parseFloat((val.pages/val.unic.length).toFixed(2))},
datakey: "ppv",
hidden: true,
customlabel: [],
tooltips: true,
yAxisID: 'y'
}
]
}
arrforline()
return arrlines.value
const dataf=computed({get() {
fullpercreate()
let data1 = moment(filterStore.date_period.enddate)
let data2 = moment(filterStore.date_period.startdate)
between.value = data1.diff(data2, 'days') + 1
let res = null
if (Object.keys(props.dataLineChart).length>0){
res = arrlines
res.labels=[]
for(let [key,val] of Object.entries(props.dataLineChart))
{
res.datasets.forEach((e) => {
e.data.push(e.func(val,key))
// e.data = [10,20,30]
});
res.labels.push(formatComa(key))
}
// console.log(res.labels,"datat");
}
// res.datasets[1].data=[]
return res
}})
const fullper = ref([])
const fullpercreate = () => {
let arr = []
props.period.period.forEach((e) => {
let ind = arr.findIndex(el => el.visitdate == e.visitdate)
if (ind ==-1) {
arr.push({visitdate: e.visitdate, user: Array.from(new Set([e.user.id]))})
}
else {
arr[ind].user = Array.from(new Set(arr[ind].user).add(e.user.id))
}
})
fullper.value= [...props.period.before, ...arr]
}
// const data = ref(datachanged.value)
const crrfunc = (date)=>{
//
// let h = new Date('2024-01-20') >=moment(new Date(date)).subtract(between.value*2, 'd')
let baseunic = unicperson(fullper.value.filter(e => new Date(e.visitdate) >=moment(new Date(date)).subtract(between.value*2, 'd') && new Date(e.visitdate) <= moment(new Date(date)).subtract(between.value, 'd')))
let crrunic = unicperson(fullper.value.filter(e => new Date(e.visitdate) >=moment(new Date(date)).subtract(between.value, 'd') && new Date(e.visitdate) <= new Date(date)))
let bothuser = new Set([...baseunic].filter(element => crrunic.has(element)))
return baseunic.size ==0?0:bothuser.size*100/baseunic.size
}
const unicperson = (arr) => {
let arrnew =[]
arr.forEach(e => arrnew.push(...e.user) )
return new Set(arrnew)
}
const data=computed({get() {
return JSON.parse(JSON.stringify(dataf.value))
}
})
const linear=ref(null)
// watch(()=>data.value,()=>{
// console.log(linear.value)
// if(linear.value!==null) {
// console.log(linear.value.chart);
// // linear.value.chart.destroy()
// linear.value.chart.render(data.value, options)
// }
// }, {deep:true})
const options = {
plugins: {
// layout: {
// padding: 20
// },
plugins: {
datalabels: {
color: 'grey',
align: 'top',
display: 'auto'
},
legend: {
position: 'bottom',
labels: {
color: 'grey',
align: 'right',
}
},
tooltip: {
displayColors: false,
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (context.datasetIndex==1) {
if (context.parsed.y !== null) {
label =arrlines.value.datasets[1].customlabel[context.dataIndex];
}
return label
}
}
}
// tooltip: {
// displayColors: false,
// callbacks: {
// label: function(context) {
// let label = context.dataset.label || '';
// if (context.datasetIndex==1) {
// if (context.parsed.y !== null) {
// label =arrlines.value.datasets[1].customlabel[context.dataIndex];
// }
// return label
// }
// }
// }
// }
},
layout: {
padding: {
top: 35,
bottom: 5,
left: 20,
right: 15
}
},
scales: {
x: {
grid: {
color: 'white',
}
},
y: {
ticks: {
stepSize: 10
stepSize: 10,
},
offset: true,
grid: {
color: 'white',
}
}
},
y1: {
type: 'linear',
display: true,
position: 'right',
},
},
responsive: true,
@@ -107,33 +307,37 @@ export default {
}
const arrforline=() => {
let datas =
props.visiting.reduce((acc, item) => {
if (!acc[item.visitdate]) {
acc[item.visitdate] = {unic: [], count: 0}
}
acc[item.visitdate]['count'] += item.count
if (!acc[item.visitdate]['unic'].includes(splitname(item.author)))
{
acc[item.visitdate]['unic'].push(splitname(item.author))
}
return acc
}, {})
Object.entries(datas).forEach(e => {
const [key, value] = e
arrlines.value.datasets[0].data.push(datas[key].count)
arrlines.value.datasets[1].data.push(datas[key]['unic'].length)
arrlines.value.labels.push(format1(key))
arrlines.value.datasets[1].customlabel.push(datas[key].unic)
})
// const arrforline=() => {
// console.log(props.dataLineChart);
// for (let [key, val] of Object.entries) {}
// // Object.entries(props.dataLineChart).forEach(e => {
// // const [key, value] = e
// // arrlines.value.datasets[0].data.push(value.count)
// // arrlines.value.datasets[1].data.push(value.unic.length)
// // arrlines.value.datasets[2].data.push(value.crr)
// // arrlines.value.datasets[3].data.push(value.br)
// // arrlines.value.datasets[4].data.push(value.ppv)
// // arrlines.value.labels.push(formatComa(key))
// // arrlines.value.datasets[1].customlabel.push(props.dataLineChart[key].unic)
// // })
}
// // console.log(props.dataLineChart,'dataYear2 -------------');
// }
// watch(()=>props.dataLineChart,(newValue, oldValue)=>{
// if (linear.value!==null) {
// renderChart(data.value, options)
// }
// linear.value.chart.datasets =data.value.datasets
// },{deep:true})
return {
data,
options,
linear
}
}
}
@@ -141,4 +345,7 @@ export default {
<style>
canvas {
flex: 1!important
}
</style>
@@ -0,0 +1,179 @@
<template>
<v-card class="h-100 ">
<line-graph :data="data" :options="options"/>
</v-card>
</template>
<script>
import lineGraph from '@/components/graph/line-graph.vue'
import {computed } from 'vue'
import {formatComa, splitname} from '@/utils/universal_functions'
export default {
components: {
lineGraph,
},
props: {
dataLineChart: {
type: Object,
default: () => {}
},
},
setup(props, {emit}) {
const arrlines = {}
const data = computed({
get() {
arrlines.value = {
labels: [],
datasets: [
{
label: 'Открыто страниц',
backgroundColor: '#C62828',
borderColor: '#C62828',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
tooltips: false
},
{
label: 'Активные пользователи',
backgroundColor: 'teal',
borderColor: 'teal',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
,
{
label: 'CRR',
backgroundColor: '#673AB7',
borderColor: '#673AB7',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
,
{
label: 'BR',
backgroundColor: '#283593',
borderColor: '#283593',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
,
{
label: 'PPV',
backgroundColor: '#EF9A9A',
borderColor: '#EF9A9A',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
]
}
arrforline()
return arrlines.value
}
})
const options = {
plugins: {
datalabels: {
color: 'grey',
align: 'top',
display: 'auto'
},
legend: {
labels: {
color: 'grey',
}
},
tooltip: {
displayColors: false,
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (context.datasetIndex==1) {
if (context.parsed.y !== null) {
label =arrlines.value.datasets[1].customlabel[context.dataIndex];
}
return label
}
}
}
}
},
scales: {
x: {
grid: {
color: 'white',
}
},
y: {
ticks: {
stepSize: 10
},
offset: true,
grid: {
color: 'white',
}
}
},
responsive: true,
maintainAspectRatio: false
}
const arrforline=() => {
Object.entries(props.dataLineChart).forEach(e => {
const [key, value] = e
arrlines.value.datasets[0].data.push(value.count)
arrlines.value.datasets[1].data.push(value.unic.length)
arrlines.value.datasets[2].data.push(value.crr)
arrlines.value.datasets[3].data.push(value.br)
arrlines.value.datasets[4].data.push(value.ppv)
arrlines.value.labels.push(formatComa(key))
arrlines.value.datasets[1].customlabel.push(props.dataLineChart[key].unic)
})
}
return {
data,
options,
}
}
}
</script>
<style>
canvas {
flex: 1!important
}
</style>
@@ -0,0 +1,33 @@
<template>
<v-card class="h-100 d-flex" variant="flat">
<v-row no-gutters class="flex-column gap">
<v-col lg=1 class="bg-teal-lighten-5 w100">
<span class="font-weight-medium text-button text-teal-darken-4">
{{title}}
</span>
</v-col>
<v-col class="d-flex flex-column pt-1">
<slot name="filling_feedback"></slot>
</v-col>
</v-row>
</v-card>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
}
}
</script>
<style>
</style>
@@ -0,0 +1,48 @@
<template>
<v-card class="text-center h-100 d-flex flex-column ">
<v-row no-gutters class="flex-grow-0">
<v-col class="d-flex flex-column pa-1">
<v-chip
color="light-blue-darken-4"
label
class="text-center text-cyan-darken-4 rounded-0 text-subtitle-1 font-weight-medium"
>
<v-icon start color="cyan-darken-4" :icon="ico"/>
{{title}}
</v-chip>
</v-col>
</v-row>
<v-row no-gutters >
<v-col class="flex-column d-flex">
<v-card-text class="px-3 py-1 flex-column d-flex h-0 overflow-x-auto overflow-x-hidden">
<slot name="filling"></slot>
</v-card-text>
</v-col>
</v-row>
</v-card>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
ico: {
type: String,
default: ''
}
}
}
</script>
<style>
</style>
@@ -0,0 +1,194 @@
<template>
<pattern-card
:title="'Посещаемость портала'"
:ico="'mdi-walk'"
>
<template v-slot:filling>
<v-table class="text-subtitle-2 table_traffic pt-1">
<thead>
<tr>
<th class="pr-0"></th>
<th class="text-center px-1">сегодня</th>
<th class="text-center ">за период</th>
</tr>
</thead>
<tbody class="text-button">
<!-- -->
<tr
v-for="(val, key) in traffic"
:key = key
>
<td style="white-space: nowrap" class="text-left text-caption pr-0 pl-4 font-weight-medium cursor-default">
<!-- -->
<v-tooltip location="top" >
<template v-slot:activator="{ props }">
<span v-bind="props" >
<v-icon
class="cursor-help "
size="large"
:color="val.color"
:icon="val.ico"
/>
</span>
</template>
<v-row
>
<v-col >
{{val.tooltip}}
</v-col>
</v-row>
</v-tooltip>
</td>
<td class="text-center px-0 font-weight-bold text-subtitle-1 cursor-help text-grey-darken-3">
<v-tooltip location="top" v-if="val.proc!=''">
<template v-slot:activator="{ props }">
<span v-bind="props" >
{{ val.user.length }}
</span>
</template>
<v-row
no-gutters v-for="n in val.user"
:key="n"
>
<v-col >
{{n}}
</v-col>
</v-row>
</v-tooltip>
</td>
<td class="text-center px-0 font-weight-bold text-subtitle-1 text-grey-darken-3 cursor-default" v-if="val.proc!=''">{{ val.proc }}%</td>
<td class="text-center font-weight-bold text-subtitle-1 text-grey-darken-3 cursor-default" v-else>
<v-icon
v-if="parseFloat((val.user.length * 100 /val.previos).toFixed(2))-100 != 'Infinity' && parseFloat((val.user.length * 100 /val.previos).toFixed(2))-100 != 0"
size="x-small"
:class="val.previos<val.user.length?'pb-1':'pt-0'"
:color="val.previos<val.user.length?'green-darken-2':'deep-orange-darken-4'"
:icon="val.previos<val.user.length?'mdi-arrow-up-bold':'mdi-arrow-down-bold'"
/>
<span v-if="val.previos!=0">
{{parseFloat(((val.user.length * 100 /val.previos)-100).toFixed(2))}} %
</span>
<span v-else>
0%
</span>
</td>
</tr>
</tbody>
</v-table>
</template>
</pattern-card>
</template>
<script>
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
import { ref, computed } from 'vue'
import {formatDash, splitname, checking_for_entry} from '@/utils/universal_functions'
import { usePortalFilterStore } from '@/store/AboutPortalFilter'
import moment from 'moment'
export default {
components: {
PatternCard
},
props: {
alldata: {
type: Object,
default: () => {return {period: [], staff: 0}}
},
// traffic: {
// type: Object,
// default: () => {}
// }
},
setup(props) {
const filterStore = usePortalFilterStore()
const traffic = computed({
get() {
let res = {
"today": {
"tooltip": "Уникальные пользователи",
"user": [],
"proc": "",
"ico": "mdi-account-box",
"color" : "indigo"
},
"period": {
"tooltip": "% от штата",
"user": [],
"proc": "",
"ico": "mdi-chart-pie",
"color" : "green"
}
,
"before": {
"tooltip":"По сравнению предыдущим периодом",
"user": [],
"proc": "",
"previos": 0,
"ico": "mdi-elevation-rise",
"color" : "pink-darken-4"
}
}
props.alldata.period.forEach(e => {
if (e.visitdate == formatDash(new Date())) {
checking_for_entry(res.today.user, splitname(e.user))
}
if (new Date(e.visitdate) <= filterStore.date_period.enddate) {
checking_for_entry(res.period.user, splitname(e.user))
}
})
res.before.user=res.period.user
res.today.proc = parseFloat(((res.today.user.length * 100) / props.alldata.staff).toFixed(2))
res.period.proc = parseFloat(((res.period.user.length * 100) / props.alldata.staff).toFixed(2))
res.period.tooltip =`% от штата (${props.alldata.staff} сотрудников не конец выбранного периода)`
let data1 = moment(filterStore.date_period.enddate)
let data2 = moment(filterStore.date_period.startdate)
let between = data1.diff(data2, 'days') + 1
props.alldata.beforperiod.filter( e=> data2.diff(moment(e.visitdate), 'days') < between).reduce((acc, item) => {
res.before.previos += item.user.length
return acc
}, res.before.previos)
return res
}
})
return {
traffic
}
}
}
</script>
<style>
.v-table > .v-table__wrapper > table > tbody > tr > td
{
padding: 0 0 0px;
}
</style>
@@ -0,0 +1,283 @@
<template>
<pattern-card
:title="'Рейтинг посещаемости страниц портала'"
:ico="'mdi-chart-bar'"
>
<template v-slot:filling>
<v-data-table-virtual
:headers="headers"
:items="tabledata"
height="400"
class="mytable"
item-value="name"
@update:sortBy=customSort
v-model:sort-by="sortBy"
density="compact"
>
<template v-slot:header.name>
<!-- v-model:sort-by="sortBy" -->
<v-switch
:label="untot"
false-value='уникальные'
true-value='всего'
hide-details
v-model="untot"
class="myleft ml-n4"
/>
</template>
<template v-slot:item.name="{ value }">
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2">
{{ value }}
</span>
</template>
<template v-slot:item.now="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
<v-tooltip
v-if="value>0"
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
{{value}}
</span>
</template>
<v-row
no-gutters
>
<v-col>
<v-row
no-gutters v-for="n in item.now.unic"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</v-col>
</v-row>
</v-tooltip>
</span>
</template>
<template v-slot:item.period="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
<v-tooltip
v-if="value>0"
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" :class="'untot'=='уникальные'?getColorPeriod1(value):getColorPeriod2(value)" class="cursor-help font-weight-medium text-subtitle-1" >
{{value}}
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
</span>
</template>
<v-row
no-gutters
>
<v-col>
<v-row
no-gutters v-for="n in item.period.unic"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</v-col>
</v-row>
</v-tooltip>
</span>
</template>
</v-data-table-virtual>
</template>
</pattern-card>
</template>
<script>
import { ref, computed, watch } from 'vue'
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
import TooltipText from '@/components/UI/tooltip-text.vue'
import {splitname, checking_for_entry, formatDash} from '@/utils/universal_functions'
import moment from 'moment'
export default {
components: { TooltipText, PatternCard },
props: {
pages_count: {
type: Array,
default: () => [],
}
},
setup(props) {
const sortBy = ref([
{
"key": "now",
"order": "desc"
}
])
const untot=ref('уникальные')
let headers = ref([
{ title: '', align: 'start', key: 'name' },
{ title: 'сегодня', align: 'center', key: 'now',
value: item => `${untot.value=='уникальные'?item.now.unic.size:item.now.total}`,
},
{ title: 'за период', align: 'center', key: 'period',
value: item => `${untot.value=='уникальные'?item.period.unic.size:item.period.total}` },
])
const datas = ()=>{
let data = []
props.pages_count.forEach((e) => {
let ind = data.findIndex(el=>el.name==e.pages)
if(ind==-1){
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}}
if (e.visitdate == formatDash(new Date())){
ob.now.unic.add(splitname(e.user))
ob.now.total = e.count
}
ob.period.unic.add(splitname(e.user))
ob.period.total = e.count
data.push(ob)
}
else{
if (e.visitdate == formatDash(new Date())){
data[ind].now.unic.add(splitname(e.user))
data[ind].now.total +=e.count
}
data[ind].period.unic.add(splitname(e.user))
data[ind].period.total +=e.count
}
})
return data
}
const modelrating = ref(false)
const getColorTooday1 = (pages) => {
if (pages > 10) return 'text-green'
else if (pages > 5) return 'text-orange'
else return 'text-red'
}
const getColorPeriod1 = (pages) => {
console.log(pages, 'ssssssssssssssssssssssssssssssss');
if (pages > 30) return 'text-green'
else if (pages > 15) return 'text-orange'
else return 'text-red'
}
const getColorTooday2 = (pages) => {
if (pages > 50) return 'text-green'
else if (pages > 25) return 'text-orange'
else return 'text-red'
}
const getColorPeriod2 = (pages) => {
console.log(pages, 'ssssssssssssssssssssssssssssssss');
if (pages > 100) return 'text-green'
else if (pages > 50) return 'text-orange'
else return 'text-red'
}
const getColorNow = (pages) => {
if (pages > 10) return 'text-green'
else if (pages > 5) return 'text-orange'
else return 'text-red'
}
const customSort= ()=> {
let arr=tabledata.value
if (sortBy.value!==undefined && sortBy.value.length>0){
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
if (untot.value=='уникальные'){
arr.sort((a,b)=>{
if (a[sortBy.value[0].key].unic.size>b[sortBy.value[0].key].unic.size) return factor[0]
if (a[sortBy.value[0].key].unic.size<b[sortBy.value[0].key].unic.size) return factor[1]
return 0 })
}else{
arr.sort((a,b)=>{
if (a[sortBy.value[0].key].total>b[sortBy.value[0].key].total) return factor[0]
if (a[sortBy.value[0].key].total<b[sortBy.value[0].key].total) return factor[1]
return 0 })
}
}
tabledata.value=arr
}
const tabledata = ref(datas())
watch(()=>props.pages_count,(newValue)=>{
if (newValue!==[]){
tabledata.value=datas()
customSort()
}
})
// tabledata.value=datas.value
return {
tabledata,
sortBy,
customSort,
untot,
modelrating,
getColorTooday1,
getColorPeriod1,
getColorTooday2,
getColorPeriod2,
getColorNow,
headers,
datas
}
}
}
</script>
<style>
.v-table {
flex: 1!important;
}
.mytable tr {
font-size: 12px;
}
.myleft {
float: left;
}
</style>
@@ -0,0 +1,61 @@
<template>
<v-toolbar
density="compact"
class="text-h6 font-weight-regular"
>
<v-icon
icon="mdi-poll"
color="cyan-darken-3"
class="mx-2"
/>
Статистика портала за период с
<div class="px-2 pb-1">
<date-select
@returndate="returnstart"
:datedefault = "filterStore.date_period.startdate"
/>
</div>
по
<div class="px-2 pb-1">
<date-select
@returndate="returnend"
:datedefault = "filterStore.date_period.enddate"
/>
</div>
</v-toolbar>
</template>
<script>
import DateSelect from '@/components/UI/date-select.vue'
import { usePortalFilterStore } from '@/store/AboutPortalFilter'
export default {
components: {
DateSelect
},
setup(){
const filterStore = usePortalFilterStore()
const returnstart = (dates) => {
filterStore.date_period.startdate = dates
}
const returnend = (dates) => {
filterStore.date_period.enddate = dates
}
return {
returnstart,
returnend,
filterStore
}
}
}
</script>
<style>
</style>
@@ -1,80 +1,292 @@
<template>
<v-card
class="mx-auto" height="150px"
<pattern-card
:title="'Самые активные пользователи'"
:ico="'mdi-star-circle'"
>
<v-card-text class="text-h5 pa-2 pl-5 flex-wrap align-center d-flex justify-space-between">
{{name}}
<!-- <my-helper :pretext="users"/> -->
<v-icon
color="blue-grey-lighten-1"
:icon="ico"
size="35"
/>
</v-card-text>
<v-divider/>
<v-card-text class="pa-0 d-flex flex-column h-100">
<v-row no-gutters>
<v-col lg=8 class="px-0 ">
<list-user :author=users />
</v-col>
<v-col class="pt-8 text-center">
<span class="subheading text-h6">
{{users.count}}
<v-tooltip
v-if="name=='Активность'"
activator="parent"
location="top"
>
<div v-for="x in users.info" :key=x>
{{x}}
</div>
</v-tooltip>
</span>
</v-col>
</v-row>
</v-card-text>
</v-card>
<template v-slot:filling>
<v-data-table-virtual
v-model:expanded="expanded"
:headers="dessertHeaders"
:items="dataActivusers"
item-value="user.id"
show-expand
class="h-0 cursor-default "
:sort-by="[{ key: 'info.count', order: 'desc' }]"
density="compact"
>
<template v-slot:item.user="{ value }">
<list-user
:author=value
:from_which = "'top-user'"
/>
</template>
<template v-slot:headers="{ columns, isSorted, getSortIcon, toggleSort }">
<tr>
<template v-for="column in columns" :key="column.key">
<td class="pa-0">
<v-tooltip location="top" v-if="column.title!=''">
<template v-slot:activator="{ props }">
<v-btn
v-bind="props"
:append-icon="isSorted(column)?getSortIcon(column):''"
variant="text"
class="text-caption"
@click="() => toggleSort(column)"
>
{{ column.title }}
<template v-slot:append>
<v-icon size="x-small"></v-icon>
</template>
</v-btn>
</template>
<span>{{ column.tooltip }} </span>
</v-tooltip>
</td>
</template>
</tr>
</template>
<template v-slot:expanded-row="{ columns, item }">
<tr>
<td :colspan="columns.length">
<v-card class="my-2 elevation-0" color='grey'>
<v-divider/>
<v-data-table
:headers="subtable"
:items="item.tooltip"
items-per-page=-1
class="subtable cursor-default px-3 bg-grey-lighten-5 text-body-2"
density="compact"
:sort-by="[{ key: 'count', order: 'desc' }]"
>
<template v-slot:headers="{ columns, isSorted, getSortIcon, toggleSort }">
<tr>
<template v-for="column in columns" :key="column.key">
<td class="pa-0">
<v-btn
:append-icon="isSorted(column)?getSortIcon(column):''"
variant="text"
class="text-caption"
@click="() => toggleSort(column)"
>
{{ column.title }}
<template v-slot:append>
<v-icon size="x-small"></v-icon>
</template>
</v-btn>
</td>
</template>
</tr>
</template>
<template v-slot:item.unic="{ value }">
<span :class="'text-'+getColor2(value) " class="font-weight-medium text-subtitle-2">
{{ value }}
</span>
</template>
<template v-slot:item.count="{ value }">
<span :class="'text-'+getColor(value) " class="font-weight-medium text-subtitle-2">
{{ value }}
</span>
</template>
</v-data-table>
</v-card>
</td>
</tr>
</template>
</v-data-table-virtual>
</template>
</pattern-card>
</template>
<script>
import { ref, computed } from 'vue'
import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
import listUser from '@/components/UI//fiousercard/listUser.vue'
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
export default {
components: { listUser },
components: {
listUser,
PatternCard
},
props: {
name: {
type: String,
default: ''
},
users: {
activusers: {
type: Object,
default: {}
},
ico: {
type: String,
default: 'mdi-emoticon-poop'
}
},
setup() {
setup(props) {
const desserts = [
{
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
iron: 1,
},
{
name: 'Ice cream sandwich',
calories: 237,
fat: 9.0,
carbs: 37,
protein: 4.3,
iron: 1,
}]
const dataActivusers = computed({
get() {
let res = []
props.activusers.forEach((e) => {
let ind = res.findIndex(el => el.user.id == e.user.id)
if (ind == -1) {
res.push({user: e.user,
info: {
count: e.count,
session:new Set([e.visitdate]),
pages: 1
},
tooltip: [{
namepages: e.pages,
count: e.count,
unic: 1
}]
})
}
else {
let ob =res[ind]
ob.info.count += e.count,
ob.info.session.add(e.visitdate)
ob.info.pages += 1
let indt = ob.tooltip.findIndex(elem =>
elem.namepages === e.pages)
if (indt == -1) {
ob.tooltip.push({
namepages: e.pages,
count: e.count,
unic: 1
})
}
else {
ob.tooltip[indt].unic += e.count
ob.tooltip[indt].unic += 1
}
}
})
return res
}
})
const expanded = ref([])
const dessertHeaders = [
{
title: '',
align: '',
sortable: false,
key: 'user',
},
{ title: 'просмотры', align: 'start', key: 'info.count', tooltip: 'Количество посещенных страниц за период' },
{ title: 'сессии', align: 'start', key: 'info.session.size', tooltip: 'Сколько дней посещали Портал за период'},
{ title: 'страницы', align: 'start', key: 'info.pages', tooltip: 'Сколько суммарно посещено уникальных страниц за период' },
]
const subtable = [
{
title: '',
align: 'start',
sortable: false,
key: 'namepages',
width: '60%',
maxWidth: '60%',
minWidth: '60%',
},
{ title: 'всего', align: 'center', key: 'count', width: '20%', maxWidth: '20%'
},
{ title: 'уникальных', align: 'center', key: 'unic', width: '20%', maxWidth: '20%'
},
]
const getColor = (pages) => {
if (pages > 100) return 'green'
else if (pages > 50) return 'orange'
else return 'red'
}
const getColor2 = (pages) => {
if (pages > 10) return 'green'
else if (pages > 5) return 'orange'
else return 'red'
}
return {
checkremote,
spravURL,
expanded,
dessertHeaders,
dataActivusers,
subtable,
getColor,
getColor2,
desserts
}
}
}
</script>
<style>
.subtable .v-data-table-footer {
display: none
}
.subtable tbody {
text-align: start!important;
}
</style>
+17 -10
View File
@@ -9,7 +9,7 @@
<template v-slot:activator="{ props }">
<v-textarea
v-model="selectedDate"
:value="dateformat()"
:value="formatComa(datedefault)"
no-resize
class="my-textarea"
rows="1"
@@ -37,6 +37,8 @@
hide-header
@update:modelValue="dateStart"
border
:max="formatDash(new Date())"
:min="formatDash(appStore.countvisitor.visitdate)"
/>
</v-locale-provider>
@@ -44,37 +46,42 @@
</template>
<script>
import moment from 'moment'
import { ref } from 'vue'
import { ref } from 'vue'
import {formatComa, formatDash} from '@/utils/universal_functions'
import { useAppStore } from '@/store/app'
export default {
props: {
datedefault: {
type: String,
type: Date,
default: ''
}
},
setup(props, {emit}) {
setup(props, {emit}) {
const appStore = useAppStore()
const maxdate = formatDash(new Date())
console.log(maxdate, 'ssssssssssssssssssssss');
const menudate = ref(false)
const selectedDate = ref(null)
const dateStart = () => {
emit('returndate', moment(selectedDate.value).format('YYYY-MM-DD'))
emit('returndate', selectedDate.value)
menudate.value=false
}
const dateformat = () => {
return moment(props.datedefault).format('DD.MM.YYYY')
}
return {
menudate,
selectedDate,
dateStart,
dateformat
formatComa,
formatDash,
appStore,
}
}
@@ -0,0 +1,84 @@
<template>
<v-list class="pa-0">
<v-list-item
v-if="!rail"
class="text-caption font-weight-bold text-truncate"
>
<v-tooltip>
<template v-slot:activator="{ props }">
<v-icon
icon="mdi-information"
color="cyan-darken-3"
size="12"
v-bind="props"
/>
</template>
<span class="text-caption">
Информация о странице: <br/>
{{router.currentRoute.value.meta.title}} <br/>
с {{formatComa(appStore.countvisitor.visitdate)}}
</span>
</v-tooltip>
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Из них уникальных: {{ appStore.countvisitor.uniqtoday }}</p>
<v-divider />
</v-list-item>
<v-list-item v-else class="align-center">
<v-tooltip
v-model="showTooltip"
location="top"
>
<template v-slot:activator="{ props }">
<v-icon
v-bind="props"
color="grey"
>
mdi-account-eye
</v-icon>
</template>
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Из них уникальных: {{ appStore.countvisitor.uniqtoday }}</p>
</v-tooltip>
</v-list-item>
</v-list>
</template>
<script>
import { formatComa } from '@/utils/universal_functions'
import { useRouter } from 'vue-router'
import { useAppStore } from '@/store/app'
import { ref } from 'vue'
export default {
props: {
rail: {
type: Boolean,
default: false
}
},
setup() {
const router = useRouter()
const appStore = useAppStore()
const showTooltip = ref(false)
return {
router,
appStore,
showTooltip,
formatComa
}
}
}
</script>
<style>
</style>
@@ -1,54 +1,111 @@
<template>
<v-row class="h-100 ">
<v-row class="h-100" v-if="how=='modal'">
<v-col class="d-flex flex-column align-self-center">
<v-row
v-for="(x, key) in criteria"
:key = key
class="align-center"
v-for="(x, key) in criteria"
:key = key
class="align-center"
>
<v-col
class="pl-5"
lg=5
>
<v-icon
size="large"
:color="x.color"
:icon="x.ico"
/>
{{x.name}}
</v-col>
<v-col lg=6>
<v-rating
v-model="message[key].rating"
:hover="typeof(key) == 'number'"
half-increments
color="yellow"
:density="'comfortable'"
/>
</v-col>
<v-divider/>
</v-row>
</v-col>
</v-row>
<pattern-card-feed
v-else
:title="'Средняя оценка'"
>
<template v-slot:filling_feedback>
<div v-if="criteria.length!=0">
<v-row
class="align-center flex-column scoreheight gap mt-n2"
no-gutters
>
<div class="flex-columnd-flex gap pa-0"
v-for="(x, key) in criteria"
:key = key
>
<v-col lg=1 class="text-subtitle-1 font-weight-regular w100 pa-0"
>
<v-col class="flex-grow-0">
</v-col>
<v-col class=""
lg=5
>
<v-icon
size="large"
:color="x.color"
:icon="x.ico"
/>
{{x.name}}
</v-col>
<v-col
lg=6
>
<v-rating
v-model="message[key].rating"
:hover="typeof(key) == 'number'"
half-increments
:readonly="how==''?true:false"
color="yellow"
:density="how==''?'compact':'comfortable'"
/>
</v-col>
<v-divider v-show="how=='modal'"/>
</v-row >
</v-col>
</v-row>
<v-icon
size="small"
:color="x.color"
:icon="x.ico"
/>
{{x.name}}
</v-col>
<v-col lg=2 class=" w100 pa-1 pt-1">
<v-rating
v-model="message[key].ratings"
:hover="typeof(key) == 'number'"
half-increments
readonly
:size="25"
color="yellow"
:density="'comfortable'"
/>
</v-col>
</div>
</v-row>
</div>
<div class="d-flex flex-column" v-else>
<v-row
class="align-center flex-column scoreheight gap mt-n2"
no-gutters
>
<v-col
class="text-h6 pt-8 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
За выбранный период оценок нет
</v-col>
</v-row>
</div>
</template>
</pattern-card-feed>
</template>
<script>
import { computed } from 'vue'
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
import { computed } from 'vue'
export default {
@@ -58,7 +115,7 @@ export default {
default: {}
},
rating: {
ratings: {
type: Object,
default: {}
},
@@ -69,13 +126,16 @@ export default {
}
},
components: {
PatternCardFeed,
},
setup(props, { emit }) {
// console.log(useDebugValue(getCurrentComponent().proxy.$options.name) , 'route.path');
const message = computed({
get: () => props.rating,
set: (value) => emit('update:rating', value)
get: () => props.ratings,
set: (value) => emit('update:ratings', value)
})
return {
@@ -88,5 +148,7 @@ export default {
</script>
<style>
.scoreheight {
min-height: 150px;
}
</style>
@@ -1,36 +1,65 @@
<template>
<div style="height:68%">
<v-list-item class="pl-4 h-100 pointer" @click="open=true">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
/>
</template>
<v-list-item-title class="text-body-1 font-weight-medium pt-2">
{{author.fio}}
</v-list-item-title>
<v-list-item-subtitle class="pb-2">
{{author.post}}
</v-list-item-subtitle>
</v-list-item>
<info-user-card
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
<div>
<v-list-item v-if="from_which=='dialog-search'" class="pl-4 h-100 text-left pa-2" @click="open=true">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
/>
</template>
<v-list-item-title :class="style_item_title()">
{{author.fio}}
</v-list-item-title>
<v-list-item-subtitle :class="style_item_subtitle()">
{{author.post}}
</v-list-item-subtitle>
</v-list-item>
<v-list-item v-if="from_which=='top-user'" class="h-100 text-left pa-2 pl-0" @click="open=true">
<v-chip
class="cursor-pointer text-body-2 pa-0"
variant='text'
label
color="grey-darken-3"
size="small"
>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
class="mr-2"
/>
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2">
{{splitname(author)}}
</span>
</v-chip>
</v-list-item>
<!-- <v-list-item class="h-100 text-left pa-2" @click="open=true"> -->
<v-img
v-if="from_which=='top_comment'"
@click="open=true"
cover
class="cursor-pointer"
:src="checkremote(`${spravURL}${author.login}.jpg`)"
/>
<!-- </v-list-item> -->
<info-user-card
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
</template>
<script>
import { ref } from 'vue'
import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
import {splitname} from '@/utils/universal_functions'
export default {
props: {
@@ -38,14 +67,47 @@ export default {
type: Object,
default: {}
},
from_which: {
type: String,
default: "dialog-search"
}
},
setup(){
setup(props){
const open = ref(false)
// const countcomment = () => {
// console.log(props.top);
// }
// countcomment()
const style_item_title = () => {
if (props.from_which=="top-user") {
return "text-body-1 font-weight-medium"
}
else
return "text-body-1 font-weight-medium pt-2"
}
const style_item_subtitle = () => {
if (props.from_which=="top-user") {
return "text-caption"
}
else
return "pb-2"
}
return {
open,
checkremote,
spravURL
spravURL,
style_item_title,
style_item_subtitle,
splitname
}
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
import myHelper from '@/components/UI/my-helper';
import InfoUserCard from '@/components/UI/infoUserCard.vue';
import TooltipText from '@/components/UI/tooltip-text.vue'
export default [myHelper, InfoUserCard,]
export default [myHelper, InfoUserCard, TooltipText, ]
+1 -2
View File
@@ -39,8 +39,7 @@ export default {
props: {
pretext: {
type:Object,
default:()=>{}
}
},
@@ -0,0 +1,48 @@
<template>
<v-tooltip
location="bottom"
v-if="number>0"
>
<template v-slot:activator="{ props }">
<span v-bind="props">
{{number}}
</span>
</template>
<v-row
no-gutters v-for="n in tooltip"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</v-tooltip>
<span v-else>
0
</span>
</template>
<script>
export default {
props: {
tooltip: {
type: Array,
default: () => []
},
number: {
type: Number,
default: 0
}
},
}
</script>
<style>
</style>
@@ -0,0 +1,37 @@
<template>
<v-tooltip
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" class="cursor-help">
{{text}}
</span>
</template>
<v-row
no-gutters
>
<v-col>
<slot name="tooltip"></slot>
</v-col>
</v-row>
</v-tooltip>
</template>
<script>
export default {
name: "TooltipText",
props: {
text: {
},
},
}
</script>
<style>
</style>
+3 -2
View File
@@ -15,7 +15,7 @@
<star-like
:criteria=feedbackdata.basecrit
:rating=feedbackdata.nowrating
:ratings=feedbackdata.nowrating
how="modal"
@update:rating="feedbackdata.nowrating = $event"
/>
@@ -80,7 +80,7 @@ export default {
feedbackdata.value = data.data
if (feedbackdata.value.nowrating.length == 0) {
for (let x of feedbackdata.value.basecrit) {
feedbackdata.value.nowrating.push({rating: x.rating, crit: x.id, id: null})
feedbackdata.value.nowrating.push({ratings: x.rating, crit: x.id, id: null})
}
}
if (feedbackdata.value.nowcomment === null) {
@@ -118,6 +118,7 @@ export default {
}
function feedSend() {
console.log(feedbackdata.value.nowrating, 'feedbackdata.value.nowrating----------------------');
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
menusCloses()
}
+69 -80
View File
@@ -1,102 +1,88 @@
<template>
<!-- cycle -->
<v-carousel
cycle
interval="10000"
cover
height="450"
hide-delimiters
hide-delimiter-background
show-arrows="hover"
color="white"
>
<v-carousel-item
v-for="(x, i) in carous" :key="i"
:src="`${burl}${x.link}`"
cover
eager
>
<!-- -->
<v-carousel
cycle
interval="10000"
cover
height="450"
hide-delimiters
hide-delimiter-background
show-arrows="hover"
color="white"
>
<v-carousel-item
v-for="(x, i) in carous" :key="i"
:src="`${burl}${x.link}`"
cover
eager
>
<v-container
fill-height
fluid
pa-0 ma-0 pb-3
class="flex-column h-100 d-flex"
>
<v-card class="bgCard h-100 d-flex flex-column">
<v-card-title class="ma-2 text-h3 text-uppercase titles text-text_carous py-5 flex-column">
<v-row>
<v-col class="pa-0 pl-1 align-self-center">{{x.title}} </v-col>
<v-col class="flex-grow-0 pa-0 pr-1">
<v-img
width="50"
:aspect-ratio="1"
:src="`${burl}${x.sender}`"
cover
/>
</v-col>
</v-row>
</v-card-title>
<v-card-text class="ml-2 mb-0 mb-2 w-50 flex-grow-0 pb-3 text-h6 bgText overflow-auto ">
<v-textarea
class="text-text_carous mt-n3 text-black textareas pt-2 font-weight-medium"
:model-value=x.text
variant='plain'
readonly
auto-grow
rows="1"
hide-details
/>
</v-card-text>
</v-card>
</v-container>
</v-carousel-item>
</v-carousel>
<v-card
v-if="x.text != '' || x.title != null"
class="bgCard h-100 d-flex flex-column"
>
<v-card-title v-if="x.title != null"
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0">
<v-row no-gutters >
<v-col class="align-self-center">
{{x.title}}
</v-col>
<v-col class="flex-grow-0">
<v-img
width="50"
:aspect-ratio="1"
:src="`${burl}${x.sender}`"
cover
/>
</v-col>
</v-row>
</v-card-title>
<v-card-text
v-if="x.text != ''"
class=" w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
>
<v-textarea
class="text-text_caroustext-black textareas font-weight-medium nocursor"
:model-value=x.text
variant='solo'
readonly
auto-grow
rows="1"
hide-details
flat
bg-color="transparent"
/>
</v-card-text>
</v-card>
</v-container>
</v-carousel-item>
</v-carousel>
</template>
<script>
import { ref, computed } from 'vue'
import { ref } from 'vue'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
export default {
setup() {
const burl = baseURL.slice(0,-1)
const carous=ref([{link: "newsimage/default.jpg"}])
getfromserver("api/navigation/carousels/", carous)
getfromserver("api/navigation/carousels/", carous)
return { burl, carous}
return {
burl,
carous
}
}
}
@@ -105,12 +91,15 @@ export default {
<style>
.titles {
font-family: cursive !important;
font-family: cursive!important;
background: #ffffff8c;
}
.textareas .v-field__input {
font-size: 1.3em!important;
}
.nocursor textarea {
cursor: default !important;
}
</style>
+2 -1
View File
@@ -28,7 +28,8 @@
</v-card-title>
<v-card-text
@click="detailRound(x.position, x.position__name)"
class="numstyle mt-2 py-0 font-weight-bold pointer bg-black_and_white"
class="numstyle mt-2 py-0 font-weight-bold cursor-
pointer bg-black_and_white"
>
<vue3-autocounter
@@ -13,12 +13,13 @@ import {
LineElement,
Title,
Tooltip,
Legend
Legend,
TimeScale
} from 'chart.js'
import { Line } from 'vue-chartjs'
import * as chartConfig from './chartConfig.js'
import ChartDataLabels from 'chartjs-plugin-datalabels'
import 'chartjs-adapter-moment'
ChartJS.register(
ChartDataLabels,
CategoryScale,
@@ -27,7 +28,8 @@ ChartJS.register(
LineElement,
Title,
Tooltip,
Legend
Legend,
TimeScale
)
export default {
+5 -2
View File
@@ -21,7 +21,7 @@
<v-col class="pa-0" >
<v-pagination
v-model="page"
:length=countetnews+1
:length=visiblePage
:total-visible="7"
@update:modelValue="loadNewsAll"
/>
@@ -65,14 +65,16 @@ export default {
const page = ref(1)
const countpage = ref(8)
const route = useRoute()
const visiblePage = ref(0)
const loadNewsAll = () => {
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
newsAll.value= result.data.result
countetnews.value = result.data.countpage/countpage.value
visiblePage.value = countetnews.value <= 1 ? 1 : countetnews.value+1
}
)
}
}
loadNewsAll()
@@ -81,6 +83,7 @@ export default {
countetnews,
page,
countpage,
visiblePage,
loadNewsAll,
}
}
+2 -2
View File
@@ -166,7 +166,7 @@
<v-img
cover
class=" pointer"
class=" cursor-pointer"
:src="`${burl}${e.img}`"
@click="openImg(e.id)"
/>
@@ -311,7 +311,7 @@
rows="1"
row-height="25"
shaped
@keyup.enter.exact="addComment(newsFull.id)"
hide-details
v-model="textcomment"
/>
+31 -51
View File
@@ -125,10 +125,10 @@
:title="x.name"
:value="x.name"
:href="x.link"
:disabled="x.path=='/securyty'"
:disabled="x.path==''"
:to="x.path"
color="navigation">
<!-- Чтобы сделать неактивным раздел безопасность, не забыть прописать путь до него в disabled для показа -->
<template v-slot:prepend>
<v-icon :icon="x.ico"/>
<v-tooltip
@@ -203,40 +203,10 @@
</v-list>
</v-col>
</v-row>
<v-row class="flex-grow-0">
<v-col class="py-0 pl-1 d-flex flex-column">
<v-list class=" d-flex flex-column ">
<v-list-item v-if="!rail" class="text-caption font-weight-bold text-truncate">
<p>Посещений всего:{{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
<v-divider />
</v-list-item>
<v-list-item v-else class="align-center ml-2">
<v-tooltip
v-model="showTooltip"
location="top">
<template v-slot:activator="{ props }">
<v-icon v-bind="props" color="grey">
mdi-account-eye
</v-icon>
</template>
<p>Посещений всего: {{ appStore.countvisitor.totalvisit }}</p>
<v-divider />
<p>Посещений сегодня: {{ appStore.countvisitor.visittoday }}</p>
<v-divider />
<p>Уникальных посещений: {{ appStore.countvisitor.uniqtoday }}</p>
</v-tooltip>
</v-list-item>
</v-list>
<v-row no-gutters class="flex-grow-0">
<v-col>
<page-counter :rail=rail />
</v-col>
</v-row>
</v-col>
@@ -293,25 +263,30 @@ import { ref, computed} from 'vue'
import uf from '@/utils/universal_functions'
import { useAccountStore } from '@/store/AccountStore'
import { useMainmenuStore } from '@/store/MainmenuStore'
import { useAppStore } from '@/store/app'
import { useTheme } from "vuetify";
import AuthForm from '@/components/UI/Auth-form.vue'
import OnlineUsers from '@/components/UI/fiousercard/onlineUsers.vue'
import CardLike from '@/components/cardLike.vue'
import { clearAxios } from '@/utils/axios-api'
import { useRouter } from 'vue-router'
import { baseURL } from '@/utils/axios-api'
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
import PageCounter from '../../components/UI/defaultportal/page-counter.vue'
export default {
components: { AuthForm, OnlineUsers, CardLike, VcardUser },
components: {
AuthForm,
OnlineUsers,
CardLike,
VcardUser,
PageCounter
},
mixins: [uf],
setup() {
// pagecounter()
const router = useRouter()
const appStore = useAppStore()
const theme = useTheme();
const mainmenuStore = useMainmenuStore()
const accountStore = useAccountStore()
@@ -326,12 +301,12 @@ export default {
const scrimg = ref([])
const screenimg = () => {
if(!accountStore.cod2user){
clearAxios.get(`api/navigation/screensaver/`)
.then(data => {
scrimg.value = data.data[0].img
})
})}
}
screenimg()
@@ -389,11 +364,16 @@ export default {
ico: 'mdi-newspaper',
path: "/news"
},
{
name: 'Безопасность',
ico: 'mdi-routes',
path: "/securyty"
},
// {
// name: 'Безопасность',
// ico: 'mdi-security',
// submenu: [
// {
// name: 'Пожарная безопасность',
// path: "/fire_safety"
// },
// ]
// },
{
name: 'О портале',
ico: 'mdi-information-variant',
@@ -431,11 +411,11 @@ export default {
imageSrc,
LikeDialog,
scrimg,
appStore,
rail,
showTooltip,
menuTruncated,
router,
alert,
burl
}
+1
View File
@@ -35,3 +35,4 @@ registerPlugins(app)
app.mount('#app')
+5
View File
@@ -2,9 +2,14 @@
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
import { ru } from 'vuetify/locale'
export default createVuetify({
locale: {
messages: { ru },
},
theme: {
defaultTheme: 'light'
},
+11 -3
View File
@@ -61,7 +61,7 @@ const routes = [
name: 'LaborProtection',
component: () => import('@/views/LaborProtection.vue'),
meta:{
title:"Безопасность",
title:"Охрана труда",
ico: "mdi-pharmacy"
}
},
@@ -70,8 +70,16 @@ const routes = [
name: 'SecurityPage',
component: () => import('@/views/SecurityPage.vue'),
meta:{
title:"Охрана труда",
ico: "mdi-ticket"
title:"Безопасность",
ico: "mdi-security"
}
},
{
path: '/:chapter_id',
component: () => import('@/views/safety/ChaptersSafety.vue'),
meta: {
title: "Разделы безопасности",
ico: "mdi-fire-extinguisher",
}
},
{
+15
View File
@@ -0,0 +1,15 @@
// Utilities
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const usePortalFilterStore = defineStore('filter', () => {
const date_period = ref({ "startdate": new Date(new Date().getFullYear(), 0, 1),
"enddate": new Date(),
})
return { date_period }
},
)
+1
View File
@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import {ref} from 'vue'
import { clearAxios } from '@/utils/axios-api'
export const useMainmenuStore = defineStore('MainmenuStore', () => {
const portallinks = ref([])
+3 -1
View File
@@ -6,7 +6,9 @@ export const useAppStore = defineStore('app', () => {
const loading = ref(false)
const countvisitor = ref({ "totalvisit": 0,
"visittoday":0,
"uniqtoday" : 0})
"uniqtoday" : 0,
"visitdate" : '2024-01-01'
})
return {loading,countvisitor}
},
+16 -22
View File
@@ -8,14 +8,25 @@ import moment from 'moment'
export function format1(date) {
export function formatComa(date) {
return moment(date).format('DD.MM.YYYY')
}
export function format2(date) {
export function formatDash(date) {
return moment(date).format('YYYY-MM-DD')
}
export function formaComaTime(date) {
return moment(date).format('DD.MM.YYYY H:mm')
}
export function checking_for_entry (where, what) {
if (!where.includes(what))
{
where.push(what)
}
}
export function getfromserver(path, reactive){
try{
@@ -45,24 +56,7 @@ export function bgimage(filecheck){
export function checkremote(filecheck){
return process.env.NODE_ENV == 'development'? "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg":filecheck
// try{
// let http = new XMLHttpRequest();
// http.open('HEAD', filecheck, false);
// http.send();
// console.log(http.status)
// return "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
// }
// catch(e){
// return "https://pixelbox.ru/wp-content/uploads/2021/11/avatar-whatsapp-pixelbox.ru-36.jpg"
// }
// let tmp = new Image
// tmp.src=filecheck
// if(tmp.complete){
// return filecheck
// }
// else {
// }
}
@@ -72,13 +66,13 @@ export default str;
export function splitname (name) {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
export function pagecounter(){
const router = useRouter()
const accountStore = useAccountStore()
const appStore = useAppStore()
console.log(router.currentRoute.value.meta, '----роутер страницы--');
let postdata = {
user__id: "user" in accountStore &&"id" in accountStore.user? accountStore.user.id: null,
page: router.currentRoute.value.meta.title,
+211 -354
View File
@@ -1,408 +1,265 @@
<template>
<v-row no-gutters class="ma-1">
<v-col class="d-flex flex-column gap">
<v-row no-gutters class="flex-grow-0">
<v-col>
<v-toolbar
density="compact"
class="text-h6 font-weight-regular"
>
<v-icon
icon="mdi-poll"
color="cyan-darken-3"
class="mx-2"
/>
Статистика портала за период с
<div class="px-2 pb-1">
<date-select
@returndate="returnstart"
:datedefault = "startdate"
/>
</div>
по
<div class="px-2 pb-1">
<date-select
@returndate="returnend"
:datedefault = "endate"
/>
</div>
</v-toolbar>
</v-col>
</v-row>
<v-row no-gutters class="gap flex-grow-0">
<v-col lg=3>
<v-card
class="text-center"
height="200px"
>
<v-card-title class="pb-0 pt-2">
Количество Посетителей
</v-card-title>
<v-card-subtitle>
(уникальные/всего)
</v-card-subtitle>
<v-card-text class="pl-0">
<v-list density="compact" class="text-start text-subtitle-1 pt-0">
<v-list-item >
на
<span class="font-weight-bold">
{{today}}
</span>
: {{countvising['now'][0].size}}
/ {{countvising['now'][1]}}
</v-list-item>
<v-list-item>
с
<span class="font-weight-bold">
{{weekday[0]}}
</span>
по
<span class="font-weight-bold">
{{weekday[1]}}
</span>
: {{countvising['week'][0].size}}
/ {{countvising['week'][1]}}
</v-list-item>
<v-list-item>
с
<span class="font-weight-bold">
{{year[0]}}
</span>
по
<span class="font-weight-bold">
{{year[1]}}
</span>
: {{countvising['year'][0].size}}
/ {{countvising['year'][1]}}
</v-list-item>
</v-list>
</v-card-text>
</v-card>
<v-row v-if="alldata.feedback.last_comment.time_create=='1990-01-01'">
<v-col class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">
<v-progress-circular
:size="150"
:width="7"
color="cyan-darken-3"
indeterminate
></v-progress-circular>
</v-col>
<v-col>
<v-card
class="d-flex flex-column text-center"
height="200px"
>
<line-chart :visiting="visiting"/>
<!-- <line-graph :data="data" :options="options"/> -->
</v-card>
</v-row>
<v-row v-else no-gutters class="gap ma-1 flex-column">
<v-col class="d-flex flex-column w100 pa-0 flex-grow-0">
<toolbar-filter/>
</v-col>
<v-col class="d-flex " >
<v-row no-gutters class="gap" >
<v-col lg=2 class=" d-flex flex-column">
<v-row no-gutters class="gap ma-0 flex-column">
<v-col lg=4 class="flex-column d-flex w100">
<portal-traffic :alldata=alldata />
</v-col>
</v-row>
<v-row no-gutters class="gap">
<v-col lg=3>
<feedmodul :feedback="feedback"/>
</v-col>
<v-col class="d-flex flex-column">
<v-row no-gutters class="ma-0 pb-1">
<v-col class="d-flex flex-column">
<v-card class="text-center h-100 d-flex flex-column" >
<v-card-title>
<v-row no-gutters class="">
<v-col lg=2>
<v-switch
v-model="modelrating"
hide-details
density="comfortable"
:label="modelrating?'уникальные':'всего'"
/>
</v-col>
<v-col class="ml-n7 pt-2">
Рейтинг посещаемости страниц портала
</v-col>
</v-row>
</v-card-title>
<v-divider/>
<v-row class=" overflow-auto h-0">
<v-col>
<v-table fixed-header
height="430px">
<thead>
<tr>
<th>Имя страницы</th>
<th class="text-center"> на {{today}}</th>
<th class="text-center">с {{weekday[0]}} по {{weekday[1]}}</th>
<th class="text-center">с {{year[0]}} по {{year[1]}}</th>
</tr>
</thead>
<tbody>
<tr v-for="(val, key) in countgrupp()" :key = key>
<td class="text-left">{{key}}</td>
<td class="text-center">{{ modelrating?val.now[0].size:val.now[1] }} </td>
<td class="text-center">{{ modelrating?val.week[0].size:val.week[1] }}</td>
<td class="text-center">{{ modelrating?val.year[0].size:val.year[1] }}</td>
</tr>
</tbody>
</v-table>
</v-col>
</v-row>
</v-card>
<v-col class="flex-column d-flex w100">
<v-row no-gutters class="flex-column gap" >
<v-col v-for="x in cardtotal" :key=x>
<card-total :indicator=x />
</v-col>
</v-row>
<v-row no-gutters class="ma-0 flex-grow-0 gap" >
<template v-for="(val, key) in activuser()" >
<v-col v-if = "Object.keys(activuser()).indexOf(key)<3" :key = key>
<top-user
:users="val"
:ico="icons[Object.keys(activuser()).indexOf(key)]"
name="Активность"
/>
</v-col>
</template>
</v-row>
</v-col>
</v-row>
</v-col>
<v-col class="d-flex flex-column">
<v-row no-gutters class="flex-column gap">
<v-col lg=4 class="w100">
<line-chart
:key = "`${filterStore.date_period.startdate}-${filterStore.date_period.enddate}`"
:dataLineChart="dataLineChart"
:period="{before:alldata.beforperiod,period:alldata.period}"
:filter = filter
/>
</v-col>
<v-col class=" d-flex flex-column">
<v-row no-gutters class="gap">
<v-col class="bg-green">
<rating-page :pages_count=alldata.period />
</v-col>
<v-col>
<top-user
:activusers = alldata.period
/>
</v-col>
</v-row>
</v-col>
</v-row>
</v-col>
<v-col lg=2 >
<feedmodul
:feedback="alldata.feedback"
/>
</v-col>
</v-row>
</v-col>
</v-row>
</template>
<script>
import { ref, computed } from 'vue'
import { ref, watch } from 'vue'
import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions'
import moment from 'moment'
import {pagecounter, splitname, formatComa, formatDash, formaComaTime, checking_for_entry} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api'
import { usePortalFilterStore } from '@/store/AboutPortalFilter'
import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
import DateSelect from '@/components/UI/date-select.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue'
import LineChart from '@/components/UI/aboutportal/line-chart.vue'
import PortalTraffic from '@/components/UI/aboutportal/portal-traffic.vue'
import ToolbarFilter from '@/components/UI/aboutportal/toolbar-filter.vue'
import RatingPage from '@/components/UI/aboutportal/rating-page.vue'
import CardTotal from '@/components/UI/aboutportal/card-total.vue'
// import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
export default {
components: {
Feedmodul,
DateSelect,
TopUser,
LineChart
LineChart,
PortalTraffic,
ToolbarFilter,
RatingPage,
CardTotal,
},
setup(){
const visiting = ref([])
const feedback = ref([])
const countvising = ref({now: [new Set(), 0], week: [new Set(), 0], year: [new Set(), 0]})
const crit = ref([])
const startdate =ref(format2(new Date(new Date().getFullYear(), 0, 1)))
const endate =ref(format2(new Date()))
const icons = ['mdi-numeric-1-box-outline', 'mdi-numeric-2-box-outline', 'mdi-numeric-3-box-outline']
const today = ref('')
const weekday = ref('')
const year = ref('')
const modelrating = ref(false)
const weekstart = (date) => {
let WeekStart = moment(date).subtract(1, 'weeks').startOf('isoWeek')._d // начало предыдущей недели
let WeekEnd =new Date(new Date(WeekStart).setDate(new Date(WeekStart).getDate() + 4)) // конец предыдущей недели
return {WeekStart, WeekEnd}
}
const returnstart = (dates) => {
startdate.value = dates
periodname()
visition()
}
const returnend = (dates) => {
endate.value = dates
periodname()
visition()
}
const visition = () => {
let end = format2(new Date(endate.value).setDate(new Date(endate.value).getDate() + 1))
axiosApiInstance.get(`api/watcher/counter/?start=${startdate.value}&end=${end}`).then(result => {
visiting.value = result.data.result
feedback.value = result.data.feedback
})}
pagecounter()
const countgrupp = () => {
let us = {}
let countall = {now: [new Set(), 0], week: [new Set(), 0], year: [new Set(), 0]}
const groupedData =
visiting.value.reduce((acc, item) => {
if (!acc[item.pages]) {
acc[item.pages] = {now: [new Set(), 0], week: [new Set(), 0], year: [new Set(), 0]}
}
acc[item.pages]['year'][0].add(item.author.id)
acc[item.pages]['year'][1] += item.count
countall['year'][0].add(item.author.id)
countall['year'][1] += item.count
if (item.visitdate == format2(endate.value)) {
acc[item.pages]['now'][0].add(item.author.id)
acc[item.pages]['now'][1] += item.count
countall['now'][0].add(item.author.id)
countall['now'][1] += item.count
}
let week = weekstart(endate.value)
if (item.visitdate >=format2(week.WeekStart) && item.visitdate <= format2(week.WeekEnd)) {
acc[item.pages]['week'][0].add(item.author.id)
acc[item.pages]['week'][1] += item.count
countall['week'][0].add(item.author.id)
countall['week'][1] += item.count
}
if (!us[splitname(item.author)])
{
us[splitname(item.author)] = {page: new Set(), login: 0}
}
us[splitname(item.author)]['page'].add(item.pages)
us[splitname(item.author)]['login'] = item.author.login
let arrcount = []
for (let [key,val] of Object.entries(us)) {
arrcount.push({fio:key,max:val.page.size, login: val.login})
}
arrcount.sort((a, b) => {
return b['max']- a['max']
})
crit.value = arrcount.slice(0, 3)
countvising.value=countall
return acc
}, {});
return groupedData
}
const periodname = () => {
let datas = weekstart(endate.value)
today.value = 'сегодня'
if (format2(new Date()) != format2(endate.value)) {
today.value = format1(endate.value)
}
weekday.value = [format1(datas.WeekStart), format1(datas.WeekEnd)]
year.value = [format1(startdate.value), format1(endate.value)]
const dataLineChart = ref({})
const cardtotal = ref(
{
"crr": {
"title": "Удержание",
"abb": "(CRR)",
"tooltip": "Показатель удержания клиентов (retention rate) — это коэффициент, который отражает способность компании выстраивать крепкие отношения с покупателями. Он показывает, насколько хорошо бизнес удерживает постоянных клиентов в течение определенного промежутка времени. Метрику также называют customer retention rate, или CRR.",
"data": 0
},
"br": {
"title": "Отказы",
"abb": "(BR)",
"tooltip": "Термин в веб-аналитике, обозначающий процентное соотношение количества посетителей, покинувших сайт прямо со страницы входа или просмотревших не более одной страницы сайта",
"data": 0
},
"ppv": {
"title": "Страниц за визит",
"abb": "(PPV)",
"tooltip": "Глубина просмотра страниц — поведенческая метрика, которая показывает, сколько страниц на сайте в среднем просматривает пользователь",
"data": 0
}
periodname()
})
const activuser = () => {
const groupedData =
visiting.value.reduce((acc, item) => {
if (!acc[splitname(item.author)]) {
acc[splitname(item.author)] = {count: 0, login: '', fio: '', post: '', info: new Set()}
const filterStore = usePortalFilterStore()
const alldata =ref({period: [], staff: 0, beforperiod: [], feedback: {criteria: [], feed: [], last_comment:{time_create:'1990-01-01'}}})
const visition = () => {
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
alldata.value = preparedata(result.data)
totalfn()
})}
console.log(alldata.value.feedback.last_comment,'alldata.feedback.last_comment.time_create');
visition()
const preparedata=(data)=>{
let beforperiod = []
data.beforperiod.forEach((e)=>{
let ind = beforperiod.findIndex(el=>el.visitdate===e.visitdate)
if(ind>-1){
beforperiod[ind].user.push(e.user__user_id)
}else{
beforperiod.push({visitdate: e.visitdate, user:[e.user__user_id]})
}
})
data.beforperiod=beforperiod
acc[splitname(item.author)]['fio'] = splitname(item.author)
acc[splitname(item.author)]['info'].add(item.pages)
acc[splitname(item.author)]['login'] = item.author.login
acc[splitname(item.author)]['post'] = item.author.post
acc[splitname(item.author)]['count'] += item.count
return acc
}, {})
return data
}
const totalfn = () => {
let beforperiodusers = new Set([])
alldata.value.beforperiod.forEach(e => beforperiodusers.add(...e.user))
let periodusers = new Set([])
let brdata = {}
let filtr = alldata.value.period
const sorted = Object.entries(groupedData)
.sort(([,a],[,b]) => (b.count - a.count))
.reduce((r, [k, v]) =>
({ ...r, [k]: v } ), {}
)
if (formatDash(filterStore.date_period.enddate) !=formatDash(new Date())) {
filtr = filtr.filter(e => e.visitdate != formatDash(new Date()))
}
return sorted
filtr.forEach((e) => {
periodusers.add(e.user.id)
if (!brdata[e.visitdate]) {
brdata[e.visitdate] = {}
}
let user = splitname(e.user)
if (!brdata[e.visitdate][user]) {
brdata[e.visitdate][user] = []
}
brdata[e.visitdate][user].push({page:e.fullPath, total:e.count})
})
let traffic ={}
for (let [key, val] of Object.entries(brdata)) {
traffic[key] ={unic: Object.keys(val), count: 0, br:0, pages: 0}
let arr = Object.values(val)
traffic[key].br = arr.filter(e=>e.length==1).length
arr.forEach(e=> traffic[key].pages += e.length)
arr.flat().reduce((acc, item) => {
traffic[key].count +=item.total
return acc
},traffic[key].count)
}
visition()
let bothuser = new Set([...periodusers].filter(element => beforperiodusers.has(element)))
cardtotal.value.crr.data = bothuser.size*100/beforperiodusers.size
sumtraffic(traffic)
dataLineChart.value = traffic
}
const sumtraffic= (data) => {
let ob = {brtot:0, ppvtot: 0, unictot: 0, pagetot: 0}
Object.values(data).flat().forEach((e) => {
ob.brtot += e.br
ob.ppvtot += e.count
ob.unictot += e.unic.length
ob.pagetot += e.pages
}
)
cardtotal.value.br.data = ob.brtot/ob.unictot*100
cardtotal.value.ppv.data = ob.pagetot/ob.unictot
}
watch(()=>filterStore.date_period,()=>{
visition()
}, {deep:true})
pagecounter()
return {
visiting,
countgrupp,
activuser,
feedback,
countvising,
crit,
visition,
returnstart,
returnend,
endate,
startdate,
icons,
periodname,
weekstart,
today,
weekday,
year,
modelrating
alldata,
cardtotal,
dataLineChart,
filterStore,
filter: ref('d'),
}
}
}
+2
View File
@@ -1,4 +1,5 @@
<template>
<v-row>
<v-col
@@ -7,6 +8,7 @@
F.A.Q.
</v-col>
</v-row>
</template>
<script>
+3 -2
View File
@@ -28,10 +28,11 @@
pa-0 ma-0 pb-3
class="flex-column h-100 d-flex"
>
<v-card class="bgCard h-100 d-flex flex-column">
<v-card-title class="ma-2 text-h3 text-uppercase titles py-5 flex-column">
<v-row>
<v-col class="pa-0 pl-1 align-self-center">{{x.title}}
<v-col class="pa-0 pl-1 align-self-center">{{x.title}}
</v-col>
<v-col class="flex-grow-0 pa-0 pr-1">
@@ -121,7 +122,7 @@
// getfromserver("api/fns/links/", carous)
const carushi = computed(()=> {
console.log(window.innerHeight, window.innerHeight-50);
return window.innerHeight-50
})
+99 -16
View File
@@ -1,23 +1,106 @@
<template>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Безопасность
<!-- <v-row class="pa-2">
<v-col cols="5" class="d-flex flex-column justify-start h-screen gap">
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto mb-2 h-auto">
<v-card-title>{{ item.name }}</v-card-title>
<v-container
v-for="category in item.categories"
:key="item.id + category.id"
:fluid="true"
class="py-0">
<v-card-actions>
<v-btn @click="showMore[item.id + category.id] = !showMore[item.id + category.id]" variant="text">{{ category.name }}</v-btn>
<v-btn
:icon="showMore[item.id + category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'"
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]">
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-show="showMore[item.id + category.id]">
<v-card-actions v-for="file in category.files" :key="file.id" class="overflow-y-auto">
<v-card-text>{{ file.name }}</v-card-text>
<v-btn icon="mdi-file-pdf-box" color="red" @click="openPDF(safetyURL + file.url), loading=true"></v-btn>
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(safetyURL + file.url, file.name)"></v-btn>
</v-card-actions>
</div>
</v-expand-transition>
</v-container>
</v-card>
</v-col>
<v-col cols="7">
<v-card v-show="showFile" class="h-screen overflow-y-auto">
<v-container v-if="loading">
<v-progress-linear
:rounded="5"
indeterminate
color="teal">
</v-progress-linear>
</v-container>
<VuePdfEmbed :source="pdfSource" width="720" @rendered="loading = false"/>
<v-card-actions>
<v-btn block @click="showFile = false">Закрыть</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</v-row> -->
<!-- <v-dialog v-model="showFile" width="auto" height="auto">
<v-card>
<v-container v-if="loading">
<v-progress-linear
:rounded="5"
indeterminate
color="teal">
</v-progress-linear>
</v-container>
<VuePdfEmbed :source="pdfSource" width="725" height="400" @rendered="loading = false"/>
<v-card-actions>
<v-btn block @click="showFile = false">Закрыть</v-btn>
</v-card-actions>
</v-card>
</v-dialog> -->
</template>
<script>
import {pagecounter} from '@/utils/universal_functions'
export default {
setup(){
pagecounter()
}
}
<script setup>
// import { ref, onBeforeMount } from 'vue';
// import { pagecounter } from '@/utils/universal_functions';
// import { axiosApiInstance, safetyURL } from '@/utils/axios-api';
// import { saveAs } from 'file-saver';
// import VuePdfEmbed from 'vue-pdf-embed';
// pagecounter();
// const safetyData = ref([]);
// const showMore = ref(false);
// const showFile = ref(false);
// let pdfSource = '';
// const loading = ref(false)
// onBeforeMount(() => {
// axiosApiInstance.get(`api/safety/files/`).then(result => {
// safetyData.value = result.data
// })
// });
// // Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
// showMore.value = safetyData.value.reduce((acc, value) => {
// acc[value.id] = false
// return acc
// }, {});
// const downloadItem = (url, fileName) => {
// axiosApiInstance.get(url, {responseType: 'blob'})
// .then(response => {
// saveAs(response.data, fileName)
// })
// };
// function openPDF(url) {
// showFile.value = true
// if (showFile) {
// return pdfSource = url
// }
// };
</script>
<style>
</style>
</style>
@@ -0,0 +1,179 @@
<template>
<v-row no-gutters class="flex-column h-100 gap pa-1">
<v-col lg="1" class="w100 h-100">
<v-card>
<v-tabs
v-model="tab"
bg-color="teal-darken-1"
slider-color="teal-darken-2"
:grow="true">
<v-tab selected-class="isActiveTab" value="mainInfo">Основная информация</v-tab>
<v-tab selected-class="isActiveTab" value="document">Документация</v-tab>
<v-tab selected-class="isActiveTab" value="testings">Тестирование</v-tab>
</v-tabs>
</v-card>
</v-col>
<v-col class="w100 h-100">
<v-window v-model="tab" class="h-100">
<v-window-item no-gutters class="gap h-100" value="mainInfo">
<MainInfoSafety></MainInfoSafety>
</v-window-item>
<v-window-item value="document" class="h-100">
<v-row no-gutters class="gap h-100 ">
<v-col lg="6">
<!---->
<v-card class="h-100 flex-column d-flex gap">
<v-row class="ma-0 my-3 overflow-auto h-0 pb-1">
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
<v-card-title>{{ item.name }}</v-card-title>
<v-container
v-for="category in item.categories"
:key="item.id + category.id"
:fluid="true"
class="py-0">
<v-card-actions v-if="category.id != 'evacuation_plan'">
<v-btn
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]"
variant="text">
{{ category.name }}
</v-btn>
<v-btn
:icon="showMore[item.id + category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'"
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]">
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-show="showMore[item.id + category.id]">
<v-card-actions v-for="file in category.files" :key="file.id" class="overflow-y-auto">
<v-card-text
class="cursor-pointer"
:ref_="openPDF(burl + file.url)"
@click="openPDF(burl + file.url), loading=true">
{{ file.name }}
</v-card-text>
<v-btn icon="mdi-file-pdf-box" color="red" @click="openPDF(burl + file.url), loading=true"></v-btn>
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(burl + file.url, file.name)"></v-btn>
</v-card-actions>
</div>
</v-expand-transition>
</v-container>
</v-card>
</v-row>
<v-row class="ma-0 overflow-auto h-0">
<v-card class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
<v-card-title>{{ responsibilityData.name.replace(/\.[^/.]+$/, "") }}</v-card-title>
<v-container
v-for="file in responsibilityData.files"
:fluid="true"
class="py-0">
<v-card-actions :key="file.id">
<v-card-text>{{ file.file_name }}</v-card-text>
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(burl + file.file_name, file.file_name)"></v-btn>
</v-card-actions>
</v-container>
</v-card>
</v-row>
</v-card>
</v-col>
<v-col>
<v-card class="h-100 flex-column d-flex gap">
<v-row class="ma-0 overflow-auto h-0">
<v-card v-show="showFile" class="mr-2 flex-grow-1 flex-shrink-1 h-100 pa-2 overflow-auto">
<v-container v-if="loading">
<v-progress-linear
:rounded="5"
indeterminate
color="teal">
</v-progress-linear>
</v-container>
<VuePdfEmbed :source="pdfSource" width="720" @rendered="loading = false"/>
</v-card>
</v-row>
<v-card-actions v-show="showFile">
<v-btn
position="sticky"
block
@click="showFile = false">Закрыть</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</v-window-item>
<v-window-item value="testings" no-gutters class="gap h-100 ">
<TestSafety></TestSafety>
</v-window-item>
</v-window>
</v-col>
</v-row>
</template>
<script setup>
import { ref, onBeforeMount, onUpdated } from 'vue';
import { pagecounter } from '@/utils/universal_functions';
import { axiosApiInstance, baseURL } from '@/utils/axios-api';
import { saveAs } from 'file-saver';
import { useRoute } from 'vue-router'
import VuePdfEmbed from 'vue-pdf-embed';
import TestSafety from './TestSafety.vue';
import MainInfoSafety from './MainInfoSafety.vue';
pagecounter();
const safetyData = ref([]);
const responsibilityData = ref();
const showMore = ref(false);
const showFile = ref(false);
let pdfSource = '';
const loading = ref(false);
const tab = ref('');
const burl = baseURL.slice(0,-1);
const route = useRoute();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() {
axiosApiInstance.get(`api/safety/files/?chapter_id=${route.params.chapter_id}`).then(result => {
safetyData.value = result.data
})
}
function getResponsibility() {
axiosApiInstance.get(`api/safety/committee_files/`).then(result => {
responsibilityData.value = result.data
})
}
getResponsibility()
onBeforeMount(() => getSafety());
// Хук обновления реализует возможность динамической подгрузки данных при переключении между вкладками раздела безопасность
onUpdated(() => getSafety());
// Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
showMore.value = safetyData.value.reduce((acc, value) => {
acc[value.id] = false
return acc
}, {});
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, {responseType: 'blob'})
.then(response => {
saveAs(response.data, fileName)
})
};
function openPDF(url) {
showFile.value = true
if (showFile) {
return pdfSource = url
}
};
</script>
<style>
.isActiveTab {
background-color: #68c3ff70;
}
</style>
@@ -0,0 +1,140 @@
<template>
<v-card class="h-100">
<v-row no-gutters class="h-100">
<v-col cols="9">
<v-card class="h-100 d-flex flex-column">
<v-row class="ma-0 overflow-auto h-0">
<v-col
cols="6"
class="h-100 gap">
<v-card class="h-100">
<v-img
class="cursor-pointer"
:src="`${burl}/media/safety/schemas/Схема1.jpg`"
height="100%"
@click="openFirstPlan = true">
</v-img>
</v-card>
<v-dialog v-model="openFirstPlan" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openFirstPlan = false">
</v-btn>
<v-img
:src="`${burl}/media/safety/schemas/Схема1.jpg`"
class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-col>
<v-col
cols="6"
class="h-100 gap">
<v-card class="h-100">
<v-img
:src="`${burl}/media/safety/schemas/Схема2.jpg`"
class="cursor-pointer"
height="100%"
@click="openSecondPlan = true">
</v-img>
<v-dialog v-model="openSecondPlan" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openSecondPlan = false">
</v-btn>
<v-img
:src="`${burl}/media/safety/schemas/Схема2.jpg`"
class="cursor-pointer"
height="100%"
width="100%"
@click="openSecondPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-card>
</v-col>
</v-row>
<v-row class="ma-0 overflow-auto h-0">
<v-col class="h-100 gap">
<v-card class="h-100">
<v-img
:src="`${burl}/media/safety/schemas/План.jpg`" @click="openImg = true"
class="cursor-pointer"
height="100%"
width="100%">
</v-img>
<v-dialog v-model="openImg" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openImg = false">
</v-btn>
<v-img
:src="`${burl}/media/safety/schemas/План.jpg`"
class="cursor-pointer"
height="100%"
width="100%"
@click="openImg = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-card>
</v-col>
</v-row>
</v-card>
</v-col>
<v-col cols="3" class="w100">
<v-card class="h-100 d-flex flex-column">
<v-card-title class="text-wrap">Ответственные за противопожарную безопасность</v-card-title>
<v-row class="ma-0 overflow-auto h-0">
<v-card class="pa-1 overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
<list-user
v-for="item in responsibility"
:author="item">
</list-user>
</v-card>
</v-row>
</v-card>
</v-col>
</v-row>
</v-card>
</template>
<script setup>
import listUser from '@/components/UI/fiousercard/listUser.vue';
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue';
const burl = baseURL.slice(0,-1)
const openImg = ref(false)
const openFirstPlan = ref(false)
const openSecondPlan = ref(false)
const responsibility = ref([])
function getResponsibility() {
axiosApiInstance.get(`api/safety/responsibility/`).then(result => {
responsibility.value = result.data.users
})
}
getResponsibility()
</script>
+79
View File
@@ -0,0 +1,79 @@
<template>
<v-row>
<v-col cols="12">
<v-card>
<v-window v-model="step">
<v-window-item v-for="(item, index) in data" :key="index">
<v-card v-if="item.question" :title="item.question">
<v-radio-group v-model="radios" label="Выберите вариант ответа">
<v-radio v-for="answer in item.answers" :label="answer" :value="answer"></v-radio>
</v-radio-group>
</v-card>
<v-card v-if="item.checkQuestion" :title="item.checkQuestion">
<v-checkbox
v-for="answer in item.answers"
v-model="checks"
:label="answer"
:value="answer">
</v-checkbox>
</v-card>
</v-window-item>
</v-window>
<v-card-actions>
<v-btn
v-if="step > 0"
variant="text"
@click="step--">
Back
</v-btn>
<v-spacer></v-spacer>
<v-btn
v-if="step < data.length"
variant="text"
@click="step++">
Next
</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
<v-row>
<v-col>
<v-card title="Результат">
<v-container>
<p>Количество баллов: {{ selected }}</p>
</v-container>
</v-card>
</v-col>
</v-row>
</template>
<script setup>
import { ref } from 'vue';
// TODO...
// Рабочий вариант с пропсами, пытаюсь реализовать компонент на пропсах
defineProps({
data: Array
})
const data = ref([
{
question: 'Вопрос 1',
answers: ['1', '2', '3', '4']
},
{
question: 'Вопрос 2',
answers: ['Rer', 'LoL', 'Fort', 'FullG']
},
{
checkQuestion: 'Вопрос с чексбоксом',
answers: ['Кукумбер', 'Сикельд']
}
])
const radios = ref('')
const checks = ref([])
const selected = ref([])
const step = ref(0)
</script>
-1
View File
@@ -7,5 +7,4 @@ from .serializers import *
class CaorusAPIView(ListAPIView):
def get(self, request):
queryset = Carousels.objects.using('add_base').all().order_by('order')
print(queryset, '----------------queryset')
return Response(CarouselsSerializer(queryset, many=True).data)
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 959 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

@@ -0,0 +1,3 @@
class="text-white text-center text-lg-h5 h-100"
align-content="center"
justify="center"
@@ -0,0 +1,3 @@
class="text-white text-center text-lg-h5 h-100"
align-content="center"
justify="center"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

+5 -5
View File
@@ -126,14 +126,14 @@ class CommentNews(models.Model):
names.short_description="ФИО"
class Carousels(models.Model):
title=models.CharField(max_length=255, verbose_name='Заголовок')
text= models.TextField(max_length=260, null=True, verbose_name='Сообщение')
title=models.CharField(max_length=255, blank=True, null=True, verbose_name='Заголовок')
text= models.TextField(max_length=260, blank=True, null=True, verbose_name='Сообщение')
cdate =models.DateTimeField(default=datetime.now, verbose_name='Дата создания')
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор новости')
link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg", verbose_name='Картинка')
published = models.BooleanField(default=True, verbose_name='Опубликован')
enddate = models.DateTimeField(default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации')
sender = models.ForeignKey(BaseSender, on_delete=models.PROTECT, related_name='get_sender', verbose_name='Тематика')
sender = models.ForeignKey(BaseSender, on_delete=models.PROTECT, related_name='get_base_sender', verbose_name='Тематика')
order = models.IntegerField(verbose_name='Порядок сортировки', null=True, blank=True)
class Meta:
@@ -169,8 +169,8 @@ class BirthdayText(models.Model):
class Screensaver(models.Model):
img = models.ImageField(upload_to='screengallery/%Y/%m/%d', null=True, verbose_name='Изображение')
cdate =models.DateField(default=date.today().replace(year=1990), null=True, verbose_name='Дата начала периода')
enddate = models.DateField(default= date.today().replace(year=1990), verbose_name='Дата окончания периода', null=True)
cdate =models.DateField(default=date.today().replace(year=1992), null=True, verbose_name='Дата начала периода')
enddate = models.DateField(default= date.today().replace(year=1992), verbose_name='Дата окончания периода', null=True)
class Meta:
+10 -2
View File
@@ -77,15 +77,23 @@ class NewsSerializer(serializers.ModelSerializer):
return CommentNewsSerializer(obj.get_comment_news.all(), many=True).data
def get_gallery(self, obj):
# print(obj.get_gallery.all(), '---------------------')
# return 'gal'
return GallerySerializer(obj.get_gallery_news.all(), many=True).data
class BaseSenderSerializer(serializers.ModelSerializer):
class Meta:
model = BaseSender
fields = '__all__'
class CarouselsSerializer(serializers.ModelSerializer):
senders = serializers.CharField(source='sender.img')
class Meta:
model = Carousels
fields = '__all__'
fields = ['title', 'text', 'link', 'senders']
class ScreensaverSerializer(serializers.ModelSerializer):
+11 -22
View File
@@ -45,11 +45,11 @@ class NewsAPIView(ListAPIView):
def get(self, request):
if request.GET.__contains__('id'):
print('Получена одна новость по ид')
newsqueryset = News.objects.filter(pk=int(request.GET.get('id')))
allnews = 1
else:
print('Получены все новости по ид')
newsqueryset = News.objects.all().order_by('-cdate')
allnews =newsqueryset.count()
@@ -100,18 +100,18 @@ class NewsCrossroadAPIView(ListAPIView):
def get(self, request):
if request.GET.__contains__('id'):
print('Получена одна новость по ид')
newsqueryset = News.objects.filter(pk=int(request.GET.get('id')))
countpage= 0
else:
print('Получены все новости по ид')
newsqueryset = News.objects.all().order_by('-cdate')
countpage = newsqueryset.count()
if request.GET.get("name") == "/":
print('Запрос на новости для главной страницы')
newsqueryset = newsqueryset[:10]
else:
print('Запрос на новости с пагинацией')
pagesel = int(request.GET.get("page"))*int(request.GET.get("countpage"))
@@ -153,27 +153,16 @@ class NewsCrossroadAPIView(ListAPIView):
class CarouselsAPIView(ListAPIView):
permission_classes = (AllowAny,)
serializer_class = CarouselsSerializer
def get(self, request):
queryset = Carousels.objects.filter(published=True, cdate__lte=datetime.now(), enddate__gte=datetime.now()).order_by('sender__order')
result = CarouselsSerializer(queryset, many= True).data
result = []
for x in queryset:
a=model_to_dict(x)
a['link']= str(x.link.url)
a['show'] = False
a['author'] = model_to_dict(x.author.user)
if x.sender.img:
a['sender'] = str(x.sender.img.url)
else:
a['sender'] = None
result.append(a)
manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month).order_by('birthdate__day')
manbrd = DictEmployee.objects.filter(birthdate__month=date.today().month, birthdate__day__gte=date.today().day).order_by('birthdate__day')
if len(manbrd) > 0 :
nowday= manbrd.filter(birthdate__day=date.today().day)
@@ -187,7 +176,7 @@ class CarouselsAPIView(ListAPIView):
"sender": "/media/default/dr.png",
}
# birthday = []
if len(nowday) > 0 :
+2 -2
View File
@@ -8,7 +8,7 @@
"date-fns": "^2.30.0",
"vue3-autocounter": "^1.0.6"
},
"version": "0.0.1"
"version": "0.0.2"
},
"node_modules/@babel/parser": {
"version": "7.22.16",
@@ -281,5 +281,5 @@
}
}
},
"version": "0.0.1"
"version": "0.0.2"
}
+1 -1
View File
@@ -3,5 +3,5 @@
"date-fns": "^2.30.0",
"vue3-autocounter": "^1.0.6"
},
"version": "0.0.1"
"version": "0.0.2"
}
BIN
View File
Binary file not shown.
View File
Whitespace-only changes.
+13
View File
@@ -0,0 +1,13 @@
from django.contrib import admin
from .models import SafetyFile
# Register your models here.
class SafetyFileAdmin(admin.ModelAdmin):
list_display = ('name', 'chapter_id', 'category_id', 'sign_date')
list_editable = ('sign_date', 'category_id')
list_filter = ('name', 'sign_date', 'category_id',)
fields = ('name', 'url', 'chapter_id', 'category_id', 'sign_date')
admin.site.register(SafetyFile, SafetyFileAdmin)
+7
View File
@@ -0,0 +1,7 @@
from django.apps import AppConfig
class SafetyConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'safety'
verbose_name = 'Раздел Безопасность'
+50
View File
@@ -0,0 +1,50 @@
from django.db import models
from enum import Enum
# Create your models here.
class EnumChoice(Enum):
@classmethod
def get_choices(cls):
return [(enum_.name, enum_.value) for enum_ in cls]
class SafetyChapter(EnumChoice):
fire_safety = "Пожарная безопасность"
information_safety = "Информационная безопасность"
occupational_safety = "Охрана труда"
access_mode = "Пропускной и внутриобъектовый режим"
civil_defense = "Гражданская оборона"
state_secrets = "Защита гостайны"
military_registration = "Мобилизационная подготовка и воинский учет"
class SafetyDocumentCategory(EnumChoice):
regulations = "Нормативные документы"
instructions = "Инструкции"
orders = "Приказы"
provisions = "Положения"
educational_materials = "Учебные материалы"
laws = "Законы"
decrees = "Указы"
resolutions = "Постановления"
thematic_materials = "Тематические материалы"
methodological_materials = "Методологические материалы"
evacuation_plan = 'План эвакуации'
# Общая модель для раздела "Безопасность"
class SafetyFile(models.Model):
name = models.CharField(verbose_name='Имя документа', max_length=255)
url = models.FileField(verbose_name='Путь до файла',upload_to='safety')
chapter_id = models.CharField(verbose_name='Раздел', max_length=255, blank=False, db_index=True, choices=SafetyChapter.get_choices())
category_id = models.CharField(verbose_name='Категория документа', max_length=255, blank=False, db_index=True, choices=SafetyDocumentCategory.get_choices())
sign_date = models.DateField(verbose_name='Дата документа')
created_at = models.DateTimeField(verbose_name='Дата загрузки файла', auto_now_add=True)
update_at = models.DateTimeField(verbose_name='Дата обновления файла', auto_now=True)
class Meta:
verbose_name = 'Документы раздела безопасности'
verbose_name_plural = 'Документы раздела безопасности'
def __str__(self):
return str(self.name)
+10
View File
@@ -0,0 +1,10 @@
from rest_framework import serializers
from .models import *
class SafetyFileSerializer(serializers.ModelSerializer):
chapter_name = serializers.CharField(source='get_chapter_id_display')
category_name = serializers.CharField(source='get_category_id_display')
class Meta:
model = SafetyFile
fields = '__all__'
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
+10
View File
@@ -0,0 +1,10 @@
from django.urls import path
from rest_framework.routers import DefaultRouter
from .views import *
urlpatterns = [
path('files/', SafetyFileAPIView.as_view(), name='safety_files'),
path('responsibility/', SafetyResponsebilityAPIView.as_view(), name='responsibility'),
path('committee_files/', CommitteeFilesAPIView.as_view(), name='committee_files')
]
+53
View File
@@ -0,0 +1,53 @@
from itertools import groupby
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from .serializers import *
from .models import *
from userauth.serializers import *
from userauth.models import *
# Create your views here.
class SafetyFileAPIView(APIView):
def get(self, request):
chapters = self.request.query_params.get('chapter_id', 1)
all_file = SafetyFile.objects.filter(chapter_id=chapters).order_by('chapter_id', 'category_id').all()
serializer_for_file = SafetyFileSerializer(instance=all_file, many=True)
data = []
for (chapter_id, chapter_name), row in groupby(serializer_for_file.data, lambda x: (x['chapter_id'], x['chapter_name'])):
chapter = {
'id': chapter_id,
'name': chapter_name,
'categories': []
}
data.append(chapter)
for (category_id, category_name), files in groupby(row, lambda x: (x['category_id'], x['category_name'])):
chapter['categories'].append({
'id': category_id,
'name': category_name,
'files': [file for file in files]
})
return Response(data)
class SafetyResponsebilityAPIView(APIView):
def get(self, request):
fireuser = OrderResponsibility.objects.get(id=54)
responsobility_users = OrderResponsibilitySerializer(fireuser)
return Response(responsobility_users.data)
class CommitteeFilesAPIView(APIView):
def get(self, request):
committee_files = Committee1.objects.get(id=106)
files = Committee1Serializer(committee_files)
return Response(files.data)
+8 -7
View File
@@ -8,16 +8,17 @@ class FileResponsiblitySerializer(serializers.ModelSerializer):
class Meta:
model = OrderResponsibilityFiles
fields = ['file_name', 'id']
fields = ['file_name', 'id', 'id_order_responsibility']
class ResponsibilityUsersSerializer(serializers.ModelSerializer):
fio=serializers.CharField(source='id_dict_employee.fio')
id = serializers.IntegerField(source='id_dict_employee.id')
login = serializers.CharField(source='id_dict_employee.login')
class Meta:
model=OrderResponsibilityEmployee
fields=['fio','id']
fields=['fio','id', 'login']
class OrderResponsibilitySerializer(serializers.ModelSerializer):
@@ -30,7 +31,7 @@ class OrderResponsibilitySerializer(serializers.ModelSerializer):
fields = '__all__'
def respons_users(self,obj):
data = OrderResponsibilityEmployee.objects.filter(id_order_responsibility=obj.respons_users.id_order_responsibility)
data = OrderResponsibilityEmployee.objects.filter(id_order_responsibility=obj.id)
return ResponsibilityUsersSerializer(data,many=True).data
class Committee1FilesSerializer(serializers.ModelSerializer):
@@ -112,10 +113,10 @@ class CardUserSerializer(serializers.ModelSerializer):
class ShortUserSerializer(serializers.ModelSerializer):
# login = serializers.CharField()
class Meta:
class Meta:
model = DictEmployee
fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department']
fields = ['familyname', 'name', 'parentname', 'id', 'login', 'post', 'department']
# fields='__all__'
+24
View File
@@ -15,3 +15,27 @@ class CountSerializer(serializers.ModelSerializer):
def get_user(self, obj):
return ShortUserSerializer(DictEmployee.objects.get(login=obj.user)).data
class VisitdateSerializer(serializers.ModelSerializer):
class Meta:
model = CountVisitor
fields = ['visitdate']
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 ShortUserSerializer(obj.user.user).data
+1
View File
@@ -3,6 +3,7 @@ from .views import *
urlpatterns = [
path('counter/', Counter.as_view(),name="CountVisitors"),
path('testwatcher/', TestwatcherAPIView.as_view(), name="Testwatcher"),
path('selectedlinks/', SelectedLinksAPIView.as_view(),name="SelectedLinks")
# path('', views.Watchuser.as_view()), selectedlinks
+65 -16
View File
@@ -6,8 +6,8 @@ from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from django.views.generic import ListView
from .serializers import *
from datetime import date
from django.db.models import Sum
from datetime import date, datetime, timedelta
from django.db.models import Sum, Q, Count, Avg, F, Max
from userauth.models import *
from feedback.models import *
from feedback.serializers import *
@@ -18,20 +18,19 @@ class Counter(ListAPIView):
permission_classes = (AllowAny,)
serializer_class = CountSerializer
def get(self, request):
res = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).annotate(Sum('count'))
result = CountSerializer(res, many=True).data
data = UserComment.objects.filter(Q(time_create__range=['2024-01-01', '2024-03-01']), ~Q(comment='')). \
values().order_by('-time_create')
# Обратная связь
feed = RatingStatus.objects.filter(usercom__time_create__range=[request.GET.get("start"), request.GET.get("end")])
feedback = RatingStatusStatSerializer(feed, many=True).data
return Response({'result':result, 'feedback':feedback})
return Response(data)
def post(self, request):
myfullPath = request.data['fullPath']
if "?" in myfullPath:
myfullPath= myfullPath.split("?")[0]
@@ -40,16 +39,18 @@ class Counter(ListAPIView):
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())
# else:
# watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, pages=page, visitdate=date.today())
watch.count+=1
watch.save()
datavisit = CountVisitor.objects.filter(pages=page.id).earliest('visitdate')
res = {"totalvisit": CountVisitor.objects.filter(pages=page.id).aggregate(Sum('count'))['count__sum'],
"visittoday":CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).aggregate(Sum('count'))['count__sum'],
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count()
"uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), pages=page.id).count(),
"visitdate" : VisitdateSerializer(datavisit).data['visitdate']
}
return Response(res)
class SelectedLinksAPIView(ListAPIView):
@@ -60,4 +61,52 @@ class SelectedLinksAPIView(ListAPIView):
sort = res.order_by('-count__sum')[:20]
return Response(sort)
class TestwatcherAPIView(ListAPIView):
def get(self, request):
data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date()
data_end = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date()
data_rating = data_end + timedelta(days=1)
beetween = data_end - (data_start - timedelta(days=1))
#
res = CountVisitor.objects.filter(visitdate__lt = request.GET.get("start"), visitdate__gte=data_start - beetween*2).distinct().values('visitdate','user__user_id')
# .annotate(total=Count('user', distinct=True)).order_by('visitdate')
per = CountVisitor.objects.filter(Q(visitdate__lte = request.GET.get("end"), visitdate__gte =request.GET.get("start")) | Q(visitdate=date.today()))
# Обратная связь
feed = UserComment.objects.all()
rating = RatingStatus.objects.values('crit__name', 'crit__ico', 'crit__color', 'rating').filter(usercom__time_create__range=[request.GET.get("start"), data_rating])
d = feed.filter(time_create__range=[request.GET.get("start"), data_rating])
return Response({
'beforperiod': res,
'period': PagesSerializer(per, many= True).data,
'staff': DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count(),
'feedback': {
'feed': UserCommentSerializer(d, many=True).data,
'criteria': list(rating.values('crit__name').annotate(ratings=Avg('rating'), name=F('crit__name'), ico=F('crit__ico'), color=F('crit__color')).values('ratings', 'name', 'ico', 'color')),
'data': {
'score': {
'title': 'Поставлено оценок',
'all': feed.count(),
'period': feed.filter(time_create__range=[request.GET.get("start"), request.GET.get("end")]).count()
},
'comment': {
'title': 'Оставлено комментариев',
'all': feed.filter(~Q(comment='')).count(),
'period': feed.filter(Q(time_create__range=[request.GET.get("start"), request.GET.get("end")]) & ~Q(comment='')).count()
}
},
'last_comment': feed.values('time_create').filter(~Q(comment='')).latest('time_create'),
},
})
-150
View File
@@ -1,150 +0,0 @@
# Daphne, Django channels backend
upstream portal-backend {
server 127.0.0.1:9967;
}
#Flask backend for UKD Wizard
#
#upstream wizard-backend {
# server 10.252.44.60:8888;
# }
# PORTAL Test server
server {
listen 9966;
server_name 9966;
send_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
root /var/www/PORTAL_COD2/src/front/dist/;
include /etc/nginx/mime.types;
access_log /var/log/nginx/portal.access.log;
error_log /var/log/nginx/portal.error.log;
location / {
try_files $uri /index.html;
}
# location ~ ^.*/static/(.+\.xlsx)/$ {
# alias /var/www/portal/portal/static;
# }
location /static {
autoindex on;
alias /var/www/PORTAL_COD2/src/portal/static/;
}
location /media {
alias /var/www/PORTAL_COD2/src/portal/media;
}
location ^~ /api/ {
client_max_body_size 100m;
include proxy_params;
proxy_pass http://127.0.0.1:8085;
}
# error_page 500 502 503 504 /500.html;
# location = /500.html {
# root /var/www/proj/;
# internal;
# }
# location /testing {
# fastcgi_pass unix:/does/not/exit;
#}
# VS 20220530 - Test reverse proxy for statistics as susbsite
## location /stat {
## rewrite ^/stat(.*) /$1 break;
# proxy_set_header Host "stat";
### proxy_set_header X-Real-IP $remote_addr;
### proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
### proxy_set_header X-Forwarded-Proto $scheme;
### autoindex on;
#
### proxy_pass http://127.0.0.1:8080;
### }
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_pass http://portal-backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
# Wizard integration
# vs@20220831
#location /wizard/ {
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
#proxy_redirect off;
# proxy_set_header Host $host;
#proxy_set_header Host $http_host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $server_name;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_pass http://wizard-backend/;
#proxy_pass http://wizard-backend/wizard;
# include proxy_params;
# }
##location /_next/ {
## proxy_http_version 1.1;
## proxy_set_header Upgrade $http_upgrade;
## proxy_set_header Connection "upgrade";
## #proxy_redirect off;
## proxy_set_header Host $host;
#proxy_set_header Host $http_host;
## proxy_set_header X-Real-IP $remote_addr;
## proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
## proxy_set_header X-Forwarded-Host $server_name;
## proxy_set_header X-Forwarded-Proto $scheme;
## proxy_pass http://wizard-backend/;
## #proxy_pass http://wizard-backend/wizard;
# include proxy_params;
## }
# Test redirection - all works fine.
# http://ukt/node-red/ -> http://10.252.44.35:1880/
# vs@20220831
## location /node-red/ {
## proxy_http_version 1.1;
## proxy_set_header Upgrade $http_upgrade;
## proxy_set_header Connection "upgrade";
## proxy_set_header Host 10.252.44.35;
## proxy_set_header X-Real-IP $remote_addr;
## proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
## proxy_set_header X-Forwarded-Proto $scheme;
## proxy_pass http://10.252.44.35:1880/;
## }
# Does not work
##location ^~ /wiki/ {
## proxy_http_version 1.1;
## proxy_set_header Upgrade $http_upgrade;
## proxy_set_header Connection "upgrade";
## proxy_redirect off;
## #proxy_set_header Host $host;
## #proxy_set_header Host $http_host;
## proxy_set_header Host wiki.cod2.regions.tax.nalog.ru;
}
@@ -7,7 +7,7 @@ After=network.target
[Service]
User=root
#WorkingDirectory=/var/www/proj/DQM/dqmback
WorkingDirectory=/var/www/PORTAL_COD2/src/
WorkingDirectory=/var/www/PORTAL_COD2/src
# --timeout NNN - set timeout for gunicorn to NNN sec, default - 30sec
# --access-logfile FILENAME - log all requests to file FILENAMEA
# --error-logfile FILENAME - set error log file to FILENAME
@@ -7,7 +7,7 @@ Type=simple
User=root
#Group = nginx
WorkingDirectory=/var/www/PORTAL_COD2/src
ExecStart=/var/www/PORTAL_COD2/env/bin/python /var/www/PORTAL_COD2/env/bin/daphne -p 9967 portal.asgi:application
ExecStart=/var/www/PORTAL_COD2/env/bin/python /var/www/PORTAL_COD2/env/bin/daphne -p 9966 portal.asgi:application
Restart=on-failure
[Install]
+65
View File
@@ -0,0 +1,65 @@
# Daphne, Django channels backend
upstream portal-backend {
server 127.0.0.1:9966;
}
# PORTAL Test server
server {
listen 80;
server_name portal-t portal-t.cod2.regions.tax.nalog.ru;
send_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
root /var/www/PORTAL_COD2/src/front/dist/;
include /etc/nginx/mime.types;
access_log /var/log/nginx/portal.access.log;
error_log /var/log/nginx/portal.error.log;
location / {
try_files $uri /index.html;
}
location /static {
autoindex on;
alias /var/www/PORTAL_COD2/src/static/;
}
location /media {
alias /var/www/PORTAL_COD2/src/media;
}
location ^~ /api/ {
client_max_body_size 100m;
include proxy_params;
proxy_pass http://portal-backend;
}
location ^~ /admin {
include proxy_params;
proxy_pass http://portal-backend;
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_pass http://portal-backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}