เลือกวุฒิการศึกษา

This commit is contained in:
Kittapath 2023-10-06 17:33:13 +07:00
parent 07dad32620
commit 96f92a5b69
6 changed files with 55 additions and 17 deletions

View file

@ -241,6 +241,7 @@ const saveData = async () => {
notifyError($q, 'กรุณาอัพโหลดรูปถ่าย')
return
}
console.log(defaultInformation.value.tel)
await formInformation.value.validate().then(async (suc: boolean) => {
if (suc) {
await formAddress.value.validate().then(async (suc: boolean) => {

View file

@ -27,9 +27,10 @@
v-model="defaultEducation.educationLevelExamId"
:rules="[(val) => !!val || `${'กรุณาเลือก วุฒิที่ใช้สมัครสอบ'}`]"
:label="`${'วุฒิที่ใช้สมัครสอบ'}`"
@update:model-value="(value) => checkInputName()"
/>
</div>
<div class="col-xs-12 col-sm-3">
<div class="col-xs-12 col-sm-3" v-if="showEducationName">
<q-input
:class="getClass(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
@ -114,7 +115,11 @@
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
:model-value="date2Thai(defaultEducation.educationEndDate)"
:model-value="
defaultEducation.educationEndDate == null
? null
: date2Thai(defaultEducation.educationEndDate)
"
:rules="[(val) => !!val || `${'กรุณาเลือกวันที่สำเร็จการศึกษา'}`]"
:label="`${'วันที่สำเร็จการศึกษา'}`"
>
@ -200,6 +205,7 @@ const props = defineProps({
const $q = useQuasar()
const edit = ref<boolean>(true)
const showEducationName = ref<boolean>(true)
const myform = ref<any>({})
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
@ -245,9 +251,11 @@ const fetchData = async () => {
defaultEducation.value.educationMajor = data.educationMajor
defaultEducation.value.educationLocation = data.educationLocation
defaultEducation.value.educationType = data.educationType
defaultEducation.value.educationEndDate = new Date(data.educationEndDate)
defaultEducation.value.educationEndDate =
data.educationEndDate == null ? null : new Date(data.educationEndDate)
defaultEducation.value.educationScores = data.educationScores
defaultEducation.value.educationLevelHighId = data.educationLevelHighId
checkInputName()
})
.catch((e) => {
// messageError($q, e)
@ -257,6 +265,17 @@ const fetchData = async () => {
})
}
const checkInputName = () => {
showEducationName.value =
props.educationLevelOptions.filter(
(x) =>
x.id == defaultEducation.value.educationLevelExamId &&
(x.name == 'ปริญญาตรี' || x.name == 'ปริญญาโท' || x.name == 'ปริญญาเอก')
).length == 0
? false
: true
}
const getClass = (val: boolean) => {
return {
'full-width inputgreen cursor-pointer': val,

View file

@ -224,6 +224,7 @@
v-model="defaultInformation.tel"
:label="`${'โทรศัพท์'}`"
:rules="[
(val) => !!val || `${'กรุณากรอก โทรศัพท์'}`,
(val) => val.length == 10 || `${'กรุณากรอก โทรศัพท์'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกข้อมูลโทรศัพท์ให้ถูกต้อง'}`
]"
@ -424,6 +425,7 @@ const img = ref<string>('')
const fileProfile = ref<File[]>([])
const cardid1 = ref<string | null>('')
const cardid2 = ref<string | null>('')
const registerEndDate = ref<Date>(new Date())
const opNat = ref(['ไทย'])
const idModel = ref<boolean>(false)
@ -441,6 +443,7 @@ onMounted(async () => {
await fetchImgData()
if (defaultInformation.value.provinceId != null)
await fetchDistrict(defaultInformation.value.provinceId)
candidateCheck()
})
const fetchData = async () => {
@ -454,8 +457,8 @@ const fetchData = async () => {
if (data.lastName == null || data.lastName == '') {
data.lastName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.family_name
}
if (data.firstname == null || data.firstname == '') {
data.firstname = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.given_name
if (data.firstName == null || data.firstName == '') {
data.firstName = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.given_name
}
if (data.email == null || data.email == '') {
data.email = keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.email
@ -521,17 +524,33 @@ const selectPrefix = async () => {
}
const selectBirthDate = async () => {
if (defaultInformation.value.birthDate != null) {
console.log(calAgeYear(defaultInformation.value.birthDate))
if (calAgeYear(defaultInformation.value.birthDate) < 18) {
if (calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) < 18) {
defaultInformation.value.birthDate = null
notifyError($q, 'อายุไม่ถึง18')
} else if (calAgeYear(defaultInformation.value.birthDate) > 60) {
} else if (calAgeYear(defaultInformation.value.birthDate, registerEndDate.value) > 60) {
defaultInformation.value.birthDate = null
notifyError($q, 'อายุเกิน60')
}
}
}
const candidateCheck = async () => {
loaderPage(true)
await http
.get(config.API.candidateCheckCreate(examId.value, positionId.value))
.then(async (res) => {
const data = res.data.result
registerEndDate.value =
data.registerEndDate == null ? new Date() : new Date(data.registerEndDate)
})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loaderPage(false)
})
}
const fetchImgData = async () => {
loaderPage(true)
await http

View file

@ -126,6 +126,7 @@
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.tel"
:rules="[
(val) => !!val || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
(val) => val.length == 10 || `${'กรุณากรอก เบอร์โทรที่ทำงาน'}`,
(val) => /^[0-9]*$/.test(val) || 'กรุณากรอก เบอร์โทรที่ทำงานให้ถูกต้อง'
]"

View file

@ -85,7 +85,7 @@ interface Education {
educationMajor: string | null
educationLocation: string | null
educationType: string | null
educationEndDate: Date
educationEndDate: Date | null
educationScores: number | null
educationLevelHighId: string | null
}
@ -154,7 +154,7 @@ const defaultInformation = ref<Information>({
prefixId: null,
firstname: null,
lastname: null,
birthDate: new Date(),
birthDate: null,
genderId: null,
bloodId: null,
nationality: 'ไทย',
@ -219,7 +219,7 @@ const defaultEducation = ref<Education>({
educationMajor: null,
educationLocation: null,
educationType: null,
educationEndDate: new Date(),
educationEndDate: null,
educationScores: null,
educationLevelHighId: null
})

View file

@ -6,9 +6,7 @@
{{ tittle }}
{{ `ครั้งที่${round}/${yearly == null ? '' : yearly + 543}` }}
</div>
<div class="col-12">
{{ position }} ระด{{ positionLevel }}
</div>
<div class="col-12">{{ position }} ระด{{ positionLevel }}</div>
</div>
</q-toolbar>
<!-- <q-toolbar class="q-pa-sm text-center">
@ -81,7 +79,7 @@
</q-card>
</q-dialog>
<q-dialog :model-value="timeout" persistent>
<q-card :style="$q.screen.gt.xs ? 'min-width: 30vw' : 'min-width: 80vw'" class=" q-pa-sm">
<q-card :style="$q.screen.gt.xs ? 'min-width: 30vw' : 'min-width: 80vw'" class="q-pa-sm">
<q-card-section class="row items-center col-12">
<div class="column col-12 text-center">
<div><q-icon name="mdi-alert-outline" size="50px" color="pink" /></div>
@ -177,8 +175,8 @@ const candidateCheck = async () => {
stepRaw.value = 2
step.value = 2
} else {
registerStartDate.value = new Date(data.registerEndDate)
registerEndDate.value = new Date(data.registerStartDate)
registerStartDate.value = new Date(data.registerStartDate)
registerEndDate.value = new Date(data.registerEndDate)
timeout.value = true
}
}