Inserire il bottone Aggiungi, anche sulla bacheca

corretto quando modificavo un record, non mostrava i campi estratti dalle tabelle di decodifica...
Quando si aggiunge una competenza e poi si clicca su annulla invece di finalizzarla con "ok", viene annullata oltre alla competenza corrente che si voleva inserire anche la precedente già inserita...
Se non riesce ad aggiungere il record, mantiene il record vuoto...
This commit is contained in:
paoloar77
2022-02-15 18:15:32 +01:00
parent b869f330f7
commit c768e9de30
11 changed files with 106 additions and 28 deletions

View File

@@ -39,7 +39,7 @@
:prop_search="true" :prop_search="true"
:finder="true" :finder="true"
:choose_visutype="$q.screen.gt.xs" :choose_visutype="$q.screen.gt.xs"
:butt_modif_new="false" :butt_modif_new="true"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato" noresultLabel="Il filtro selezionato non ha trovato nessun risultato"
:arrfilters="arrfilterand" :arrfilters="arrfilterand"
:filtercustom="filtercustom" :filtercustom="filtercustom"

View File

@@ -436,14 +436,22 @@ export default defineComponent({
if (!item.notinsearch) { if (!item.notinsearch) {
let objitem: any = {} let objitem: any = {}
// console.log(' item ', item) // console.log(' item ', item)
if (item.table === 'provinces') {
let obj: any = {} let obj: any = {}
if (item.table === 'provinces') {
obj['mycities.prov'] = item.value obj['mycities.prov'] = item.value
if (item.value !== '') { if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) {
filtersearch3or.push(obj) 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) { } else if (item.value > 0) {
objitem[item.key] = item.value objitem[item.key] = item.value
filtersearch.push(objitem) filtersearch.push(objitem)
@@ -754,6 +762,7 @@ export default defineComponent({
function annulla(val: any) { function annulla(val: any) {
console.log('annulla') console.log('annulla')
/*
if (newRecord.value) { if (newRecord.value) {
globalStore.DeleteRec({ table: mytable.value, id: newRecord.value._id }) globalStore.DeleteRec({ table: mytable.value, id: newRecord.value._id })
.then((ris) => { .then((ris) => {
@@ -763,6 +772,9 @@ export default defineComponent({
return true return true
}) })
} }
*/
newRecord.value = null
} }
function SaveValue(newVal: any, valinitial: any) { function SaveValue(newVal: any, valinitial: any) {
@@ -846,27 +858,31 @@ export default defineComponent({
return pagination.value.rowsNumber return pagination.value.rowsNumber
} }
async function createNewRecordDialog() { function createNewRecordDialog() {
const mydata: any = { const mydata: any = {
table: mytable.value, table: mytable.value,
data: {} data: {}
} }
if (props.defaultnewrec) // if (props.defaultnewrec)
mydata.data = props.defaultnewrec() // mydata.data = props.defaultnewrec()
// console.log('DATA=', mydata.data) // 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 newRecordBool.value = true
} }
async function createNewRecord() { function createNewRecord() {
await createNewRecordDialog() createNewRecordDialog()
console.log('newRecord.value', newRecord.value) console.log('newRecord.value', newRecord.value)
@@ -964,13 +980,13 @@ export default defineComponent({
const funccancel = 0 const funccancel = 0
const par = { const par = {
param1: item._id, param1: item._id,
param2: item, param2: {...item},
} }
if (col.action === lists.MenuAction.CAN_EDIT_TABLE) { if (col.action === lists.MenuAction.CAN_EDIT_TABLE) {
console.log('Edit', item) console.log('Edit', item)
selItem(item, col) selItem(item, col)
recModif.value = item recModif.value = {...item}
recSaved.value = {...item} recSaved.value = {...item}
editRecordBool.value = true editRecordBool.value = true
} else { } else {
@@ -1317,12 +1333,16 @@ export default defineComponent({
function cancelrecModif() { function cancelrecModif() {
recModif.value = {...recSaved.value} 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) const indrec = serverData.value.findIndex((rec: any) => rec._id === recModif.value._id)
if (indrec >= 0) if (indrec >= 0)
serverData.value[indrec] = recModif.value serverData.value[indrec] = recModif.value
editRecordBool.value = false editRecordBool.value = false
} }
*/
} }
async function saverecModif() { async function saverecModif() {
@@ -1409,6 +1429,26 @@ export default defineComponent({
return '' 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) // onMounted(mounted)
created() created()
@@ -1491,6 +1531,7 @@ export default defineComponent({
shared_consts, shared_consts,
getLabelFooterByRow, getLabelFooterByRow,
showfilteradv, showfilteradv,
cmdExt,
} }
} }
}) })

View File

@@ -316,6 +316,7 @@
<div v-if="showType === costanti.SHOW_MYSKILL || (myvertical === costanti.VISUTABLE_LISTA && tablesel === 'myskills') "> <div v-if="showType === costanti.SHOW_MYSKILL || (myvertical === costanti.VISUTABLE_LISTA && tablesel === 'myskills') ">
<CMySkill <CMySkill
:prop_myskill="props.row" :prop_myskill="props.row"
@cmdext="cmdExt"
:visu="visufind" :visu="visufind"
> >
</CMySkill> </CMySkill>

View File

@@ -11,7 +11,7 @@ import { useRoute, useRouter } from 'vue-router'
export default defineComponent({ export default defineComponent({
name: 'CMySkill', name: 'CMySkill',
emits: ['setCmd'], emits: ['setCmd', 'cmdext'],
props: { props: {
prop_myskill: { prop_myskill: {
type: Object as PropType<IMySkill | null>, type: Object as PropType<IMySkill | null>,
@@ -55,6 +55,10 @@ export default defineComponent({
emit('setCmd', $q, cmd, myusername, value, groupname) emit('setCmd', $q, cmd, myusername, value, groupname)
} }
function cmdExt(cmd: any, val1: any, val2: any) {
emit('cmdext', cmd, val1, val2)
}
onMounted(mounted) onMounted(mounted)
return { return {
@@ -67,6 +71,7 @@ export default defineComponent({
userStore, userStore,
tools, tools,
fieldsTable, fieldsTable,
cmdExt,
} }
}, },
}) })

View File

@@ -23,13 +23,34 @@
<!--<span> - {{ myskill.profile.qualifica }}</span>--> <!--<span> - {{ myskill.profile.qualifica }}</span>-->
</q-item-label> </q-item-label>
<q-item-label lines="3">{{ myskill.descr }}<br> <q-item-label lines="3" v-if="myskill.descr">{{ myskill.descr }}<br>
</q-item-label> </q-item-label>
<q-item-label overline lines="1" style="text-align: right"> <q-item-label overline lines="1" style="text-align: right">
<span class="text-weight-bold">{{ myskill.username }}</span> - <span class="text-weight-bold">{{ myskill.username }}</span> -
<span v-for="(rec, ind) of myskill.mycities" :key="ind"><span v-if="ind > 0">, </span>{{ rec.comune }}</span> <span v-for="(rec, ind) of myskill.mycities" :key="ind"><span v-if="ind > 0">, </span>{{ rec.comune }}</span>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section side v-if="myskill.userId === userStore.my._id">
<q-item-label>
<q-btn rounded icon="fas fa-ellipsis-h">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-pencil-alt" v-close-popup
@click="cmdExt(costanti.CMD_MODIFY, myskill._id)">
<q-item-section>{{ $t('reg.edit') }}</q-item-section>
</q-item>
</q-list>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-trash-alt" v-close-popup @click="cmdExt(costanti.CMD_DELETE, myskill._id)">
<q-item-section>{{ $t('reg.elimina') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
</q-item-section>
</q-item> </q-item>
<q-separator inset="item"/> <q-separator inset="item"/>

View File

@@ -40,13 +40,13 @@ export default defineComponent({
function SendMsg(params: any) { function SendMsg(params: any) {
$q.dialog({ $q.dialog({
message: t('dialog.continue') + ' ' + params.content + ' ?', message: t('dialog.continue') + ' ' + params.content + ' ?',
cancel: {
label: t('dialog.cancel')
},
ok: { ok: {
label: t('dialog.yes'), label: t('dialog.yes'),
push: true push: true
}, },
cancel: {
label: t('dialog.cancel')
},
title: params.title title: params.title
}).onOk(async () => { }).onOk(async () => {

View File

@@ -40,6 +40,9 @@ export const costanti = {
CREATE_GROUP: 30, CREATE_GROUP: 30,
MANAGE_GROUPS: 31, MANAGE_GROUPS: 31,
CMD_DELETE: 1,
CMD_MODIFY: 2,
SHOW_ALL: 50, SHOW_ALL: 50,
REQ_ADD_USER_TO_GROUP: 40, REQ_ADD_USER_TO_GROUP: 40,

View File

@@ -1328,6 +1328,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
risultato = mylist.filter((myrec: any) => myrec.username === val).map(collab) risultato = mylist.filter((myrec: any) => myrec.username === val).map(collab)
} else { } else {
const myris = mylist.find((myrec: any) => myrec[key] === val) const myris = mylist.find((myrec: any) => myrec[key] === val)
if (myris)
risultato = myris[collab] risultato = myris[collab]
} }

View File

@@ -32,13 +32,13 @@ export default defineComponent({
$q.dialog({ $q.dialog({
message: t('dialog.continue') + ' ' + miafunz + ' ?', message: t('dialog.continue') + ' ' + miafunz + ' ?',
cancel: {
label: t('dialog.cancel'),
},
ok: { ok: {
label: t('dialog.yes'), label: t('dialog.yes'),
push: true, push: true,
}, },
cancel: {
label: t('dialog.cancel'),
},
title: 'Funzione:', title: 'Funzione:',
}).onOk(async () => { }).onOk(async () => {
const mydata = { const mydata = {

View File

@@ -215,10 +215,16 @@
</div> </div>
<div class="row"> <div class="row">
<q-btn <q-btn
label="1. Cancella e Ricrea tutte le Tabelle (Sector, Skill, SubSkill, City, Province, Contribtype, AdType)" color="negative" label="1. Cancella e Ricrea tutte le Tabelle (Sector, Skill, SubSkill, Contribtype, AdType)" color="negative"
@click="EseguiFunz('emptyDbSkill')"></q-btn> @click="EseguiFunz('emptyDbSkill')"></q-btn>
<br> <br>
</div> </div>
<div class="row">
<q-btn
label="1. Cancella e Ricrea le Tabelle (City, Province)" color="negative"
@click="EseguiFunz('ricreaTabCitiesProvinces')"></q-btn>
<br>
</div>
<div class="row"> <div class="row">
<q-btn <q-btn
label="2. Popola Tutte le Tabelle vuote (o incomplete)" color="negative" label="2. Popola Tutte le Tabelle vuote (o incomplete)" color="negative"

View File

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