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