This commit is contained in:
iriska-gri committed 2024-02-01 09:09:33 +03:00
1 parent 470d2e1fe0
commit 29db3f3aba
3 files changed
+137 -33

No files matched your search

@@ -0,0 +1,36 @@
<template>
<v-table fixed-header
>
<thead>
<tr class="text-uppercase">
<th>Имя страницы</th>
<!-- <th class="text-center"> на {{selected_days.today}} </th> -->
<th class="text-center">за период</th>
</tr>
</thead>
<tbody>
<tr v-for="x in 9" :key="x">
<td>{{x}}</td>
</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>
<td class="text-center">{{ modelrating?val.year.unique.size:val.year.countall }}</td> -->
<!-- </tr> -->
</tbody>
</v-table>
</template>
<script>
export default {
}
</script>
<style>
</style>
+4 -4
View File
@@ -2,10 +2,10 @@ import {useAccountStore} from '@/store/AccountStore'
import axios from "axios"; import axios from "axios";
const spravURL = 'http://10.252.44.33/accounting6/images/photo/' const spravURL = 'http://10.252.44.33/accounting6/images/photo/'
// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://${window.location.host}/`; const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://${window.location.host}/`;
// const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://${window.location.host}/`; const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://${window.location.host}/`;
const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`; // const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`;
const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`; // const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`;
const safetyURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000': `http://10.252.44.60:9965`; const safetyURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000': `http://10.252.44.60:9965`;
// для релизного меняем 'http://ukd/' // для релизного меняем 'http://ukd/'
// const baseURL = 'http://127.0.0.1:8000/'; // const baseURL = 'http://127.0.0.1:8000/';
+97 -29
View File
@@ -4,25 +4,32 @@
<toolbar-filter/> <toolbar-filter/>
<v-col lg=2 class="bg-yellow w100 pa-1"> <v-col lg=3 class="bg-yellow w100 pa-1">
<v-row no-gutters class=" h-100"> <v-row no-gutters class=" h-100">
<v-col lg=3 class="bg-blue">1</v-col> <v-col lg=2 class="bg-blue">
{{format1(previous.start)}} - {{format1(previous.end)}}
</v-col>
<v-col class="bg-yellow "> <v-col class="bg-yellow ">
<line-chart :dataLineChart="dataLineChart"/> <line-chart :dataLineChart="dataLineChart"/>
</v-col> </v-col>
</v-row> </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 lg=6 class="bg-green w100">3</v-col> <v-col class=" w100">
<v-col class="bg-red w100">4</v-col> <v-row no-gutters class="h-100">
<v-col lg=2 class="bg-green">
visiting- (все данные)
<my-helper :pretext="pages_count"/>
</v-col>
<v-col lg=5 class="bg-red">
<rating-page/>
</v-col>
<v-col class="bg-yellow">3 </v-col>
<v-col class="bg-red">4 </v-col>
</v-row>
</v-col>
<!-- <v-row class="flex-grow-0"> <!-- <v-row class="flex-grow-0">
<v-col lg=3> <v-col lg=3>
@@ -166,10 +173,6 @@
</v-row> </v-row>
</v-col> </v-col>
</v-row> --> </v-row> -->
<!-- </v-col> --> <!-- </v-col> -->
</v-row> </v-row>
@@ -181,7 +184,6 @@ import { ref, watch } from 'vue'
import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions' import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from '@/utils/axios-api'
import { usePortalFilterStore } from '@/store/AboutPortalFilter' import { usePortalFilterStore } from '@/store/AboutPortalFilter'
@@ -191,7 +193,7 @@ import TopUser from '@/components/UI/aboutportal/top-user.vue'
import LineChart from '@/components/UI/aboutportal/line-chart.vue' import LineChart from '@/components/UI/aboutportal/line-chart.vue'
import PortalTraffic from '@/components/UI/aboutportal/portal-traffic.vue' import PortalTraffic from '@/components/UI/aboutportal/portal-traffic.vue'
import ToolbarFilter from '@/components/UI/aboutportal/toolbar-filter.vue' import ToolbarFilter from '@/components/UI/aboutportal/toolbar-filter.vue'
import RatingPage from '@/components/UI/aboutportal/rating-page.vue'
export default { export default {
components: { components: {
@@ -200,17 +202,34 @@ export default {
TopUser, TopUser,
LineChart, LineChart,
PortalTraffic, PortalTraffic,
ToolbarFilter ToolbarFilter,
RatingPage
}, },
setup(){ setup(){
const filterStore = usePortalFilterStore() const filterStore = usePortalFilterStore()
const visiting = ref([]) const visiting = ref([])
const feedback = ref([]) const feedback = ref([])
const staff = ref(0) const staff = ref(0)
const dataLineChart = ref({}) const dataLineChart = ref({})
const previous = ref({start: new Date(), end: new Date()})
const pages_count = ref({})
const previous_period =() => {
let days_between = Math.floor((new Date(filterStore.date_period.enddate) - new Date(filterStore.date_period.startdate)) / (1000*60*60*24))
days_between += 1
if (filterStore.date_period.startdate == filterStore.date_period.enddate) {
days_between = 1
}
console.log(days_between, 'days_between');
previous.value.start = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - days_between))
previous.value.end = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - 1))
}
pagecounter() pagecounter()
const visition = () => { const visition = () => {
@@ -219,12 +238,32 @@ setup(){
visiting.value = result.data.result visiting.value = result.data.result
feedback.value = result.data.feedback feedback.value = result.data.feedback
visitionreduce() visitionreduce()
})} })}
visition() visition()
const visitionreduce = () => { const visitionreduce = () => {
previous_period()
let lineCharts = {} let lineCharts = {}
// let portal_traffic = {
// now: {
// title: '',
// info: '',
// unique: new Set(),
// percentage_staff: 0,
// comparison_period: new Set(),
// percentage_period: 0
// },
// year: {
// title: 'За период',
// info: '',
// unique: new Set(),
// percentage_staff: 0,
// comparison_period: new Set(),
// percentage_period: 0
// }
// }
const groupedData = visiting.value.reduce((acc, item) => { const groupedData = visiting.value.reduce((acc, item) => {
// Данные для графика по фильтру // Данные для графика по фильтру
@@ -233,25 +272,53 @@ setup(){
if (!lineCharts[item.visitdate]) { if (!lineCharts[item.visitdate]) {
lineCharts[item.visitdate] = {count: 0, unic: []} lineCharts[item.visitdate] = {count: 0, unic: []}
} }
lineCharts[item.visitdate]['count'] +=item.count lineCharts[item.visitdate]['count'] +=item.count
if (!lineCharts[item.visitdate]['unic'].includes(splitname(item.author))) if (!lineCharts[item.visitdate]['unic'].includes(splitname(item.author)))
{ {
lineCharts[item.visitdate]['unic'].push(splitname(item.author)) lineCharts[item.visitdate]['unic'].push(splitname(item.author))
} }
// Данные для таблицы по страницам
if (!acc[item.pages]) {
acc[item.pages] = {
now:
{unique: new Set(), countall: 0},
year:
{unique: new Set(), countall: 0}
}
}
acc[item.pages].year.unique.add(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))
acc[item.pages].now.countall += item.count
}
// Данные для посещаемость портала
if (item.visitdate >= format2(previous.value.start) && item.visitdate <= format2(previous.value.end)){
// console.log(item.visitdate, '------------------------------');
}
dataLineChart.value = lineCharts dataLineChart.value = lineCharts
return acc return acc
}, {}) }, {})
//
watch(()=>filterStore.date_period,(newValue,oldValue)=>{ watch(()=>filterStore.date_period,(newValue,oldValue)=>{
if(newValue){ if(newValue){
visitionreduce() visitionreduce()
} }
}, {deep:true}) }, {deep:true})
pages_count.value = groupedData
return groupedData return groupedData
} }
@@ -264,10 +331,11 @@ setup(){
return { return {
visiting, visiting,
pages_count,
visitionreduce, visitionreduce,
dataLineChart dataLineChart,
previous,
format1
// countgrupp, // countgrupp,
// activuser, // activuser,