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