aggiornamento cataloghi, search

This commit is contained in:
Surya Paolo
2025-04-22 18:30:42 +02:00
parent 6d0efaadb9
commit ae4efab0f3
18 changed files with 117 additions and 27 deletions

View File

@@ -13,7 +13,7 @@ import { tools } from '@tools'
export default defineComponent({
name: 'CMySelect',
emits: ['update:value', 'update:arrvalue', 'changeval', 'clear'],
emits: ['update:value', 'update:arrvalue', 'changeval', 'clear', 'searchOnGM'],
props: {
options: {
type: Array,
@@ -177,6 +177,8 @@ export default defineComponent({
const selectMultiple = ref(null)
const selectGeneric = ref(null)
const mystr = ref('')
const valoriload = computed(() => {
return updateArrOptions()
})
@@ -596,7 +598,7 @@ export default defineComponent({
let myarr: any = []
const mystr = val.toLocaleLowerCase()
mystr.value = val.toLocaleLowerCase()
myarr = updateArrOptions()
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
@@ -618,7 +620,7 @@ export default defineComponent({
valori.value = myarr.filter((v: any) => {
const mioval = tools.getRecordByField(optlab, v)
if (mioval)
return mioval?.toLowerCase().indexOf(mystr) > -1
return mioval?.toLowerCase().indexOf(mystr.value) > -1
else
return false
@@ -643,7 +645,7 @@ export default defineComponent({
try {
// myarr = optionsreal.value
myarr = []
if (mystr !== '' || props.filter_extra)
if (mystr.value !== '' || props.filter_extra)
// myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}]
/*
if (val === '1') {
@@ -654,7 +656,7 @@ export default defineComponent({
myarr.push({ _id: 2, comune: 'PROVA 2B', prov: 'AL' })
}*/ { // @ts-ignore
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim(), filter: props.filter_extra })
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.value.trim(), filter: props.filter_extra })
}
if (myarr === null) {
@@ -696,6 +698,8 @@ export default defineComponent({
if (props.multiselect_by_server) {
// console.log('@@@ VALORI CHANGED (3)', valori.value)
}
} else {
valori.value = []
}
console.log('*** OUT: tablesel', props.tablesel, 'filterFn', myarr)
@@ -818,6 +822,11 @@ export default defineComponent({
function clear() {
emit('clear')
myvalue.value = ''
mystr.value = ''
}
function searchOnGM(mystr: string) {
emit('searchOnGM', mystr)
}
onMounted(mounted)
@@ -839,6 +848,8 @@ export default defineComponent({
getLabelValue,
getOptionLabel,
clear,
mystr,
searchOnGM,
}
}
})

View File

@@ -36,7 +36,21 @@
</template>
<template v-slot:no-option>
<q-item>
<q-item v-if="mystr">
<q-item-section class="text-grey">
<span
v-if="Number.isInteger(parseInt(mystr))"
@click="searchOnGM(mystr)"
class="clickable-text"
>
Clicca qui per cercarlo su GM
</span>
<span v-else>
Testo non trovato: '{{ mystr }}'
</span>
</q-item-section>
</q-item>
<q-item v-else>
<q-item-section class="text-grey"> Digita il testo da cercare </q-item-section>
</q-item>
</template>
@@ -113,7 +127,21 @@
/>
</template>
<template v-slot:no-option>
<q-item>
<q-item v-if="mystr">
<q-item-section class="text-grey">
<span
v-if="Number.isInteger(parseInt(mystr))"
@click="searchOnGM(mystr)"
class="clickable-text text-blue"
>
Clicca qui per cercarlo su GM
</span>
<span v-else>
Testo non trovato: '{{ mystr }}'
</span>
</q-item-section>
</q-item>
<q-item v-else>
<q-item-section class="text-grey"> Digita il testo da cercare </q-item-section>
</q-item>
</template>