Фильтрация
This commit is contained in:
1 parent
9e4dc87b46
commit
bbed144517
3 files changed
+96
-49
No files matched your search
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<v-menu
|
||||||
|
v-model="menudate"
|
||||||
|
:close-on-content-click="false"
|
||||||
|
:nudge-right="40"
|
||||||
|
transition="scale-transition"
|
||||||
|
offset-y
|
||||||
|
>
|
||||||
|
<template v-slot:activator="{ props }">
|
||||||
|
<v-text-field
|
||||||
|
v-model="selectedDate"
|
||||||
|
:label="datedefault"
|
||||||
|
append-icon="event"
|
||||||
|
readonly
|
||||||
|
v-bind="props"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<v-date-picker
|
||||||
|
v-model="selectedDate"
|
||||||
|
show-adjacent-months
|
||||||
|
@update:modelValue="dateStart"
|
||||||
|
/>
|
||||||
|
</v-menu>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
props: {
|
||||||
|
datedefault: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props, {emit}) {
|
||||||
|
|
||||||
|
const menudate = ref(false)
|
||||||
|
const selectedDate = ref(null)
|
||||||
|
|
||||||
|
const dateStart = () => {
|
||||||
|
emit('returndate', moment(selectedDate.value).format('YYYY-MM-DD'))
|
||||||
|
menudate.value=false
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
menudate,
|
||||||
|
selectedDate,
|
||||||
|
dateStart
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -89,35 +89,16 @@
|
|||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
<v-col>
|
<v-col>
|
||||||
|
<date-select
|
||||||
<v-menu
|
@returndate="returnstart"
|
||||||
v-model="menudate"
|
:datedefault = "startdate"
|
||||||
:close-on-content-click="false"
|
/>
|
||||||
:nudge-right="40"
|
<date-select
|
||||||
transition="scale-transition"
|
@returndate="returnend"
|
||||||
offset-y
|
:datedefault = "endate"
|
||||||
>
|
/>
|
||||||
<template v-slot:activator="{ props }">
|
|
||||||
<v-text-field
|
|
||||||
v-model="selectedDateStart"
|
|
||||||
label="Дата"
|
|
||||||
append-icon="event"
|
|
||||||
readonly
|
|
||||||
|
|
||||||
v-bind="props"
|
|
||||||
>
|
|
||||||
</v-text-field>
|
|
||||||
</template>
|
|
||||||
<v-date-picker
|
|
||||||
v-model="selectedDateStart"
|
|
||||||
show-adjacent-months
|
|
||||||
|
|
||||||
@update:modelValue="dateStart"
|
|
||||||
>
|
|
||||||
|
|
||||||
</v-date-picker>
|
|
||||||
</v-menu>
|
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -134,12 +115,14 @@ import moment from 'moment'
|
|||||||
import lineGraph from '@/components/graph/line-graph.vue'
|
import lineGraph from '@/components/graph/line-graph.vue'
|
||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
|
import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
|
||||||
|
import DateSelect from '@/components/UI/date-select.vue'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { lineGraph,
|
components: { lineGraph,
|
||||||
Feedmodul },
|
Feedmodul,
|
||||||
|
DateSelect },
|
||||||
|
|
||||||
|
|
||||||
setup(){
|
setup(){
|
||||||
@@ -147,10 +130,8 @@ setup(){
|
|||||||
const feedback = ref([])
|
const feedback = ref([])
|
||||||
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 menudate = ref(false)
|
|
||||||
const selectedDateStart = ref(null)
|
|
||||||
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 arrlines = {}
|
const arrlines = {}
|
||||||
@@ -232,10 +213,23 @@ setup(){
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
const returnstart = (dates) => {
|
||||||
|
startdate.value = dates
|
||||||
|
visition()
|
||||||
|
}
|
||||||
|
|
||||||
|
const returnend = (dates) => {
|
||||||
|
endate.value = dates
|
||||||
|
visition()
|
||||||
|
}
|
||||||
|
|
||||||
const visition = () => {
|
const visition = () => {
|
||||||
|
|
||||||
// ${startdate.value}
|
// ${startdate.value}
|
||||||
axiosApiInstance.get(`api/watcher/counter/?start=${startdate.value}`).then(result => {
|
|
||||||
|
axiosApiInstance.get(`api/watcher/counter/?start=${startdate.value}&end=${endate.value}`).then(result => {
|
||||||
visiting.value = result.data.result
|
visiting.value = result.data.result
|
||||||
feedback.value = result.data.feedback
|
feedback.value = result.data.feedback
|
||||||
|
|
||||||
@@ -359,13 +353,7 @@ setup(){
|
|||||||
visition()
|
visition()
|
||||||
|
|
||||||
|
|
||||||
const dateStart = () => {
|
|
||||||
startdate.value = moment(selectedDateStart.value).format('YYYY-MM-DD')
|
|
||||||
visition()
|
|
||||||
let d = new Date(new Date().getFullYear(), 0, 1)
|
|
||||||
console.log( moment(new Date(new Date().getFullYear(), 0, 1)).format('YYYY-MM-DD'), '222222222222222222222222222');
|
|
||||||
menudate.value=false
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
visiting,
|
visiting,
|
||||||
@@ -376,13 +364,11 @@ setup(){
|
|||||||
feedback,
|
feedback,
|
||||||
countvising,
|
countvising,
|
||||||
crit,
|
crit,
|
||||||
menudate,
|
visition,
|
||||||
selectedDateStart,
|
returnstart,
|
||||||
dateStart
|
returnend,
|
||||||
|
endate,
|
||||||
|
startdate
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Counter(ListAPIView):
|
|||||||
def get(self, request):
|
def get(self, request):
|
||||||
print(request.GET.get("start"), '-----------------------')
|
print(request.GET.get("start"), '-----------------------')
|
||||||
|
|
||||||
res = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), '2024-12-31']).annotate(Sum('count'))
|
res = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")]).annotate(Sum('count'))
|
||||||
result = CountSerializer(res, many=True).data
|
result = CountSerializer(res, many=True).data
|
||||||
|
|
||||||
# Обратная связь
|
# Обратная связь
|
||||||
|
|||||||
Reference in new issue
Block a user