fixed CGallery
This commit is contained in:
@@ -58,16 +58,17 @@ export default defineComponent({
|
|||||||
console.log('created cgallery')
|
console.log('created cgallery')
|
||||||
if (isValid(props.imgGall)) {
|
if (isValid(props.imgGall)) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
gallerylist.value = props.imgGall
|
let myarr: any = props.imgGall
|
||||||
|
gallerylist.value = []
|
||||||
|
if (myarr) {
|
||||||
|
myarr.forEach((pic: any) => {
|
||||||
|
if (pic.imagefile)
|
||||||
|
gallerylist.value.push(pic)
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gallerylist.value = [
|
gallerylist.value = [
|
||||||
{
|
]
|
||||||
_id: '',
|
|
||||||
imagefile: 'noimg.png',
|
|
||||||
order: 0,
|
|
||||||
alt: '',
|
|
||||||
description: '(nessuna foto)'
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +211,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function uploaded(info: any) {
|
function uploaded(info: any) {
|
||||||
console.log(info)
|
console.log('uploaded', info)
|
||||||
if (gallerylist.value) {
|
if (gallerylist.value) {
|
||||||
for (const file of info.files) {
|
for (const file of info.files) {
|
||||||
gallerylist.value.push({ imagefile: file.name, order: getlastord() })
|
gallerylist.value.push({ imagefile: file.name, order: getlastord() })
|
||||||
@@ -218,6 +219,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
if (!props.single)
|
if (!props.single)
|
||||||
save()
|
save()
|
||||||
|
|
||||||
|
console.log('gallerylist', gallerylist.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,21 +273,27 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
console.log('CGallery save')
|
||||||
if (gallerylist.value.length > 0) {
|
if (gallerylist.value.length > 0) {
|
||||||
if (!props.single) {
|
if (!props.single) {
|
||||||
emit('showandsave', gallerylist.value)
|
emit('showandsave', gallerylist.value)
|
||||||
} else {
|
} else {
|
||||||
emit('showandsave', gallerylist.value[0].imagefile)
|
emit('showandsave', gallerylist.value[0].imagefile)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
emit('showandsave', '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
save()
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function getsrcimg(gallerylistery: any) {
|
function getsrcimg(gallerylistery: any) {
|
||||||
|
|
||||||
|
if (!gallerylistery.imagefile) {
|
||||||
|
return 'images/noimg.png';
|
||||||
|
}
|
||||||
if (gallerylistery) {
|
if (gallerylistery) {
|
||||||
if (tools.getextfile(gallerylistery.imagefile) === 'pdf')
|
if (tools.getextfile(gallerylistery.imagefile) === 'pdf')
|
||||||
return 'images/images/pdf.jpg'
|
return 'images/images/pdf.jpg'
|
||||||
|
|||||||
@@ -19,12 +19,19 @@
|
|||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div v-if="getnumimages() <= 0">
|
||||||
|
<q-btn
|
||||||
|
flat round color="blue" icon="fas fa-tools" size="md"
|
||||||
|
@click="apri"></q-btn>
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class=" row">
|
<div class=" row">
|
||||||
<!--<q-draggable-rows
|
<!--<q-draggable-rows
|
||||||
v-model="order">-->
|
v-model="order">-->
|
||||||
|
|
||||||
<div v-for="(mygallery, index) in getlistimages()" :key="index">
|
<div v-for="(mygallery, index) in getlistimages()" :key="index">
|
||||||
|
mygallery : {{ mygallery}}
|
||||||
<div
|
<div
|
||||||
class="q-pa-sm q-gutter-sm"
|
class="q-pa-sm q-gutter-sm"
|
||||||
@dragenter="onDragEnter"
|
@dragenter="onDragEnter"
|
||||||
@@ -83,7 +90,7 @@
|
|||||||
<div class="q-pa-sm">
|
<div class="q-pa-sm">
|
||||||
<div v-if="edit" class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
<div v-if="edit" class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
label="Aggiungi Immagine o PDF"
|
label="Aggiungi Immagine"
|
||||||
accept=".jpg, image/*, .pdf"
|
accept=".jpg, image/*, .pdf"
|
||||||
:url="getUrl()"
|
:url="getUrl()"
|
||||||
:headers="tools.getheaders()"
|
:headers="tools.getheaders()"
|
||||||
@@ -99,6 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<q-dialog
|
<q-dialog
|
||||||
v-model="displayGall"
|
v-model="displayGall"
|
||||||
persistent
|
persistent
|
||||||
@@ -116,7 +124,7 @@
|
|||||||
<q-btn dense flat icon="crop_square" @click="maximizedToggle = true" :disable="maximizedToggle">
|
<q-btn dense flat icon="crop_square" @click="maximizedToggle = true" :disable="maximizedToggle">
|
||||||
<q-tooltip v-if="!maximizedToggle" class="bg-white text-primary">Maximize</q-tooltip>
|
<q-tooltip v-if="!maximizedToggle" class="bg-white text-primary">Maximize</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn dense flat icon="close" v-close-popup @click="close">
|
<q-btn dense flat icon="close" v-close-popup>
|
||||||
<q-tooltip class="bg-white text-primary">Close</q-tooltip>
|
<q-tooltip class="bg-white text-primary">Close</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-bar>
|
</q-bar>
|
||||||
@@ -186,7 +194,7 @@
|
|||||||
<div class="q-pa-sm">
|
<div class="q-pa-sm">
|
||||||
<div class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
<div class="q-gutter-sm " style="max-height: 200px; width: 208px;">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
label="Aggiungi Immagine o PDF"
|
label="Aggiungi Immagine"
|
||||||
accept=".jpg, image/*, .pdf"
|
accept=".jpg, image/*, .pdf"
|
||||||
:url="getUrl()"
|
:url="getUrl()"
|
||||||
:headers="tools.getheaders()"
|
:headers="tools.getheaders()"
|
||||||
@@ -202,6 +210,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<q-card-actions align="right">
|
||||||
|
<q-btn flat label="Annulla" color="primary" v-close-popup />
|
||||||
|
<q-btn label="salva" color="primary" v-close-popup @click="save"/>
|
||||||
|
</q-card-actions>
|
||||||
|
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
|
|
||||||
function showandsel(row: any, col: any, newval: any, valinitial: any) {
|
function showandsel(row: any, col: any, newval: any, valinitial: any) {
|
||||||
// console.log('showandsel', row, col, newval)
|
console.log('showandsel CGridTable', row, col, newval)
|
||||||
rowsel = row
|
rowsel = row
|
||||||
colsel.value = col
|
colsel.value = col
|
||||||
idsel = row._id
|
idsel = row._id
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { tools } from '@store/Modules/tools'
|
|||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { CMyPopupEdit } from '@/components/CMyPopupEdit'
|
import { CMyPopupEdit } from '@/components/CMyPopupEdit'
|
||||||
import { IColGridTable } from 'model'
|
import { IColGridTable } from 'model'
|
||||||
|
import MixinBase from '@/mixins/mixin-base'
|
||||||
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -84,6 +85,15 @@ export default defineComponent({
|
|||||||
const col = ref(<IColGridTable> { name: 'test' })
|
const col = ref(<IColGridTable> { name: 'test' })
|
||||||
const row = ref({})
|
const row = ref({})
|
||||||
|
|
||||||
|
const { setValDb, getValDb } = MixinBase()
|
||||||
|
|
||||||
|
function showandsel(row: any, col: any, newval: any, valinitial: any) {
|
||||||
|
console.log('showandsel CMyFieldDb', row, col, newval)
|
||||||
|
|
||||||
|
if (newval !== valinitial)
|
||||||
|
setValDb($q, props.mykey, newval, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tools,
|
tools,
|
||||||
costanti,
|
costanti,
|
||||||
@@ -91,6 +101,7 @@ export default defineComponent({
|
|||||||
globalStore,
|
globalStore,
|
||||||
col,
|
col,
|
||||||
row,
|
row,
|
||||||
|
showandsel,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
:mycol="col"
|
:mycol="col"
|
||||||
v-model:row="row"
|
v-model:row="row"
|
||||||
minuteinterval="1"
|
minuteinterval="1"
|
||||||
|
@showandsave="showandsel"
|
||||||
>
|
>
|
||||||
|
|
||||||
</CMyPopupEdit>
|
</CMyPopupEdit>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import MixinUsers from '@/mixins/mixin-users'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CMyPopupEdit',
|
name: 'CMyPopupEdit',
|
||||||
|
emits: ['showandsave', 'update:row', 'show', 'save', 'annulla'],
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -250,14 +251,7 @@ export default defineComponent({
|
|||||||
myvalue.value = {
|
myvalue.value = {
|
||||||
title: 'Galleria',
|
title: 'Galleria',
|
||||||
directory: 'none',
|
directory: 'none',
|
||||||
list: [
|
list: []
|
||||||
{
|
|
||||||
_id: '',
|
|
||||||
imagefile: 'noimg.png',
|
|
||||||
order: 0,
|
|
||||||
alt: '',
|
|
||||||
description: '(nessuna foto)'
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,6 +330,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
|
|
||||||
function Savedb(newVal: any, valinitial: any) {
|
function Savedb(newVal: any, valinitial: any) {
|
||||||
|
console.log('Savedb')
|
||||||
|
|
||||||
if (col.value.fieldtype === costanti.FieldType.boolean) {
|
if (col.value.fieldtype === costanti.FieldType.boolean) {
|
||||||
// console.log('myvalue', myvalue, newVal, myvalueprec)
|
// console.log('myvalue', myvalue, newVal, myvalueprec)
|
||||||
|
|||||||
@@ -85,7 +85,6 @@
|
|||||||
<div v-else-if="col.fieldtype === costanti.FieldType.listimages">
|
<div v-else-if="col.fieldtype === costanti.FieldType.listimages">
|
||||||
gall1:
|
gall1:
|
||||||
<CGallery
|
<CGallery
|
||||||
v-if="myvalue"
|
|
||||||
:title="getTitleGall()"
|
:title="getTitleGall()"
|
||||||
:directory="getDirectoryGall()"
|
:directory="getDirectoryGall()"
|
||||||
:imgGall="myvalue" :edit="isviewfield()"
|
:imgGall="myvalue" :edit="isviewfield()"
|
||||||
@@ -99,7 +98,6 @@
|
|||||||
<div v-if="canEdit">
|
<div v-if="canEdit">
|
||||||
gall2:
|
gall2:
|
||||||
<CGallery
|
<CGallery
|
||||||
v-if="myvalue"
|
|
||||||
:title="getTitleGall()"
|
:title="getTitleGall()"
|
||||||
:directory="getDirectoryGall()"
|
:directory="getDirectoryGall()"
|
||||||
:imgGall="myvalue" :edit="isviewfield()"
|
:imgGall="myvalue" :edit="isviewfield()"
|
||||||
@@ -184,7 +182,6 @@
|
|||||||
<div v-if="col.fieldtype === costanti.FieldType.listimages">
|
<div v-if="col.fieldtype === costanti.FieldType.listimages">
|
||||||
gall3:
|
gall3:
|
||||||
<CGallery
|
<CGallery
|
||||||
v-if="myvalue"
|
|
||||||
:title="getTitleGall()"
|
:title="getTitleGall()"
|
||||||
:directory="getDirectoryGall()"
|
:directory="getDirectoryGall()"
|
||||||
:imgGall="myvalue" :edit="isviewfield()"
|
:imgGall="myvalue" :edit="isviewfield()"
|
||||||
@@ -193,9 +190,8 @@
|
|||||||
</CGallery>
|
</CGallery>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.fieldtype === costanti.FieldType.image">
|
<div v-else-if="col.fieldtype === costanti.FieldType.image">
|
||||||
gall4:
|
|
||||||
<CGallery
|
<CGallery
|
||||||
v-if="myvalue"
|
|
||||||
:title="getTitleGall()"
|
:title="getTitleGall()"
|
||||||
:directory="getDirectoryGall()"
|
:directory="getDirectoryGall()"
|
||||||
:single="isFieldDb()"
|
:single="isFieldDb()"
|
||||||
|
|||||||
@@ -839,7 +839,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
async DeleteFile({ filename }: {filename: string}) {
|
async DeleteFile({ filename }: {filename: string}) {
|
||||||
console.log('DeleteFile', filename)
|
console.log('DeleteFile', filename)
|
||||||
|
|
||||||
return Api.SendReq('/delfile', 'DELETE', { filename })
|
return Api.SendReq(`/delfile/${tools.getvers()}/`, 'DELETE', { filename })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user