Sistemato il filtro per Provincia
This commit is contained in:
@@ -129,18 +129,18 @@ export default defineComponent({
|
||||
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'provinces', [costanti.FILTER_TUTTI]),
|
||||
filter: null,
|
||||
useinput: true,
|
||||
notinsearch: true,
|
||||
},
|
||||
{
|
||||
label: 'Città',
|
||||
table: 'cities',
|
||||
key: 'idProvince',
|
||||
key: 'idCity',
|
||||
type: costanti.FieldType.multiselect_by_server,
|
||||
value: 0,
|
||||
addall: true,
|
||||
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'cities', [costanti.FILTER_TUTTI]),
|
||||
useinput: true,
|
||||
filter: getFilterCitiesByProvince,
|
||||
filter: null,
|
||||
// filter: getFilterCitiesByProvince,
|
||||
// param1: shared_consts.PARAM_SHOW_PROVINCE,
|
||||
tablesel: 'cities',
|
||||
},
|
||||
@@ -252,6 +252,7 @@ export default defineComponent({
|
||||
name: 1,
|
||||
surname: 1,
|
||||
comune: 1,
|
||||
mycities: 1,
|
||||
'profile.img': 1,
|
||||
'profile.qualifica': 1,
|
||||
}
|
||||
@@ -271,10 +272,10 @@ export default defineComponent({
|
||||
af_objId_tab: '',
|
||||
},
|
||||
lookup5: {
|
||||
lk_tab: 'provinces',
|
||||
lk_LF: 'idProvince',
|
||||
lk_FF: 'prov',
|
||||
lk_as: 'descr',
|
||||
lk_tab: 'cities',
|
||||
lk_LF: 'idCity',
|
||||
lk_FF: '_id',
|
||||
lk_as: 'mycities',
|
||||
af_objId_tab: '',
|
||||
},
|
||||
}
|
||||
|
||||
@@ -343,15 +343,22 @@ export default defineComponent({
|
||||
|
||||
let filtersearch: any[] = []
|
||||
let filtersearch2: any[] = []
|
||||
let filtersearch3or: any[] = []
|
||||
|
||||
let recSector = null;
|
||||
let recSkill = null;
|
||||
let idSector = 0;
|
||||
let idSkill = 0;
|
||||
let recSector = null
|
||||
let recProvince = null
|
||||
let recSkill = null
|
||||
let idSector = 0
|
||||
let idProvince = 0
|
||||
let idSkill = 0
|
||||
if (searchList.value) {
|
||||
recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors')
|
||||
idSector = recSector ? recSector.value : 0
|
||||
}
|
||||
if (searchList.value) {
|
||||
recProvince = searchList.value.find((item: ISearchList) => item.table === 'provinces')
|
||||
idProvince = recProvince ? recProvince.value : 0
|
||||
}
|
||||
|
||||
if (searchList.value) {
|
||||
recSkill = searchList.value.find((item: ISearchList) => item.table === 'skills')
|
||||
@@ -365,19 +372,34 @@ export default defineComponent({
|
||||
//searchList.value.forEach((item: ISearchList) => {
|
||||
if (!item.notinsearch) {
|
||||
let objitem: any = {}
|
||||
// console.log(' item ', item)
|
||||
if (item.value > 0) {
|
||||
objitem[item.key] = item.value
|
||||
filtersearch.push(objitem)
|
||||
} else if (item.arrvalue.length > 0) {
|
||||
const myarr = item.arrvalue.filter((value: any) => {
|
||||
if (typeof value === 'number') {
|
||||
return value > 0;
|
||||
return value > 0
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
})
|
||||
|
||||
let arr2: any = []
|
||||
|
||||
if (item.table === 'provinces') {
|
||||
arr2 = []
|
||||
myarr.forEach((myval: any) => {
|
||||
let objitem3: any = {}
|
||||
objitem3['mycities.prov'] = myval
|
||||
arr2.push(objitem3)
|
||||
})
|
||||
let obj2: any = {
|
||||
$or: arr2
|
||||
}
|
||||
if (arr2.length > 0) {
|
||||
filtersearch3or = arr2
|
||||
}
|
||||
} else {
|
||||
myarr.forEach((myval: any) => {
|
||||
let objitem2: any = {}
|
||||
objitem2[item.key] = myval
|
||||
@@ -387,8 +409,11 @@ export default defineComponent({
|
||||
let obj2: any = {
|
||||
$or: arr2
|
||||
}
|
||||
if (arr2.length > 0)
|
||||
if (arr2.length > 0) {
|
||||
filtersearch.push(obj2)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if ((item.table === 'skills') && item.value === costanti.FILTER_TUTTI) {
|
||||
let obj2: any = {}
|
||||
@@ -447,6 +472,7 @@ export default defineComponent({
|
||||
filtersearch: filtersearch,
|
||||
// @ts-ignore
|
||||
filtersearch2: filtersearch2,
|
||||
filtersearch3or: filtersearch3or,
|
||||
// @ts-ignore
|
||||
filtercustom: props.filtercustom,
|
||||
sortBy: myobj,
|
||||
@@ -934,6 +960,7 @@ export default defineComponent({
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function visuIntestazCol(col: IColGridTable) {
|
||||
if (col.fieldtype === costanti.FieldType.html || col.fieldtype === costanti.FieldType.listimages) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user