Таблица

This commit is contained in:
iriska-gri committed 2024-02-01 13:41:05 +03:00
1 parent 29db3f3aba
commit 39e04e6841
4 files changed
+136 -29

No files matched your search

@@ -1,20 +1,47 @@
<template>
<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 class="d-flex flex-column">
<v-table fixed-header
height="0"
>
<thead>
<tr class="text-uppercase">
<th>Имя страницы</th>
<!-- <th class="text-center"> на {{selected_days.today}} </th> -->
<th class="text-center">за период</th>
<th>Имя страницы
</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="x in 9" :key="x">
<td>{{x}}</td>
<tr v-for="(val, key) in pages_count.data" :key="key">
<td>{{key}} </td>
<td-tooltip :lines = val.now.unique />
</tr>
<!-- <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>
@@ -23,14 +50,40 @@
</tbody>
</v-table>
</v-col>
</v-row>
</v-card>
</template>
<script>
import { ref } from 'vue'
import tdTooltip from '@/components/UI/td-tooltip.vue'
export default {
components: { tdTooltip },
props: {
pages_count: {
type: Object,
default: () => {}
}
},
setup() {
const modelrating = ref(false)
return {
modelrating
}
}
}
</script>
<style>
.v-table {
flex: 1!important;
}
</style>
@@ -0,0 +1,40 @@
<template>
<td>
<v-tooltip
location="bottom"
v-if="lines.length>0"
>
<template v-slot:activator="{ props }">
<span v-bind="props">
{{lines.length}}
</span>
</template>
<v-row
no-gutters v-for="n in lines"
:key="n">
<v-col>
{{n}}
</v-col>
</v-row>
</v-tooltip>
<span v-else>
0
</span>
</td>
</template>
<script>
export default {
props: {
lines: {
type: Array,
default: () => []
}
},
}
</script>
<style>
</style>
+34 -22
View File
@@ -22,8 +22,8 @@
visiting- (все данные)
<my-helper :pretext="pages_count"/>
</v-col>
<v-col lg=5 class="bg-red">
<rating-page/>
<v-col lg=5 class="bg-red d-flex flex-column">
<rating-page :pages_count=pages_count />
</v-col>
<v-col class="bg-yellow">3 </v-col>
<v-col class="bg-red">4 </v-col>
@@ -216,7 +216,8 @@ setup(){
const dataLineChart = ref({})
const previous = ref({start: new Date(), end: new Date()})
const pages_count = ref({})
const selected_days = ref({today: new Date(), year: {start: new Date(), end: new Date()}})
const pages_count = ref({data: {}, title: {}})
const previous_period =() => {
let days_between = Math.floor((new Date(filterStore.date_period.enddate) - new Date(filterStore.date_period.startdate)) / (1000*60*60*24))
@@ -264,6 +265,14 @@ setup(){
// percentage_period: 0
// }
// }
const checking_for_entry = (where, what) => {
if (!where.includes(what))
{
where.push(what)
}
}
const groupedData = visiting.value.reduce((acc, item) => {
// Данные для графика по фильтру
@@ -274,28 +283,25 @@ setup(){
}
lineCharts[item.visitdate]['count'] +=item.count
if (!lineCharts[item.visitdate]['unic'].includes(splitname(item.author)))
{
lineCharts[item.visitdate]['unic'].push(splitname(item.author))
}
checking_for_entry(lineCharts[item.visitdate]['unic'], splitname(item.author))
// Данные для таблицы по страницам
if (!acc[item.pages]) {
acc[item.pages] = {
now:
{unique: new Set(), countall: 0},
{unique: [], countall: 0},
year:
{unique: new Set(), countall: 0}
{unique: [], countall: 0}
}
}
acc[item.pages].year.unique.add(splitname(item.author))
checking_for_entry(acc[item.pages].year.unique, splitname(item.author))
acc[item.pages].year.countall += item.count
}
if (item.visitdate == format2(filterStore.date_period.enddate)) {
acc[item.pages].now.unique.add(splitname(item.author))
checking_for_entry(acc[item.pages].now.unique, splitname(item.author))
acc[item.pages].now.countall += item.count
}
@@ -314,10 +320,11 @@ setup(){
watch(()=>filterStore.date_period,(newValue,oldValue)=>{
if(newValue){
visitionreduce()
title_period()
}
}, {deep:true})
pages_count.value = groupedData
pages_count.value.data = groupedData
return groupedData
@@ -325,7 +332,17 @@ setup(){
const title_period = () => {
selected_days.value.today = 'сегодня'
if (format2(new Date()) != format2(filterStore.date_period.enddate)) {
selected_days.value.today = format1(filterStore.date_period.enddate)
}
selected_days.value.year.start = format1(filterStore.date_period.startdate)
selected_days.value.year.end = format1(filterStore.date_period.enddate)
pages_count.value.title = selected_days.value
}
title_period()
@@ -335,7 +352,8 @@ setup(){
visitionreduce,
dataLineChart,
previous,
format1
format1,
selected_days
// countgrupp,
// activuser,
@@ -355,7 +373,7 @@ setup(){
}
// const pages_count = ref({})
// const selected_days = ref({today: '', year: ''})
// const traffic = ref({
// now: {
// title: '',
@@ -406,13 +424,7 @@ setup(){
// const periodname = () => {
// selected_days.value.today = 'сегодня'
// if (format2(new Date()) != format2(enddate.value)) {
// selected_days.value.today = format1(enddate.value)
// }
// selected_days.value.year = [format1(startdate.value), format1(enddate.value)]
// }