Период сортировки
This commit is contained in:
1 parent
d94754e99b
commit
998f30c7e3
1 file changed
+46
-16
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row no-gutters class="ma-1">
|
<!-- <v-row no-gutters class="ma-1">
|
||||||
<v-col class="d-flex flex-column gap">
|
<v-col class="d-flex flex-column gap">
|
||||||
|
|
||||||
<v-row no-gutters class="flex-grow-0">
|
<v-row no-gutters class="flex-grow-0">
|
||||||
@@ -34,7 +34,12 @@
|
|||||||
|
|
||||||
<v-row no-gutters class="gap">
|
<v-row no-gutters class="gap">
|
||||||
<v-col lg=3>
|
<v-col lg=3>
|
||||||
{{periodname()}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{weekstart(new Date()).WeekStart}}
|
||||||
|
{{weekstart(new Date()).WeekEnd}}
|
||||||
<v-card
|
<v-card
|
||||||
class="text-center"
|
class="text-center"
|
||||||
title="Количество посещений"
|
title="Количество посещений"
|
||||||
@@ -61,7 +66,7 @@
|
|||||||
<line-graph :data="data" :options="options"/>
|
<line-graph :data="data" :options="options"/>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -115,9 +120,9 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row> -->
|
</v-row> -->
|
||||||
</v-col>
|
<!-- </v-col>
|
||||||
</v-row>
|
</v-row> -->
|
||||||
<!-- <v-row class="ma-3">
|
<v-row class="ma-3">
|
||||||
|
|
||||||
<v-col
|
<v-col
|
||||||
class="d-flex flex-column"
|
class="d-flex flex-column"
|
||||||
@@ -217,7 +222,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row> -->
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -247,9 +252,10 @@ setup(){
|
|||||||
const countvising = ref({now: 0, week: 0, year: 0})
|
const countvising = ref({now: 0, week: 0, year: 0})
|
||||||
const crit = ref([])
|
const crit = ref([])
|
||||||
const startdate =ref(moment(new Date(new Date().getFullYear(), 0, 1)).format('YYYY-MM-DD'))
|
const startdate =ref(moment(new Date(new Date().getFullYear(), 0, 1)).format('YYYY-MM-DD'))
|
||||||
const endate =ref(moment(new Date(new Date().getFullYear(), 11, 31)).format('YYYY-MM-DD'))
|
const endate =ref(moment(new Date()).format('YYYY-MM-DD'))
|
||||||
const icons = ['mdi-numeric-1-box-outline', 'mdi-numeric-2-box-outline', 'mdi-numeric-3-box-outline']
|
const icons = ['mdi-numeric-1-box-outline', 'mdi-numeric-2-box-outline', 'mdi-numeric-3-box-outline']
|
||||||
|
|
||||||
|
// const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); // конец предыдущей недели
|
||||||
|
|
||||||
const arrlines = {}
|
const arrlines = {}
|
||||||
const data = computed({
|
const data = computed({
|
||||||
@@ -317,11 +323,15 @@ setup(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const weekstart = (start, end) => {
|
||||||
|
|
||||||
|
let WeekStart = moment(end).subtract(1, 'weeks').startOf('isoWeek')._d // начало предыдущей недели
|
||||||
|
let WeekEnd = moment(end).subtract(1, 'weeks').endOf('isoWeek')._d // конец предыдущей недели
|
||||||
|
return {WeekStart, WeekEnd}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const previousWeekStart = moment().subtract(1, 'weeks').startOf('week'); // начало предыдущей недели
|
|
||||||
const previousWeekEnd = moment().subtract(1, 'weeks').endOf('week'); // конец предыдущей недели
|
|
||||||
|
|
||||||
const maxDate = new Date(
|
const maxDate = new Date(
|
||||||
Math.max(
|
Math.max(
|
||||||
@@ -351,8 +361,18 @@ setup(){
|
|||||||
pagecounter()
|
pagecounter()
|
||||||
|
|
||||||
const periodname = () => {
|
const periodname = () => {
|
||||||
|
let today = 'Посетителей сегодня:'
|
||||||
|
let weekday = 'Посетителей на прошлой неделе'
|
||||||
|
|
||||||
|
if (new Date(endate.value) < new Date() ) {
|
||||||
|
today = `Посетителей на ${moment(endate.value).format('DD.MM.YYYY')} число`
|
||||||
|
// weekday = `Посетителей с ${moment(previousWeekStart._d).format('DD.MM.YYYY')} по ${moment(previousWeekEnd._d,).format('DD.MM.YYYY')}`
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{now: ['Посетителей сегодня:', countvising.value['now']]},
|
{now: [today, countvising.value['now']],
|
||||||
|
week: [weekday, countvising.value['week']]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,12 +400,19 @@ setup(){
|
|||||||
countall.now += item.count
|
countall.now += item.count
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// let wekst = weekstart(new Date())._d
|
||||||
|
// if (new Date() > new Date(endate.value)) {
|
||||||
|
let wekst = weekstart(endate.value)._d
|
||||||
|
// }
|
||||||
|
// weekend(wekst)
|
||||||
|
// console.log(wekst, weekend(wekst), 'endate.value');
|
||||||
|
// console.log(item.visitdate, moment(wekst).format('YYYY-MM-DD'), ']]]]]]]]]]]]]]]]]]]]]]]]]');
|
||||||
|
|
||||||
if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
// if (item.visitdate >= previousWeekStart.format('YYYY-MM-DD') && item.visitdate <= previousWeekEnd.format('YYYY-MM-DD')) {
|
||||||
acc[item.pages]['week'] += item.count
|
// acc[item.pages]['week'] += item.count
|
||||||
countall.week += item.count
|
// countall.week += item.count
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!us[splitname(item.author)])
|
if (!us[splitname(item.author)])
|
||||||
{
|
{
|
||||||
@@ -484,7 +511,10 @@ setup(){
|
|||||||
endate,
|
endate,
|
||||||
startdate,
|
startdate,
|
||||||
icons,
|
icons,
|
||||||
periodname
|
periodname,
|
||||||
|
|
||||||
|
weekstart
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user