- Generazione PDF e per Stampa
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 148 KiB |
@@ -38,7 +38,7 @@ const firstPage = {
|
|||||||
path: '/',
|
path: '/',
|
||||||
materialIcon: 'home',
|
materialIcon: 'home',
|
||||||
name: 'pages.home',
|
name: 'pages.home',
|
||||||
component: () => import('@src/root/mainview/mainview/home.vue'),
|
component: () => import('@src/root/mainview/mainview.vue'),
|
||||||
reqauth: false,
|
reqauth: false,
|
||||||
inmenu: true,
|
inmenu: true,
|
||||||
infooter: true,
|
infooter: true,
|
||||||
|
|||||||
@@ -767,6 +767,11 @@ export default defineComponent({
|
|||||||
globalStore.myselector.data = { _id: 0, comune: '' }
|
globalStore.myselector.data = { _id: 0, comune: '' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const rec = searchList.value.find((rec) => rec.table === table && rec.bool)
|
||||||
|
if (rec) {
|
||||||
|
tools.setCookieBool(tools.COOK_SEARCH + costanti.FILTER_SEP + table + costanti.FILTER_SEP + rec.key, rec.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2839,7 +2844,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getisDettagliByCatalog() {
|
function getisDettagliByCatalog() {
|
||||||
const rec = searchList.value.find((myrec) => myrec.table === shared_consts.TABLES_CATALOG && myrec.key === 'dettagli')
|
const rec = searchList.value.find((myrec) => myrec.table === ('finto_' + myrec.key) && myrec.key === 'dettagli')
|
||||||
if (rec) {
|
if (rec) {
|
||||||
return rec.value
|
return rec.value
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,7 +253,7 @@
|
|||||||
v-else-if="item.type === costanti.FieldType.boolean"
|
v-else-if="item.type === costanti.FieldType.boolean"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
v-model="item.value"
|
v-model="item.value"
|
||||||
@update:model-value="refresh"
|
@update:model-value="searchval(item.value, item.table)"
|
||||||
color="green"
|
color="green"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -923,7 +923,7 @@
|
|||||||
v-else-if="item.type === costanti.FieldType.boolean"
|
v-else-if="item.type === costanti.FieldType.boolean"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
v-model="item.value"
|
v-model="item.value"
|
||||||
@update:model-value="refresh"
|
@update:model-value="searchval(item.value, item.table)"
|
||||||
color="green"
|
color="green"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const firstPage = {
|
|||||||
path: '/',
|
path: '/',
|
||||||
materialIcon: 'home',
|
materialIcon: 'home',
|
||||||
name: 'pages.home',
|
name: 'pages.home',
|
||||||
component: () => import('@src/root/mainview/mainview/home.vue'),
|
component: () => import('@src/root/mainview/mainview.vue'),
|
||||||
reqauth: false,
|
reqauth: false,
|
||||||
inmenu: true,
|
inmenu: true,
|
||||||
infooter: true,
|
infooter: true,
|
||||||
|
|||||||
@@ -4482,6 +4482,14 @@ export const tools = {
|
|||||||
return def
|
return def
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getCookieBool(mytok: any, def?: any) {
|
||||||
|
const ris = Cookies.get(mytok)
|
||||||
|
if (ris === 'null')
|
||||||
|
return def
|
||||||
|
|
||||||
|
return ris === '1' ? true : false
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
localStSetItem(item: string, value: string) {
|
localStSetItem(item: string, value: string) {
|
||||||
if (localStorage.getItem('cookie-id') === 'decline')
|
if (localStorage.getItem('cookie-id') === 'decline')
|
||||||
@@ -4502,6 +4510,13 @@ export const tools = {
|
|||||||
return Cookies.set(mytok, value)
|
return Cookies.set(mytok, value)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setCookieBool(mytok: any, valbool: boolean) {
|
||||||
|
if (localStorage.getItem('cookie-id') === 'decline')
|
||||||
|
return null
|
||||||
|
|
||||||
|
return Cookies.set(mytok, valbool ? '1' : '0')
|
||||||
|
},
|
||||||
|
|
||||||
removeCookie(mytok: any) {
|
removeCookie(mytok: any) {
|
||||||
return Cookies.remove(mytok)
|
return Cookies.remove(mytok)
|
||||||
},
|
},
|
||||||
@@ -9846,11 +9861,13 @@ export const tools = {
|
|||||||
icon: 'fas fa-user'
|
icon: 'fas fa-user'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
table: 'finto_active',
|
||||||
visible: !this.isUtente(),
|
visible: !this.isUtente(),
|
||||||
label: 'Pubblicati OnLine',
|
label: 'Pubblicati OnLine',
|
||||||
key: 'active',
|
key: 'active',
|
||||||
type: costanti.FieldType.boolean,
|
type: costanti.FieldType.boolean,
|
||||||
value: this.isUtente() ? true: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'active', true),
|
value: this.isUtente() ? true: this.getCookieBool(this.COOK_SEARCH + costanti.FILTER_SEP + 'finto_active' + costanti.FILTER_SEP + 'active', true),
|
||||||
|
bool: true,
|
||||||
keycookie: '',
|
keycookie: '',
|
||||||
addall: true,
|
addall: true,
|
||||||
arrvalue: [],
|
arrvalue: [],
|
||||||
@@ -9859,11 +9876,13 @@ export const tools = {
|
|||||||
icon: 'fas fa-globe'
|
icon: 'fas fa-globe'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
table: 'finto_isCatalogoGenerale',
|
||||||
visible: !this.isUtente(),
|
visible: !this.isUtente(),
|
||||||
label: 'Solo Catalogo Generale',
|
label: 'Solo Catalogo Generale',
|
||||||
key: 'isCatalogoGenerale',
|
key: 'isCatalogoGenerale',
|
||||||
type: costanti.FieldType.boolean,
|
type: costanti.FieldType.boolean,
|
||||||
value: this.isUtente() ? isCatalogoGenerale: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'isCatalogoGenerale', isCatalogoGenerale),
|
value: this.isUtente() ? isCatalogoGenerale: this.getCookieBool(this.COOK_SEARCH + costanti.FILTER_SEP + 'finto_isCatalogoGenerale' + costanti.FILTER_SEP + 'isCatalogoGenerale', isCatalogoGenerale),
|
||||||
|
bool: true,
|
||||||
keycookie: '',
|
keycookie: '',
|
||||||
addall: true,
|
addall: true,
|
||||||
arrvalue: [],
|
arrvalue: [],
|
||||||
@@ -9874,11 +9893,12 @@ export const tools = {
|
|||||||
{
|
{
|
||||||
visible: !this.isUtente(),
|
visible: !this.isUtente(),
|
||||||
label: 'Dettagli',
|
label: 'Dettagli',
|
||||||
table: shared_consts.TABLES_CATALOG,
|
table: 'finto_dettagli',
|
||||||
key: 'dettagli',
|
key: 'dettagli',
|
||||||
|
bool: true,
|
||||||
notinsearch: true, // non usarlo nella ricerca filtro
|
notinsearch: true, // non usarlo nella ricerca filtro
|
||||||
type: costanti.FieldType.boolean,
|
type: costanti.FieldType.boolean,
|
||||||
value: this.isUtente() ? false: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'dettagli', true),
|
value: this.isUtente() ? false: this.getCookieBool(this.COOK_SEARCH + costanti.FILTER_SEP + 'finto_dettagli' + costanti.FILTER_SEP + 'dettagli', true),
|
||||||
keycookie: '',
|
keycookie: '',
|
||||||
addall: true,
|
addall: true,
|
||||||
arrvalue: [],
|
arrvalue: [],
|
||||||
|
|||||||
@@ -2538,6 +2538,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
file_out: string = '',
|
file_out: string = '',
|
||||||
print: boolean = false,
|
print: boolean = false,
|
||||||
optcatalogo: IOptCatalogo | null = null,
|
optcatalogo: IOptCatalogo | null = null,
|
||||||
|
salvasufiledascaricare
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
if (!pdfFile) {
|
if (!pdfFile) {
|
||||||
@@ -2567,6 +2568,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
const response = await this.execConvertPDF(formData);
|
const response = await this.execConvertPDF(formData);
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
|
if (salvasufiledascaricare) {
|
||||||
const blob = new Blob([response], { type: 'application/pdf' });
|
const blob = new Blob([response], { type: 'application/pdf' });
|
||||||
const downloadUrl = window.URL.createObjectURL(blob);
|
const downloadUrl = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
@@ -2577,6 +2579,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
link.remove();
|
link.remove();
|
||||||
|
|
||||||
window.URL.revokeObjectURL(downloadUrl);
|
window.URL.revokeObjectURL(downloadUrl);
|
||||||
|
} else {
|
||||||
|
return response
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error('No data returned from the server.');
|
console.error('No data returned from the server.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1747,6 +1747,7 @@ export default defineComponent({
|
|||||||
const pages = document.querySelectorAll(pagesSelector);
|
const pages = document.querySelectorAll(pagesSelector);
|
||||||
const pdfs = [];
|
const pdfs = [];
|
||||||
|
|
||||||
|
try {
|
||||||
for (let i = 0; i < pages.length; i++) {
|
for (let i = 0; i < pages.length; i++) {
|
||||||
const page = pages[i];
|
const page = pages[i];
|
||||||
|
|
||||||
@@ -1793,7 +1794,7 @@ export default defineComponent({
|
|||||||
const pdfFile = new File([blob], 'report.pdf', { type: 'application/pdf' });
|
const pdfFile = new File([blob], 'report.pdf', { type: 'application/pdf' });
|
||||||
|
|
||||||
// Converti il file appena generato
|
// Converti il file appena generato
|
||||||
await globalStore.convertPdf(
|
const ris = await globalStore.convertPdf(
|
||||||
pdfFile,
|
pdfFile,
|
||||||
widthpdf.value,
|
widthpdf.value,
|
||||||
heightpdf.value,
|
heightpdf.value,
|
||||||
@@ -1802,11 +1803,29 @@ export default defineComponent({
|
|||||||
file_out,
|
file_out,
|
||||||
true,
|
true,
|
||||||
optcatalogo.value,
|
optcatalogo.value,
|
||||||
|
salvasufiledascaricare
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (ris) {
|
||||||
|
const catalog = getCatalogoByMyPage.value;
|
||||||
|
if (ris.pdf_generato) {
|
||||||
|
catalog.pdf_generato = ris.pdf_generato;
|
||||||
|
catalog.data_generato = tools.getDateNow();
|
||||||
|
}
|
||||||
|
if (ris.pdf_generato_stampa) {
|
||||||
|
catalog.pdf_generato_stampa = ris.pdf_generato_stampa;
|
||||||
|
catalog.data_generato_stampa = tools.getDateNow();
|
||||||
|
}
|
||||||
|
|
||||||
|
await saveCatalog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ripristina visibilità
|
// Ripristina visibilità
|
||||||
pages.forEach((p) => p.classList.remove('hidden'));
|
pages.forEach((p) => p.classList.remove('hidden'));
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err', e.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const generatePDF = async () => {
|
const generatePDF = async () => {
|
||||||
@@ -1860,12 +1879,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const element = document.getElementById('pdf-content');
|
const element = document.getElementById('pdf-content');
|
||||||
const opt = {
|
const opt = {
|
||||||
margin: [
|
margin: [defaultMargin, defaultMargin, defaultMargin, defaultMargin],
|
||||||
defaultMargin,
|
|
||||||
defaultMargin,
|
|
||||||
defaultMargin,
|
|
||||||
defaultMargin,
|
|
||||||
],
|
|
||||||
filename: myfile,
|
filename: myfile,
|
||||||
image: {
|
image: {
|
||||||
type: 'jpeg',
|
type: 'jpeg',
|
||||||
@@ -1890,7 +1904,7 @@ export default defineComponent({
|
|||||||
// a4: [595.28, 841.89]
|
// a4: [595.28, 841.89]
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
await generateLargePDF(opt, '.pdf-section', false, 'upload/', file_out);
|
await generateLargePDF(opt, '.pdf-section', false, 'upload/cataloghi/', file_out);
|
||||||
} else {
|
} else {
|
||||||
await html2pdf().set(opt).from(element).save();
|
await html2pdf().set(opt).from(element).save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,6 +432,25 @@
|
|||||||
:color="optcatalogo.indebug ? `positive` : 'primary'"
|
:color="optcatalogo.indebug ? `positive` : 'primary'"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="getCatalogoByMyPage.pdf_generato" class="column justify-center q-ma-sm q-pa-sm">
|
||||||
|
<div >
|
||||||
|
PDF:
|
||||||
|
<a :href="tools.getHost() + getCatalogoByMyPage.pdf_generato" target="_blank" v-if="getCatalogoByMyPage.pdf_generato" class="text-bold">
|
||||||
|
{{tools.getHost() + getCatalogoByMyPage.pdf_generato}}
|
||||||
|
</a>
|
||||||
|
<span v-else>-</span>
|
||||||
|
<br>(Generato il {{ tools.getstrDateTime(getCatalogoByMyPage.data_generato)}})
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div>
|
||||||
|
PDF Stampa:
|
||||||
|
<a :href="tools.getHost() + getCatalogoByMyPage.pdf_generato_stampa" target="_blank" v-if="getCatalogoByMyPage.pdf_generato_stampa" class="text-bold">
|
||||||
|
{{tools.getHost() + getCatalogoByMyPage.pdf_generato_stampa}}
|
||||||
|
</a>
|
||||||
|
<span v-else>-</span>
|
||||||
|
<br>(Generato il {{ tools.getstrDateTime(getCatalogoByMyPage.data_generato_stampa) }})
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
<q-tab-panel name="ricerca">
|
<q-tab-panel name="ricerca">
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user