Фильтрация

This commit is contained in:
iriska-gri committed 2024-01-15 16:28:26 +03:00
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>
+34 -48
View File
@@ -89,35 +89,16 @@
</v-row>
<v-row>
<v-col>
<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="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>
<date-select
@returndate="returnstart"
:datedefault = "startdate"
/>
<date-select
@returndate="returnend"
:datedefault = "endate"
/>
</v-col>
</v-row>
</v-col>
@@ -134,12 +115,14 @@ import moment from 'moment'
import lineGraph from '@/components/graph/line-graph.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
import DateSelect from '@/components/UI/date-select.vue'
export default {
components: { lineGraph,
Feedmodul },
Feedmodul,
DateSelect },
setup(){
@@ -147,10 +130,8 @@ setup(){
const feedback = ref([])
const countvising = ref({now: 0, week: 0, year: 0})
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 endate =ref(moment(new Date(new Date().getFullYear(), 11, 31)).format('YYYY-MM-DD'))
const arrlines = {}
@@ -232,10 +213,23 @@ setup(){
}),
),
);
const returnstart = (dates) => {
startdate.value = dates
visition()
}
const returnend = (dates) => {
endate.value = dates
visition()
}
const visition = () => {
// ${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
feedback.value = result.data.feedback
@@ -359,13 +353,7 @@ setup(){
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 {
visiting,
@@ -376,13 +364,11 @@ setup(){
feedback,
countvising,
crit,
menudate,
selectedDateStart,
dateStart
visition,
returnstart,
returnend,
endate,
startdate
}
}