2021-09-04 15:05:34 +02:00
|
|
|
import { computed, defineComponent, PropType, ref } from 'vue'
|
|
|
|
|
|
2025-03-01 14:14:43 +01:00
|
|
|
import { tools } from '@tools'
|
|
|
|
|
|
2021-09-04 15:05:34 +02:00
|
|
|
import { useQuasar } from 'quasar'
|
2025-03-01 14:14:43 +01:00
|
|
|
import { useI18n } from 'vue-i18n'
|
2021-09-04 15:05:34 +02:00
|
|
|
import { useGlobalStore } from '@store/globalStore'
|
2025-03-01 14:14:43 +01:00
|
|
|
import type { ICfgServer } from 'model'
|
2021-09-04 15:05:34 +02:00
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
2021-09-19 20:07:28 +02:00
|
|
|
const provaval = ref(1)
|
|
|
|
|
|
2021-09-04 15:05:34 +02:00
|
|
|
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) {
|
2021-09-19 20:07:28 +02:00
|
|
|
console.log('SaveValue', newVal)
|
2021-09-04 15:05:34 +02:00
|
|
|
|
|
|
|
|
const mydata: ICfgServer = {
|
|
|
|
|
chiave: keysel.value,
|
|
|
|
|
userId: userIdsel.value,
|
|
|
|
|
valore: newVal,
|
2025-03-01 14:14:43 +01:00
|
|
|
idapp: tools.getEnv('VITE_APP_ID')!,
|
2021-09-04 15:05:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Save on Server
|
|
|
|
|
globalStore.saveCfgServerKey(mydata)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
selItem,
|
|
|
|
|
SaveValue,
|
|
|
|
|
serverData,
|
|
|
|
|
columns,
|
|
|
|
|
filter,
|
2021-09-19 20:07:28 +02:00
|
|
|
provaval,
|
2022-05-27 01:33:39 +02:00
|
|
|
globalStore,
|
2021-09-04 15:05:34 +02:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|