- aggiornamento cataloghi.
possibilità di estrapolare i dati da GM direttamente - migrazione delle tabelle di GM in locale - corretto l'ordinamento del Catalogo
This commit is contained in:
@@ -84,6 +84,7 @@ const msg_website_it = {
|
||||
eventodef: 'Evento:',
|
||||
prova: 'prova',
|
||||
dbop: 'Operazioni',
|
||||
dbopmacro: 'Operazioni Macro',
|
||||
projall: 'Comunitari',
|
||||
groups: 'Lista Gruppi',
|
||||
projectsShared: 'Condivisi da me',
|
||||
|
||||
@@ -648,7 +648,7 @@ export default defineComponent({
|
||||
loading.value = true
|
||||
updatefromgm.value = true
|
||||
field_updated_fromGM.value = ''
|
||||
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!)
|
||||
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!, myproduct.value.isbn)
|
||||
if (ris) {
|
||||
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
|
||||
|
||||
@@ -659,12 +659,28 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
}
|
||||
async function refreshAllDataBookFromGM() {
|
||||
async function refreshAllDataBookFromGM(options: any) {
|
||||
if (myproduct.value) {
|
||||
loading.value = true
|
||||
updatefromgm.value = true
|
||||
field_updated_fromGM.value = ''
|
||||
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!)
|
||||
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options, caricatutti: true })
|
||||
if (ris) {
|
||||
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
|
||||
|
||||
await updateproduct(false)
|
||||
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
}
|
||||
async function refreshSingleBookFromGM(options: any) {
|
||||
if (myproduct.value) {
|
||||
loading.value = true
|
||||
updatefromgm.value = true
|
||||
field_updated_fromGM.value = ''
|
||||
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options })
|
||||
if (ris) {
|
||||
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
|
||||
|
||||
@@ -760,6 +776,7 @@ export default defineComponent({
|
||||
updatetogm,
|
||||
refreshDataFromGM,
|
||||
refreshAllDataBookFromGM,
|
||||
refreshSingleBookFromGM,
|
||||
loading,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="refreshAllDataBookFromGM()"
|
||||
@click="refreshSingleBookFromGM({usaDBGMLocale: false})"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
@@ -173,9 +173,67 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Riaggiorna Tutto il Libro da GM</q-item-label>
|
||||
<q-item-label>Riaggiorna il Libro da GM</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="
|
||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="refreshSingleBookFromGM({usaDBGMLocale: true})"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-pencil-alt"
|
||||
color="accent"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Riaggiorna il Libro da DBLocale</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<!--<q-item
|
||||
v-if="
|
||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="refreshAllDataBookFromGM({usaDBGMLocale: false})"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-pencil-alt"
|
||||
color="accent"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Riaggiorna TUTTI da GM</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="
|
||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="refreshAllDataBookFromGM({usaDBGMLocale: true})"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-pencil-alt"
|
||||
color="accent"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Riaggiorna TUTTI da GM (da DB Locale)</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
-->
|
||||
<q-item
|
||||
v-if="
|
||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
@@ -618,7 +676,7 @@
|
||||
nameTable: 'T_Web_Articoli',
|
||||
campispeciali: true,
|
||||
numrec: 1,
|
||||
where: 'T.IdArticolo =' + myproduct.productInfo.sku,
|
||||
where: 'T.IdArticolo =' + myproduct.productInfo.sku + ' AND T.Ean13 = ' + myproduct.productInfo.code,
|
||||
showQtaDisponibile,
|
||||
outhtml: true,
|
||||
}"
|
||||
|
||||
@@ -102,6 +102,7 @@ export default defineComponent({
|
||||
|
||||
// Colonne della tabella
|
||||
const allColumns = [
|
||||
{ name: "pos", label: "Pos", field: "pos", align: "left", style: "width: 50px" },
|
||||
{ name: "drag", label: "Ordinam.", field: "", align: "left", style: "width: 50px" },
|
||||
{ name: "image", label: "Foto", field: "image", align: "center" },
|
||||
{ name: "name", label: "Titolo del Libro", field: "name", align: "left" },
|
||||
@@ -109,6 +110,7 @@ export default defineComponent({
|
||||
{ name: "trafiletto", label: "Trafiletto", field: "trafiletto", align: "left" },
|
||||
{ name: "catprods", label: "Argomento", field: "catprods", align: "left" },
|
||||
{ name: "idCollana", label: "Collana", field: "idCollana", align: "left" },
|
||||
{ name: "stato", label: "Stato", field: "stato", 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" },
|
||||
@@ -134,7 +136,7 @@ export default defineComponent({
|
||||
cookieValue = []; // In caso di errore, inizializza come array vuoto
|
||||
}
|
||||
|
||||
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["drag", "image", "name", "authors", "catprods", "isbn", "actions"]);
|
||||
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["pos", "drag", "image", "name", "authors", "catprods", "isbn", "actions"]);
|
||||
|
||||
|
||||
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
|
||||
|
||||
@@ -40,8 +40,22 @@
|
||||
@end="onDragEnd"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<tr :key="element._id">
|
||||
<tr
|
||||
:key="element._id"
|
||||
:class="{
|
||||
'bg-yellow': products.isPubblicato(element.productInfo) && products.isQtaLimitata(element),
|
||||
'bg-orange': products.isPubblicato(element.productInfo) && products.isInEsaurendo(element),
|
||||
'text-white bg-red-10': products.isPubblicato(element.productInfo) && products.isEsaurito(element),
|
||||
'bg-grey': !products.isPubblicato(element.productInfo),
|
||||
}"
|
||||
>
|
||||
<!-- Icona Drag Handle -->
|
||||
<td v-if="isColumnVisible('pos')">
|
||||
{{
|
||||
// put index in the first column
|
||||
internalProducts.indexOf(element) + 1
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
v-if="isColumnVisible('drag')"
|
||||
class="drag-handle"
|
||||
@@ -85,6 +99,9 @@
|
||||
<td v-if="isColumnVisible('catprods')">{{ tools.formatCatProds(element.productInfo?.catprods) }}</td>
|
||||
<!-- Collana -->
|
||||
<td v-if="isColumnVisible('idCollana')">{{ tools.formatCollane(element.productInfo?.idCollana) }}</td>
|
||||
<td v-if="isColumnVisible('stato')">
|
||||
{{ products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo.idStatoProdotto || '') }}
|
||||
</td>
|
||||
|
||||
<td v-if="isColumnVisible('date_pub')">{{ tools.getstrDate(element.productInfo?.date_pub) }}</td>
|
||||
|
||||
@@ -240,7 +257,10 @@
|
||||
nameTable: 'T_Web_Articoli',
|
||||
campispeciali: true,
|
||||
numrec: 1,
|
||||
where: 'T.IdArticolo =' + selProd.productInfo.sku + ' AND T.DataPubblicazione IS NOT NULL ORDER BY T.DataOra DESC;',
|
||||
where:
|
||||
'T.IdArticolo =' +
|
||||
selProd.productInfo.sku +
|
||||
' AND T.DataPubblicazione IS NOT NULL ORDER BY T.DataOra DESC;',
|
||||
showQtaDisponibile,
|
||||
outhtml: true,
|
||||
}"
|
||||
|
||||
@@ -419,7 +419,7 @@ export default defineComponent({
|
||||
async function refreshDataFromGM() {
|
||||
if (myproduct.value) {
|
||||
loading.value = true
|
||||
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!)
|
||||
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!, myproduct.value.isbn)
|
||||
if (ris) {
|
||||
|
||||
await updateproduct(false)
|
||||
|
||||
@@ -75,6 +75,7 @@ const msg_website_it = {
|
||||
eventodef: 'Evento:',
|
||||
prova: 'prova',
|
||||
dbop: 'Operazioni',
|
||||
dbopmacro: 'Operazioni Macro',
|
||||
projall: 'Comunitari',
|
||||
groups: 'Lista Gruppi',
|
||||
projectsShared: 'Condivisi da me',
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface IProductInfo {
|
||||
idSubCatProds?: string[]
|
||||
catprods?: ICatProd[]
|
||||
subcatprods?: ISubCatProd[]
|
||||
idStatoProdotto?: number
|
||||
color?: string
|
||||
size?: string
|
||||
weight?: number
|
||||
@@ -99,7 +100,6 @@ export interface IAuthor {
|
||||
|
||||
export interface IProdView {
|
||||
id: string
|
||||
showed: boolean
|
||||
}
|
||||
|
||||
export interface IProduct {
|
||||
@@ -179,6 +179,7 @@ export interface IProductsState {
|
||||
products: IProduct[]
|
||||
authors: IAuthor[]
|
||||
publishers: IPublisher[]
|
||||
stati_prodotto?: T_Web_StatiProdotto[]
|
||||
cart: ICart
|
||||
orders: IOrderCart[]
|
||||
catprods: ICatProd[]
|
||||
@@ -270,6 +271,12 @@ export interface ISubCatProd {
|
||||
icon?: string
|
||||
color?: string
|
||||
}
|
||||
export interface T_Web_StatiProdotto {
|
||||
IdStatoProdotto: number
|
||||
Descrizione: string
|
||||
dataora?: Date,
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
export interface IStorehouse {
|
||||
_id?: any
|
||||
|
||||
@@ -43,6 +43,19 @@ function getRoutesAd(site: ISites) {
|
||||
submenu: true,
|
||||
onlyAdmin: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 1020,
|
||||
path: '/admin/dbopmacro',
|
||||
materialIcon: 'event_seat',
|
||||
name: 'pages.dbopmacro',
|
||||
component: () => import('@src/views/admin/dbopmacro/dbopmacro.vue'),
|
||||
level_parent: 0.0,
|
||||
level_child: 0.5,
|
||||
inmenu: true,
|
||||
submenu: true,
|
||||
onlyAdmin: true
|
||||
},
|
||||
{
|
||||
active: true,
|
||||
order: 1020,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda } from 'model'
|
||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda, T_Web_StatiProdotto } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -129,6 +129,41 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
},
|
||||
|
||||
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 100
|
||||
},
|
||||
|
||||
isQtaLimitata: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 50 && product.arrvariazioni[0].quantita < 100
|
||||
},
|
||||
|
||||
isInEsaurendo: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 0 && product.arrvariazioni[0].quantita < 50
|
||||
},
|
||||
isEsaurito: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita <= 0
|
||||
},
|
||||
|
||||
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||
switch (productInfo?.idStatoProdotto) {
|
||||
case 1:
|
||||
case 4:
|
||||
case 34:
|
||||
case 45:
|
||||
case 46:
|
||||
case undefined:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
getDescrStatiProdottoByIdStatoProdotto: (state: IProductsState) => (idStatoProdotto: number): string => {
|
||||
const ctrec = state.stati_prodotto.find((mystatus: T_Web_StatiProdotto) => mystatus.IdStatoProdotto === idStatoProdotto)
|
||||
return (ctrec) ? ctrec.Descrizione : ''
|
||||
},
|
||||
|
||||
|
||||
getArrayidArgomentoByArridCatProds: (state: IProductsState) => (arridCatProds: string[]): string[] => {
|
||||
const myarr: string[] = []
|
||||
for (const idCatProd of arridCatProds) {
|
||||
@@ -1404,14 +1439,14 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
const linkvenduti = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + venduti + '</a>'
|
||||
const linkfatturati = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-fatturati-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + fatturati + '</a>'
|
||||
const debugstr = this.getkeyValStr('Pubblicato il', date_pub) +
|
||||
this.getkeyValStr('Rank3M', myproduct.productInfo.rank3M) +
|
||||
this.getkeyValStr('Venduti', linkvenduti) +
|
||||
this.getkeyValStr('vLast3M', vLast3M) +
|
||||
this.getkeyValStr('vLast6M', vLast6M) +
|
||||
this.getkeyValStr('Fatturati', linkfatturati) +
|
||||
this.getkeyValStr('fatLast3M', fatLast3M) +
|
||||
this.getkeyValStr('fatLast6M', fatLast6M)
|
||||
const debugstr = this.getkeyValStr('Pub:', date_pub) +
|
||||
this.getkeyValStr('fat6M', fatLast6M) +
|
||||
// this.getkeyValStr('Rank3M', myproduct.productInfo.rank3M) +
|
||||
this.getkeyValStr('Ven:', linkvenduti) +
|
||||
this.getkeyValStr('v3M', vLast3M) +
|
||||
this.getkeyValStr('v6M', vLast6M) +
|
||||
this.getkeyValStr('Fatt:', linkfatturati) +
|
||||
this.getkeyValStr('fat3M', fatLast3M)
|
||||
|
||||
const truncatedDescription = description.length > maxDescriptionLength
|
||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
@@ -1458,6 +1493,7 @@ export const useProducts = defineStore('Products', {
|
||||
const isbn = myproduct.productInfo.code || ''
|
||||
const image_link = myproduct.productInfo.image_link || ''
|
||||
const imagefile = myproduct.productInfo.imagefile || ''
|
||||
const stato = this.getDescrStatiProdottoByIdStatoProdotto(myproduct.productInfo.idStatoProdotto || '')
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
@@ -1480,6 +1516,7 @@ export const useProducts = defineStore('Products', {
|
||||
'{ranking_globale}': ranking_globale || '',
|
||||
'{venduti}': venduti || '',
|
||||
'{formato}': formato || '',
|
||||
'{stato}': stato || '',
|
||||
'{collana}': collana ? collana || '' : '',
|
||||
'{prezzo}': prezzo || '',
|
||||
'{scale}': scale || '',
|
||||
|
||||
@@ -441,6 +441,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'catprods_gas') ris = Products.catprods_gas
|
||||
else if (table === 'authors') ris = Products.authors
|
||||
else if (table === 'publishers') ris = Products.publishers
|
||||
else if (table === 't_web_statiprodottos') ris = Products.stati_prodotto
|
||||
else if (table === 'catais') ris = state.catAI
|
||||
else if (table === 'queryais') ris = state.queryAIList
|
||||
else if (table === 'sharewithus') ris = state.sharewithus
|
||||
@@ -1827,6 +1828,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.catprtotali = (res.data.catprtotali) ? [...res.data.catprtotali] : []
|
||||
Products.collane = (res.data.collane) ? [...res.data.collane] : []
|
||||
Products.subcatprods = (res.data.subcatprods) ? [...res.data.subcatprods] : []
|
||||
Products.stati_prodotto = (res.data.stati_prodotto) ? [...res.data.stati_prodotto] : []
|
||||
Products.catprods_gas = (res.data.catprods_gas) ? [...res.data.catprods_gas] : []
|
||||
Products.authors = (res.data.authors) ? [...res.data.authors] : []
|
||||
Products.publishers = (res.data.publishers) ? [...res.data.publishers] : []
|
||||
@@ -2607,12 +2609,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
return null
|
||||
},
|
||||
async updateLocalDbFromGM_T_Web_Articoli(sku: string) {
|
||||
async updateLocalDbFromGM_T_Web_Articoli(sku: string, isbn: string) {
|
||||
|
||||
const options: IOptQueryGM = {
|
||||
nameTable: 'T_Web_Articoli',
|
||||
query: '',
|
||||
where: 'T.IdArticolo =' + sku,
|
||||
where: 'T.IdArticolo =' + sku + ' AND T.Ean13 = ' + isbn,
|
||||
showQtaDisponibile: false,
|
||||
outhtml: false,
|
||||
cmd: shared_consts.CmdQueryMs.UPDATE,
|
||||
@@ -2623,9 +2625,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
return !!valueris
|
||||
},
|
||||
async updateAllBookFromGM_T_Web_Articoli(sku: string) {
|
||||
async updateAllBookFromGM_T_Web_Articoli(options: any) {
|
||||
|
||||
const valueris = await this.updateAllBookTableContent({ sku });
|
||||
const valueris = await this.updateAllBookTableContent(options);
|
||||
|
||||
return valueris
|
||||
},
|
||||
|
||||
36
src/views/admin/dbopmacro/dbopmacro.scss
Executable file
36
src/views/admin/dbopmacro/dbopmacro.scss
Executable file
@@ -0,0 +1,36 @@
|
||||
.results-container {
|
||||
border: 2px solid #4CAF50;
|
||||
/* Colore del bordo */
|
||||
border-radius: 10px;
|
||||
/* Angoli arrotondati */
|
||||
padding: 20px;
|
||||
/* Spaziatura interna */
|
||||
background-color: #f9f9f9;
|
||||
/* Colore di sfondo */
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
/* Ombra */
|
||||
margin: 20px 0;
|
||||
/* Margine sopra e sotto */
|
||||
}
|
||||
|
||||
.results-title {
|
||||
color: #333;
|
||||
/* Colore del testo */
|
||||
font-family: Arial, sans-serif;
|
||||
/* Tipo di font */
|
||||
margin-bottom: 15px;
|
||||
/* Spaziatura sotto il titolo */
|
||||
font-size: 24px;
|
||||
/* Dimensione del font */
|
||||
}
|
||||
|
||||
.results-content {
|
||||
color: #555;
|
||||
/* Colore del testo dei risultati */
|
||||
font-family: Arial, sans-serif;
|
||||
/* Tipo di font */
|
||||
font-size: 18px;
|
||||
/* Dimensione del font */
|
||||
white-space: pre-wrap;
|
||||
/* Mantiene gli spazi e le interruzioni di riga */
|
||||
}
|
||||
131
src/views/admin/dbopmacro/dbopmacro.ts
Executable file
131
src/views/admin/dbopmacro/dbopmacro.ts
Executable file
@@ -0,0 +1,131 @@
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
import { CTitleBanner } from '../../../components/CTitleBanner'
|
||||
import { CDateTime } from '../../../components/CDateTime'
|
||||
import { CMyFieldDb } from '../../../components/CMyFieldDb'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useCircuitStore } from '@store/CircuitStore'
|
||||
import { tools } from '@tools'
|
||||
import { costanti } from '@costanti'
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
import type { IOptQueryGM } from '@src/model'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'dbopmacro',
|
||||
components: { CTitleBanner, CDateTime, CMyFieldDb },
|
||||
props: {},
|
||||
setup() {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const circuitStore = useCircuitStore()
|
||||
|
||||
const ris = ref('')
|
||||
const riga = ref(0)
|
||||
const numpersone = ref(7)
|
||||
const date_start = ref(new Date())
|
||||
const col = ref(0)
|
||||
const placca = ref('')
|
||||
const valmin = ref(200)
|
||||
const circuitId = ref('')
|
||||
const valmax = ref(400)
|
||||
const defmin = ref(shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_GRP)
|
||||
const defmax = ref(shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_GRP)
|
||||
const defpersmin = ref(100)
|
||||
const defpersmax = ref(200)
|
||||
const search_username = ref('')
|
||||
const search = ref('')
|
||||
const replace_username = ref('')
|
||||
const risultato = ref('')
|
||||
const risultatoHTML = ref('')
|
||||
const incaricamento = ref(false)
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
function EseguiFunz(miafunz: string, options?: any, search_username?: string, replace_username?: string, valmin?: number, valmax?: number, circuitId?: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
$q.dialog({
|
||||
message: t('dialog.continue') + ' ' + miafunz + ' ?',
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true,
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel'),
|
||||
},
|
||||
title: 'Funzione:',
|
||||
}).onOk(async () => {
|
||||
const mydata = {
|
||||
dbop: miafunz,
|
||||
riga: riga,
|
||||
col: col,
|
||||
date_start: date_start,
|
||||
numpersone: numpersone,
|
||||
search_username,
|
||||
replace_username,
|
||||
search: search.value,
|
||||
valmin: tools.convstrToNum(valmin),
|
||||
valmax: tools.convstrToNum(valmax),
|
||||
circuitId,
|
||||
options,
|
||||
}
|
||||
|
||||
incaricamento.value = true
|
||||
$q.loading.show({ message: t('otherpages.update') })
|
||||
|
||||
const risfunz = await userStore.execDbOp({ mydata })
|
||||
|
||||
$q.loading.hide()
|
||||
await globalStore.loadSite()
|
||||
|
||||
incaricamento.value = false
|
||||
|
||||
console.log('risfunz', risfunz)
|
||||
|
||||
ris.value = ''
|
||||
|
||||
risultato.value = ''
|
||||
if (risfunz.data && risfunz.data.mystr) {
|
||||
risultato.value = risfunz.data.mystr
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function getListaArg() {
|
||||
risultatoHTML.value = ''
|
||||
risultatoHTML.value = await globalStore.getGM_Lista_Argomenti(true)
|
||||
}
|
||||
|
||||
async function getTabellaDaGM(options: IOptQueryGM) {
|
||||
risultatoHTML.value = ''
|
||||
risultatoHTML.value = await globalStore.getGM_Tabella(options)
|
||||
}
|
||||
|
||||
return {
|
||||
EseguiFunz,
|
||||
tools,
|
||||
costanti,
|
||||
search_username,
|
||||
replace_username,
|
||||
valmin,
|
||||
valmax,
|
||||
defmin,
|
||||
defmax,
|
||||
defpersmin,
|
||||
defpersmax,
|
||||
circuitId,
|
||||
circuitStore,
|
||||
incaricamento,
|
||||
ris,
|
||||
risultato,
|
||||
search,
|
||||
globalStore,
|
||||
risultatoHTML,
|
||||
getListaArg,
|
||||
getTabellaDaGM,
|
||||
}
|
||||
},
|
||||
})
|
||||
80
src/views/admin/dbopmacro/dbopmacro.vue
Executable file
80
src/views/admin/dbopmacro/dbopmacro.vue
Executable file
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div>
|
||||
<CTitleBanner title="Operazioni su DB MACRO:"></CTitleBanner>
|
||||
<div
|
||||
class="row justify-center q-gutter-sm q-list--bordered center_img"
|
||||
style="max-width: 600px"
|
||||
>
|
||||
<q-btn
|
||||
label="Migrazione del DB MSSQL su MongoDB (TUTTE)"
|
||||
color="positive"
|
||||
@click="EseguiFunz('MigrateMSSQLToMongoDb', {tutte: true})"
|
||||
></q-btn>
|
||||
|
||||
<q-btn
|
||||
label="Migrazione del DB MSSQL su MongoDB (ALCUNE)"
|
||||
color="positive"
|
||||
@click="EseguiFunz('MigrateMSSQLToMongoDb')"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Aggiorna Statistiche Fatturato"
|
||||
color="positive"
|
||||
@click="EseguiFunz('UpdateStatFatturato')"
|
||||
></q-btn>
|
||||
<br><br>
|
||||
<q-btn
|
||||
label="Riaggiorna TUTTI gli ARTICOLI da GM SERVER"
|
||||
color="accent"
|
||||
@click="EseguiFunz('updateAllBook', {usaDBGMLocale: false, caricatutti: true})"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Riaggiorna TUTTI gli ARTICOLI dal DB Locale Importato"
|
||||
color="accent"
|
||||
@click="EseguiFunz('updateAllBook', {usaDBGMLocale: true, caricatutti: true})"
|
||||
></q-btn>
|
||||
|
||||
<!--
|
||||
<q-btn
|
||||
label="getGM_Lista_Argomenti"
|
||||
color="positive"
|
||||
@click="getListaArg()"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="getGM_Tabella Collane"
|
||||
color="positive"
|
||||
@click="
|
||||
getTabellaDaGM({
|
||||
nameTable: 'T_Web_Collane',
|
||||
numrec: 500,
|
||||
outhtml: true,
|
||||
})
|
||||
"
|
||||
></q-btn>
|
||||
--></div>
|
||||
|
||||
<div class="results-container">
|
||||
<h2 class="results-title">Risultati:</h2>
|
||||
<div class="results-content">
|
||||
{{ risultato }}
|
||||
</div>
|
||||
<h2
|
||||
v-if="!!risultatoHTML"
|
||||
class="results-title"
|
||||
>
|
||||
Risultati HTML:
|
||||
</h2>
|
||||
<div
|
||||
v-if="!!risultatoHTML"
|
||||
v-html="risultatoHTML"
|
||||
></div>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" src="./dbopmacro.ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './dbopmacro.scss';
|
||||
</style>
|
||||
1
src/views/admin/dbopmacro/index.ts
Executable file
1
src/views/admin/dbopmacro/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as dbopmacro} from './dbopmacro.vue'
|
||||
@@ -678,13 +678,8 @@ export default defineComponent({
|
||||
|
||||
// Crea una copia dell'array per non modificare l'originale
|
||||
const sortedArr = [...arrprod].sort((a: IProduct, b: IProduct) => {
|
||||
const valA = a.productInfo?.[sort_field];
|
||||
const valB = b.productInfo?.[sort_field];
|
||||
|
||||
// Gestisce il caso in cui il campo non esiste
|
||||
if (valA === undefined || valB === undefined) {
|
||||
return 0;
|
||||
}
|
||||
const valA = a.productInfo?.[sort_field] ?? (typeof a.productInfo?.[sort_field] === 'number' ? 0 : '');
|
||||
const valB = b.productInfo?.[sort_field] ?? (typeof b.productInfo?.[sort_field] === 'number' ? 0 : '');
|
||||
|
||||
// Ordinamento per data
|
||||
if (valA instanceof Date && valB instanceof Date) {
|
||||
@@ -704,7 +699,7 @@ export default defineComponent({
|
||||
: compB.localeCompare(compA);
|
||||
});
|
||||
|
||||
// logga i primi 3 elementi, mostrando il nome del prodotto (productInfo.name e la data di pibblicazione : productinfo.date_pub
|
||||
// logga i primi N elementi, mostrando il nome del prodotto (productInfo.name e la data di pibblicazione : productinfo.date_pub
|
||||
if (sortedArr.length > 0) {
|
||||
console.log('Primi 15 elementi ordinati: ***** ');
|
||||
sortedArr.slice(0, 15).forEach((product, index) => {
|
||||
@@ -717,10 +712,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
|
||||
// Aggiunge l'indice di ranking ai prodotti
|
||||
return sortedArr.map((product, index) => ({
|
||||
...product,
|
||||
}))
|
||||
return sortedArr
|
||||
}
|
||||
|
||||
return arrprod;
|
||||
@@ -728,35 +720,24 @@ export default defineComponent({
|
||||
|
||||
function addNextProductToTheView(arrproductfiltrati: IProduct[], indprod: number) {
|
||||
try {
|
||||
|
||||
let rectrovato = null;
|
||||
while (true) {
|
||||
if (indprod >= arrproductfiltrati.length) {
|
||||
return { end: true }
|
||||
}
|
||||
|
||||
rectrovato = arrProdToView.value.find(
|
||||
while (indprod < arrproductfiltrati.length) {
|
||||
const rectrovato = arrProdToView.value.find(
|
||||
(prodview: IProdView) => prodview.id === arrproductfiltrati[indprod]._id
|
||||
);
|
||||
|
||||
if (rectrovato) {
|
||||
indprod++
|
||||
continue; // Era stato già aggiunto, quindi prova col prossimo
|
||||
} else {
|
||||
// Non è stato ancora aggiunto, quindi prendo questo e lo aggiungo alla lista !
|
||||
|
||||
const myrec = arrproductfiltrati[indprod]
|
||||
|
||||
arrProdToView.value.push({ id: myrec._id, showed: false });
|
||||
return { myrec, added: true, indprod }
|
||||
if (!rectrovato) {
|
||||
const myrec = arrproductfiltrati[indprod];
|
||||
arrProdToView.value.push({ id: myrec._id });
|
||||
return { myrec, added: true, indprod: indprod + 1 };
|
||||
}
|
||||
|
||||
indprod++;
|
||||
}
|
||||
|
||||
|
||||
return { end: true };
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { rec: null, indprod }; // Assicurati di gestire correttamente l'errore
|
||||
return { rec: null, indprod };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -822,8 +803,9 @@ export default defineComponent({
|
||||
let indadded = 0
|
||||
recscheda.arrProdToShow = []
|
||||
|
||||
for (let pagina = 0; pagina < 60; pagina++) {
|
||||
for (let pagina = 0; pagina < 600; pagina++) {
|
||||
indadded = 0
|
||||
let lastresultend = false
|
||||
if (!recscheda.arrProdToShow[pagina]) {
|
||||
recscheda.arrProdToShow[pagina] = [];
|
||||
}
|
||||
@@ -832,6 +814,7 @@ export default defineComponent({
|
||||
// Aggiunge il prossimo prodotto che non è stato ancora inserito
|
||||
const result = addNextProductToTheView(arrProdFiltrati, indprod);
|
||||
if (result.end) {
|
||||
lastresultend = true
|
||||
break; // Esci dal ciclo se non ci sono più prodotti disponibili
|
||||
} else {
|
||||
if (result.indprod)
|
||||
@@ -856,14 +839,17 @@ export default defineComponent({
|
||||
if (indtotale > optcatalogo.value.maxnumlibri!)
|
||||
return
|
||||
|
||||
} else {
|
||||
if (indtotale > 200)
|
||||
return
|
||||
//} else {
|
||||
// if (indtotale > 5000)
|
||||
// return
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (lastresultend)
|
||||
break; // Esci dal ciclo se non ci sono più prodotti disponibili
|
||||
|
||||
|
||||
if (recscheda.numPagineMax! > 0) {
|
||||
@@ -916,18 +902,6 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function getNextProd() {
|
||||
const nextRecord = arrProdToView.value.find((rec: any) => !rec.showed)
|
||||
|
||||
// Se un tale record esiste, impostalo su mostrato
|
||||
if (nextRecord) {
|
||||
nextRecord.showed = true
|
||||
return arrProducts.value.find((recprod: IProduct) => recprod._id === nextRecord.id)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
/*function getProducts() {
|
||||
let arrprod = productStore.getProducts(cosa.value)
|
||||
@@ -1328,7 +1302,6 @@ export default defineComponent({
|
||||
pdfContent,
|
||||
tabcatalogo,
|
||||
groupedPages,
|
||||
getNextProd,
|
||||
getProdBySchedaRigaCol,
|
||||
generateStylePageScheda,
|
||||
generateStyleCatalogo,
|
||||
|
||||
Reference in New Issue
Block a user