2023-03-19 00:43:28 +07:00
|
|
|
<!-- tab ข้อมูลส่วนบุคคล -->
|
|
|
|
|
<template>
|
2023-03-29 16:39:45 +07:00
|
|
|
<div class="q-px-sm">
|
|
|
|
|
<Information
|
|
|
|
|
:prefixOptions="prefixOptions"
|
|
|
|
|
:relationshipOptions="relationshipOptions"
|
|
|
|
|
:provinceOptions="provinceOptions"
|
|
|
|
|
:status="status"
|
2023-03-30 13:42:08 +07:00
|
|
|
v-model:form="formInformation"
|
2023-03-29 16:39:45 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
2023-03-30 13:42:08 +07:00
|
|
|
|
2023-03-29 16:39:45 +07:00
|
|
|
<q-separator class="q-my-lg bg-gray" size="5px" />
|
|
|
|
|
<div class="q-px-sm">
|
2023-03-30 22:37:24 +07:00
|
|
|
<Address :provinceOptions="provinceOptions" :status="status" v-model:form="formAddress" />
|
2023-03-29 16:39:45 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-separator class="q-my-lg bg-gray" size="5px" />
|
|
|
|
|
<div class="q-px-sm">
|
2023-03-30 22:37:24 +07:00
|
|
|
<Family :prefixOptions="prefixOptions" :status="status" v-model:form="formFamily" />
|
2023-03-29 16:39:45 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-separator class="q-my-lg bg-gray" size="5px" />
|
|
|
|
|
<div class="q-px-sm">
|
2023-03-30 22:37:24 +07:00
|
|
|
<Occupation :status="status" v-model:form="formOccupation" />
|
2023-03-29 16:39:45 +07:00
|
|
|
</div>
|
2023-03-30 13:42:08 +07:00
|
|
|
|
2023-03-29 16:39:45 +07:00
|
|
|
<q-separator class="q-my-lg bg-gray" size="5px" />
|
|
|
|
|
<div class="q-px-sm">
|
2023-03-30 22:37:24 +07:00
|
|
|
<Education :status="status" />
|
2023-03-29 16:39:45 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-separator class="q-my-lg bg-gray" size="5px" />
|
|
|
|
|
<div class="q-px-sm">
|
2023-03-30 22:37:24 +07:00
|
|
|
<Career :status="status" />
|
2023-03-29 16:39:45 +07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<q-separator class="q-my-lg bg-gray" size="5px" />
|
|
|
|
|
<div class="q-px-sm">
|
2023-03-30 22:37:24 +07:00
|
|
|
<Document :status="status" />
|
2023-03-29 16:39:45 +07:00
|
|
|
</div>
|
2023-03-19 00:43:28 +07:00
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted, watch } from 'vue'
|
2023-03-25 01:07:18 +07:00
|
|
|
import http from '@/plugins/http'
|
|
|
|
|
import config from '@/app.config'
|
2023-03-19 00:43:28 +07:00
|
|
|
import type { DataOption } from '@/modules/01_exam/interface/index/Main'
|
2023-03-28 14:51:48 +07:00
|
|
|
import Information from '@/modules/01_exam/components/Form/Information.vue'
|
|
|
|
|
import Address from '@/modules/01_exam/components/Form/Address.vue'
|
|
|
|
|
import Family from '@/modules/01_exam/components/Form/Family.vue'
|
|
|
|
|
import Occupation from '@/modules/01_exam/components/Form/Occupation.vue'
|
|
|
|
|
import Education from '@/modules/01_exam/components/Form/Education.vue'
|
|
|
|
|
import Career from '@/modules/01_exam/components/Form/Career.vue'
|
|
|
|
|
import Document from '@/modules/01_exam/components/Form/Document.vue'
|
2023-03-19 00:43:28 +07:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
2023-03-25 01:07:18 +07:00
|
|
|
status: {
|
|
|
|
|
type: String,
|
2023-03-19 00:43:28 +07:00
|
|
|
required: true
|
2023-03-30 13:42:08 +07:00
|
|
|
},
|
|
|
|
|
formInformation: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
formAddress: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
formFamily: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
formOccupation: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
2023-03-19 00:43:28 +07:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const loader = ref<boolean>(true)
|
|
|
|
|
const prefixOptions = ref<DataOption[]>([])
|
2023-03-25 01:07:18 +07:00
|
|
|
const relationshipOptions = ref<DataOption[]>([])
|
2023-03-19 00:43:28 +07:00
|
|
|
const provinceOptions = ref<DataOption[]>([])
|
2023-03-30 13:42:08 +07:00
|
|
|
const formInformation = ref<any>({})
|
|
|
|
|
const formAddress = ref<any>({})
|
|
|
|
|
const formFamily = ref<any>({})
|
|
|
|
|
const formOccupation = ref<any>({})
|
2023-03-19 00:43:28 +07:00
|
|
|
|
2023-03-30 13:42:08 +07:00
|
|
|
const emit = defineEmits([
|
|
|
|
|
'update:formInformation',
|
|
|
|
|
'update:formAddress',
|
|
|
|
|
'update:formFamily',
|
|
|
|
|
'update:formOccupation'
|
|
|
|
|
])
|
2023-03-19 00:43:28 +07:00
|
|
|
|
2023-03-30 13:42:08 +07:00
|
|
|
watch(formInformation, async (count: Object, prevCount: Object) => {
|
|
|
|
|
emit('update:formInformation', count)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(formAddress, async (count: Object, prevCount: Object) => {
|
|
|
|
|
emit('update:formAddress', count)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(formFamily, async (count: Object, prevCount: Object) => {
|
|
|
|
|
emit('update:formFamily', count)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(formOccupation, async (count: Object, prevCount: Object) => {
|
|
|
|
|
emit('update:formOccupation', count)
|
|
|
|
|
})
|
|
|
|
|
|
2023-03-25 01:07:18 +07:00
|
|
|
onMounted(() => {
|
|
|
|
|
fetchPrefix()
|
|
|
|
|
fetchRelationship()
|
|
|
|
|
fetchProvince()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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: any) => {
|
|
|
|
|
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: any) => {
|
|
|
|
|
option.push({ id: r.id.toString(), name: r.name.toString() })
|
|
|
|
|
})
|
|
|
|
|
relationshipOptions.value = option
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
loader.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fetchProvince = async () => {
|
|
|
|
|
loader.value = true
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.province)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data.result
|
|
|
|
|
let option: DataOption[] = []
|
|
|
|
|
data.map((r: any) => {
|
|
|
|
|
option.push({ id: r.id.toString(), name: r.name.toString() })
|
|
|
|
|
})
|
|
|
|
|
provinceOptions.value = option
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
loader.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
2023-03-19 00:43:28 +07:00
|
|
|
</script>
|