Files
myprojplanet_vite/src/components/CSkill/CSkill.ts

155 lines
3.3 KiB
TypeScript
Raw Normal View History

2021-10-08 00:38:22 +02:00
import {
defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
} from 'vue'
import { tools } from '@store/Modules/tools'
import { CMyFieldDb } from '@/components/CMyFieldDb'
import { costanti } from '@costanti'
import { useGlobalStore } from '@store/globalStore'
import { useUserStore } from '@store/UserStore'
import { colmySkills } from '@store/Modules/fieldsTable'
import { CGridTableRec } from '@/components/CGridTableRec'
import { IMySkill, ISkill } from 'model'
2021-10-08 00:38:22 +02:00
export default defineComponent({
name: 'CSkill',
props: {
defaultnewrec: {
type: Function,
required: false,
},
filtercustom: {
type: Array,
required: false,
default: () => {
return []
}
},
2022-01-26 01:31:07 +01:00
visuinpage: {
type: Boolean,
required: false,
default: false,
},
2022-01-03 21:53:41 +01:00
username: {
type: String,
required: false,
default: ''
}
2021-10-08 00:38:22 +02:00
},
components: {
CMyFieldDb, CGridTableRec,
},
setup(props, { attrs, slots, emit }) {
const mytable = 'users'
const globalStore = useGlobalStore()
const userStore = useUserStore()
2021-12-17 18:30:18 +01:00
function getdefaultnewrec(): IMySkill {
return {
_id: 0,
idSector: 0,
idSkill: 0,
2021-12-31 01:44:16 +01:00
idSubSkill: [],
idStatusSkill: [],
2021-12-17 18:30:18 +01:00
idContribType: [],
idCity: [],
NumLevel: 0,
adType: 0,
photos: [],
note: '',
descr: '',
}
}
2021-12-11 00:25:35 +01:00
function extraparams() {
2022-01-03 21:53:41 +01:00
let lk_tab = 'users'
let lk_LF = 'userId'
let lk_FF = '_id'
let lk_as = 'user'
let af_objId_tab = 'myId'
if (props.username) {
// lk_LF = 'username'
}
2021-12-11 00:25:35 +01:00
return {
lookup1: {
2022-01-03 21:53:41 +01:00
lk_tab,
lk_LF,
lk_FF,
lk_as,
af_objId_tab,
lk_proj: {
2022-01-26 01:31:07 +01:00
recSkill: 1,
sector: 1,
idSector: 1,
idSkill: 1,
2021-12-31 01:44:16 +01:00
idSubSkill: 1,
myskill: 1,
2022-01-26 01:31:07 +01:00
idStatusSkill: 1,
idContribType: 1,
idCity: 1,
numLevel: 1,
adType: 1,
photos: 1,
note: 1,
descr: 1,
date_created: 1,
date_updated: 1,
userId: 1,
username: 1,
name: 1,
surname: 1,
2022-01-26 01:31:07 +01:00
comune: 1,
mycities: 1,
'profile.img': 1,
'profile.qualifica': 1,
}
},
lookup2: {
lk_tab: 'cities',
lk_LF: 'idCity',
lk_FF: '_id',
lk_as: 'comune',
af_objId_tab: '',
lk_proj: {
2022-01-26 01:31:07 +01:00
recSkill: 1,
sector: 1,
idSector: 1,
idSkill: 1,
idSubSkill: 1,
myskill: 1,
2022-01-26 01:31:07 +01:00
idStatusSkill: 1,
idContribType: 1,
idCity: 1,
numLevel: 1,
adType: 1,
photos: 1,
note: 1,
descr: 1,
date_created: 1,
date_updated: 1,
comune: 1,
userId: 1,
username: 1,
name: 1,
surname: 1,
'profile.img': 1,
'profile.qualifica': 1,
}
},
2021-12-11 00:25:35 +01:00
}
}
2021-10-08 00:38:22 +02:00
return {
tools,
costanti,
colmySkills,
getdefaultnewrec,
2021-12-11 00:25:35 +01:00
extraparams,
2021-10-08 00:38:22 +02:00
}
},
})