- Cataloghi: parte finale... prima bozza 9 dic

This commit is contained in:
Surya Paolo
2024-12-09 12:32:19 +01:00
parent 5c20e75b6a
commit 29c59588c7
33 changed files with 1009 additions and 397 deletions

View File

@@ -20,7 +20,7 @@ import { ICatalogo, IMyScheda, IProduct } from '@src/model'
export default defineComponent({
name: 'CContainerCatalogoCard',
emits: ['selauthor'],
emits: ['selauthor', 'update:modelValue'],
props: {
id: {
type: String,
@@ -47,24 +47,15 @@ export default defineComponent({
required: false,
default: () => { }
},
optcatalogo: {
modelValue: {
type: Object as PropType<ICatalogo>,
required: false,
default: () => ({
//++AddCATALOGO_FIELDS
productTypes: [0],
excludeproductTypes: [],
formato: [],
Categoria: [],
Editore: [],
pdf: false,
}),
required: true,
},
scheda: {
type: Object as PropType<IMyScheda>,
required: false,
default: () => ({
}),
},
},
@@ -77,6 +68,25 @@ export default defineComponent({
const opendetailbool = ref(false)
// Crea una copia locale reattiva di modelValue
const optcatalogo = ref<ICatalogo>({ ...props.modelValue });
// Watcher per sincronizzare le modifiche di modelValue
watch(() => props.modelValue, (newVal) => {
optcatalogo.value = { ...newVal };
// updateCatalogoPadre()
}, { deep: true });
function updateCatalogoPadre() {
emit('update:modelValue', optcatalogo.value);
}
// Metodo per aggiornare il valore del catalogo
const updateCatalogo = (updatedCatalogo: ICatalogo) => {
optcatalogo.value = updatedCatalogo; // Aggiorna la copia locale
updateCatalogoPadre()
};
function selauthor(id: any, autore: any) {
emit('selauthor', id, autore)
}
@@ -102,6 +112,8 @@ export default defineComponent({
selauthor,
opendetail,
opendetailbool,
optcatalogo,
updateCatalogo,
}
}
})

View File

@@ -7,7 +7,7 @@
:options="options"
@selauthor="selauthor"
@opendetail="opendetail"
:optcatalogo="optcatalogo"
v-model="optcatalogo"
:scheda="scheda"
>
</CCatalogoCard>
@@ -32,7 +32,7 @@
quante_col: 'c1',
in_3d: true,
}"
:optcatalogo="optcatalogo"
v-model="optcatalogo"
@selauthor="selauthor"
:scheda="scheda"
>