br
This commit is contained in:
1 parent
5aa4136cfd
commit
3875cc2a5a
5 files changed
+81
-10
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card class="text-center text-blue-grey-darken-4 d-flex h-100 flex-column cursor-default justify-center">
|
<v-card class="text-center text-blue-grey-darken-4 d-flex h-100 flex-column cursor-default justify-center">
|
||||||
|
<!-- <my-helper :pretext="x"/> -->
|
||||||
<v-row no-gutters class="flex-grow-0 ">
|
<v-row no-gutters class="flex-grow-0 ">
|
||||||
<v-col class="text-h5 font-weight-bold pl-5">
|
<v-col class="text-h5 font-weight-bold pl-5">
|
||||||
{{indicator.title}}
|
{{indicator.title}}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
:color="val.previos<val.user.length?'green-darken-2':'deep-orange-darken-4'"
|
: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'"
|
:icon="val.previos<val.user.length?'mdi-arrow-up-bold':'mdi-arrow-down-bold'"
|
||||||
/>
|
/>
|
||||||
<!-- <my-helper :pretext="alldata.beforperiod"/> -->
|
<!-- -->
|
||||||
{{100 - parseFloat( val.user.length * 100 /val.previos).toFixed(2)}} %
|
{{100 - parseFloat( val.user.length * 100 /val.previos).toFixed(2)}} %
|
||||||
</td>
|
</td>
|
||||||
<td v-if="!val.previos"></td>
|
<td v-if="!val.previos"></td>
|
||||||
@@ -118,7 +118,7 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
props.alldata.beforperiod.filter( e=> data2.diff(moment(e.visitdate), 'days') < between).reduce((acc, item) => {
|
props.alldata.beforperiod.filter( e=> data2.diff(moment(e.visitdate), 'days') < between).reduce((acc, item) => {
|
||||||
res.period.previos += item.total
|
res.period.previos += item.user.length
|
||||||
return acc
|
return acc
|
||||||
}, res.period.previos)
|
}, res.period.previos)
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,10 @@
|
|||||||
<v-row no-gutters class="h-100 gap">
|
<v-row no-gutters class="h-100 gap">
|
||||||
<v-col class="flex-column d-flex">
|
<v-col class="flex-column d-flex">
|
||||||
<v-row no-gutters class="flex-column gap" >
|
<v-row no-gutters class="flex-column gap" >
|
||||||
<!-- <v-col v-for="x in dataIndicators" :key=x>
|
<my-helper :pretext="alldata.period"/>
|
||||||
|
<v-col v-for="x in cardtotal" :key=x>
|
||||||
<card-total :indicator=x />
|
<card-total :indicator=x />
|
||||||
</v-col> -->
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -99,19 +100,78 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
const filterStore = usePortalFilterStore()
|
const filterStore = usePortalFilterStore()
|
||||||
const alldata =ref({period: [], staff: 0, beforperiod: []})
|
const alldata =ref({period: [], staff: 0, beforperiod: []})
|
||||||
const visition = () => {
|
const visition = () => {
|
||||||
|
|
||||||
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
|
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
|
||||||
alldata.value = result.data
|
|
||||||
console.log(result.data, 'result.data');
|
|
||||||
|
|
||||||
|
alldata.value = preparedata(result.data)
|
||||||
|
console.log(result.data, 'result.data');
|
||||||
|
totalfn()
|
||||||
|
|
||||||
|
|
||||||
})}
|
})}
|
||||||
visition()
|
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
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const totalfn = () => {
|
||||||
|
let beforperiodusers = new Set([])
|
||||||
|
alldata.value.beforperiod.forEach(e => beforperiodusers.add(...e.user))
|
||||||
|
|
||||||
|
|
||||||
|
let periodusers = new Set([])
|
||||||
|
let brdata = {}
|
||||||
|
|
||||||
|
alldata.value.period.forEach((e) => {
|
||||||
|
periodusers.add(e.user.id)
|
||||||
|
if (!brdata[e.user.id]) {
|
||||||
|
brdata[e.user.id] = []
|
||||||
|
}
|
||||||
|
brdata[e.user.id].push(e.fullPath)
|
||||||
|
})
|
||||||
|
console.log(brdata, 'brdata')
|
||||||
|
let bothuser = new Set([...periodusers].filter(element => beforperiodusers.has(element)))
|
||||||
|
cardtotal.value.crr.data = bothuser.size*100/beforperiodusers.size
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
watch(()=>filterStore.date_period,()=>{
|
watch(()=>filterStore.date_period,()=>{
|
||||||
|
|
||||||
@@ -374,7 +434,8 @@ setup(){
|
|||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
alldata
|
alldata,
|
||||||
|
cardtotal
|
||||||
// visiting,
|
// visiting,
|
||||||
// pages_count,
|
// pages_count,
|
||||||
// visitionreduce,
|
// visitionreduce,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<v-col lg=3 class="w100">
|
<v-col lg=3 class="w100">
|
||||||
<v-row no-gutters class="h-100 gap">
|
<v-row no-gutters class="h-100 gap">
|
||||||
<v-col >
|
<v-col >
|
||||||
<portal-traffic :traffic=dataAttendance />
|
<!-- <portal-traffic :traffic=dataAttendance /> -->
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col lg=9>
|
<v-col lg=9>
|
||||||
|
|
||||||
@@ -34,7 +34,9 @@
|
|||||||
<v-row no-gutters class="h-100 gap">
|
<v-row no-gutters class="h-100 gap">
|
||||||
<v-col class="flex-column d-flex">
|
<v-col class="flex-column d-flex">
|
||||||
<v-row no-gutters class="flex-column gap" >
|
<v-row no-gutters class="flex-column gap" >
|
||||||
|
<my-helper :pretext="dataIndicators"/>
|
||||||
<v-col v-for="x in dataIndicators" :key=x>
|
<v-col v-for="x in dataIndicators" :key=x>
|
||||||
|
<!-- -->
|
||||||
<card-total :indicator=x />
|
<card-total :indicator=x />
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|||||||
@@ -168,7 +168,15 @@ class SelectedLinksAPIView(ListAPIView):
|
|||||||
class TestwatcherAPIView(ListAPIView):
|
class TestwatcherAPIView(ListAPIView):
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
res = CountVisitor.objects.filter(visitdate__lt = request.GET.get("start")).values('visitdate').annotate(total=Count('user', distinct=True)).order_by('visitdate')
|
|
||||||
|
data_start = datetime.strptime(request.GET.get("start"), "%Y-%m-%d").date()
|
||||||
|
data_end = datetime.strptime(request.GET.get("end"), "%Y-%m-%d").date()
|
||||||
|
beetween = data_end - (data_start + timedelta(days=1))
|
||||||
|
new_date_start = data_start - beetween
|
||||||
|
print(new_date_start, '-----------------' )
|
||||||
|
#
|
||||||
|
res = CountVisitor.objects.filter(visitdate__lt = request.GET.get("start"), visitdate__gte=data_start - beetween).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()))
|
per = CountVisitor.objects.filter(Q(visitdate__lte = request.GET.get("end"), visitdate__gte =request.GET.get("start")) | Q(visitdate=date.today()))
|
||||||
# print( DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count())
|
# print( DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count())
|
||||||
return Response({
|
return Response({
|
||||||
|
|||||||
Reference in new issue
Block a user