Campo Citta di Nascita (nel profilo nuova maniera), manca ancora da sistemare l'edit

Se seleziono la Provincia , mi deve comparire la lista dei comuni
This commit is contained in:
paoloar77
2022-02-21 13:12:04 +01:00
parent 1aea88a1fa
commit bec191ccd8
22 changed files with 840 additions and 702 deletions

View File

@@ -1,4 +1,4 @@
import { defineComponent, onMounted, onBeforeMount, PropType, ref, toRef, watch } from 'vue'
import { defineComponent, onMounted, onBeforeMount, PropType, ref, toRef, watch, computed } from 'vue'
import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
@@ -38,6 +38,11 @@ export default defineComponent({
type: Object,
required: true,
},
rec: {
type: Object,
required: false,
default: null,
},
isrec: {
type: Boolean,
required: false,
@@ -186,15 +191,20 @@ export default defineComponent({
const col = ref(<IColGridTable> { name: 'test', fieldtype: 0, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView, visible: true, maxlength: props.mycol ? props.mycol.maxlength : 0 })
const myrow = toRef(props, 'row')
const { setValDb, getValDb } = MixinBase()
const { getMyUsername } = MixinUsers()
const myrealrow = toRef(props, 'row')
watch(() => props.row, (newval, oldval) => {
refresh()
})
const myrow = computed(() => {
return props.rec && props.isrec ? props.rec : props.row
})
function crea() {
// console.log('crea', isFieldDb())
@@ -321,12 +331,13 @@ export default defineComponent({
function mounted() {
try {
// console.log('mounted', 'isFieldDb()', isFieldDb())
if (isFieldDb() && !props.isrec) {
} else {
if (props.subfield !== '') {
if (props.row[props.field] === undefined) {
if (myrow.value[props.field] === undefined) {
myrow.value[props.field] = {}
myvalue.value = ''
} else {
@@ -408,8 +419,13 @@ export default defineComponent({
} else {
if (props.field !== '')
myrow.value[props.field] = newVal
else
myrow.value = newVal
else {
if (!props.isrec) {
// @ts-ignore
myrealrow.value = newVal
}
}
}
emit('save', newVal, valinitial)

View File

@@ -1,5 +1,6 @@
<template>
<div :class="getclassCol(col)">
<div
v-if="tools.checkIfShowField(col, insertMode ? tools.TIPOVIS_NEW_RECORD : (isInModif ? tools.TIPOVIS_EDIT_RECORD : tools.TIPOVIS_SHOW_RECORD), visulabel, myvalue)"
style="flex-grow: 1;">
@@ -305,6 +306,7 @@
</div>
<div v-else>
<CMyChipList
:rec="row"
:type="costanti.FieldType.binary"
:value="myvalue"
@update:value="changevalRec"
@@ -374,6 +376,7 @@
</div>
<div v-else>
<CMyChipList
:rec="row"
:type="col.fieldtype"
:type_out="col.field_outtype"
@update:value="changevalRec"
@@ -394,7 +397,7 @@
:label="col.label"
v-model:value="myvalue"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:tablesel="col.type === costanti.FieldType.select_by_server ? tablesel : ''"
:tablesel="col.fieldtype === costanti.FieldType.select_by_server ? tablesel : ''"
@update:value="changevalRec"
:newvaluefunc="addNewValue"
:filter_table="col.filter_table"
@@ -407,12 +410,23 @@
</CMySelect>
</div>
<div v-else>
<!--
rec: {{rec}}
row: {{row}}
col.jointable {{col.jointable}}
myvalue {{myvalue}}
opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)}}
val: {{fieldsTable.getKeyByTable(col.jointable)}}
lab: {{fieldsTable.getLabelByTable(col.jointable)}}-->
<CMyChipList
:rec="row"
myclass="text-center"
:type="col.fieldtype"
:type_out="col.field_outtype"
@update:value="changevalRec"
v-model:value="myvalue"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.filter)"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
@@ -420,6 +434,7 @@
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect_by_server">
<CMySelect
:type_out="col.field_outtype"
:col="col"
@@ -648,7 +663,7 @@
:label="col.label"
v-model:value="scope.value"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:tablesel="col.type === costanti.FieldType.select_by_server ? tablesel : ''"
:tablesel="col.fieldtype === costanti.FieldType.select_by_server ? tablesel : ''"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"