diff --git a/src/api/exam/api.metadata.ts b/src/api/exam/api.metadata.ts index 5255dea..8f35838 100644 --- a/src/api/exam/api.metadata.ts +++ b/src/api/exam/api.metadata.ts @@ -1,7 +1,15 @@ import env from '../index' const dashbord = `${env.API_URI}/dashbord/` +const prefix = `${env.API_URI}/prefix/` +const religion = `${env.API_URI}/religion/` +const relationship = `${env.API_URI}/relationship/` +const educationLevel = `${env.API_URI}/education-level/` export default { countDashbordSubHistory: (type: number) => `${dashbord}${type}`, - countDashbordHistory: `${dashbord}` + countDashbordHistory: `${dashbord}`, + prefix, + religion, + relationship, + educationLevel } diff --git a/src/modules/01_exam/components/Form/Education.vue b/src/modules/01_exam/components/Form/Education.vue index 3e32400..986886f 100644 --- a/src/modules/01_exam/components/Form/Education.vue +++ b/src/modules/01_exam/components/Form/Education.vue @@ -67,14 +67,14 @@ lazy-rules :readonly="!edit" :borderless="!edit" - v-model="qualificationId" + v-model="educationLevel" :rules="[(val) => !!val || `${'กรุณาเลือกวุฒิที่ได้รับ'}`]" :label="`${'วุฒิที่ได้รับ'}`" @update:modelValue="clickEditRow" emit-value map-options option-label="name" - :options="qualificationOptions" + :options="educationLevelOptions" option-value="id" /> @@ -226,9 +226,10 @@ const store = useExamDataStore() const { examData, changeExamColumns } = store const loader = ref(false) const id = ref() +const educationLevel = ref() const qualification = ref() const qualificationId = ref() -const qualificationOptions = ref([]) +const educationLevelOptions = ref([]) const major = ref() const scores = ref() const name = ref() @@ -338,9 +339,31 @@ watch(edit, (count: boolean, prevCount: boolean) => { }) onMounted(async () => { - // await fetchData() + await fetchData() // await fetchQualification() + await fetcheducationLevel() }) +const fetchData = () => { + educationLevel.value = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c' +} + +const fetcheducationLevel = async () => { + // loader.value = true; + await http + .get(config.API.educationLevel) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + data.map((r: DataOption) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + educationLevelOptions.value = option + }) + .catch((e) => {}) + .finally(() => { + // loader.value = false; + }) +} const fetchQualification = async () => { // loader.value = true; @@ -360,9 +383,9 @@ const fetchQualification = async () => { // }) } -const fetchData = async () => { - editRow.value = false -} +// const fetchData = async () => { +// editRow.value = false +// } /** * กดดูข้อมูลก่อนหน้า diff --git a/src/modules/01_exam/components/Form/Profile/Family.vue b/src/modules/01_exam/components/Form/Profile/Family.vue index 7a018af..6960d0a 100644 --- a/src/modules/01_exam/components/Form/Profile/Family.vue +++ b/src/modules/01_exam/components/Form/Profile/Family.vue @@ -48,11 +48,11 @@ :outlined="edit" dense lazy-rules - v-model="familyData.prefixIdC" + v-model="prefixRelation" emit-value map-options option-label="name" - :options="prefixOptions" + :options="prefixRelationOptions" option-value="id" :label="`${'คำนำหน้า'}`" /> @@ -126,11 +126,11 @@ :outlined="edit" dense lazy-rules - v-model="familyData.prefixIdM" + v-model="prefixDad" emit-value map-options option-label="name" - :options="prefixOptions" + :options="prefixDadOptions" option-value="id" :label="`${'คำนำหน้า'}`" /> @@ -204,11 +204,11 @@ :outlined="edit" dense lazy-rules - v-model="familyData.prefixIdF" + v-model="prefixMom" emit-value map-options option-label="name" - :options="prefixOptions" + :options="prefixMomOptions" option-value="id" :label="`${'คำนำหน้า'}`" /> @@ -287,11 +287,18 @@ import { defaultFamily } from '@/modules/01_exam/interface/index/Main' import HeaderTop from '@/components/top.vue' import Conference from '@/modules/01_exam/components/Conference.vue' import { useExamDataStore } from '@/modules/01_exam/store' +import http from '@/plugins/http' +import config from '@/app.config' const mixin = useCounterMixin() const store = useExamDataStore() const { date2Thai, calAge } = mixin - +const prefixRelation = ref() +const prefixMom = ref() +const prefixDad = ref() +const prefixDadOptions = ref([]) +const prefixMomOptions = ref([]) +const prefixRelationOptions = ref([]) const edit = ref(false) const myform = ref() const familyData = ref(defaultFamily) @@ -325,7 +332,71 @@ const props = defineProps({ const emit = defineEmits(['update:statusEdit']) -onMounted(() => {}) +onMounted(async () => { + await fetchData() + await fetchprefixMom() + await fetchprefixDad() + await fetchprefixRelation() +}) +const fetchData = () => { + prefixRelation.value = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c' + prefixDad.value = '02fbc0e3-1da0-45b5-90da-783d344b5896' + prefixMom.value = '362405f7-9ca2-4f3a-b5ac-08b56c24555d' +} + +const fetchprefixMom = async () => { + // loader.value = true; + await http + .get(config.API.prefix) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + data.map((r: DataOption) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + prefixMomOptions.value = option + }) + .catch((e) => {}) + .finally(() => { + // loader.value = false; + }) +} + +const fetchprefixDad = async () => { + // loader.value = true; + await http + .get(config.API.prefix) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + data.map((r: DataOption) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + prefixDadOptions.value = option + }) + .catch((e) => {}) + .finally(() => { + // loader.value = false; + }) +} + +const fetchprefixRelation = async () => { + // loader.value = true; + await http + .get(config.API.prefix) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + data.map((r: DataOption) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + prefixRelationOptions.value = option + }) + .catch((e) => {}) + .finally(() => { + // loader.value = false; + }) +} const saveData = async () => { if (store.consend == true) { diff --git a/src/modules/01_exam/components/Form/Profile/Information.vue b/src/modules/01_exam/components/Form/Profile/Information.vue index 46cd7cf..071045b 100644 --- a/src/modules/01_exam/components/Form/Profile/Information.vue +++ b/src/modules/01_exam/components/Form/Profile/Information.vue @@ -25,7 +25,7 @@ :outlined="edit" dense lazy-rules - v-model="informaData.prefixId" + v-model="prefix" emit-value map-options option-label="name" @@ -136,11 +136,11 @@ :outlined="edit" dense lazy-rules - v-model="informaData.statusId" + v-model="relationship" emit-value map-options option-label="name" - :options="statusOptions" + :options="relationshipOptions" option-value="id" :label="`${'สถานภาพ'}`" /> @@ -349,6 +349,11 @@ import { useExamDataStore } from '@/modules/01_exam/store' const mixin = useCounterMixin() const store = useExamDataStore() const { date2Thai, calAge } = mixin +const prefix = ref() +const relationship = ref() + +const prefixOptions = ref([]) +const relationshipOptions = ref([]) const edit = ref(false) const informaData = ref(defaultInformation) @@ -401,6 +406,8 @@ const emit = defineEmits(['update:statusEdit']) onMounted(() => { // fetchProvince() + fetchprefix() + fetchrelationship() }) const saveData = async () => { @@ -448,7 +455,41 @@ const fetchProvince = async () => { // // loader.value = false; // }) } +const fetchprefix = async () => { + // loader.value = true; + await http + .get(config.API.prefix) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + data.map((r: DataOption) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + prefixOptions.value = option + }) + .catch((e) => {}) + .finally(() => { + // loader.value = false; + }) +} +const fetchrelationship = async () => { + // loader.value = true; + await http + .get(config.API.relationship) + .then((res) => { + const data = res.data.result + let option: DataOption[] = [] + data.map((r: DataOption) => { + option.push({ id: r.id.toString(), name: r.name.toString() }) + }) + relationshipOptions.value = option + }) + .catch((e) => {}) + .finally(() => { + // loader.value = false; + }) +} const savePic = () => { disabledPic.value = false } diff --git a/src/plugins/keycloak.ts b/src/plugins/keycloak.ts index 7aeee92..2525d50 100644 --- a/src/plugins/keycloak.ts +++ b/src/plugins/keycloak.ts @@ -8,11 +8,13 @@ import Keycloak from 'keycloak-js' const initOptions = { // url: "https://keycloak.frappet.synology.me/auth/", - // realm: "bma-ehr", - // clientId: "bma-ehr-vue3", + // realm: "bma-ehr", + // clientId: "bma-ehr-vue3", url: 'https://identity.frappet.com/', - realm: 'exam_test', - clientId: 'exam_vue3' + // realm: 'exam_test', + // clientId: 'exam_vue3' + realm: 'bma-ehr', + clientId: 'bma-ehr-vue3' } //option keycloak ที่จะ connect const keycloak = Keycloak(initOptions)