2023-03-19 00:43:28 +07:00
|
|
|
<!-- tab ข้อมูลส่วนบุคคล -->
|
|
|
|
|
<template>
|
|
|
|
|
<Information
|
|
|
|
|
:prefixOptions="prefixOptions"
|
2023-03-25 01:07:18 +07:00
|
|
|
:relationshipOptions="relationshipOptions"
|
2023-03-19 00:43:28 +07:00
|
|
|
:provinceOptions="provinceOptions"
|
|
|
|
|
v-model:statusEdit="statusEdit"
|
|
|
|
|
:notiNoEdit="notiNoEdit"
|
2023-03-25 01:07:18 +07:00
|
|
|
:status="status"
|
|
|
|
|
/>
|
|
|
|
|
<Address
|
|
|
|
|
:provinceOptions="provinceOptions"
|
|
|
|
|
v-model:statusEdit="statusEdit"
|
|
|
|
|
:notiNoEdit="notiNoEdit"
|
|
|
|
|
:status="status"
|
2023-03-19 00:43:28 +07:00
|
|
|
/>
|
|
|
|
|
<Family
|
|
|
|
|
:prefixOptions="prefixOptions"
|
|
|
|
|
v-model:statusEdit="statusEdit"
|
|
|
|
|
:notiNoEdit="notiNoEdit"
|
2023-03-25 01:07:18 +07:00
|
|
|
:status="status"
|
2023-03-19 00:43:28 +07:00
|
|
|
/>
|
2023-03-25 01:07:18 +07:00
|
|
|
<Occupation v-model:statusEdit="statusEdit" :notiNoEdit="notiNoEdit" :status="status" />
|
2023-03-28 14:51:48 +07:00
|
|
|
<Education
|
|
|
|
|
:loader="loader"
|
|
|
|
|
v-model:statusEdit="statusEdit"
|
|
|
|
|
:notiNoEdit="notiNoEdit"
|
|
|
|
|
:status="status"
|
|
|
|
|
/>
|
|
|
|
|
<Career
|
|
|
|
|
:loader="loader"
|
|
|
|
|
v-model:statusEdit="statusEdit"
|
|
|
|
|
:notiNoEdit="notiNoEdit"
|
|
|
|
|
:status="status"
|
|
|
|
|
/>
|
|
|
|
|
<Document
|
|
|
|
|
:loader="loader"
|
|
|
|
|
v-model:statusEdit="statusEdit"
|
|
|
|
|
:notiNoEdit="notiNoEdit"
|
|
|
|
|
:status="status"
|
|
|
|
|
/>
|
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 { useQuasar } from 'quasar'
|
|
|
|
|
import { useCounterMixin } from '@/stores/mixin'
|
|
|
|
|
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({
|
|
|
|
|
loader: {
|
|
|
|
|
//หน้า main มีการอัพเดทค่าให้ refresh data
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
statusEdit: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
2023-03-25 01:07:18 +07:00
|
|
|
status: {
|
|
|
|
|
type: String,
|
2023-03-19 00:43:28 +07:00
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2023-03-22 00:25:55 +07:00
|
|
|
const $q = useQuasar()
|
2023-03-21 16:30:02 +07:00
|
|
|
const mixin = useCounterMixin() //เรียกฟังก์ชันกลาง
|
2023-03-22 00:25:55 +07:00
|
|
|
const { modalError } = mixin
|
2023-03-19 00:43:28 +07:00
|
|
|
const loader = ref<boolean>(true)
|
|
|
|
|
const statusEdit = ref<boolean>(false)
|
|
|
|
|
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[]>([])
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:loader', 'update:statusEdit'])
|
|
|
|
|
|
|
|
|
|
watch(statusEdit, (count: boolean, prevCount: boolean) => {
|
|
|
|
|
emit('update:statusEdit', 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[] = []
|
|
|
|
|
// console.log(data);
|
|
|
|
|
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[] = []
|
|
|
|
|
// console.log(data);
|
|
|
|
|
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
|
|
|
const notiNoEdit = () => {
|
2023-03-22 00:25:55 +07:00
|
|
|
modalError($q, 'ไม่สามารถไม่สามารถแก้ไขข้อมูลได้', 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล')
|
2023-03-19 00:43:28 +07:00
|
|
|
}
|
|
|
|
|
</script>
|