From f31eb0ea99ff9559c276a87700ae376ef57ffc39 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Fri, 31 Dec 2021 01:44:16 +0100 Subject: [PATCH] - select specializz. --- package.json | 2 +- src/boot/i18n.ts | 3 +- src/components/CFinder/CFinder.ts | 36 ++- .../CGridTableRec/CGridTableRec.scss | 6 + src/components/CGridTableRec/CGridTableRec.ts | 66 +++++- .../CGridTableRec/CGridTableRec.vue | 127 +++++----- src/components/CMyChipList/CMyChipList.ts | 1 - src/components/CMyPopupEdit/CMyPopupEdit.vue | 4 +- src/components/CMySelect/CMySelect.ts | 20 +- src/components/CMySelect/CMySelect.vue | 3 +- src/components/CSignUp/CSignUp.ts | 2 +- src/components/CSkill/CSkill.ts | 2 + src/css/app.scss | 7 + src/model/GlobalStore.ts | 13 ++ src/statics/lang/it.js | 2 + src/store/Modules/fieldsTable.ts | 33 ++- src/store/globalStore.ts | 8 +- yarn.lock | 218 ++++-------------- 18 files changed, 293 insertions(+), 260 deletions(-) diff --git a/package.json b/package.json index 8da52654..8f84b816 100755 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "vue-class-component": "^8.0.0-rc.1", "vue-country-code": "^1.1.2", "vue-echarts": "^6.0.0", - "vue-i18n": "^9.1.8", + "vue-i18n": "^9.2.0-beta.26", "vue-idb": "^0.2.0", "vue-loader": "^16.5.0", "vue-property-decorator": "^10.0.0-rc.3", diff --git a/src/boot/i18n.ts b/src/boot/i18n.ts index 37064aa3..d8527c00 100755 --- a/src/boot/i18n.ts +++ b/src/boot/i18n.ts @@ -1,5 +1,6 @@ // @ts-ignore -import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler' +// import { createI18n } from 'vue-i18n/index' +import { createI18n } from 'vue-i18n/dist/vue-i18n.esm-bundler.js' import messages from '../statics/i18n' import { boot } from 'quasar/wrappers' // you'll need to create the src/i18n/index.js file too diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index b2701e06..bc90d5cd 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -43,6 +43,7 @@ export default defineComponent({ function getFilterSkills(recSkill: any, index: number, arr: any) { const recsectors:any = searchList.value.find((rec) => rec.table === 'sectors') + // console.log('getFilterSkills', recSkill.idSector, recsectors.value) if (recsectors) { return recSkill.idSector.includes(recsectors.value) } else { @@ -50,6 +51,16 @@ export default defineComponent({ } } + function getFilterSubSkills(recSubSkill: any, index: number, arr: any) { + const recskills:any = searchList.value.find((rec) => rec.table === 'skills') + // console.log('recSubSkill', recSubSkill, 'recskills', recskills) + if (recskills) { + return recSubSkill.idSkill === recskills.value + } else { + return true + } + } + searchList.value = [ { @@ -60,16 +71,30 @@ export default defineComponent({ arrvalue: [], type: costanti.FieldType.select, filter: null, + addall: true, notinsearch: true, }, { label: 'Competenza', table: 'skills', key: 'idSkill', - value: tools.getCookie(tools.COOK_SEARCH + 'skills', costanti.FILTER_TUTTI), + value: tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + tools.getCookie(tools.COOK_SEARCH + 'sectors', costanti.FILTER_TUTTI), costanti.FILTER_TUTTI), arrvalue: [], type: costanti.FieldType.select, + addall: true, filter: getFilterSkills, + showcount: true, + }, + { + label: 'Specializz.', + table: 'subskills', + key: 'idSubSkill', + value: 0, + type: costanti.FieldType.multiselect, + arrvalue: [costanti.FILTER_TUTTI], + addall: true, + filter: getFilterSubSkills, + showcount: true, }, { label: 'Citta', @@ -139,6 +164,7 @@ export default defineComponent({ return { _id: 0, idSkill: 0, + idSubSkill: [], idStatusSkill: [], idContribType: [], idCity: [], @@ -169,6 +195,7 @@ export default defineComponent({ recSkill: 1, sector: 1, idSkill: 1, + idSubSkill: 1, idStatusSkill: 1, idContribType: 1, idCity: 1, @@ -191,6 +218,13 @@ export default defineComponent({ lk_as: 'sector', af_objId_tab: '', }, + lookup4: { + lk_tab: 'subskills', + lk_LF: 'idSubSkill', + lk_FF: '_id', + lk_as: 'myskill', + af_objId_tab: '', + }, } } diff --git a/src/components/CGridTableRec/CGridTableRec.scss b/src/components/CGridTableRec/CGridTableRec.scss index 98063c1d..8321e839 100755 --- a/src/components/CGridTableRec/CGridTableRec.scss +++ b/src/components/CGridTableRec/CGridTableRec.scss @@ -35,3 +35,9 @@ align-items: center; justify-content: center; } + +.riduci_pad { + min-height: 30px; + padding: 4px 8px !important; +} + diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index ccdd4de3..35c07c96 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -204,6 +204,18 @@ export default defineComponent({ const mycodeid = toRef(props, 'prop_codeId') + const valoriopt = computed(() => (item: any, addall: boolean) => { + // console.log('valoriopt', item.table) + return globalStore.getTableJoinByName(item.table, addall, item.filter) + }) + + const labelcombo = computed(() => (item: any) => { + let lab = item.label + if (item.showcount) + lab += ' (' + valoriopt.value(item, false).length + ')' + return lab + }) + watch(searchList.value, (to: any, from: any) => { console.log('watch searchlist', to) refresh() @@ -212,6 +224,37 @@ export default defineComponent({ function searchval(newval: any, table: any) { console.log('searchval', newval, table) tools.setCookie(tools.COOK_SEARCH + table, newval) + + if (table === 'skills') { + const recSector = searchList.value.find((rec) => rec.table === 'sectors') + if (recSector) + tools.setCookie(tools.COOK_SEARCH + table + '_' + recSector.value, newval) + } + + if (table === 'sectors') { + for (const item of searchList.value) { + if ((item.table === 'subskills')) { + // item.arrvalue = [costanti.FILTER_TUTTI] + } + if (item.table === 'skills') { + // console.log('---PRIMA ', item.value) + const valsaved = tools.getCookie(tools.COOK_SEARCH + 'skills' + '_' + newval, costanti.FILTER_TUTTI) + if (valsaved) + item.value = valsaved + else + item.value = costanti.FILTER_TUTTI + // console.log('---DOPO ', item.value) + } + } + } + /*if (table === 'skills') { + for (const item of searchList.value) { + if (item.table === 'subskills') { + item.arrvalue = [costanti.FILTER_TUTTI] + } + } + } */ + refresh() } @@ -267,16 +310,24 @@ export default defineComponent({ let filtersearch2: any[] = [] let recSector = null; + let recSkill = null; let idSector = 0; + let idSkill = 0; if (searchList.value) { recSector = searchList.value.find((item: ISearchList) => item.table === 'sectors') idSector = recSector ? recSector.value : 0 } + if (searchList.value) { + recSkill = searchList.value.find((item: ISearchList) => item.table === 'skills') + idSkill = recSkill ? recSkill.value : 0 + } + // console.table(searchList.value) if (searchList.value) { - searchList.value.forEach((item: ISearchList) => { + for (const item of searchList.value) { + //searchList.value.forEach((item: ISearchList) => { if (!item.notinsearch) { let objitem: any = {} if (item.value > 0) { @@ -304,15 +355,22 @@ export default defineComponent({ if (arr2.length > 0) filtersearch.push(obj2) } else { - if (item.table === 'skills' && item.value === costanti.FILTER_TUTTI) { + if ((item.table === 'skills') && item.value === costanti.FILTER_TUTTI) { let obj2: any = {} // idSector obj2['sector._id'] = idSector filtersearch2.push(obj2) } + if ((item.table === 'subskills') && item.value === costanti.FILTER_TUTTI) { + let obj2: any = {} + // idSector + obj2['myskill._id'] = idSkill + filtersearch2.push(obj2) + } } + } - }) + } } console.log('filtersearch', filtersearch) @@ -1146,6 +1204,8 @@ export default defineComponent({ searchval, canModifyThisRec, checkIfShowRec, + valoriopt, + labelcombo, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 5cf13b38..6f39cc10 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -1,5 +1,5 @@ +