111111
This commit is contained in:
1 parent
9dc96dd514
commit
7c88054d2a
9 files changed
+205
-124
No files matched your search
@@ -95,7 +95,7 @@ export default {
|
||||
|
||||
const sorted = Object.entries(topUser)
|
||||
.sort(([,a],[,b]) => (b.comment.textarr.length - a.comment.textarr.length))
|
||||
console.log(sorted[0],'-------------');
|
||||
|
||||
dataTopUser.value = sorted[0][1]
|
||||
|
||||
|
||||
|
||||
@@ -149,11 +149,10 @@ export default {
|
||||
let data2 = moment(filterStore.date_period.startdate)
|
||||
between.value = data1.diff(data2, 'days') + 1
|
||||
let res = null
|
||||
console.log("sdssdss");
|
||||
|
||||
if (Object.keys(props.dataLineChart).length>0){
|
||||
res = arrlines
|
||||
res.labels=[]
|
||||
// console.log(props.dataLineChart, 'uuuuuuuuuuuuuuuuuuuuuu');
|
||||
for(let [key,val] of Object.entries(props.dataLineChart))
|
||||
|
||||
{
|
||||
@@ -166,7 +165,6 @@ export default {
|
||||
res.labels.push(formatComa(key))
|
||||
}
|
||||
|
||||
// console.log(fullper.value,"reeeeeeee"); // console.log(res, "kdjshskjhd");
|
||||
}
|
||||
// res.datasets[1].data=[]
|
||||
|
||||
@@ -175,7 +173,6 @@ export default {
|
||||
|
||||
const fullper = ref([])
|
||||
const fullpercreate = () => {
|
||||
console.log(props.period, 'ddddddddddddd');
|
||||
let arr = []
|
||||
props.period.period.forEach((e) => {
|
||||
let ind = arr.findIndex(el => el.visitdate == e.visitdate)
|
||||
@@ -203,8 +200,6 @@ export default {
|
||||
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)))
|
||||
// console.log(h);
|
||||
console.log(baseunic, crrunic, bothuser, "date");
|
||||
return parseFloat((bothuser.size*100/baseunic.size).toFixed(2))
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ export default {
|
||||
}
|
||||
|
||||
const arrforline=() => {
|
||||
console.log(props.dataLineChart, 'props.dataLineChart');
|
||||
|
||||
Object.entries(props.dataLineChart).forEach(e => {
|
||||
const [key, value] = e
|
||||
arrlines.value.datasets[0].data.push(value.count)
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
arrlines.value.datasets[1].customlabel.push(props.dataLineChart[key].unic)
|
||||
})
|
||||
|
||||
console.log(props.dataLineChart,'dataYear2 -------------');
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -122,13 +122,7 @@ export default {
|
||||
return acc
|
||||
}, res.period.previos)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(between, 'props.alldata')
|
||||
return res
|
||||
return res
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -4,46 +4,62 @@
|
||||
:ico="'mdi-chart-bar'"
|
||||
>
|
||||
<template v-slot:filling>
|
||||
<v-table
|
||||
fixed-header
|
||||
density="comfortable"
|
||||
hover
|
||||
class="cursor-default h-0 text-caption"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="pl-1">
|
||||
<v-switch
|
||||
v-model="modelrating"
|
||||
hide-details
|
||||
<v-data-table-virtual
|
||||
:headers="headers"
|
||||
:items="tabledata"
|
||||
height="400"
|
||||
item-value="name"
|
||||
@update:sortBy=customSort
|
||||
v-model:sort-by="sortBy"
|
||||
>
|
||||
<template v-slot:header.name>
|
||||
<v-switch label="Всего"
|
||||
false-value='unic'
|
||||
true-value='total'
|
||||
v-model="untot"></v-switch>
|
||||
</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="cursor-help font-weight-medium text-subtitle-2" >
|
||||
{{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.now.unic"
|
||||
:key="n"
|
||||
>
|
||||
<v-col>
|
||||
{{n}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
:label="modelrating?'Уникальные':'Всего'"
|
||||
color="teal-darken-4"
|
||||
|
||||
/>
|
||||
</th>
|
||||
<th class="text-center"> сегодня </th>
|
||||
<th class="text-center"> за период </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> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(val, key) in pages_count.data"
|
||||
:key="key"
|
||||
|
||||
>
|
||||
|
||||
<td class="text-left ">{{key}}</td>
|
||||
<td >
|
||||
<v-tooltip
|
||||
v-if="val.now.unique.length>0"
|
||||
</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="cursor-help font-weight-medium text-subtitle-2" :class="getColorNow(modelrating?val.now.unique.length:val.now.countall) ">
|
||||
{{modelrating?val.now.unique.length:val.now.countall}}
|
||||
<span v-bind="props" class="cursor-help font-weight-medium text-subtitle-2" >
|
||||
{{value}} <!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
|
||||
</span>
|
||||
</template>
|
||||
<v-row
|
||||
@@ -51,7 +67,7 @@
|
||||
>
|
||||
<v-col>
|
||||
<v-row
|
||||
no-gutters v-for="n in val.now.unique"
|
||||
no-gutters v-for="n in item.period.unic"
|
||||
:key="n"
|
||||
>
|
||||
<v-col>
|
||||
@@ -60,67 +76,99 @@
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-tooltip>
|
||||
<span class='font-weight-regular text-subtitle-2' v-else>
|
||||
0
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<v-tooltip
|
||||
v-if="val.year.unique.length>0"
|
||||
location="bottom"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
class="cursor-help font-weight-medium text-subtitle-2"
|
||||
:class="modelrating?getColorNow(val.year.unique.length):getColorAll(val.year.countall)">
|
||||
{{modelrating?val.year.unique.length:val.year.countall}}
|
||||
</span>
|
||||
</template>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col>
|
||||
<v-row
|
||||
no-gutters v-for="n in val.year.unique"
|
||||
:key="n"
|
||||
>
|
||||
<v-col>
|
||||
{{n}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tooltip>
|
||||
<span class='font-weight-regular text-subtitle-2' v-else>
|
||||
0
|
||||
</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-data-table-virtual>
|
||||
|
||||
</template>
|
||||
</pattern-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
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: Object,
|
||||
default: () => {}
|
||||
type: Array,
|
||||
default: () => [],
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
setup() {
|
||||
setup(props) {
|
||||
|
||||
const sortBy = ref([
|
||||
{
|
||||
"key": "now",
|
||||
"order": "desc"
|
||||
}
|
||||
])
|
||||
|
||||
const untot=ref('unic')
|
||||
let headers = ref([
|
||||
{ title: '', align: 'start', key: 'name' },
|
||||
{ title: 'сегодня', align: 'center', key: 'now',
|
||||
value: item => `${untot.value=='unic'?item.now.unic.size:item.now.total}`,
|
||||
},
|
||||
{ title: 'за период', align: 'center', key: 'period',
|
||||
value: item => `${untot.value=='unic'?item.period.unic.size:item.period.total}` },
|
||||
])
|
||||
|
||||
const datas = ()=>{
|
||||
|
||||
let data = []
|
||||
props.pages_count.forEach((e) => {
|
||||
console.log(e.visitdate == moment().format("YYYY-MM-DD"));
|
||||
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 getColorAll = (pages) => {
|
||||
@@ -136,10 +184,49 @@ export default {
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const customSort= ()=> {
|
||||
let arr=tabledata.value
|
||||
console.log(sortBy.value,"error");
|
||||
if (sortBy.value!==undefined && sortBy.value.length>0){
|
||||
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
|
||||
if (untot.value=='unic'){
|
||||
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,
|
||||
getColorAll,
|
||||
getColorNow
|
||||
getColorNow,
|
||||
headers,
|
||||
datas
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,6 @@
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
<v-col >
|
||||
<v-btn block class="text-caption" @click="filter='y'">Год</v-btn>
|
||||
<v-btn block class="text-caption" @click="filter='m'">Месяц</v-btn>
|
||||
<v-btn block class="text-caption" @click="filter='d'">День</v-btn>
|
||||
|
||||
{{filter}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
<v-col class="w100 ">
|
||||
@@ -41,16 +34,13 @@
|
||||
<v-row no-gutters class="h-100 gap">
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row no-gutters class="flex-column gap" >
|
||||
<my-helper :pretext="alldata.beforperiod"/>
|
||||
<my-helper :pretext="alldata.period"/>
|
||||
<v-col v-for="x in cardtotal" :key=x>
|
||||
<card-total :indicator=x />
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-col>
|
||||
<v-col lg=4 class="d-flex flex-column">
|
||||
<!-- <rating-page :pages_count=pages_count /> -->
|
||||
<rating-page :pages_count=alldata.period />
|
||||
</v-col>
|
||||
<v-col lg=4 class="d-flex flex-column ">
|
||||
|
||||
@@ -75,7 +65,7 @@
|
||||
<script>
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
import {pagecounter, splitname, formatComa, formatDash} from '@/utils/universal_functions'
|
||||
import {pagecounter, splitname, formatComa, formatDash, checking_for_entry} from '@/utils/universal_functions'
|
||||
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { usePortalFilterStore } from '@/store/AboutPortalFilter'
|
||||
@@ -131,6 +121,11 @@ setup(){
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const filterStore = usePortalFilterStore()
|
||||
const alldata =ref({period: [], staff: 0, beforperiod: []})
|
||||
const visition = () => {
|
||||
@@ -138,7 +133,7 @@ setup(){
|
||||
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
|
||||
|
||||
alldata.value = preparedata(result.data)
|
||||
console.log(result.data, 'result.data');
|
||||
// console.log(result.data, 'result.data');
|
||||
totalfn()
|
||||
|
||||
|
||||
@@ -168,12 +163,17 @@ setup(){
|
||||
|
||||
let periodusers = new Set([])
|
||||
let brdata = {}
|
||||
|
||||
let filtr = alldata.value.period
|
||||
|
||||
|
||||
|
||||
|
||||
if (formatDash(filterStore.date_period.enddate) !=formatDash(new Date())) {
|
||||
filtr = filtr.filter(e => e.visitdate != formatDash(new Date()))
|
||||
}
|
||||
}
|
||||
|
||||
filtr.forEach((e) => {
|
||||
|
||||
periodusers.add(e.user.id)
|
||||
if (!brdata[e.visitdate]) {
|
||||
brdata[e.visitdate] = {}
|
||||
@@ -184,27 +184,28 @@ setup(){
|
||||
brdata[e.visitdate][user] = []
|
||||
}
|
||||
brdata[e.visitdate][user].push({page:e.fullPath, total:e.count})
|
||||
|
||||
|
||||
})
|
||||
|
||||
let traffic ={}
|
||||
// console.log(brdata, 'brdatabrdatabrdata')
|
||||
|
||||
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)
|
||||
// traffic[key].pages += arr
|
||||
arr.flat().reduce((acc, item) => {
|
||||
|
||||
traffic[key].count +=item.total
|
||||
|
||||
return acc
|
||||
},traffic[key].count)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
console.log(brdata,'33333333333333');
|
||||
let bothuser = new Set([...periodusers].filter(element => beforperiodusers.has(element)))
|
||||
cardtotal.value.crr.data = bothuser.size*100/beforperiodusers.size
|
||||
sumtraffic(traffic)
|
||||
@@ -212,7 +213,7 @@ setup(){
|
||||
}
|
||||
|
||||
const sumtraffic= (data) => {
|
||||
console.log(data, 'traffic');
|
||||
|
||||
let ob = {brtot:0, ppvtot: 0, unictot: 0, pagetot: 0}
|
||||
Object.values(data).flat().forEach((e) => {
|
||||
ob.brtot += e.br
|
||||
@@ -223,7 +224,7 @@ setup(){
|
||||
}
|
||||
|
||||
)
|
||||
console.log(ob.ppvtot, ob.unictot, 'xxxxxxxxxxxx');
|
||||
|
||||
cardtotal.value.br.data = ob.brtot/ob.unictot*100
|
||||
cardtotal.value.ppv.data = ob.pagetot/ob.unictot
|
||||
|
||||
@@ -252,7 +253,7 @@ setup(){
|
||||
// const pages_count = ref({data: {}, title: {}})
|
||||
|
||||
|
||||
// pagecounter()
|
||||
// pagecounter()
|
||||
|
||||
// const visition = () => {
|
||||
|
||||
@@ -493,6 +494,7 @@ setup(){
|
||||
alldata,
|
||||
cardtotal,
|
||||
dataLineChart,
|
||||
|
||||
// visiting,
|
||||
// pages_count,
|
||||
// visitionreduce,
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
</v-col>
|
||||
<v-col lg=9>
|
||||
|
||||
<line-chart :dataLineChart="dataLineChart" :dataChart="dataChart"/>
|
||||
<!-- <line-chart :dataLineChart="dataLineChart" :dataChart="dataChart"/> -->
|
||||
</v-col>
|
||||
<v-col >
|
||||
<v-btn block class="text-caption" @click="filter='year'">Год</v-btn>
|
||||
<v-btn block class="text-caption" @click="filter='month'">Месяц</v-btn>
|
||||
<v-btn block class="text-caption" @click="filter='day'">День</v-btn>
|
||||
<!-- ------------------------------------------------------------------------- -->
|
||||
<my-helper :pretext="dataLineChart"/>
|
||||
<my-helper :pretext="dataActivusers"/>
|
||||
{{filter}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -182,5 +182,8 @@ class TestwatcherAPIView(ListAPIView):
|
||||
'beforperiod': res,
|
||||
'period': PagesSerializer(per, many= True).data,
|
||||
'staff': DictEmployee.objects.filter(Q(deleteddate__isnull= True) | Q(deleteddate__gte = request.GET.get("end"))).count()
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user