- corretto scheda prodotto, record salvato
This commit is contained in:
@@ -65,7 +65,7 @@ export default defineComponent({
|
||||
const cmd = ref(shared_consts.SCHEDA_PRODOTTO.CMD_NONE)
|
||||
|
||||
const showQtaDisponibile = ref(false)
|
||||
const loading = ref(false)
|
||||
const loading = ref(true)
|
||||
const visufromgm = ref(false)
|
||||
const updatefromgm = ref(false)
|
||||
const field_updated_fromGM = ref('')
|
||||
@@ -77,6 +77,10 @@ export default defineComponent({
|
||||
|
||||
const optionscatalogo = ref(<any>{ maxlength: 0 })
|
||||
|
||||
function handleUpdate(newList) {
|
||||
internalProducts.value = newList
|
||||
emit('update:lista_prodotti', internalProducts.value)
|
||||
}
|
||||
|
||||
const editOn = computed({
|
||||
get(): boolean {
|
||||
@@ -90,10 +94,19 @@ export default defineComponent({
|
||||
|
||||
|
||||
async function mounted() {
|
||||
console.log('mounted CProductTable')
|
||||
loading.value = true
|
||||
|
||||
optionscatalogo.value = {
|
||||
maxlength: props.scheda?.testo_bottom?.maxlength
|
||||
}
|
||||
|
||||
const savedColumns = tools.getCookie("selColCat");
|
||||
if (savedColumns) {
|
||||
selectedColumns.value = savedColumns;
|
||||
}
|
||||
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// Aggiorna la copia locale quando il prop cambia
|
||||
@@ -102,7 +115,7 @@ export default defineComponent({
|
||||
(newVal) => {
|
||||
internalProducts.value = [...newVal];
|
||||
}
|
||||
);
|
||||
), { deep: true };
|
||||
|
||||
// Colonne della tabella
|
||||
const allColumns = [
|
||||
@@ -119,6 +132,7 @@ export default defineComponent({
|
||||
{ name: "idCollana", label: "Collana", field: "idCollana", align: "left" },
|
||||
{ name: "stato", label: "Stato", field: "stato", align: "left" },
|
||||
{ name: "tipologia", label: "Tipologia", field: "tipologia", align: "left" },
|
||||
{ name: "tipoformato", label: "Formato", field: "tipoformato", align: "left" },
|
||||
{ name: "date_pub", label: "Pubblicato", field: "date_pub", align: "left" },
|
||||
//{ name: "ranking", label: "Class.", field: "ranking", align: "right" },
|
||||
//{ name: "rank3M", label: "Class. 3M", field: "rank3M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
@@ -136,87 +150,97 @@ export default defineComponent({
|
||||
];
|
||||
|
||||
function getFieldValue(element: any, field: any): any {
|
||||
switch (field.field) {
|
||||
case 'image':
|
||||
return element.productInfo?.imagefile
|
||||
? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile)
|
||||
: element.productInfo?.image_link;
|
||||
if (!element)
|
||||
return ''
|
||||
|
||||
case 'name':
|
||||
return element.productInfo?.name;
|
||||
try {
|
||||
switch (field.field) {
|
||||
case 'image':
|
||||
return element.productInfo?.imagefile
|
||||
? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile)
|
||||
: element.productInfo?.image_link;
|
||||
|
||||
case 'authors':
|
||||
return formatAuthors(element.productInfo?.authors);
|
||||
case 'name':
|
||||
return element.productInfo?.name;
|
||||
|
||||
case 'isbn':
|
||||
return element.isbn;
|
||||
case 'authors':
|
||||
return formatAuthors(element.productInfo?.authors);
|
||||
|
||||
case 'trafiletto':
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'SI' : 'NO';
|
||||
case 'isbn':
|
||||
return element.isbn;
|
||||
|
||||
case 'catprods':
|
||||
return tools.formatCatProds(element.productInfo?.catprods);
|
||||
case 'trafiletto':
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'SI' : 'NO';
|
||||
|
||||
case 'edizione':
|
||||
return element.arrvariazioni?.[0]?.edizione;
|
||||
case 'catprods':
|
||||
return tools.formatCatProds(element.productInfo?.catprods);
|
||||
|
||||
case 'casaeditrice':
|
||||
return products.getCasaEditriceByIdPublisher(element.productInfo?.idPublisher);
|
||||
case 'edizione':
|
||||
return element.arrvariazioni?.[0]?.edizione;
|
||||
|
||||
case 'idCollana':
|
||||
return tools.formatCollane(element.productInfo?.idCollana);
|
||||
case 'casaeditrice':
|
||||
return products.getCasaEditriceByIdPublisher(element.productInfo?.idPublisher);
|
||||
|
||||
case 'stato':
|
||||
return products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo?.idStatoProdotto || '');
|
||||
case 'idCollana':
|
||||
return tools.formatCollane(element.productInfo?.idCollana);
|
||||
|
||||
case 'tipologia':
|
||||
return products.getDescrByIdTipologia(element.arrvariazioni?.[0]?.idTipologia || '');
|
||||
case 'stato':
|
||||
return products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo?.idStatoProdotto || '');
|
||||
|
||||
case 'tipoformato':
|
||||
return products.getDescrByIdTipoFormato(element.arrvariazioni?.[0]?.idTipoFormato || '');
|
||||
case 'tipologia':
|
||||
return products.getDescrByIdTipologia(element.arrvariazioni?.[0]?.idTipologia || '');
|
||||
|
||||
case 'date_pub':
|
||||
return tools.getstrDate(element.productInfo?.date_pub);
|
||||
case 'tipoformato':
|
||||
return products.getDescrByIdTipoFormato(element.arrvariazioni?.[0]?.idTipoFormato || '');
|
||||
|
||||
case 'rank3M':
|
||||
return element.productInfo?.rank3M;
|
||||
case 'date_pub':
|
||||
return tools.getstrDate(element.productInfo?.date_pub);
|
||||
|
||||
case 'rank6M':
|
||||
return element.productInfo?.rank6M;
|
||||
case 'rank3M':
|
||||
return element.productInfo?.rank3M;
|
||||
|
||||
case 'rank1Y':
|
||||
return element.productInfo?.rank1Y;
|
||||
case 'rank6M':
|
||||
return element.productInfo?.rank6M;
|
||||
|
||||
case 'pagine':
|
||||
return element.arrvariazioni?.[0]?.pagine;
|
||||
case 'rank1Y':
|
||||
return element.productInfo?.rank1Y;
|
||||
|
||||
case 'totVen':
|
||||
return element.productInfo?.totVen;
|
||||
case 'pagine':
|
||||
return element.arrvariazioni?.[0]?.pagine;
|
||||
|
||||
case 'totFat':
|
||||
return element.productInfo?.totFat;
|
||||
case 'totVen':
|
||||
return element.productInfo?.totVen;
|
||||
|
||||
case 'fatLast6M':
|
||||
return element.productInfo?.fatLast6M;
|
||||
case 'totFat':
|
||||
return element.productInfo?.totFat;
|
||||
|
||||
case 'fatLast1Y':
|
||||
return element.productInfo?.fatLast1Y;
|
||||
case 'fatLast6M':
|
||||
return element.productInfo?.fatLast6M;
|
||||
|
||||
case 'fatLast2Y':
|
||||
return element.productInfo?.fatLast2Y;
|
||||
case 'fatLast1Y':
|
||||
return element.productInfo?.fatLast1Y;
|
||||
|
||||
case 'ult_ord':
|
||||
return tools.getstrDate(element.productInfo?.dataUltimoOrdine);
|
||||
case 'fatLast2Y':
|
||||
return element.productInfo?.fatLast2Y;
|
||||
|
||||
case 'quantity':
|
||||
return element.arrvariazioni?.[0]?.quantita;
|
||||
case 'ult_ord':
|
||||
return tools.getstrDate(element.productInfo?.dataUltimoOrdine);
|
||||
|
||||
default:
|
||||
return null;
|
||||
case 'quantity':
|
||||
return element.arrvariazioni?.[0]?.quantita;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Errore getFieldValue:', e, element, field);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function getFieldClass(element: any, field: any): string {
|
||||
if (!element)
|
||||
return ''
|
||||
switch (field.field) {
|
||||
case 'trafiletto':
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length > 100
|
||||
@@ -265,6 +289,8 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function getFieldStyle(element: any, field: any): Record<string, string> {
|
||||
if (!element)
|
||||
return ''
|
||||
switch (field.field) {
|
||||
case 'image':
|
||||
return {
|
||||
@@ -357,13 +383,6 @@ export default defineComponent({
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
// Caricamento delle preferenze al mount del componente
|
||||
onMounted(() => {
|
||||
const savedColumns = tools.getCookie("selColCat");
|
||||
if (savedColumns) {
|
||||
selectedColumns.value = savedColumns;
|
||||
}
|
||||
});
|
||||
|
||||
function showProduct(element: any) {
|
||||
selProd.value = element
|
||||
@@ -524,6 +543,7 @@ export default defineComponent({
|
||||
getFieldClass,
|
||||
getFieldStyle,
|
||||
getFieldClick,
|
||||
handleUpdate,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user