P-42 search
This commit is contained in:
1 parent
7ab0353833
commit
e1039cbf46
1 file changed
+15
-12
@@ -5,8 +5,9 @@
|
|||||||
:items="staff"
|
:items="staff"
|
||||||
label="Выберите из списка или найдите по ФИО"
|
label="Выберите из списка или найдите по ФИО"
|
||||||
item-title="title"
|
item-title="title"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
:custom-filter="onFilter"
|
:custom-filter="onFilter"
|
||||||
|
@update:search="filchange"
|
||||||
multiple
|
multiple
|
||||||
hide-details
|
hide-details
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<v-list-item
|
<v-list-item
|
||||||
v-for="x in item.raw.employees"
|
v-for="x in item.raw.employees.filter(e=>e.title.toLowerCase().includes(filtered.toLowerCase()))"
|
||||||
:key="x.id"
|
:key="x.id"
|
||||||
:value="x.title"
|
:value="x.title"
|
||||||
@click.stop="x.selected = !x.selected"
|
@click.stop="x.selected = !x.selected"
|
||||||
@@ -97,6 +98,7 @@ import { axiosApiInstance } from "@/utils/axios-api";
|
|||||||
import { splitname } from "@/utils/universal_functions";
|
import { splitname } from "@/utils/universal_functions";
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
|
const filtered= ref("")
|
||||||
const staff = ref([]);
|
const staff = ref([]);
|
||||||
axiosApiInstance
|
axiosApiInstance
|
||||||
.get("api/calendar_of_events/get_employees/")
|
.get("api/calendar_of_events/get_employees/")
|
||||||
@@ -137,21 +139,22 @@ export default {
|
|||||||
item.employees.forEach((e) => (e.selected = !item.selected));
|
item.employees.forEach((e) => (e.selected = !item.selected));
|
||||||
item.selected = !item.selected;
|
item.selected = !item.selected;
|
||||||
}
|
}
|
||||||
|
function filchange(search){
|
||||||
|
if(search.length==0){
|
||||||
|
filtered.value=''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onFilter(item, queryText, itemText){
|
function onFilter(item, queryText, itemText){
|
||||||
console.log(item, 'item')
|
filtered.value=queryText===null?"":queryText
|
||||||
console.log(queryText, 'queryText,')
|
return item.includes(filtered.value) || itemText.raw.employees.some(e =>e.title.toLowerCase().includes(filtered.value.toLowerCase()))
|
||||||
console.log(itemText.raw.employees, 'itemText,')
|
|
||||||
// let fio = itemText.raw.employees.map(e =>e.title.includes(queryText))
|
|
||||||
// console.log (itemText.raw.employees.map(e =>e.title.includes(queryText)))
|
|
||||||
// console.log(item.includes(queryText));
|
|
||||||
return itemText.raw.employees.map(e =>e.title.includes(queryText))
|
|
||||||
// return item.title.includes(queryText)
|
|
||||||
// || item.Value.toLocaleLowerCase().includes(queryText.toLocaleLowerCase())
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
filchange,
|
||||||
|
filtered,
|
||||||
staff,
|
staff,
|
||||||
selectedStaff,
|
selectedStaff,
|
||||||
allman,
|
allman,
|
||||||
|
|||||||
Reference in new issue
Block a user