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"
: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"

View File

@@ -436,14 +436,22 @@ export default defineComponent({
if (!item.notinsearch) {
let objitem: any = {}
// console.log(' item ', item)
if (item.table === 'provinces') {
let obj: any = {}
if (item.table === 'provinces') {
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,
}
}
})

View File

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

View File

@@ -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<IMySkill | null>,
@@ -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,
}
},
})

View File

@@ -23,13 +23,34 @@
<!--<span> - {{ myskill.profile.qualifica }}</span>-->
</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 overline lines="1" style="text-align: right">
<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>
</q-item-label>
</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-separator inset="item"/>

View File

@@ -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 () => {

View File

@@ -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,

View File

@@ -1328,6 +1328,7 @@ 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)
if (myris)
risultato = myris[collab]
}

View File

@@ -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 = {

View File

@@ -215,10 +215,16 @@
</div>
<div class="row">
<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>
<br>
</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">
<q-btn
label="2. Popola Tutte le Tabelle vuote (o incomplete)" color="negative"

View File

@@ -38,24 +38,24 @@ export default defineComponent({
$q.dialog({
message: t('reg.cancellami', { 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(() => {
$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(() => {