- Cataloghi: qualita di stampa e margini
This commit is contained in:
@@ -15,6 +15,13 @@ import {
|
||||
Privacy,
|
||||
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim, ILang, IGroupShort, IPagination, IFavorite, IBookmark,
|
||||
IMovQuery,
|
||||
IDimensioni,
|
||||
ISize,
|
||||
IBorder,
|
||||
IImg,
|
||||
IText,
|
||||
IAreaDiStampa,
|
||||
ICatalogo,
|
||||
} from '@model'
|
||||
|
||||
import MixinBase from '@/mixins/mixin-base'
|
||||
@@ -48,6 +55,7 @@ import { Router } from 'vue-router'
|
||||
import { AxiosResponse, default as Axios } from 'axios'
|
||||
import { PayloadMessageTypes } from '@/common'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
import { isDimensionToken } from 'html2canvas/dist/types/css/syntax/parser'
|
||||
|
||||
export interface INotify {
|
||||
color?: string
|
||||
@@ -343,6 +351,34 @@ export const tools = {
|
||||
},
|
||||
],
|
||||
|
||||
SelectListFormatPDF: [
|
||||
{ label: 'a4 (mm)', value: [210, 297] },
|
||||
{ label: '22,60 x 31,26 (in mm)', value: [226.0, 312.6] },
|
||||
],
|
||||
|
||||
SelectListScalePDF: [
|
||||
{ label: 'Normale (100 DPI)', value: 1 },
|
||||
{ label: 'Medio (200 PDI)', value: 2 },
|
||||
{ label: 'Alto (300 PDI)', value: 3 },
|
||||
],
|
||||
SelectListQualityPDF: [
|
||||
{ label: 'Bassa (1 scale)', value: 1 },
|
||||
{ label: 'Normale (2 scale)', value: 2 },
|
||||
{ label: 'Media (3 scale)', value: 3 },
|
||||
{ label: 'Elevata (4 scale)', value: 4 },
|
||||
],
|
||||
|
||||
SelectListOrientamentoPDF: [
|
||||
{ label: 'Verticale', value: 'portrait' },
|
||||
{ label: 'orizzontale', value: 'landscape' }
|
||||
],
|
||||
|
||||
SelectListUnitPDF: [
|
||||
{ label: 'Millimetri (mm)', value: 'mm' },
|
||||
{ label: 'Centimetri (cm)', value: 'cm' },
|
||||
{ label: 'Pollici (in)', value: 'in' },
|
||||
{ label: 'Pixel (px)', value: 'px' },
|
||||
],
|
||||
|
||||
SelectListColors: [
|
||||
{ label: '[Nessuno]', value: '' },
|
||||
@@ -7949,6 +7985,8 @@ export const tools = {
|
||||
ris = 'pages/' + path
|
||||
} else if (table === 'productInfos') {
|
||||
ris = path
|
||||
} else if (table === 'imgs') {
|
||||
ris = path
|
||||
} else {
|
||||
ris = table
|
||||
}
|
||||
@@ -9145,6 +9183,131 @@ export const tools = {
|
||||
return encodeURIComponent(str); // Codifica la stringa per URL
|
||||
},
|
||||
|
||||
resetISize(rec: ISize | null) {
|
||||
if (!rec) {
|
||||
rec = {
|
||||
width: '',
|
||||
height: ''
|
||||
}
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetIBorder(rec: IBorder | null) {
|
||||
if (!rec) {
|
||||
rec = {}
|
||||
rec.top = ''
|
||||
rec.bottom = ''
|
||||
rec.left = ''
|
||||
rec.right = ''
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetIImg(rec: IImg | null) {
|
||||
if (!rec) {
|
||||
rec = {}
|
||||
|
||||
rec.imagefile = ''
|
||||
rec.fit = ''
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetIText(rec: IText | null) {
|
||||
if (!rec) {
|
||||
rec = {}
|
||||
|
||||
rec.contenuto = ''
|
||||
rec.maxlength = 0
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetRecIDimensioni(rec: IDimensioni | null) {
|
||||
|
||||
let myrec: IDimensioni = {}
|
||||
|
||||
if (!rec) {
|
||||
myrec = {
|
||||
size: {},
|
||||
margini: {},
|
||||
padding: {},
|
||||
imgsfondo: {},
|
||||
text_html: {},
|
||||
}
|
||||
} else {
|
||||
myrec = rec
|
||||
}
|
||||
|
||||
myrec.size = this.resetISize(myrec.size!)
|
||||
myrec.margini = this.resetIBorder(myrec.margini!)
|
||||
myrec.padding = this.resetIBorder(myrec.padding!)
|
||||
myrec.imgsfondo = this.resetIImg(myrec.imgsfondo!)
|
||||
myrec.text_html = this.resetIText(myrec.text_html!)
|
||||
|
||||
return myrec
|
||||
},
|
||||
|
||||
resetRecIAreaDiStampa(rec: IAreaDiStampa | null) {
|
||||
|
||||
let myrec: IAreaDiStampa = {}
|
||||
|
||||
if (!rec) {
|
||||
myrec = {
|
||||
margini: {},
|
||||
unit: 'mm',
|
||||
compress: false,
|
||||
orientation: 'portrait',
|
||||
format: [210, 297],
|
||||
scale: 1,
|
||||
scalecanvas: 2,
|
||||
}
|
||||
} else {
|
||||
myrec = rec
|
||||
}
|
||||
|
||||
myrec.margini = this.resetIBorder(myrec.margini!)
|
||||
|
||||
return myrec
|
||||
},
|
||||
|
||||
adjustSize(optcatalogo: ICatalogo, mysize: any) {
|
||||
if (!mysize) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Estrae l'unità di misura
|
||||
const unit = mysize.replace(/[\d.]/g, ''); // Ottiene il suffisso (es. 'px')
|
||||
const numericalValue = parseFloat(mysize) || 0; // Converti la parte numerica in float
|
||||
|
||||
let size = numericalValue; // Inizializza size con il valore numerico
|
||||
|
||||
if (optcatalogo.printable && optcatalogo.areadistampa?.scale && optcatalogo.areadistampa?.scale > 0) {
|
||||
size = size * optcatalogo.areadistampa?.scale; // Applicare la scala se necessaria
|
||||
}
|
||||
|
||||
let strfinale = `${size}${unit}`
|
||||
// console.log('mysize', mysize, ' => ', strfinale)
|
||||
return strfinale; // Restituisce il valore con il suffisso
|
||||
},
|
||||
|
||||
getValueAndSuffix(myvalue: any): {value: number, suffix: string} {
|
||||
if (!myvalue) {
|
||||
return {value: 0, suffix: ''};
|
||||
}
|
||||
|
||||
// Estrae l'unità di misura
|
||||
const unit = myvalue.replace(/[\d.]/g, ''); // Ottiene il suffisso (es. 'px')
|
||||
const numericalValue = parseFloat(myvalue) || 0; // Converti la parte numerica in float
|
||||
|
||||
return { value: numericalValue, suffix: unit}; // Restituisce il valore con il suffisso
|
||||
},
|
||||
|
||||
|
||||
// FINE !
|
||||
|
||||
|
||||
Reference in New Issue
Block a user