corretto edit e newrecord Città
This commit is contained in:
@@ -103,7 +103,7 @@ export default defineComponent({
|
|||||||
showcount: true,
|
showcount: true,
|
||||||
useinput: false,
|
useinput: false,
|
||||||
},
|
},
|
||||||
{
|
/*{
|
||||||
label: 'Regione',
|
label: 'Regione',
|
||||||
table: 'regions',
|
table: 'regions',
|
||||||
key: 'idReg',
|
key: 'idReg',
|
||||||
@@ -112,7 +112,7 @@ export default defineComponent({
|
|||||||
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'regions', [costanti.FILTER_TUTTI]),
|
arrvalue: tools.getCookie(tools.COOK_SEARCH + 'regions', [costanti.FILTER_TUTTI]),
|
||||||
filter: null,
|
filter: null,
|
||||||
useinput: true,
|
useinput: true,
|
||||||
},
|
},*/
|
||||||
{
|
{
|
||||||
label: 'Citta',
|
label: 'Citta',
|
||||||
table: 'cities',
|
table: 'cities',
|
||||||
|
|||||||
@@ -311,16 +311,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
|
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
|
||||||
tablesel: {{tablesel}}
|
|
||||||
myvalue: {{ myvalue}}
|
|
||||||
<CMySelect
|
<CMySelect
|
||||||
:isarray="true"
|
|
||||||
:multiselect_by_server="true"
|
:multiselect_by_server="true"
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model:arrvalue="myvalue"
|
v-model:arrvalue="myvalue"
|
||||||
@update:arrvalue="changevalRec"
|
@update:arrvalue="changevalRec"
|
||||||
:addall="true"
|
:addall="false"
|
||||||
:tablesel="tablesel"
|
:tablesel="col.tablesel"
|
||||||
:pickup="true"
|
:pickup="true"
|
||||||
label-color="primary"
|
label-color="primary"
|
||||||
class="combowidth"
|
class="combowidth"
|
||||||
|
|||||||
@@ -135,8 +135,11 @@ export default defineComponent({
|
|||||||
if (!trovato) {
|
if (!trovato) {
|
||||||
const rec = valori.value.find((rec: any) => rec._id === id)
|
const rec = valori.value.find((rec: any) => rec._id === id)
|
||||||
if (rec) {
|
if (rec) {
|
||||||
console.log('SAVE OPT rec', rec)
|
// console.log('SAVE OPT rec', rec)
|
||||||
arrtempOpt.value.push({ _id: id, comune: rec.comune })
|
let obj: any = {}
|
||||||
|
obj[`${props.optval}`] = id
|
||||||
|
obj[`${props.optlab}`] = rec[`${props.optlab}`]
|
||||||
|
arrtempOpt.value.push(obj)
|
||||||
let num = localStorage.getItem(props.tablesel + 'NUM') || 0
|
let num = localStorage.getItem(props.tablesel + 'NUM') || 0
|
||||||
try {
|
try {
|
||||||
if (!num) {
|
if (!num) {
|
||||||
@@ -147,11 +150,11 @@ export default defineComponent({
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
num = 0
|
num = 0
|
||||||
}
|
}
|
||||||
console.log('----------- valori.value', valori.value)
|
// console.log('----------- valori.value', valori.value)
|
||||||
console.log('----------- arrtempOpt.value', arrtempOpt.value)
|
// console.log('----------- arrtempOpt.value', arrtempOpt.value)
|
||||||
|
|
||||||
localStorage.setItem(props.tablesel + num + 'ID', rec._id)
|
localStorage.setItem(props.tablesel + num + props.optval, id)
|
||||||
localStorage.setItem(props.tablesel + num + 'COMUNE', rec.comune)
|
localStorage.setItem(props.tablesel + num + props.optlab, rec[`${props.optlab}`])
|
||||||
|
|
||||||
num += 1
|
num += 1
|
||||||
localStorage.setItem(props.tablesel + 'NUM', num.toString())
|
localStorage.setItem(props.tablesel + 'NUM', num.toString())
|
||||||
@@ -163,13 +166,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
|
|
||||||
function changeval(newval: any) {
|
function changeval(newval: any) {
|
||||||
console.log(' ½½½½½½½ changeval', newval)
|
// console.log(' ½½½½½½½ changeval', newval)
|
||||||
if (props.multiselect_by_server) {
|
if (props.multiselect_by_server) {
|
||||||
// localStorage.setItem(props.tablesel + '_' + newval, valori.value[newval])
|
// localStorage.setItem(props.tablesel + '_' + newval, valori.value[newval])
|
||||||
myarrvalue.value = newval && newval['arrvalue'] ? newval['arrvalue'] : newval
|
myarrvalue.value = newval && newval['arrvalue'] ? newval['arrvalue'] : newval
|
||||||
saveOptInCookie(newval)
|
saveOptInCookie(newval)
|
||||||
|
|
||||||
console.log(' ----- Myselect changeval Arrvalue', myarrvalue.value)
|
// console.log(' ----- Myselect changeval Arrvalue', myarrvalue.value)
|
||||||
emit('update:arrvalue', myarrvalue.value)
|
emit('update:arrvalue', myarrvalue.value)
|
||||||
emit('changeval', myarrvalue.value)
|
emit('changeval', myarrvalue.value)
|
||||||
|
|
||||||
@@ -183,7 +186,7 @@ export default defineComponent({
|
|||||||
myvalue.value = newval && newval['code'] ? newval['code'] : newval
|
myvalue.value = newval && newval['code'] ? newval['code'] : newval
|
||||||
else
|
else
|
||||||
myvalue.value = newval
|
myvalue.value = newval
|
||||||
console.log('Myselect changeval', myvalue.value)
|
// console.log('Myselect changeval', myvalue.value)
|
||||||
emit('update:value', myvalue.value)
|
emit('update:value', myvalue.value)
|
||||||
emit('changeval', myvalue.value)
|
emit('changeval', myvalue.value)
|
||||||
}
|
}
|
||||||
@@ -201,10 +204,13 @@ export default defineComponent({
|
|||||||
const num = parseInt(localStorage.getItem(props.tablesel + 'NUM')!)
|
const num = parseInt(localStorage.getItem(props.tablesel + 'NUM')!)
|
||||||
console.log('num LOADED ', num)
|
console.log('num LOADED ', num)
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
const itemId = parseInt(localStorage.getItem(props.tablesel + i + 'ID')!)
|
const itemId = parseInt(localStorage.getItem(props.tablesel + i + props.optval)!)
|
||||||
const itemcomune = localStorage.getItem(props.tablesel + i + 'COMUNE')
|
const itemlab = localStorage.getItem(props.tablesel + i + props.optlab)
|
||||||
if (itemId) {
|
if (itemId) {
|
||||||
arrtempOpt.value.push({ _id: itemId, comune: itemcomune })
|
let obj: any = {}
|
||||||
|
obj[`${props.optval}`] = itemId
|
||||||
|
obj[`${props.optlab}`] = itemlab
|
||||||
|
arrtempOpt.value.push(obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,7 +291,7 @@ export default defineComponent({
|
|||||||
myarr = [myobj, ...myarr]
|
myarr = [myobj, ...myarr]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myarr.length > 0) {
|
if (myarr && myarr.length > 0) {
|
||||||
valori.value = myarr
|
valori.value = myarr
|
||||||
if (props.multiselect_by_server) {
|
if (props.multiselect_by_server) {
|
||||||
console.log('@@@ VALORI CHANGED (3)', valori.value)
|
console.log('@@@ VALORI CHANGED (3)', valori.value)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
input-debounce="300"
|
input-debounce="300"
|
||||||
rounded
|
rounded
|
||||||
outlined
|
outlined
|
||||||
fill-input
|
|
||||||
multiple
|
multiple
|
||||||
options-dense
|
options-dense
|
||||||
map-options
|
map-options
|
||||||
@@ -32,17 +31,7 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
|
|
||||||
<q-item v-bind="itemProps">
|
|
||||||
|
|
||||||
<q-item-section>
|
|
||||||
<q-item-label>{{ opt[fieldsTable.getLabelByTable(tablesel)] }}</q-item-label>
|
|
||||||
</q-item-section>
|
|
||||||
<q-item-section side>
|
|
||||||
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)"/>
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</template>
|
|
||||||
<template v-slot:selected-item="scope">
|
<template v-slot:selected-item="scope">
|
||||||
<div v-if="scope.opt[fieldsTable.getLabelByTable(tablesel)]">
|
<div v-if="scope.opt[fieldsTable.getLabelByTable(tablesel)]">
|
||||||
<q-chip
|
<q-chip
|
||||||
@@ -60,6 +49,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
|
||||||
|
<q-item v-bind="itemProps">
|
||||||
|
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>{{ opt[fieldsTable.getLabelByTable(tablesel)] }}</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)"/>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
</q-select>
|
</q-select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -72,10 +73,11 @@
|
|||||||
:input-class="myclass"
|
:input-class="myclass"
|
||||||
:model-value="myvalue"
|
:model-value="myvalue"
|
||||||
:use-input="useinput"
|
:use-input="useinput"
|
||||||
@filter="filterFn"
|
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
@new-value="newvaluefunc"
|
@new-value="newvaluefunc"
|
||||||
new-value-mode="add-unique"
|
new-value-mode="add-unique"
|
||||||
|
map-options
|
||||||
|
emit-value
|
||||||
:options="valori"
|
:options="valori"
|
||||||
:option-value="optval"
|
:option-value="optval"
|
||||||
:option-label="optlab"
|
:option-label="optlab"
|
||||||
@@ -153,6 +155,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
</q-select>
|
</q-select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user