Merge branch 'II' into razrab

This commit is contained in:
iriska-gri committed 2024-02-09 14:43:37 +03:00
commit 2840e7ecb7
15 files changed
+641 -424

No files matched your search

+3 -3
View File
@@ -22919,9 +22919,9 @@
} }
}, },
"node_modules/vuetify": { "node_modules/vuetify": {
"version": "3.4.10", "version": "3.5.2",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.4.10.tgz", "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.5.2.tgz",
"integrity": "sha512-tObGoumCJxuK26OpS/CLZZIJAgDtN2cnd31vJscVhpuf6jeMD7wh8IsgfZownAOXU1FcKWVQwn1RSDsoXk5cJA==", "integrity": "sha512-H/g9+8Loykt50qe9mruHkwWsAIgfQ8gO+SPTAV2uaCFmfYPSFRfu0aGcZ42iWu4bZ9ZkgswIIDaVsfnKINd8yg==",
"engines": { "engines": {
"node": "^12.20 || >=14.13" "node": "^12.20 || >=14.13"
}, },
+1 -3
View File
@@ -45,9 +45,7 @@ import {useAccountStore} from '@/store/AccountStore'
background: rgb(var(--v-theme-scrollbar)) background: rgb(var(--v-theme-scrollbar))
} }
.pointer {
cursor:pointer
}
.bggrad { .bggrad {
background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8)); background: linear-gradient(to top right, rgba(19,84,122,.8), rgba(128,208,199,.8));
@@ -1,7 +1,6 @@
<template> <template>
<v-card class="text-center h-100 d-flex flex-column" > <v-card class="text-center h-100 d-flex flex-column" >
<v-card-title> <v-card-title>
<v-row no-gutters> <v-row no-gutters>
<v-col lg=2> <v-col lg=2>
<v-switch <v-switch
@@ -13,18 +12,22 @@
</v-col> </v-col>
<v-col class="ml-n7 pt-2"> <v-col class="ml-n7 pt-2">
Рейтинг посещаемости страниц портала Рейтинг посещаемости страниц портала
<!-- <v-icon size="small" icon="mdi-menu-down" class="pa-0"/> -->
</v-col> </v-col>
</v-row> </v-row>
</v-card-title> </v-card-title>
<v-divider/> <v-divider/>
<v-row class="overflow-auto h-0"> <v-row class="overflow-auto h-0">
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
<v-table fixed-header <v-table
fixed-header
height="0" height="0"
hover
class="cursor-default"
> >
<thead> <thead>
<tr class="text-uppercase"> <tr>
<th>Имя страницы</th> <th></th>
<th class="text-center"> на {{pages_count.title.today}} </th> <th class="text-center"> на {{pages_count.title.today}} </th>
<th class="text-center">с {{pages_count.title.year.start}} по {{pages_count.title.year.end}}</th> <th class="text-center">с {{pages_count.title.year.start}} по {{pages_count.title.year.end}}</th>
</tr> </tr>
@@ -35,29 +38,54 @@
:key="key" :key="key"
> >
<td>{{key}}</td> <td>{{key}}</td>
<td-tooltip <td>
:number = modelrating?val.now.unique.length:val.now.countall <tooltip-text
:tooltip = val.now.unique
/> v-if="val.now.unique.length>0"
<td-tooltip :text="modelrating?val.now.unique.length:val.now.countall"
:number = modelrating?val.year.unique.length:val.year.countall >
:tooltip = val.year.unique <template v-slot:tooltip>
/> <v-row
</tr> no-gutters v-for="n in val.now.unique"
<tr :key="n"
v-for="(val, key) in pages_count.data" >
:key="key" <v-col>
> {{n}}
<td>{{key}}</td> </v-col>
<td-tooltip </v-row>
:number = modelrating?val.now.unique.length:val.now.countall </template>
:tooltip = val.now.unique </tooltip-text>
/> <span v-else>
<td-tooltip 0
:number = modelrating?val.year.unique.length:val.year.countall </span>
:tooltip = val.year.unique </td>
/> <td >
<tooltip-text
v-if="val.year.unique.length>0"
:text="modelrating?val.year.unique.length:val.year.countall"
>
<template v-slot:tooltip>
<v-row
no-gutters
v-for="n in val.year.unique"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</template>
</tooltip-text>
<span v-else>
0
</span>
<!-- <tooltip-number
:number = modelrating?val.year.unique.length:val.year.countall
:tooltip = val.year.unique
/> -->
</td>
</tr> </tr>
</tbody> </tbody>
</v-table> </v-table>
@@ -68,11 +96,11 @@
<script> <script>
import { ref } from 'vue' import { ref } from 'vue'
import tdTooltip from '@/components/UI/td-tooltip.vue'
import TooltipText from '@/components/UI/tooltip-text.vue'
export default { export default {
components: { tdTooltip }, components: { TooltipText },
props: { props: {
pages_count: { pages_count: {
@@ -1,84 +1,266 @@
<template> <template>
<v-card <v-card class="h-100 d-flex flex-column pa-1" >
class="mx-auto" height="150px" <!-- <my-helper :pretext="activusers"/> -->
> <v-row no-gutters class="overflow-auto h-0">
<v-col class="d-flex flex-column">
<v-chip
color="light-blue-darken-4"
label
class="text-center rounded-0 text-subtitle-1 font-weight-medium"
>
<v-icon start icon="mdi-account-circle-outline"/>
Самые активные пользователи
</v-chip>
<v-divider/>
<v-data-table
v-model:expanded="expanded"
:headers="dessertHeaders"
:items="activusers"
item-value="user.fio"
show-expand
items-per-page-text=""
:items-per-page-options=perpage
show-current-page
: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:expanded-row="{ columns, item }">
<tr>
<td :colspan="columns.length">
<v-card class="my-2 elevation-5" >
<v-chip
prepend-icon="mdi-script"
size="small"
class="font-italic my-2"
text="Количество посещенных страниц за выбранный период (всего/уникальные)"
variant="text"
color="grey"
/>
<v-divider/>
<v-data-table
:headers="subtable"
:items="item.tooltip"
items-per-page=-1
class="subtable"
density="compact"
:sort-by="[{ key: 'count', order: 'desc' }]"
>
<my-helper :pretext="users"/> <template v-slot:header.count="{ column, isSorted, getSortIcon }">
<v-card-text class="text-h5 pa-2 pl-5 flex-wrap align-center d-flex justify-space-between"> <v-btn
{{name}} max-width="50px"
prepend-icon="mdi-folder-multiple-outline"
<v-icon variant="text"
color="blue-grey-lighten-1" >
:icon="ico" <v-icon
size="35" v-if="isSorted(column)"
/> :icon="getSortIcon(column)"
</v-card-text> />
<v-divider/> </v-btn>
<v-card-text class="pa-0 d-flex flex-column h-100"> </template>
<v-row no-gutters>
<v-col lg=8 class="px-0 "> <template v-slot:header.unic="{ column, isSorted, getSortIcon }">
<list-user :author=users /> <v-tooltip location="top">
</v-col> <template v-slot:activator="{ props }">
<v-col class="pt-8 text-center"> <v-btn v-bind="props" max-width="50px" prepend-icon="mdi-folder-outline" variant="text">
<v-icon v-if="isSorted(column)" :icon="getSortIcon(column)"/>
</v-btn>
</template>
<span>Сколько раз посетили в течение заданного периода (1 раз = 1 день)</span>
</v-tooltip>
</template>
<template v-slot:item.count="{ value }">
<v-chip :color="getColor(value)" density="compact">
{{ value }}
</v-chip>
</template>
<template v-slot:item.unic="{ value }">
<v-chip :color="getColor2(value)" density="compact">
{{ value }}
</v-chip>
</template>
</v-data-table>
</v-card>
</td>
</tr>
</template>
<span class="subheading text-h6"> </v-data-table>
{{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-col>
</v-row> </v-row>
</v-card-text>
</v-card> </v-card>
</template> </template>
<script> <script>
import { ref } from 'vue'
import { spravURL } from '@/utils/axios-api' import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions' import {checkremote} from '@/utils/universal_functions'
import listUser from '@/components/UI//fiousercard/listUser.vue' import listUser from '@/components/UI//fiousercard/listUser.vue'
export default { export default {
components: { listUser }, components: {
listUser
},
props: { props: {
activusers: {
name: {
type: String,
default: ''
},
users: {
type: Object, type: Object,
default: {} default: {}
}, },
ico: { days: {
type: String, type: Number,
default: 'mdi-emoticon-poop' default: 0
} }
}, },
setup() { setup() {
const expanded = ref([])
const dessertHeaders = [
{
title: '',
align: 'start',
sortable: false,
key: 'user',
},
{ title: 'Просмотры', align: 'start', key: 'info.count', maxWidth: '10' },
{ title: 'Сессии', align: 'start', key: 'info.session', maxWidth: '10' },
{ title: 'Страницы', align: 'start', key: 'info.pages', maxWidth: '10' },
]
const subtable = [
{
title: '',
align: 'start',
sortable: false,
key: 'namepages',
width: '60%',
maxWidth: '60%',
minWidth: '60%',
},
{ title: 'Всего', align: 'start', key: 'count', width: '20%', maxWidth: '20%'
},
{ title: 'Уникальных', align: 'start', key: 'unic', width: '20%', maxWidth: '20%'
},
]
const desserts = [
{
user: {
login: "9966-00-001",
post: "Начальник инспекции",
fio: "Толоко Б.Б."
},
info: {
count: 253,
session: 4,
pages: 5
},
tooltip: [
{
namepages: "О портале",
count: 241,
unic: 3
}],
},
{
user: {
login: "9966-00-107",
post: "Старший специалист 1 разряда",
fio: "Гришина И.С."
},
info: {
count: 6010,
session: 21,
pages: 56
},
tooltip: [
{
namepages: "О портале",
count: 241,
unic: 3
},
{
namepages: "Портал МИ ФНС России по ЦОД №2",
count: 120,
unic: 27
},
],
},
]
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'
}
const perpage =
[
{value: 10, title: '10'},
{value: 25, title: '25'},
{value: 50, title: '50'},
{value: 100, title: '100'},
{value: -1, title: 'лох'}
]
return { return {
checkremote, checkremote,
spravURL, spravURL,
expanded,
dessertHeaders,
desserts,
subtable,
getColor,
getColor2,
perpage
} }
} }
} }
</script> </script>
<style> <style>
.subtable .v-data-table-footer {
display: none
}
</style> </style>
@@ -1,30 +1,56 @@
<template> <template>
<div style="height:68%"> <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-list-item class="pl-4 h-100 pointer" @click="open=true"> <v-avatar
<template v-slot:prepend> color="grey-darken-3"
<v-avatar :image="checkremote( `${spravURL}${author.login}.jpg`)"
color="grey-darken-3" />
:image="checkremote( `${spravURL}${author.login}.jpg`)" </template>
<v-list-item-title :class="style_item_title()">
/> {{author.fio}}
</template> </v-list-item-title>
<v-list-item-title class="text-body-1 font-weight-medium pt-2"> <v-list-item-subtitle :class="style_item_subtitle()">
{{author.fio}} {{author.post}}
</v-list-item-title> </v-list-item-subtitle>
<v-list-item-subtitle class="pb-2"> </v-list-item>
{{author.post}}
<v-list-item v-if="from_which=='top-user'" class="h-100 text-left pa-2 pl-0" @click="open=true">
</v-list-item-subtitle> <v-chip
</v-list-item> class="cursor-pointer pa-0"
variant='text'
<info-user-card label
:opendialog = open color="grey-darken-3"
:loging="author.login" size="small"
@update:opendialog="open = $event" >
/> <v-avatar
</div> color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
class="mr-2"
/>
{{author.fio}}
</v-chip>
<!-- <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>
<info-user-card
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
</template> </template>
<script> <script>
@@ -38,14 +64,40 @@ export default {
type: Object, type: Object,
default: {} default: {}
}, },
from_which: {
type: String,
default: "dialog-search"
}
}, },
setup(){ setup(props){
const open = ref(false) const open = ref(false)
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 { return {
open, open,
checkremote, checkremote,
spravURL spravURL,
style_item_title,
style_item_subtitle
} }
} }
} }
+2 -1
View File
@@ -1,4 +1,5 @@
import myHelper from '@/components/UI/my-helper'; import myHelper from '@/components/UI/my-helper';
import InfoUserCard from '@/components/UI/infoUserCard.vue'; import InfoUserCard from '@/components/UI/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: { props: {
pretext: { pretext: {
type:Object,
default:()=>{}
} }
}, },
@@ -1,50 +0,0 @@
<template>
<td>
<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>
</td>
</template>
<script>
export default {
props: {
tooltip: {
type: Array,
default: () => []
},
number: {
type: Number,
default: 0
}
},
}
</script>
<style>
</style>
@@ -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>
+2 -1
View File
@@ -28,7 +28,8 @@
</v-card-title> </v-card-title>
<v-card-text <v-card-text
@click="detailRound(x.position, x.position__name)" @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 <vue3-autocounter
+1 -1
View File
@@ -166,7 +166,7 @@
<v-img <v-img
cover cover
class=" pointer" class=" cursor-pointer"
:src="`${burl}${e.img}`" :src="`${burl}${e.img}`"
@click="openImg(e.id)" @click="openImg(e.id)"
/> />
+4 -1
View File
@@ -5,8 +5,11 @@ import { ref } from 'vue'
export const usePortalFilterStore = defineStore('filter', () => { export const usePortalFilterStore = defineStore('filter', () => {
const date_period = ref({ "startdate": new Date(new Date().getFullYear(), 0, 1), const date_period = ref({ "startdate": new Date(new Date().getFullYear(), 0, 1),
"enddate": new Date() "enddate": new Date(),
}) })
return { date_period } return { date_period }
}, },
) )
+173 -256
View File
@@ -1,203 +1,41 @@
<template> <template>
<v-row no-gutters class="flex-column"> <v-row no-gutters class="flex-column gap ma-1">
<toolbar-filter/> <toolbar-filter/>
<v-col lg=3 class="w100 pa-1"> <v-col lg=3 class="w100">
<v-row no-gutters class="h-100"> <v-row no-gutters class="h-100 gap">
<v-col lg=2 class="bg-blue"> <v-col lg=2 class="bg-blue">
{{format1(previous.start)}} - {{format1(previous.end)}} {{format1(previous.start)}} - {{format1(previous.end)}}
{{days_between_startend}}
</v-col> </v-col>
<v-col class="bg-yellow "> <v-col>
<line-chart :dataLineChart="dataLineChart"/> <line-chart :dataLineChart="dataLineChart"/>
</v-col> </v-col>
</v-row> </v-row>
</v-col> </v-col>
<v-col class="w100"> <v-col class="w100 ">
<v-row no-gutters class="h-100"> <v-row no-gutters class="h-100 gap">
<v-col lg=2 class="bg-green"> <v-col lg=2 class="bg-green">
visiting- (все данные) visiting- (все данные)
<my-helper :pretext="visiting"/> <my-helper :pretext="visiting"/>
</v-col> </v-col>
<v-col lg=5 class="bg-red d-flex flex-column"> <v-col lg=4 class="d-flex flex-column">
<rating-page :pages_count=pages_count /> <rating-page :pages_count=pages_count />
</v-col> </v-col>
<v-col class="d-flex flex-column bg-yellow"> <v-col lg=4 class="d-flex flex-column ">
<v-row class=" overflow-auto h-0">
<v-col>
<v-card class="text-center h-100 ">
<div v-for="(x, key) in dataActivusers" :key="key" >
<top-user
:users = x
:name= key
/>
</div>
</v-card>
</v-col>
</v-row>
<!-- -->
<!--
> -->
<!-- <div v-for="(x, key) in dataActivusers" :key="key" >
{{x}}
<top-user
:users = x
:name= key
/>
</div> -->
<!-- </v-card> -->
<top-user
:activusers = dataActivusers
:days = days_between_startend
@sortcount=sortcount
/>
</v-col> </v-col>
<v-col class="bg-red">4 </v-col> <v-col class="bg-red">4 </v-col>
</v-row> </v-row>
</v-col> </v-col>
<!-- <v-row class="flex-grow-0">
<v-col lg=3>
dataLineChart (данные для графика)-
</v-col>
<v-col> <my-helper :pretext="dataLineChart"/> </v-col>
</v-row> -->
<!-- <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 = "enddate"
/>
</div>
</v-toolbar>
</v-col>
</v-row>
<v-row>
</v-row>
<v-row class="flex-grow-0">
<v-col lg=3>
visiting- (все данные)
</v-col>
<v-col > <my-helper :pretext="visiting"/> </v-col>
</v-row>
<v-row class="flex-grow-0">
<v-col lg=3>
dataLineChart (данные для графика)-
</v-col>
<v-col> <my-helper :pretext="dataLineChart"/> </v-col>
</v-row> -->
<!-- <v-row no-gutters class="gap flex-grow-0">
<v-col lg=3>
<portal-traffic
:traffic=traffic
/>
</v-col>
<v-col>
<line-chart :visiting="visiting"/>
</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 class="text-uppercase">
<th>Имя страницы</th>
<th class="text-center"> на {{selected_days.today}} </th>
<th class="text-center">за период</th>
</tr>
</thead>
<tbody>
<tr v-for="(val, key) in pages_count" :key = key>
<td class="text-left">{{key}}</td>
<td class="text-center">{{ modelrating?val.now.unique.size:val.now.countall }} </td>
<td class="text-center">{{ modelrating?val.year.unique.size:val.year.countall }}</td>
</tr>
</tbody>
</v-table>
</v-col>
</v-row>
</v-card>
</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-row> </v-row>
</template> </template>
@@ -232,148 +70,225 @@ export default {
setup(){ setup(){
const filterStore = usePortalFilterStore() const filterStore = usePortalFilterStore()
const days_between_startend = ref(0)
const visiting = ref([]) const visiting = ref([])
const feedback = ref([]) const feedback = ref([])
const staff = ref(0) const staff = ref(0)
const dataLineChart = ref({}) const dataLineChart = ref({})
const dataActivusers = ref({}) const dataActivusers = ref([])
const unicuser = ref([])
const previous = ref({start: new Date(), end: new Date()}) const previous = ref({start: new Date(), end: new Date()})
const selected_days = ref({today: 'сегодня', year: {start: new Date(), end: new Date()}}) const selected_days = ref({today: 'сегодня', year: {start: new Date(), end: new Date()}})
const pages_count = ref({data: {}, title: {}}) const pages_count = ref({data: {}, title: {}})
const previous_period =() => { const previous_period =() => {
let days_between = Math.floor((new Date(filterStore.date_period.enddate) - new Date(filterStore.date_period.startdate)) / (1000*60*60*24)) let days_between = Math.floor((new Date(filterStore.date_period.enddate) - new Date(filterStore.date_period.startdate)) / (1000*60*60*24))
days_between += 1 days_between += 1
if (filterStore.date_period.startdate == filterStore.date_period.enddate) { if (filterStore.date_period.startdate == filterStore.date_period.enddate) {
days_between = 1 days_between = 1
} }
console.log(days_between, 'days_between');
previous.value.start = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - days_between)) previous.value.start = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - days_between))
previous.value.end = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - 1)) previous.value.end = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - 1))
days_between_startend.value = days_between
} }
pagecounter() pagecounter()
const visition = () => { const visition = () => {
axiosApiInstance.get(`api/watcher/counter/`).then(result => { previous_period()
console.log(format2(previous.value.start), format2(previous.value.end), '---------previous.value--------------');
axiosApiInstance.get(`api/watcher/counter/?start=${format2(previous.value.start)}&end=${format2(previous.value.end)}`).then(result => {
staff.value = result.data.staff staff.value = result.data.staff
visiting.value = result.data.result visiting.value = result.data.result
feedback.value = result.data.feedback feedback.value = result.data.feedback
visitionreduce() visitionreduce()
funActiveUser()
})} })}
visition() visition()
const visitionreduce = () => { const checking_for_entry = (where, what) => {
previous_period()
let lineCharts = {}
let activusers = {}
// let portal_traffic = {
// now: {
// title: '',
// info: '',
// unique: new Set(),
// percentage_staff: 0,
// comparison_period: new Set(),
// percentage_period: 0
// },
// year: {
// title: 'За период',
// info: '',
// unique: new Set(),
// percentage_staff: 0,
// comparison_period: new Set(),
// percentage_period: 0
// }
// }
const checking_for_entry = (where, what) => {
if (!where.includes(what)) if (!where.includes(what))
{ {
where.push(what) where.push(what)
} }
} }
const funLineChart = (data, item) => {
if (!data[item.visitdate]) {
data[item.visitdate] = {count: 0, unic: []}
}
checking_for_entry(data[item.visitdate]['unic'], splitname(item.author))
data[item.visitdate].count += item.count
}
const funActiveUser = (data, onedata, item) => {
unicuser.value.map(iduser => {
let activuser ={
user: {
id: "",
login: "",
post: "",
fio: ""
},
info: {
count: 0,
session: 0,
pages: 0
},
tooltip: [],
}
let yearpages = {}
let pages = []
let user = visiting.value.filter(e => e.author.id == iduser)
const groupUser = user.reduce((acc, item) => {
funyearpages(yearpages, item)
checking_for_entry(pages, item.pages)
acc['id'] = item.author.id
acc['login'] = item.author.login
acc['post'] = item.author.post
acc['fio'] = splitname(item.author)
acc['count'] += item.count
acc['session'] = Object.keys(yearpages).length
return acc
}, {count: 0})
let arrbigs = []
pages.map(namepages => {
let onetooltip = {
namepages: "",
count: 0,
unic: 0
}
let unicpages = user.filter(e => (e.pages == namepages))
const pagesData = unicpages.reduce((accpag, pag) => {
accpag['pages'] = pag.pages
accpag['count'] += pag.count
accpag['unic'] += 1
return accpag
}, {count: 0, unic: 0})
onetooltip.namepages = pagesData.pages
onetooltip.count = pagesData.count
onetooltip.unic = pagesData.unic
arrbigs.push(onetooltip)
}
)
activuser.user.id = groupUser.id
activuser.user.login = groupUser.login
activuser.user.post = groupUser.post
activuser.user.fio = groupUser.fio
activuser.info.count = groupUser.count
activuser.info.session = groupUser.session
activuser.info.pages = user.length
activuser.tooltip = arrbigs
dataActivusers.value.push(activuser)
})
}
const funyearpages = (data, item) => {
if (!data[item.visitdate]) {
data[item.visitdate] = {}
}
if (!data[item.visitdate][item.pages]) {
data[item.visitdate][item.pages] = 0
}
data[item.visitdate][item.pages] += item.count
}
const visitionreduce = () => {
previous_period()
let lineCharts = {}
console.log(visiting.value)
const groupedData = visiting.value.reduce((acc, item) => { const groupedData = visiting.value.reduce((acc, item) => {
// Данные для графика по фильтру
if (item.visitdate >= format2(filterStore.date_period.startdate) && item.visitdate <= format2(filterStore.date_period.enddate)){ if (item.visitdate >= format2(filterStore.date_period.startdate) && item.visitdate <= format2(filterStore.date_period.enddate)){
funLineChart(lineCharts, item)
checking_for_entry(unicuser.value, item.author.id)
// funActiveUser(activeUser, oneUser, item)
if (!lineCharts[item.visitdate]) {
lineCharts[item.visitdate] = {count: 0, unic: []}
}
checking_for_entry(lineCharts[item.visitdate]['unic'], splitname(item.author))
if (!activusers[splitname(item.author)])
{
activusers[splitname(item.author)] = {login: '', post: '', session: {} }
}
activusers[splitname(item.author)].login = item.author.login
activusers[splitname(item.author)].post = item.author.post
if (!activusers[splitname(item.author)].session[item.visitdate]) {
activusers[splitname(item.author)].session[item.visitdate] = {pages: {}}
}
if (!activusers[splitname(item.author)].session[item.visitdate].pages[item.pages]) {
activusers[splitname(item.author)].session[item.visitdate].pages[item.pages] = {count: 0}
}
activusers[splitname(item.author)].session[item.visitdate].pages[item.pages].count = item.count
// Данные для таблицы по страницам
if (!acc[item.pages]) { if (!acc[item.pages]) {
acc[item.pages] = { acc[item.pages] = {
now: now:
{unique: [], countall: 0}, {unique: [], countall: 0},
year: year:
{unique: [], countall: 0} {unique: [], countall: 0}
} }
} }
checking_for_entry(acc[item.pages].year.unique, splitname(item.author)) checking_for_entry(acc[item.pages].year.unique, splitname(item.author))
acc[item.pages].year.countall += item.count acc[item.pages].year.countall += item.count
} }
// ------------------------------------------------------------------------------------------------------
if (item.visitdate == format2(new Date())) { if (item.visitdate == format2(new Date())) {
checking_for_entry(acc[item.pages].now.unique, splitname(item.author)) checking_for_entry(acc[item.pages].now.unique, splitname(item.author))
acc[item.pages].now.countall += item.count acc[item.pages].now.countall += item.count
} }
// Данные для посещаемость портала
if (item.visitdate >= format2(previous.value.start) && item.visitdate <= format2(previous.value.end)){
// console.log(item.visitdate, '------------------------------');
}
dataLineChart.value = lineCharts
dataActivusers.value = activusers
return acc return acc
}, {}) }, {})
//
watch(()=>filterStore.date_period,(newValue,oldValue)=>{ dataLineChart.value = lineCharts
pages_count.value.data = groupedData
}
watch(()=>filterStore.date_period,(newValue,oldValue)=>{
if(newValue){ if(newValue){
visition()
visitionreduce() visitionreduce()
title_period() title_period()
} }
}, {deep:true}) }, {deep:true})
pages_count.value.data = groupedData
return groupedData
}
const sortcount = () => {
console.log('функция из топ юзер');
}
const title_period = () => { const title_period = () => {
selected_days.value.year.start = format1(filterStore.date_period.startdate) selected_days.value.year.start = format1(filterStore.date_period.startdate)
@@ -393,7 +308,9 @@ setup(){
dataActivusers, dataActivusers,
previous, previous,
format1, format1,
selected_days selected_days,
sortcount,
days_between_startend
// countgrupp, // countgrupp,
// activuser, // activuser,
+3 -2
View File
@@ -19,10 +19,11 @@ class Counter(ListAPIView):
serializer_class = CountSerializer serializer_class = CountSerializer
def get(self, request): def get(self, request):
print(request.GET.get("start"), request.GET.get("end"),'--------------------------------------------')
# Посещаемость портала # Посещаемость портала
# res = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).annotate(Sum('count')) res = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).annotate(Sum('count'))
res = CountVisitor.objects.all().annotate(Sum('count')) # res = CountVisitor.objects.all().annotate(Sum('count'))
result = CountSerializer(res, many=True).data result = CountSerializer(res, many=True).data
# Обратная связь # Обратная связь