- CMyPopupEdit
- CMyEditor - MySkills
This commit is contained in:
@@ -67,7 +67,11 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
|
||||
table: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery },
|
||||
setup(props, { emit }) {
|
||||
@@ -76,11 +80,11 @@ export default defineComponent({
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const myvalue = ref('')
|
||||
const myvalue = ref(<any>'')
|
||||
const myvalueprec = ref('false')
|
||||
const countryname = ref('')
|
||||
const visueditor = ref(false)
|
||||
const showeditor = ref(true)
|
||||
const showeditor = ref(false)
|
||||
|
||||
const myrow = toRef(props, 'row')
|
||||
|
||||
@@ -89,8 +93,8 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function changeval(newval: any) {
|
||||
console.log('changeval update:row', newval)
|
||||
emit('update:row', newval)
|
||||
// console.log('changeval update:row', newval)
|
||||
emit('update:row', props.row)
|
||||
}
|
||||
|
||||
function getrealval(newval: any) {
|
||||
@@ -100,10 +104,10 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function changevalRec(newval: any) {
|
||||
console.log('row', props.row, 'col', props.col, 'newval', newval)
|
||||
console.log('row[col.name]', props.row[props.col.name])
|
||||
// console.log('row', props.row, 'col', props.col, 'newval', newval)
|
||||
// console.log('row[col.name]', props.row[props.col.name])
|
||||
myrow.value[props.col.name] = newval
|
||||
console.log('changevalRec update:row', newval)
|
||||
// console.log('changevalRec update:row', newval)
|
||||
emit('update:row', props.row)
|
||||
}
|
||||
|
||||
@@ -138,6 +142,25 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
if (props.col.fieldtype === costanti.FieldType.listimages) {
|
||||
if (myvalue.value === '' || myvalue.value === undefined) {
|
||||
console.log('set default myvalue.value ')
|
||||
myvalue.value = {
|
||||
title: 'Galleria',
|
||||
directory: 'none',
|
||||
list: [
|
||||
{
|
||||
_id: '',
|
||||
imagefile: 'noimg.png',
|
||||
order: 0,
|
||||
alt: '',
|
||||
description: '(nessuna foto)'
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log('myvalue.value', myvalue.value)
|
||||
myvalueprec.value = myvalue.value
|
||||
|
||||
// console.log('myvalueprec', myvalueprec)
|
||||
@@ -309,6 +332,18 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function getTitleGall() {
|
||||
return fieldsTable.getTitleImgByTable(props.table);
|
||||
}
|
||||
function getDirectoryGall() {
|
||||
if (fieldsTable.tableForUsers.includes(props.table)) {
|
||||
return 'profile/' + userStore.my.username + '/' + props.table
|
||||
} else {
|
||||
return props.table
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -336,6 +371,8 @@ export default defineComponent({
|
||||
fieldsTable,
|
||||
onInput,
|
||||
globalStore,
|
||||
getTitleGall,
|
||||
getDirectoryGall,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -83,8 +83,12 @@
|
||||
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.listimages">
|
||||
Galleria:
|
||||
<CGallery
|
||||
:gall="row" :listimages="myvalue" :edit="isviewfield()"
|
||||
v-if="myvalue"
|
||||
:title="getTitleGall()"
|
||||
:directory="getDirectoryGall()"
|
||||
:imgGall="myvalue" :edit="isviewfield()"
|
||||
@showandsave="Savedb"
|
||||
@update:model-value="changevalRec"
|
||||
>
|
||||
@@ -92,8 +96,12 @@
|
||||
</CGallery>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.image">
|
||||
|
||||
<CGallery
|
||||
:gall="row" :listimages="myvalue" :edit="isviewfield()"
|
||||
v-if="myvalue"
|
||||
:title="getTitleGall()"
|
||||
:directory="getDirectoryGall()"
|
||||
:imgGall="myvalue" :edit="isviewfield()"
|
||||
@update:model-value="changevalRec"
|
||||
@showandsave="Savedb">
|
||||
|
||||
@@ -149,14 +157,20 @@
|
||||
<div v-else>
|
||||
<div v-if="col.fieldtype === costanti.FieldType.listimages">
|
||||
<CGallery
|
||||
:gall="row" :listimages="myvalue" :edit="isviewfield()"
|
||||
v-if="myvalue"
|
||||
:title="getTitleGall()"
|
||||
:directory="getDirectoryGall()"
|
||||
:imgGall="myvalue" :edit="isviewfield()"
|
||||
@showandsave="Savedb">
|
||||
|
||||
</CGallery>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.image">
|
||||
<CGallery
|
||||
:gall="row" :listimages="myvalue" :edit="isviewfield()"
|
||||
v-if="myvalue"
|
||||
:title="getTitleGall()"
|
||||
:directory="getDirectoryGall()"
|
||||
:imgGall="myvalue" :edit="isviewfield()"
|
||||
@showandsave="Savedb">
|
||||
|
||||
</CGallery>
|
||||
@@ -252,13 +266,17 @@
|
||||
|
||||
<div v-if="col.fieldtype === costanti.FieldType.html">
|
||||
|
||||
<!--<q-dialog v-model="showeditor">-->
|
||||
<CMyEditor
|
||||
v-if="visueditor" v-model:value="myvalue" :title="col.title" @keyup.enter.stop
|
||||
@showandsave="Savedb" @annulla="visueditor=false">
|
||||
<q-dialog v-model="visueditor" no-backdrop-dismiss persistent full-height full-width>
|
||||
<q-card :style="`min-width: `+ tools.myheight_dialog() + `px;`">
|
||||
<q-card-section>
|
||||
<CMyEditor
|
||||
v-if="visueditor" v-model:value="myvalue" :title="col.title" @keyup.enter.stop
|
||||
@showandsave="Savedb" @annulla="visueditor=false">
|
||||
|
||||
</CMyEditor>
|
||||
<!--</q-dialog>-->
|
||||
</CMyEditor>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</div>
|
||||
|
||||
<q-popup-edit
|
||||
@@ -383,11 +401,22 @@
|
||||
emit-value
|
||||
map-options
|
||||
:options="globalStore.getTableJoinByName(col.jointable)"
|
||||
:option-label="fieldsTable.getLabelByTable(col.jointable)"
|
||||
:option-value="fieldsTable.getKeyByTable(col.jointable)"
|
||||
style="min-width: 150px"
|
||||
:option-value="fieldsTable.getKeyByTable(col.jointable)"
|
||||
@update:model-value="changeval">
|
||||
|
||||
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
|
||||
<q-item v-bind="itemProps">
|
||||
|
||||
<q-item-section>
|
||||
<q-item-label>{{ opt[fieldsTable.getLabelByTable(col.jointable)] }}</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side>
|
||||
<q-toggle :model-value="selected" @update:model-value="toggleOption(opt)" />
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
|
||||
</q-select>
|
||||
</div>
|
||||
</q-popup-edit>
|
||||
|
||||
Reference in New Issue
Block a user