ต่อapiคนสมัครกรอกข้อมูลสมัครสอบ

This commit is contained in:
Kittapath 2023-03-25 01:07:18 +07:00
parent f74972e5ec
commit b7a91fa326
16 changed files with 567 additions and 522 deletions

View file

@ -2,35 +2,37 @@
<template>
<Information
:prefixOptions="prefixOptions"
:genderOptions="genderOptions"
:bloodOptions="bloodOptions"
:statusOptions="statusOptions"
:religionOptions="religionOptions"
:relationshipOptions="relationshipOptions"
:provinceOptions="provinceOptions"
v-model:statusEdit="statusEdit"
:notiNoEdit="notiNoEdit"
:step="step"
:status="status"
/>
<Address
:provinceOptions="provinceOptions"
v-model:statusEdit="statusEdit"
:notiNoEdit="notiNoEdit"
:status="status"
/>
<Address v-model:statusEdit="statusEdit" :notiNoEdit="notiNoEdit" :step="step" />
<Family
:prefixOptions="prefixOptions"
v-model:statusEdit="statusEdit"
:notiNoEdit="notiNoEdit"
:step="step"
:status="status"
/>
<Occupation v-model:statusEdit="statusEdit" :notiNoEdit="notiNoEdit" :step="step" />
<Occupation v-model:statusEdit="statusEdit" :notiNoEdit="notiNoEdit" :status="status" />
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import http from '@/plugins/http'
import config from '@/app.config'
import type { DataOption } from '@/modules/01_exam/interface/index/Main'
import Information from '@/modules/01_exam/components/Form/Profile/Information.vue'
import Address from '@/modules/01_exam/components/Form/Profile/Address.vue'
import Family from '@/modules/01_exam/components/Form/Profile/Family.vue'
import Occupation from '@/modules/01_exam/components/Form/Profile/Occupation.vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
const props = defineProps({
loader: {
@ -42,8 +44,8 @@ const props = defineProps({
type: Boolean,
required: true
},
step: {
type: Number,
status: {
type: String,
required: true
}
})
@ -54,10 +56,7 @@ const { modalError } = mixin
const loader = ref<boolean>(true)
const statusEdit = ref<boolean>(false)
const prefixOptions = ref<DataOption[]>([])
const bloodOptions = ref<DataOption[]>([])
const genderOptions = ref<DataOption[]>([])
const statusOptions = ref<DataOption[]>([])
const religionOptions = ref<DataOption[]>([])
const relationshipOptions = ref<DataOption[]>([])
const provinceOptions = ref<DataOption[]>([])
const emit = defineEmits(['update:loader', 'update:statusEdit'])
@ -66,6 +65,68 @@ watch(statusEdit, (count: boolean, prevCount: boolean) => {
emit('update:statusEdit', count)
})
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
})
}
const notiNoEdit = () => {
modalError($q, 'ไม่สามารถไม่สามารถแก้ไขข้อมูลได้', 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล')
}