Files
salvato.newfreeplanet/src/components/CMyFieldDb/CMyFieldDb.ts

129 lines
2.7 KiB
TypeScript
Raw Normal View History

2021-09-16 21:08:02 +02:00
import { defineComponent, PropType, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useGlobalStore } from '@store/globalStore'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { tools } from '@store/Modules/tools'
import { costanti } from '@costanti'
2021-11-04 16:02:14 +01:00
import { CMyPopupEdit } from '@/components/CMyPopupEdit'
import { IColGridTable } from 'model'
2021-11-22 18:28:45 +01:00
import MixinBase from '@/mixins/mixin-base'
2021-09-04 15:05:34 +02:00
2021-10-01 03:08:43 +02:00
2021-09-16 21:08:02 +02:00
export default defineComponent({
name: 'CMyFieldDb',
props: {
title: {
type: String,
required: true,
},
mykey: {
type: String,
required: true,
},
mysubkey: {
type: String,
required: false,
default: '',
},
2021-10-08 00:38:22 +02:00
indrec: {
type: Number,
required: false,
default: -1,
},
mysubsubkey: {
type: String,
required: false,
default: '',
},
2021-09-16 21:08:02 +02:00
type: {
type: Number,
required: true,
},
serv: {
type: Boolean,
required: false,
default: false,
},
canModify: {
type: Boolean,
required: false,
default: true,
},
2021-09-16 21:08:02 +02:00
disable: {
type: Boolean,
required: false,
default: false,
},
jointable: {
type: String,
required: false,
default: '',
},
table: {
type: String,
required: false,
default: 'settings',
},
myimg: {
type: String,
required: false,
default: '',
},
id: {
type: String,
required: false,
default: '',
},
idmain: {
type: String,
required: false,
default: '',
},
tablesel: {
type: String,
required: false,
default: '',
},
pickup: {
type: Boolean,
required: false,
default: false,
},
2021-09-16 21:08:02 +02:00
},
2021-11-04 16:02:14 +01:00
components: { CMyPopupEdit },
2021-09-16 21:08:02 +02:00
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
2021-11-04 16:02:14 +01:00
const col = ref(<IColGridTable> { name: 'test' })
const row = ref({})
2021-09-16 21:08:02 +02:00
2021-11-22 18:28:45 +01:00
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)
}
function withBorder() {
return col.value.fieldtype !== costanti.FieldType.onlydate && col.value.fieldtype !== costanti.FieldType.date
}
2021-09-16 21:08:02 +02:00
return {
2021-09-19 02:59:24 +02:00
tools,
costanti,
2021-10-01 03:08:43 +02:00
fieldsTable,
globalStore,
2021-11-04 16:02:14 +01:00
col,
row,
2021-11-22 18:28:45 +01:00
showandsel,
withBorder,
2021-09-16 21:08:02 +02:00
}
},
})
2021-09-04 15:05:34 +02:00