Верстка

This commit is contained in:
iriska-gri committed 2024-01-31 13:00:21 +03:00
1 parent 61bd1cd362
commit 0503cd6cf7
3 files changed
+80 -57

No files matched your search

@@ -1,9 +1,6 @@
<template> <template>
<v-card <v-card class="h-100">
class="d-flex flex-column text-center" <line-graph :data="data" :options="options"/>
height="200px"
>
<line-graph :data="data" :options="options"/>
</v-card> </v-card>
</template> </template>
@@ -18,9 +15,9 @@ export default {
}, },
props: { props: {
visiting: { dataLineChart: {
type: Array, type: Object,
default: () => [] default: () => {}
} }
}, },
@@ -34,7 +31,7 @@ export default {
labels: [], labels: [],
datasets: [ datasets: [
{ {
label: 'Посещений всего', label: 'Открыто страниц',
backgroundColor: 'crimson', backgroundColor: 'crimson',
borderColor: 'crimson', borderColor: 'crimson',
borderWidth: 3, borderWidth: 3,
@@ -45,7 +42,7 @@ export default {
}, },
{ {
label: 'Уникальные посещения', label: 'Активные пользователи',
backgroundColor: 'teal', backgroundColor: 'teal',
borderColor: 'teal', borderColor: 'teal',
borderWidth: 3, borderWidth: 3,
@@ -112,26 +109,26 @@ export default {
} }
const arrforline=() => { const arrforline=() => {
let datas = // let datas =
props.visiting.reduce((acc, item) => { // props.visiting.reduce((acc, item) => {
if (!acc[item.visitdate]) { // if (!acc[item.visitdate]) {
acc[item.visitdate] = {unic: [], count: 0} // acc[item.visitdate] = {unic: [], count: 0}
} // }
acc[item.visitdate]['count'] += item.count // acc[item.visitdate]['count'] += item.count
if (!acc[item.visitdate]['unic'].includes(splitname(item.author))) // if (!acc[item.visitdate]['unic'].includes(splitname(item.author)))
{ // {
acc[item.visitdate]['unic'].push(splitname(item.author)) // acc[item.visitdate]['unic'].push(splitname(item.author))
} // }
return acc // return acc
}, {}) // }, {})
Object.entries(datas).forEach(e => { Object.entries(props.dataLineChart).forEach(e => {
const [key, value] = e const [key, value] = e
arrlines.value.datasets[0].data.push(datas[key].count) arrlines.value.datasets[0].data.push(value.count)
arrlines.value.datasets[1].data.push(datas[key]['unic'].length) arrlines.value.datasets[1].data.push(value.unic.length)
arrlines.value.labels.push(format1(key)) arrlines.value.labels.push(format1(key))
arrlines.value.datasets[1].customlabel.push(datas[key].unic) arrlines.value.datasets[1].customlabel.push(props.dataLineChart[key].unic)
}) })
} }
@@ -145,4 +142,7 @@ export default {
<style> <style>
canvas {
flex: 1!important
}
</style> </style>
+2 -2
View File
@@ -46,12 +46,12 @@
<script> <script>
import { ref } from 'vue' import { ref } from 'vue'
import {format1, format2} from '@/utils/universal_functions' import {format1} from '@/utils/universal_functions'
export default { export default {
props: { props: {
datedefault: { datedefault: {
type: String, type: Date,
default: '' default: ''
} }
}, },
+52 -29
View File
@@ -1,16 +1,39 @@
<template> <template>
<v-row no-gutters class="flex-column"> <v-row no-gutters class="flex-column">
<toolbar-filter
@returnend="returnend" <toolbar-filter/>
/>
<v-col lg=1 class="w100 bg-red">
<v-col lg=2 class="bg-yellow w100">
<v-row no-gutters class=" h-100">
<v-col lg=3 class="bg-blue">1</v-col>
<v-col class="bg-yellow ">
<line-chart :dataLineChart="dataLineChart"/>
</v-col>
</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-col> </v-col>
<v-col class="bg-green">2</v-col> <v-col lg=6 class="bg-green w100">3</v-col>
<v-col class="bg-red w100">4</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-col class="d-flex flex-column gap">
{{visitionreduce()}}
<v-row no-gutters class="flex-grow-0"> <v-row no-gutters class="flex-grow-0">
<v-col> <v-col>
<v-toolbar <v-toolbar
@@ -154,12 +177,14 @@
</template> </template>
<script> <script>
import { ref, computed } from 'vue' import { ref, watch } from 'vue'
import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions' import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions'
import moment from 'moment'
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from '@/utils/axios-api'
import { usePortalFilterStore } from '@/store/AboutPortalFilter'
import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue' import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
import DateSelect from '@/components/UI/date-select.vue' import DateSelect from '@/components/UI/date-select.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue' import TopUser from '@/components/UI/aboutportal/top-user.vue'
@@ -180,11 +205,10 @@ export default {
setup(){ setup(){
const filterStore = usePortalFilterStore()
const visiting = ref([]) const visiting = ref([])
const feedback = ref([]) const feedback = ref([])
const staff = ref(0) const staff = ref(0)
const startdate =ref(format2(new Date(new Date().getFullYear(), 0, 1)))
const enddate =ref(format2(new Date()))
const dataLineChart = ref({}) const dataLineChart = ref({})
pagecounter() pagecounter()
@@ -194,40 +218,39 @@ setup(){
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()
})} })}
visition() visition()
const returnstart = (dates) => {
startdate.value = dates
visition()
}
const returnend = (dates) => {
enddate.value = dates
visition()
}
const visitionreduce = () => { const visitionreduce = () => {
let lineCharts = {} let lineCharts = {}
const groupedData = visiting.value.reduce((acc, item) => { const groupedData = visiting.value.reduce((acc, item) => {
// Данные для графика по фильтру // Данные для графика по фильтру
if (item.visitdate >= format2(startdate.value) && item.visitdate <= format2(enddate.value)){ if (item.visitdate >= format2(filterStore.date_period.startdate) && item.visitdate <= format2(filterStore.date_period.enddate)){
if (!lineCharts[item.visitdate]) { if (!lineCharts[item.visitdate]) {
lineCharts[item.visitdate] = {count: 0, unic: new Set()} lineCharts[item.visitdate] = {count: 0, unic: []}
} }
lineCharts[item.visitdate]['count'] +=item.count lineCharts[item.visitdate]['count'] +=item.count
lineCharts[item.visitdate]['unic'].add(splitname(item.author)) if (!lineCharts[item.visitdate]['unic'].includes(splitname(item.author)))
{
lineCharts[item.visitdate]['unic'].push(splitname(item.author))
}
} }
dataLineChart.value = lineCharts dataLineChart.value = lineCharts
return acc return acc
}, {}) }, {})
watch(()=>filterStore.date_period,(newValue,oldValue)=>{
if(newValue){
visitionreduce()
}
}, {deep:true})
return groupedData return groupedData
@@ -235,14 +258,14 @@ setup(){
return { return {
visiting, visiting,
enddate,
startdate,
returnstart,
returnend,
visitionreduce, visitionreduce,
dataLineChart dataLineChart
// countgrupp, // countgrupp,