From c768e9de307fad197e837ac6a77fa6b4ba0c2bd1 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Tue, 15 Feb 2022 18:15:32 +0100 Subject: [PATCH] =?UTF-8?q?Inserire=20il=20bottone=20Aggiungi,=20anche=20s?= =?UTF-8?q?ulla=20bacheca=20corretto=20quando=20modificavo=20un=20record,?= =?UTF-8?q?=20non=20mostrava=20i=20campi=20estratti=20dalle=20tabelle=20di?= =?UTF-8?q?=20decodifica...=20Quando=20si=20aggiunge=20una=20competenza=20?= =?UTF-8?q?e=20poi=20si=20clicca=20su=20annulla=20invece=20di=20finalizzar?= =?UTF-8?q?la=20con=20"ok",=20viene=20annullata=20oltre=20alla=20competenz?= =?UTF-8?q?a=20corrente=20che=20si=20voleva=20inserire=20anche=20la=20prec?= =?UTF-8?q?edente=20gi=C3=A0=20inserita...=20Se=20non=20riesce=20ad=20aggi?= =?UTF-8?q?ungere=20il=20record,=20mantiene=20il=20record=20vuoto...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CFinder/CFinder.vue | 2 +- src/components/CGridTableRec/CGridTableRec.ts | 63 +++++++++++++++---- .../CGridTableRec/CGridTableRec.vue | 1 + src/components/CMySkill/CMySkill.ts | 7 ++- src/components/CMySkill/CMySkill.vue | 23 ++++++- .../admin/sendpushnotif/sendpushnotif.ts | 6 +- src/store/Modules/costanti.ts | 3 + src/store/globalStore.ts | 3 +- src/views/admin/dbop/dbop.ts | 6 +- src/views/admin/dbop/dbop.vue | 8 ++- src/views/user/test/test.ts | 12 ++-- 11 files changed, 106 insertions(+), 28 deletions(-) diff --git a/src/components/CFinder/CFinder.vue b/src/components/CFinder/CFinder.vue index 670cbbf5..027342e0 100755 --- a/src/components/CFinder/CFinder.vue +++ b/src/components/CFinder/CFinder.vue @@ -39,7 +39,7 @@ :prop_search="true" :finder="true" :choose_visutype="$q.screen.gt.xs" - :butt_modif_new="false" + :butt_modif_new="true" noresultLabel="Il filtro selezionato non ha trovato nessun risultato" :arrfilters="arrfilterand" :filtercustom="filtercustom" diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 6d40ea5f..2ee1c004 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -436,14 +436,22 @@ export default defineComponent({ if (!item.notinsearch) { let objitem: any = {} // console.log(' item ', item) + let obj: any = {} if (item.table === 'provinces') { - let obj: any = {} obj['mycities.prov'] = item.value - if (item.value !== '') { + if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) { filtersearch3or.push(obj) } + } else if (item.table === 'cities') { + + if (item.value && item.value.hasOwnProperty('_id')) { + obj['idCity'] = item.value._id + if (item.value && item.value !== '' && item.value._id !== costanti.FILTER_TUTTI) { + filtersearch3or.push(obj) + } + } } else if (item.value > 0) { objitem[item.key] = item.value filtersearch.push(objitem) @@ -754,6 +762,7 @@ export default defineComponent({ function annulla(val: any) { console.log('annulla') + /* if (newRecord.value) { globalStore.DeleteRec({ table: mytable.value, id: newRecord.value._id }) .then((ris) => { @@ -763,6 +772,9 @@ export default defineComponent({ return true }) } + + */ + newRecord.value = null } function SaveValue(newVal: any, valinitial: any) { @@ -846,27 +858,31 @@ export default defineComponent({ return pagination.value.rowsNumber } - async function createNewRecordDialog() { + function createNewRecordDialog() { const mydata: any = { table: mytable.value, data: {} } - if (props.defaultnewrec) - mydata.data = props.defaultnewrec() + // if (props.defaultnewrec) + // mydata.data = props.defaultnewrec() // console.log('DATA=', mydata.data) - newRecord.value = await globalStore.saveTable(mydata) + // @ts-ignore + newRecord.value = props.defaultnewrec() + newRecord.value['userId'] = userStore.my._id + newRecord.value['idapp'] = process.env.APP_ID + globalStore.saveTable(mydata).then(ris => console.log('RISULT', ris)) newRecordBool.value = true } - async function createNewRecord() { + function createNewRecord() { - await createNewRecordDialog() + createNewRecordDialog() console.log('newRecord.value', newRecord.value) @@ -964,13 +980,13 @@ export default defineComponent({ const funccancel = 0 const par = { param1: item._id, - param2: item, + param2: {...item}, } if (col.action === lists.MenuAction.CAN_EDIT_TABLE) { console.log('Edit', item) selItem(item, col) - recModif.value = item + recModif.value = {...item} recSaved.value = {...item} editRecordBool.value = true } else { @@ -1317,12 +1333,16 @@ export default defineComponent({ function cancelrecModif() { recModif.value = {...recSaved.value} - if (recModif.value._id) { + + editRecordBool.value = false + /*if (recModif.value._id) { const indrec = serverData.value.findIndex((rec: any) => rec._id === recModif.value._id) if (indrec >= 0) serverData.value[indrec] = recModif.value editRecordBool.value = false } + + */ } async function saverecModif() { @@ -1409,6 +1429,26 @@ export default defineComponent({ return '' } + function cmdExt(cmd: any, id: any, val2: any) { + console.log('cmd', cmd) + + let action = 0 + if (cmd === costanti.CMD_DELETE) { + action = lists.MenuAction.DELETE_RECTABLE + } else if (cmd === costanti.CMD_MODIFY) { + action = lists.MenuAction.CAN_EDIT_TABLE + } + + if (action > 0) { + const col = props.prop_mycolumns.find((rec: any) => rec.action === action) + if (col) { + const myarr = serverData.value.find((rec: any) => rec._id === id) + if (myarr) + clickFunz(myarr, col) + } + } + } + // onMounted(mounted) created() @@ -1491,6 +1531,7 @@ export default defineComponent({ shared_consts, getLabelFooterByRow, showfilteradv, + cmdExt, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 24fec33b..c277eb5f 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -316,6 +316,7 @@
diff --git a/src/components/CMySkill/CMySkill.ts b/src/components/CMySkill/CMySkill.ts index b94a5484..1eea77ff 100755 --- a/src/components/CMySkill/CMySkill.ts +++ b/src/components/CMySkill/CMySkill.ts @@ -11,7 +11,7 @@ import { useRoute, useRouter } from 'vue-router' export default defineComponent({ name: 'CMySkill', - emits: ['setCmd'], + emits: ['setCmd', 'cmdext'], props: { prop_myskill: { type: Object as PropType, @@ -55,6 +55,10 @@ export default defineComponent({ emit('setCmd', $q, cmd, myusername, value, groupname) } + function cmdExt(cmd: any, val1: any, val2: any) { + emit('cmdext', cmd, val1, val2) + } + onMounted(mounted) return { @@ -67,6 +71,7 @@ export default defineComponent({ userStore, tools, fieldsTable, + cmdExt, } }, }) diff --git a/src/components/CMySkill/CMySkill.vue b/src/components/CMySkill/CMySkill.vue index 890d3946..afd5f323 100755 --- a/src/components/CMySkill/CMySkill.vue +++ b/src/components/CMySkill/CMySkill.vue @@ -23,13 +23,34 @@ - {{ myskill.descr }}
+ {{ myskill.descr }}
{{ myskill.username }} - , {{ rec.comune }} + + + + + + + + {{ $t('reg.edit') }} + + + + + {{ $t('reg.elimina') }} + + + + + + + diff --git a/src/rootgen/admin/sendpushnotif/sendpushnotif.ts b/src/rootgen/admin/sendpushnotif/sendpushnotif.ts index 2c63e0ef..9ca47ef8 100755 --- a/src/rootgen/admin/sendpushnotif/sendpushnotif.ts +++ b/src/rootgen/admin/sendpushnotif/sendpushnotif.ts @@ -40,13 +40,13 @@ export default defineComponent({ function SendMsg(params: any) { $q.dialog({ message: t('dialog.continue') + ' ' + params.content + ' ?', - cancel: { - label: t('dialog.cancel') - }, ok: { label: t('dialog.yes'), push: true }, + cancel: { + label: t('dialog.cancel') + }, title: params.title }).onOk(async () => { diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 6e66aaaf..8131b235 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -40,6 +40,9 @@ export const costanti = { CREATE_GROUP: 30, MANAGE_GROUPS: 31, + CMD_DELETE: 1, + CMD_MODIFY: 2, + SHOW_ALL: 50, REQ_ADD_USER_TO_GROUP: 40, diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index ea2a3de1..6712c65e 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -1328,7 +1328,8 @@ export const useGlobalStore = defineStore('GlobalStore', { risultato = mylist.filter((myrec: any) => myrec.username === val).map(collab) } else { const myris = mylist.find((myrec: any) => myrec[key] === val) - risultato = myris[collab] + if (myris) + risultato = myris[collab] } if (key === 'username') { diff --git a/src/views/admin/dbop/dbop.ts b/src/views/admin/dbop/dbop.ts index 6ba1d6ab..39bba841 100755 --- a/src/views/admin/dbop/dbop.ts +++ b/src/views/admin/dbop/dbop.ts @@ -32,13 +32,13 @@ export default defineComponent({ $q.dialog({ message: t('dialog.continue') + ' ' + miafunz + ' ?', - cancel: { - label: t('dialog.cancel'), - }, ok: { label: t('dialog.yes'), push: true, }, + cancel: { + label: t('dialog.cancel'), + }, title: 'Funzione:', }).onOk(async () => { const mydata = { diff --git a/src/views/admin/dbop/dbop.vue b/src/views/admin/dbop/dbop.vue index 8c9444ad..c71c65b5 100755 --- a/src/views/admin/dbop/dbop.vue +++ b/src/views/admin/dbop/dbop.vue @@ -215,10 +215,16 @@

+
+ +
+
{ $q.dialog({ message: t('reg.cancellami_2', { sitename: t('ws.sitename') }), - cancel: { - label: t('dialog.cancel') - }, ok: { label: t('dialog.yes'), push: true }, + cancel: { + label: t('dialog.cancel') + }, title: t('pages.profile') }) .onOk(() => {