diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 34d5c6b8..b55b398c 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -111,6 +111,8 @@ export const shared_consts = { PROVINCE: 1, COMUNI: 2, CITIES_SERVER: 3, + CAT_TXT: 4, + CAT_NO_SPAZI: 5, }, BotType: [ diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index 055485e6..466b12ac 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -12,6 +12,7 @@ import { colmySkills } from '@store/Modules/fieldsTable' import { CGridTableRec } from '@/components/CGridTableRec' import { IMySkill, ISearchList, ISkill } from 'model' import { shared_consts } from '@/common/shared_vuejs' +import { useI18n } from '@/boot/i18n' export default defineComponent({ name: 'CFinder', @@ -26,6 +27,7 @@ export default defineComponent({ }, setup(props, { attrs, slots, emit }) { const mytable = 'users' + const { t } = useI18n(); const globalStore = useGlobalStore() const userStore = useUserStore() @@ -33,6 +35,8 @@ export default defineComponent({ const filtercustom: any = ref([]) const searchList = ref([]) + const search = ref('') + const idSector = computed(() => { let myval: any = null myval = searchList.value.find((rec) => (rec.table === 'sectors')) @@ -114,9 +118,9 @@ export default defineComponent({ label: 'Specializzazione', table: 'subskills', key: 'idSubSkill', - value: 0, - type: costanti.FieldType.multiselect, - arrvalue: [costanti.FILTER_TUTTI], + value: tools.getCookie(tools.COOK_SEARCH + 'subskills' + '_' + tools.getCookie(tools.COOK_SEARCH + 'skills', costanti.FILTER_TUTTI), costanti.FILTER_TUTTI), + type: costanti.FieldType.select, + arrvalue: [], addall: true, filter: getFilterSubSkills, showcount: true, @@ -302,9 +306,14 @@ export default defineComponent({ } } + function doSearch() { + // + } + onMounted(mounted) return { + t, tools, costanti, colmySkills, @@ -314,6 +323,8 @@ export default defineComponent({ filtercustom, searchList, idSector, + search, + doSearch, } }, }) diff --git a/src/components/CFinder/CFinder.vue b/src/components/CFinder/CFinder.vue index 552af34d..bebd0787 100755 --- a/src/components/CFinder/CFinder.vue +++ b/src/components/CFinder/CFinder.vue @@ -1,6 +1,17 @@ - - diff --git a/src/root/My404page/My404page.vue b/src/root/My404page/My404page.vue index cc1891d7..7aebac4d 100755 --- a/src/root/My404page/My404page.vue +++ b/src/root/My404page/My404page.vue @@ -1,8 +1,13 @@ +im diff --git a/src/rootgen/admin/importdata/importdata.ts b/src/rootgen/admin/importdata/importdata.ts index a9ae99e1..4086e398 100755 --- a/src/rootgen/admin/importdata/importdata.ts +++ b/src/rootgen/admin/importdata/importdata.ts @@ -8,6 +8,7 @@ import { useI18n } from '@src/boot/i18n' import { useUserStore } from '@store/UserStore' import { useGlobalStore } from '@store/globalStore' import { useQuasar } from 'quasar' +import { IParamsQuery } from 'model' export default defineComponent({ name: 'Sendpushnotif', @@ -18,6 +19,9 @@ export default defineComponent({ const userStore = useUserStore() const globalStore = useGlobalStore() + const arrSector = ref([]) + const arrSkill = ref([]) + const incaricamento = ref(false) @@ -40,11 +44,186 @@ export default defineComponent({ label: 'Tabella Cities', value: shared_consts.Cmd.CITIES_SERVER }, + { + label: 'Importa Categorie da TXT', + value: shared_consts.Cmd.CAT_TXT + }, + { + label: 'converti da TXT seperato senza spazi', + value: shared_consts.Cmd.CAT_NO_SPAZI + }, ] ) function created() { inputfile.value = '' + + const sortBy = 'descr' + const descending = 1 + const myobj: any = {} + if (descending) + myobj[sortBy] = -1 + else + myobj[sortBy] = 1 + + const params: IParamsQuery = { + table: 'sectors', + startRow: 0, + endRow: 10000, + filter: '', + filterand: '', + filtersearch: '', + filtersearch2: '', + filtercustom: '', + sortBy: myobj, + descending, + userId: '' + } + + globalStore.loadTable(params).then((data) => { + arrSector.value = data.rows + }) + + + params.table = 'skills' + globalStore.loadTable(params).then((data) => { + arrSkill.value = data.rows + }) + + } + + function createSector(cat: string) { + const myid = arrSector.value.length + 1 + arrSector.value.push({_id: myid, descr: cat}) + return myid + } + + function findidSector(cat: string) { + const rec = arrSector.value.find((rec) => rec.descr === cat) + if (rec) { + return rec._id + } + return 0; + } + function findidSkill(cat: string) { + const rec = arrSkill.value.find((rec) => rec.descr === cat) + if (rec) { + return rec._id + } + return 0; + } + + function createSkill(cat: string) { + const myid = arrSkill.value.length + 1 + arrSkill.value.push({_id: myid, descr: cat}) + return myid + } + + + function importCmdTxt(cmd: number, testo: string) { + + const delim = '\n'; + const righe = 1; + let indrec = 0; + let myarr = tools.CSVToArray(testo, delim) + + let sector = '' + let skill = '' + let sotto_cat = '' + let idSector = 0 + let idSkill = 0 + + let strskills = ''; + let strsubskills = ''; + let strsectors = ''; + + let indrecsub = 1; + + myarr = myarr[0] + let arrstr = [] + + // debugger; + for (let i = 0; i < myarr.length; i = i + righe) { + arrstr = myarr[i].split(',') + sector = arrstr[0] + skill = arrstr[1] + sotto_cat = arrstr[2] + // sotto_cat = myarr[i].replace('\'', '\\\'') + // sector = myarr[i+2] + if (skill) + skill = skill.replace('\'', '\\\'') + if (sector) + sector = sector.replace('\'', '\\\'') + + idSector = findidSector(sector) + if (!idSector) { + idSector = createSector(sector) + + // sectors + strsectors += '{ \n' + strsectors += ' _id:' + idSector + ',' + strsectors += ' descr:\'' + sector + '\',' + strsectors += '}, \n' + } + + idSkill = findidSkill(skill) + if (!idSkill) { + idSkill = createSkill(skill) + + // skills + strskills += '{ \n' + strsectors += ' _id:' + idSkill + ',' + strskills += ' idSector: [' + idSector + '],' + strskills += ' descr:\'' + skill + '\',' + strskills += '}, \n' + } + + // subskills + strsubskills += '{ \n' + strsubskills += ' idSkill: ' + idSkill + ',' + strsubskills += ' descr:\'' + sotto_cat + '\',' + strsubskills += '}, \n' + + indrecsub++ + } + + let ris = 'module.exports = {\n' + + ' list: [' + strsectors + ']' + ris += '



' + ris += 'module.exports = {\n' + + ' list: [' + strskills + ']' + ris += '



' + ris += 'module.exports = {\n' + + ' list: [' + strsubskills + ']' + + return ris + + } + + function importNoSpazi(cmd: number, testo: string) { + + const delim = '\n'; + const righe = 3; + let indrec = 0; + let myarr = tools.CSVToArray(testo, delim) + + let sector = '' + let sotto_cat = '' + + myarr = myarr[0] + + let txt = '' + + // debugger; + for (let i = 0; i < myarr.length; i = i + righe) { + sotto_cat = myarr[i].replace('\'', '\\\'') + sector = myarr[i+2] + + txt += sotto_cat + ',' + sector + '
' + } + + return txt + } function importCmd(cmd: number, testo: string) { @@ -56,6 +235,10 @@ export default defineComponent({ delim = ',' } else if ((cmd === shared_consts.Cmd.COMUNI) || (cmd === shared_consts.Cmd.CITIES_SERVER)) { delim = ';' + } else if (cmd === shared_consts.Cmd.CAT_TXT) { + return importCmdTxt(cmd, testo); + } else if (cmd === shared_consts.Cmd.CAT_NO_SPAZI) { + return importNoSpazi(cmd, testo); } const myarr = tools.CSVToArray(testo, delim) diff --git a/src/rootgen/admin/importdata/importdata.vue b/src/rootgen/admin/importdata/importdata.vue index 1d5a18a0..299ac083 100755 --- a/src/rootgen/admin/importdata/importdata.vue +++ b/src/rootgen/admin/importdata/importdata.vue @@ -17,6 +17,10 @@ label="Esegui" @click="eseguiCmd"> {{risultato}} + +




+ VERSIONE HTML: +


diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index c5a18436..3bca71e5 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -906,7 +906,10 @@ const msg_it = { cancel_ask_group_short: 'Annulla richiesta', refuse_ask_group_short: 'Rifiuta la richiesta', pwd: 'Password per accedere', - } + }, + finder: { + search_skill: 'Cerca una specializzazione' + }, }, };