From d5436f3cd990af1898b7acf2775c4a0ed63b9394 Mon Sep 17 00:00:00 2001 From: AnandaTon <125332905+anandaAiemvong@users.noreply.github.com> Date: Tue, 21 Mar 2023 15:48:21 +0700 Subject: [PATCH 1/4] Update keycloak.ts --- src/plugins/keycloak.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) From 54bd567401bda1bf9421ed21279aa440c5f364d0 Mon Sep 17 00:00:00 2001 From: AnandaTon <125332905+anandaAiemvong@users.noreply.github.com> Date: Tue, 21 Mar 2023 16:31:45 +0700 Subject: [PATCH 2/4] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=20api=20=E0=B8=84=E0=B8=B3=E0=B8=99=E0=B8=B3=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=89=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Form/Profile/Information.vue | 24 +++++++++++++++++-- src/plugins/keycloak.ts | 10 ++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/modules/01_exam/components/Form/Profile/Information.vue b/src/modules/01_exam/components/Form/Profile/Information.vue index 01c7a4f..1495c13 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" @@ -339,6 +339,9 @@ import type { file } from '@babel/types' const mixin = useCounterMixin() const { date2Thai, calAge } = mixin +const prefix = ref() + +const prefixOptions = ref([]) const edit = ref(false) const informaData = ref(defaultInformation) @@ -390,6 +393,7 @@ const emit = defineEmits(['update:statusEdit']) onMounted(() => { // fetchProvince() + fetchprefix() }) const saveData = async () => { @@ -431,7 +435,23 @@ 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 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) From c289ed17adc0bc68bf8a048d2ff56b47c06da338 Mon Sep 17 00:00:00 2001 From: AnandaTon <125332905+anandaAiemvong@users.noreply.github.com> Date: Tue, 21 Mar 2023 17:24:01 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=AD=20Api=20prefix?= =?UTF-8?q?=20/educationLevel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/exam/api.metadata.ts | 10 ++- .../01_exam/components/Form/Education.vue | 26 +++++- .../components/Form/Profile/Family.vue | 87 +++++++++++++++++-- .../components/Form/Profile/Information.vue | 25 +++++- 4 files changed, 134 insertions(+), 14 deletions(-) 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 4765502..ef0f20f 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" /> @@ -220,9 +220,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() @@ -333,8 +334,27 @@ watch(edit, (count: boolean, prevCount: boolean) => { onMounted(async () => { // await fetchData() // await fetchQualification() + fetcheducationLevel() }) +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; // await http diff --git a/src/modules/01_exam/components/Form/Profile/Family.vue b/src/modules/01_exam/components/Form/Profile/Family.vue index 82395ad..aa7a401 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="`${'คำนำหน้า'}`" /> @@ -280,10 +280,17 @@ import { useCounterMixin } from '@/stores/mixin' import type { Family, DataOption } from '@/modules/01_exam/interface/index/Main' import { defaultFamily } from '@/modules/01_exam/interface/index/Main' import HeaderTop from '@/components/top.vue' +import http from '@/plugins/http' +import config from '@/app.config' const mixin = useCounterMixin() 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) @@ -316,7 +323,71 @@ const props = defineProps({ const emit = defineEmits(['update:statusEdit']) -onMounted(() => {}) +onMounted(() => { + fetchData() + fetchprefixMom() + fetchprefixDad() + 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 () => { await myform.value.validate().then(async (success: boolean) => { diff --git a/src/modules/01_exam/components/Form/Profile/Information.vue b/src/modules/01_exam/components/Form/Profile/Information.vue index 1495c13..3aa1bd7 100644 --- a/src/modules/01_exam/components/Form/Profile/Information.vue +++ b/src/modules/01_exam/components/Form/Profile/Information.vue @@ -135,11 +135,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="`${'สถานภาพ'}`" /> @@ -340,8 +340,10 @@ import type { file } from '@babel/types' const mixin = useCounterMixin() const { date2Thai, calAge } = mixin const prefix = ref() +const relationship = ref() const prefixOptions = ref([]) +const relationshipOptions = ref([]) const edit = ref(false) const informaData = ref(defaultInformation) @@ -394,6 +396,7 @@ const emit = defineEmits(['update:statusEdit']) onMounted(() => { // fetchProvince() fetchprefix() + fetchrelationship() }) const saveData = async () => { @@ -452,6 +455,24 @@ const fetchprefix = async () => { // 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 } From eedafc68911349db80ae67feb3482e697c2337fc Mon Sep 17 00:00:00 2001 From: AnandaTon <125332905+anandaAiemvong@users.noreply.github.com> Date: Tue, 21 Mar 2023 17:36:02 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=AD=20api=20?= =?UTF-8?q?=E0=B8=84=E0=B8=B3=E0=B8=99=E0=B8=B3=E0=B8=AB=E0=B8=99=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=20/=E0=B8=A7=E0=B8=B8=E0=B8=92=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=A8=E0=B8=B6=E0=B8=81=E0=B8=A9=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/01_exam/components/Form/Education.vue | 13 ++++++++----- .../01_exam/components/Form/Profile/Family.vue | 10 +++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/modules/01_exam/components/Form/Education.vue b/src/modules/01_exam/components/Form/Education.vue index ef0f20f..5a6fc80 100644 --- a/src/modules/01_exam/components/Form/Education.vue +++ b/src/modules/01_exam/components/Form/Education.vue @@ -332,10 +332,13 @@ watch(edit, (count: boolean, prevCount: boolean) => { }) onMounted(async () => { - // await fetchData() + await fetchData() // await fetchQualification() - fetcheducationLevel() + await fetcheducationLevel() }) +const fetchData = () => { + educationLevel.value = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c' +} const fetcheducationLevel = async () => { // loader.value = true; @@ -373,9 +376,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 aa7a401..58bb57b 100644 --- a/src/modules/01_exam/components/Form/Profile/Family.vue +++ b/src/modules/01_exam/components/Form/Profile/Family.vue @@ -323,11 +323,11 @@ const props = defineProps({ const emit = defineEmits(['update:statusEdit']) -onMounted(() => { - fetchData() - fetchprefixMom() - fetchprefixDad() - fetchprefixRelation() +onMounted(async () => { + await fetchData() + await fetchprefixMom() + await fetchprefixDad() + await fetchprefixRelation() }) const fetchData = () => { prefixRelation.value = 'e4e6a4f8-39c6-467f-bd84-7650d105fc4c'