- posso fare upload dell'immagine del prodotto dalla lista
- corretto import dati
This commit is contained in:
@@ -96,7 +96,7 @@ export default defineComponent({
|
||||
}
|
||||
} else {
|
||||
gallerylist.value = [
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -229,12 +229,16 @@ export default defineComponent({
|
||||
function uploaded(info: any) {
|
||||
console.log('uploaded', info)
|
||||
if (gallerylist.value) {
|
||||
for (const file of info.files) {
|
||||
gallerylist.value.push({ imagefile: file.name })
|
||||
if (props.single && info.files) {
|
||||
console.log('gallerylist.value[0]', info.files[0].name)
|
||||
gallerylist.value[0] = { imagefile: info.files[0].name }
|
||||
} else {
|
||||
for (const file of info.files) {
|
||||
gallerylist.value.push({ imagefile: file.name })
|
||||
}
|
||||
}
|
||||
|
||||
if (!props.single)
|
||||
save()
|
||||
save()
|
||||
|
||||
console.log('gallerylist', gallerylist.value)
|
||||
}
|
||||
@@ -260,9 +264,7 @@ export default defineComponent({
|
||||
|
||||
console.log('single', props.single)
|
||||
|
||||
if (!props.single) {
|
||||
save()
|
||||
}
|
||||
save()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,8 +282,7 @@ export default defineComponent({
|
||||
tools.copyStringToClipboard($q, filename, true)
|
||||
}
|
||||
|
||||
function deleteFile(rec: any)
|
||||
{
|
||||
function deleteFile(rec: any) {
|
||||
console.log('deleteFile....')
|
||||
const filename = getfullname(rec)
|
||||
const filenamerel = filename.replace(/^.*[\\\/]/, '')
|
||||
@@ -353,7 +354,7 @@ export default defineComponent({
|
||||
fullscreensrc.value = getfullname(mygallery)
|
||||
}
|
||||
|
||||
function onRejected (rejectedEntries: any) {
|
||||
function onRejected(rejectedEntries: any) {
|
||||
// Notify plugin needs to be installed
|
||||
// https://quasar.dev/quasar-plugins/notify#Installation
|
||||
console.log('rejectedEntries', rejectedEntries)
|
||||
|
||||
@@ -116,12 +116,12 @@
|
||||
<div class="q-pa-sm">
|
||||
<div v-if="edit" class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
||||
<q-uploader
|
||||
label="Aggiungi Immagine"
|
||||
:label="single && (gallerylist.length > 0 && gallerylist[0].imagefile !== '') ? 'Sostituisci Immagine' : 'Aggiungi Immagine'"
|
||||
accept="image/*"
|
||||
:url="getUrl()"
|
||||
:headers="tools.getheaders()"
|
||||
:max-file-size="3000000"
|
||||
multiple
|
||||
:multiple="!single"
|
||||
auto-upload
|
||||
hide-upload-btn
|
||||
no-thumbnails
|
||||
|
||||
@@ -263,6 +263,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const myrow = ref(<any>null)
|
||||
const mypath = ref('')
|
||||
|
||||
/* const myrow = computed(() => {
|
||||
return props.rec && props.isrec ? props.rec : props.row
|
||||
@@ -328,6 +329,13 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
if (props.path) {
|
||||
mypath.value = props.path
|
||||
} else {
|
||||
if (col.value.hasOwnProperty('path'))
|
||||
mypath.value = col.value.path ? col.value.path : ''
|
||||
}
|
||||
|
||||
// console.log('CMyFieldDb crea', myvalue)
|
||||
}
|
||||
|
||||
@@ -612,6 +620,9 @@ export default defineComponent({
|
||||
} else if (col.value.fieldtype === costanti.FieldType.imgcard) {
|
||||
console.log('newVal.imagefile', newVal)
|
||||
myvalue.value = newVal
|
||||
} else if (col.value.fieldtype === costanti.FieldType.image_and_filename) {
|
||||
console.log('newVal.imagefile', newVal)
|
||||
myvalue.value = newVal
|
||||
}
|
||||
|
||||
if (col.value.fieldtype === costanti.FieldType.listobj) {
|
||||
@@ -855,6 +866,7 @@ export default defineComponent({
|
||||
shared_consts,
|
||||
nameKeydown,
|
||||
gotoPage,
|
||||
mypath,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -377,7 +377,7 @@
|
||||
: ''
|
||||
"
|
||||
:title="tools.getTitleGall(table)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, path)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, mypath)"
|
||||
:imgGall="myvalue"
|
||||
:isInModif="isInModif"
|
||||
:edit="isviewfield() && isInModif"
|
||||
@@ -409,7 +409,71 @@
|
||||
: ''
|
||||
"
|
||||
:title="tools.getTitleGall(table)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, path)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, mypath)"
|
||||
:imgGall="[{ imagefile: myvalue }]"
|
||||
:edit="isviewfield()"
|
||||
:canModify="canModify"
|
||||
:isInModif="isInModif"
|
||||
:single="true"
|
||||
@update:imgGall="changevalRec"
|
||||
@showandsave="Savedb"
|
||||
>
|
||||
</CGallery>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="myvalue" class="text-center">
|
||||
<q-img
|
||||
:src="myvalue"
|
||||
class="text-center"
|
||||
style="height: 100px; width: 100px"
|
||||
alt="foto"
|
||||
>
|
||||
</q-img>
|
||||
</div>
|
||||
<div v-else class="text-center">
|
||||
<q-img
|
||||
:src="
|
||||
col.showpicprofile_ifnotset
|
||||
? userStore.getImgByProfile(row['profile'], true)
|
||||
: 'images/noimg-user.svg'
|
||||
"
|
||||
class="text-center"
|
||||
style="height: 100px; width: 100px"
|
||||
alt="nessuna immagine"
|
||||
>
|
||||
</q-img>
|
||||
</div>
|
||||
<q-btn
|
||||
v-if="myvalue"
|
||||
label="Rimuovi Foto"
|
||||
color="blue"
|
||||
icon="fas fa-trash-alt"
|
||||
size="sm"
|
||||
@click="removephoto"
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="col.fieldtype === costanti.FieldType.image_and_filename"
|
||||
>
|
||||
<div v-if="canEdit">
|
||||
{{ $t('reg.photo') }}
|
||||
<q-input
|
||||
v-model="myvalue"
|
||||
@update:value="changevalRec"
|
||||
@update:model-value="Savedb"
|
||||
:maxlength="col.maxlength ? col.maxlength : undefined"
|
||||
autofocus
|
||||
>
|
||||
</q-input>
|
||||
<CGallery
|
||||
:imagebak="
|
||||
col.showpicprofile_ifnotset
|
||||
? userStore.getImgByProfile(row['profile'], true)
|
||||
: ''
|
||||
"
|
||||
:title="tools.getTitleGall(table)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, mypath)"
|
||||
:imgGall="[{ imagefile: myvalue }]"
|
||||
:edit="isviewfield()"
|
||||
:canModify="canModify"
|
||||
@@ -464,7 +528,7 @@
|
||||
: ''
|
||||
"
|
||||
:title="tools.getTitleGall(table)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, path)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, mypath)"
|
||||
:imgGall="[myvalue]"
|
||||
:edit="isviewfield()"
|
||||
:canModify="canModify"
|
||||
@@ -1055,7 +1119,7 @@
|
||||
<q-popup-edit
|
||||
v-if="!isInModif && canEdit && noPopupeditByCol(col)"
|
||||
v-model="myvalue"
|
||||
:disable="col.disable || disable"
|
||||
:disable="(col.disable || disable) || (col.fieldtype === costanti.FieldType.image_and_filename)"
|
||||
:readonly="col.disable || disable"
|
||||
:title="col.title ? col.title : col.titlepopupedit"
|
||||
buttons
|
||||
@@ -1079,8 +1143,7 @@
|
||||
col.fieldtype === costanti.FieldType.string ||
|
||||
col.fieldtype === costanti.FieldType.crypted
|
||||
"
|
||||
>
|
||||
|
||||
>
|
||||
<q-input
|
||||
v-bind="$attrs"
|
||||
counter
|
||||
@@ -1097,9 +1160,9 @@
|
||||
@keyup.enter.stop
|
||||
autofocus
|
||||
>
|
||||
<template v-if="notAllowAtChar" v-slot:prepend>
|
||||
<span class="text-h7 text-blue">@</span>
|
||||
</template>
|
||||
<template v-if="notAllowAtChar" v-slot:prepend>
|
||||
<span class="text-h7 text-blue">@</span>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.number">
|
||||
@@ -1488,6 +1551,35 @@
|
||||
</CMyEditor>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.image_and_filename">
|
||||
<div v-if="canEdit">
|
||||
{{ $t('reg.photo') }}
|
||||
<q-input
|
||||
v-model="myvalue"
|
||||
@update:value="changevalRec"
|
||||
:maxlength="col.maxlength ? col.maxlength : undefined"
|
||||
autofocus
|
||||
>
|
||||
</q-input>
|
||||
<CGallery
|
||||
:imagebak="
|
||||
col.showpicprofile_ifnotset
|
||||
? userStore.getImgByProfile(row['profile'], true)
|
||||
: ''
|
||||
"
|
||||
:title="tools.getTitleGall(table)"
|
||||
:directory="tools.getDirectoryGall(myrow, table, mypath)"
|
||||
:imgGall="[{ imagefile: myvalue }]"
|
||||
:edit="isviewfield()"
|
||||
:canModify="canModify"
|
||||
:isInModif="isInModif"
|
||||
:single="true"
|
||||
@update:imgGall="changevalRec"
|
||||
@showandsave="Savedb"
|
||||
>
|
||||
</CGallery>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.color">
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
|
||||
Reference in New Issue
Block a user