Files
myprojplanet_vite/src/views/admin/cfgServer/cfgServer.ts
Surya Paolo bc960d38a1 PASSAGGIO A VITE !
AGG. 1.1.23
2025-03-01 14:14:43 +01:00

89 lines
2.1 KiB
TypeScript
Executable File

import { computed, defineComponent, PropType, ref } from 'vue'
import { tools } from '@tools'
import { useQuasar } from 'quasar'
import { useI18n } from 'vue-i18n'
import { useGlobalStore } from '@store/globalStore'
import type { ICfgServer } from 'model'
interface IPageSrv {
page: number,
rowsPerPage: number // specifying this determines pagination is server-side
}
interface IPageS {
page: number,
}
export default defineComponent({
name: 'CfgServer',
setup() {
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
const provaval = ref(1)
const serverData = computed(() => globalStore.cfgServer.slice()) // [{ chiave: 'chiave1', valore: 'valore 1' }]
const columns = ref([
{
name: 'chiave',
required: true,
label: 'Chiave',
align: 'left',
field: 'chiave',
sortable: true,
},
{ name: 'idapp', label: 'idapp', field: 'idapp', sortable: true },
{ name: 'userid', label: 'UserId', field: 'userid', sortable: false },
{ name: 'valore', label: 'Valore', field: 'valore', sortable: false },
])
const colVisib = ref(['chiave', 'idapp', 'userid', 'valore'])
const separator = ref('horizontal')
const filter = ref('')
const selected = ref([])
const dark = ref(true)
const keysel = ref('')
const userIdsel = ref('')
function tableClass() {
if (dark.value) {
return 'bg-black'
}
}
function selItem(item: any) {
console.log('item', item)
keysel.value = item.chiave
userIdsel.value = item.userId
console.log('this.keysel', keysel.value)
}
function SaveValue(newVal: any, valinitial: any) {
console.log('SaveValue', newVal)
const mydata: ICfgServer = {
chiave: keysel.value,
userId: userIdsel.value,
valore: newVal,
idapp: tools.getEnv('VITE_APP_ID')!,
}
// Save on Server
globalStore.saveCfgServerKey(mydata)
}
return {
selItem,
SaveValue,
serverData,
columns,
filter,
provaval,
globalStore,
}
},
})