Поиск

This commit is contained in:
iriska-gri committed 2023-11-08 09:47:36 +03:00
1 parent efe9b9eb43
commit 8398990f19
3 files changed
+99 -81

No files matched your search

BIN
View File
Binary file not shown.
+75 -56
View File
@@ -1,22 +1,24 @@
<template> <template>
<v-card class="bg-white pa-3 px-0" width="550" <v-card
height="600"> class="bg-white pa-3 px-0"
width="550"
height="600"
>
<v-card
class="mx-auto overflow-auto mx-0 px-3"
width="550"
height="600"
flat
>
<v-card <v-card-title class="fixed-bar bg-white">
class="mx-auto overflow-auto mx-0 px-3"
width="550"
height="600"
flat
>
<v-card-title class="fixed-bar bg-white"> <v-row class="bggrad">
<v-col class="text-center text-black_and_white">
<v-row class="bggrad"> {{t_dailyRound.position}}
<v-col class="text-center text-black_and_white"> </v-col>
{{heading}} </v-row>
</v-col> <v-row>
</v-row>
<v-row>
<v-col class="pa-0 mb-3"> <v-col class="pa-0 mb-3">
<v-textarea <v-textarea
@@ -38,7 +40,7 @@ flat
<div <div
v-for="(x, key) in variable" v-for="(x, key) in result"
:key="key" :key="key"
class="px-3" > class="px-3" >
@@ -81,73 +83,90 @@ class="px-3" >
</template> </template>
<script> <script>
import { ref,watch } from 'vue' import { ref,watch, onMounted, computed } from 'vue'
import {checkremote} from '@/utils/universal_functions' import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api' import { spravURL } from '@/utils/axios-api'
import { axiosApiInstance } from '@/utils/axios-api'
export default { export default {
props: { props: {
idpos: {
byDefault: { type: Number,
type: Object, default: ''
default: {}
},
variable: {
type: Object,
default: {}
},
heading: {
type: String,
default: ''
}
},
setup(props, context){
const searchname = ref('')
const onSubmit = () => {
context.emit('searchClose')
} }
},
setup(props, {emit}){
const t_dailyRound = ref({})
const result = ref({})
const searchname = ref('')
const onSubmit = () => {
emit('searchClose')
}
onMounted(() => {
detailRound(props.idpos)
})
const detailRound = (pos) => {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then(data => {
t_dailyRound.value = data.data
result.value=JSON.parse(JSON.stringify(data.data.daily))
})
}
const filterItems = (query) => { const filterItems = (query) => {
console.log(props.variable, '----------t_dailyRound.value'); console.log(props.idpos, '33333333333333333333333333333');
result.value={}
Object.keys(t_dailyRound.value['daily']).map(el1 => {
let myarr = t_dailyRound.value['daily'][el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase()))
if(myarr.length>0)
{
result.value[el1] = myarr
}
props.variable={}
Object.keys(props.byDefault).map(el1 => {
let myarr = props.byDefault[el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase()))
if(myarr.length>0)
{
props.variable[el1] = myarr
} }
)
}
}
)
}
watch(()=> searchname.value,(newValue,oldValue)=>{ watch(()=> searchname.value,(newValue,oldValue)=>{
if(newValue){ if(newValue){
filterItems(newValue) filterItems(newValue)
} }
else { else {
props.variable = JSON.parse(JSON.stringify(props.byDefault)) result.value = JSON.parse(JSON.stringify(t_dailyRound.value['daily']))
} }
}, {deep:true}) }, {deep:true})
return { return {
onSubmit, onSubmit,
checkremote, checkremote,
searchname, searchname,
spravURL spravURL,
t_dailyRound,
result
} }
} }
+24 -25
View File
@@ -77,10 +77,8 @@
width="500" width="500"
> >
<dialog-search <dialog-search
:heading="t_dailyRound.position" :idpos=idpos
:byDefault="t_dailyRound.daily" @searchClose="dialogDetailRound=!dialogDetailRound"
:variable="result"
@searchClose="dialogDetailRound=!dialogDetailRound"
/> />
<!-- <v-card class="bg-white pa-3 px-0" width="550" <!-- <v-card class="bg-white pa-3 px-0" width="550"
height="600"> height="600">
@@ -250,38 +248,38 @@ export default {
} }
const filterItems = (query) => { // const filterItems = (query) => {
console.log(t_dailyRound.value['daily'], '----------t_dailyRound.value'); // console.log(t_dailyRound.value['daily'], '----------t_dailyRound.value');
result.value={} // result.value={}
Object.keys(t_dailyRound.value['daily']).map(el1 => { // Object.keys(t_dailyRound.value['daily']).map(el1 => {
let myarr = t_dailyRound.value['daily'][el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase())) // let myarr = t_dailyRound.value['daily'][el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase()))
if(myarr.length>0) // if(myarr.length>0)
{ // {
result.value[el1] = myarr // result.value[el1] = myarr
} // }
} // }
) // )
} // }
watch(()=> searchname.value,(newValue,oldValue)=>{ // watch(()=> searchname.value,(newValue,oldValue)=>{
if(newValue){ // if(newValue){
filterItems(newValue) // filterItems(newValue)
} // }
else { // else {
result.value = JSON.parse(JSON.stringify(t_dailyRound.value['daily'])) // result.value = JSON.parse(JSON.stringify(t_dailyRound.value['daily']))
} // }
}, {deep:true}) // }, {deep:true})
onMounted(() => { onMounted(() => {
@@ -302,7 +300,8 @@ export default {
menuGetUserDialog, menuGetUserDialog,
iduser, iduser,
getcard, getcard,
result result,
idpos
} }
} }