все переписать
This commit is contained in:
1 parent
c43cf66398
commit
2478bb72ab
3 files changed
+71
-30
No files matched your search
@@ -3,30 +3,49 @@
|
||||
class="text-center"
|
||||
height="200px"
|
||||
>
|
||||
<v-card-title class="text-uppercase">
|
||||
<v-card-title class="text-uppercase text-body-1">
|
||||
Посещаемость портала
|
||||
</v-card-title>
|
||||
|
||||
|
||||
<v-card-text class="pl-0">
|
||||
<v-table fixed-header
|
||||
height="430px">
|
||||
<v-table
|
||||
fixed-header
|
||||
density="comfortable"
|
||||
class="text-caption"
|
||||
>
|
||||
<thead>
|
||||
<tr >
|
||||
<th></th>
|
||||
<th>Уникальные пользователи</th>
|
||||
<!-- <th class="text-center"> на {{selected_days.today}} </th> -->
|
||||
<th class="text-center">за период</th>
|
||||
<th width="125"></th>
|
||||
<th class="text-center">Уникальные пользователи</th>
|
||||
<th class="text-center">% от шага </th>
|
||||
<th class="text-center">% от периода</th>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="text-caption">
|
||||
<tr v-for="(val, key) in traffic" :key = key>
|
||||
|
||||
<my-helper :pretext="val"/>
|
||||
<!-- {{val}} {{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> -->
|
||||
|
||||
|
||||
<td class="text-left">{{val.title}}</td>
|
||||
<td class="text-center ">{{ val.unique.size }} </td>
|
||||
<td class="text-center">
|
||||
|
||||
{{ val.percentage_staff }}</td>
|
||||
<td>
|
||||
|
||||
<v-tooltip location="top"
|
||||
:text="`${val.info} - ${val.comparison_period.size} чел.`"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props" >
|
||||
|
||||
{{val.percentage_period}}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
</v-tooltip>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<v-row no-gutters class="ma-1">
|
||||
<v-col class="d-flex flex-column gap">
|
||||
|
||||
<my-helper :pretext="visiting"/>
|
||||
<v-row no-gutters class="flex-grow-0">
|
||||
<v-col>
|
||||
<v-toolbar
|
||||
@@ -32,7 +32,7 @@
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row no-gutters class="gap flex-grow-0">
|
||||
<!-- <v-row no-gutters class="gap flex-grow-0">
|
||||
<v-col lg=3>
|
||||
<portal-traffic
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
</template>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row> -->
|
||||
|
||||
|
||||
|
||||
@@ -184,15 +184,24 @@ setup(){
|
||||
pagecounter()
|
||||
|
||||
const weekstart = () => {
|
||||
|
||||
// console.log( , '!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
||||
let days_between = Math.floor((new Date(endate.value) - new Date(startdate.value)) / (1000*60*60*24))
|
||||
previous_period.value = format1(new Date(new Date(startdate.value).setDate(new Date(startdate.value).getDate() - days_between)))
|
||||
if (startdate.value == endate.value) {
|
||||
days_between = 1
|
||||
}
|
||||
previous_period.value = new Date(new Date(startdate.value).setDate(new Date(startdate.value).getDate() - days_between))
|
||||
|
||||
}
|
||||
|
||||
const lastperiod = () => {
|
||||
let last_day = []
|
||||
visiting.value.map((e)=>{
|
||||
if (e.visitdate < format2(endate.value))
|
||||
last_day.push(e.visitdate)
|
||||
|
||||
if (e.visitdate < format2(endate.value)) {
|
||||
last_day.push(e.visitdate)
|
||||
}
|
||||
|
||||
})
|
||||
last_days.value = last_day[last_day.length-1]
|
||||
}
|
||||
@@ -216,15 +225,18 @@ setup(){
|
||||
}
|
||||
|
||||
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 => {
|
||||
let start = startdate.value
|
||||
if (startdate.value == endate.value) {
|
||||
start = format2(new Date(startdate.value).setDate(new Date(startdate.value).getDate() -1))
|
||||
}
|
||||
axiosApiInstance.get(`api/watcher/counter/?start=${start}&end=${endate.value}`).then(result => {
|
||||
staff.value = result.data.staff
|
||||
visiting.value = result.data.result
|
||||
feedback.value = result.data.feedback
|
||||
weekstart()
|
||||
lastperiod()
|
||||
countgrupp()
|
||||
periodname()
|
||||
countgrupp()
|
||||
})}
|
||||
|
||||
const countgrupp = () => {
|
||||
@@ -232,6 +244,7 @@ setup(){
|
||||
let portal_traffic = {
|
||||
now: {
|
||||
title: '',
|
||||
info: '',
|
||||
unique: new Set(),
|
||||
percentage_staff: 0,
|
||||
comparison_period: new Set(),
|
||||
@@ -239,6 +252,7 @@ setup(){
|
||||
},
|
||||
year: {
|
||||
title: 'За период',
|
||||
info: '',
|
||||
unique: new Set(),
|
||||
percentage_staff: 0,
|
||||
comparison_period: new Set(),
|
||||
@@ -273,10 +287,16 @@ setup(){
|
||||
// Посещаемость портала для периода 1 день
|
||||
if (item.visitdate ==format2(last_days.value)){
|
||||
portal_traffic.now.comparison_period.add(item.author.id)
|
||||
portal_traffic.now.info = `за ${format1(last_days.value)}`
|
||||
}
|
||||
|
||||
portal_traffic.year.info = `с ${format1(previous_period.value)} по ${format1(startdate.value)} `
|
||||
console.log( `${format1(previous_period.value)} >=${format1(item.visitdate)} <= ${format1(startdate.value)}`,'до')
|
||||
|
||||
|
||||
// Посещаемость портала для периода - выбранный период фильтра
|
||||
if (item.visitdate >= previous_period.value && item.visitdate <= format2(startdate.value)) {
|
||||
if (item.visitdate >= format2(previous_period.value) && item.visitdate < format2(startdate.value)) {
|
||||
console.log( `${format1(previous_period.value)} >=${format1(item.visitdate)} < ${format1(startdate.value)}`,'после')
|
||||
console.log(previous_period.value, format2(startdate.value), '-------------------------------')
|
||||
portal_traffic.year.comparison_period.add(item.author.id)
|
||||
}
|
||||
|
||||
@@ -310,8 +330,8 @@ setup(){
|
||||
portal_traffic.now.percentage_period = percentageStaff(portal_traffic.now.comparison_period, portal_traffic.now.unique.size)
|
||||
portal_traffic.year.percentage_staff = percentageStaff(portal_traffic.year.unique, staff.value)
|
||||
portal_traffic.year.percentage_period = percentageStaff(portal_traffic.year.comparison_period, portal_traffic.year.unique.size)
|
||||
portal_traffic.now.title = selected_days.value.today
|
||||
console.log(portal_traffic, 'portal_traffic');
|
||||
portal_traffic.now.title = `На ${selected_days.value.today}`
|
||||
|
||||
pages_count.value = groupedData
|
||||
traffic.value = portal_traffic
|
||||
|
||||
|
||||
@@ -20,11 +20,13 @@ class Counter(ListAPIView):
|
||||
|
||||
def get(self, request):
|
||||
# Посещаемость портала
|
||||
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'))
|
||||
result = CountSerializer(res, many=True).data
|
||||
|
||||
# Обратная связь
|
||||
feed = RatingStatus.objects.filter(usercom__time_create__range=[request.GET.get("start"), request.GET.get("end")])
|
||||
feed = RatingStatus.objects.all()
|
||||
feedback = RatingStatusStatSerializer(feed, many=True).data
|
||||
|
||||
return Response({'result':result, 'feedback':feedback, 'staff':DictEmployee.objects.filter(deleted=0).count()})
|
||||
|
||||
Reference in new issue
Block a user