ต่อapiสมัครสอบ

This commit is contained in:
Kittapath 2023-10-04 09:46:36 +07:00
parent 16dd4c2fe8
commit e1020ab6fe
6 changed files with 168 additions and 66 deletions

View file

@ -57,8 +57,8 @@
</div>
</q-card>
<q-card bordered flat class="q-pa-md q-mt-sm">
<div class="col-12 text-weight-bold">ผลคะแนนสอบ</div>
<div class="row items-center q-gutter-y-sm col-12">
<div class="col-12 text-weight-bold" v-if="scoreSumFull != 0">ผลคะแนนสอบ</div>
<div class="row items-center q-gutter-y-sm col-12" v-if="scoreSumFull != 0">
<div class="col-xs-4 col-sm-5 text-weight-medium text-grey-7">ประเภท</div>
<div class="col-xs-3 col-sm-2 text-primary text-weight-bold text-center">คะแนนเต</div>
<div class="col-xs-3 col-sm-2 text-primary text-weight-bold text-center">คะแนนทได</div>
@ -106,6 +106,8 @@
examResultinscore
}}</span>
</div>
</div>
<div class="row items-center q-gutter-y-sm col-12">
<div class="col-xs-6 col-sm-5 text-grey-7">ตำแหน</div>
<div class="col-xs-6 col-sm-7 q-pr-xs">
{{ position }}

View file

@ -87,7 +87,7 @@
<div class="q-pt-xs row">
<div class=""> :</div>
<div class="text-black text-bold q-pl-sm">
{{ defaultInformation.firstname }}{{ defaultInformation.firstname }}
{{ defaultInformation.prefix }}{{ defaultInformation.firstname }}
{{ defaultInformation.lastname }}
</div>
</div>

View file

@ -282,7 +282,7 @@ const { loaderPage } = dataStore
const id = ref<string>('')
const type = ref<string | null>()
const opType = ref(['ลูกจ้างประจำ','ลูกจ้างชั่วคราว','ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร'])
const opType = ref(['ลูกจ้างประจำ', 'ลูกจ้างชั่วคราว', 'ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร'])
const position = ref<string | null>()
const group = ref<string | null>()
@ -334,7 +334,6 @@ const columns = ref<any>([
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })
},
{
name: 'type',
align: 'left',
@ -493,6 +492,7 @@ const clickPrevious = async () => {
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
position.value = row.position
type.value = row.type
group.value = row.group
pile.value = row.pile
org.value = row.org
@ -510,6 +510,7 @@ const clickNext = async () => {
rowIndex.value += 1
const row = rows.value[rowIndex.value]
position.value = row.position
type.value = row.type
group.value = row.group
pile.value = row.pile
org.value = row.org
@ -600,6 +601,7 @@ const saveData = async () => {
await http
.post(config.API.candidateCareer(examId.value, positionId.value), {
position: position.value,
type: type.value,
group: group.value,
pile: pile.value,
org: org.value,
@ -627,6 +629,7 @@ const editData = async () => {
await http
.put(config.API.candidateCareer(id.value, ''), {
position: position.value,
type: type.value,
group: group.value,
pile: pile.value,
org: org.value,
@ -676,6 +679,7 @@ const selectData = (props: any) => {
rawItem.value = props.row
rowIndex.value = props.rowIndex
position.value = props.row.position
type.value = props.row.type
group.value = props.row.group
pile.value = props.row.pile
org.value = props.row.org
@ -694,6 +698,7 @@ const addRow = () => {
modalEdit.value = false
modal.value = true
position.value = null
type.value = null
group.value = null
pile.value = null
org.value = null

View file

@ -13,14 +13,33 @@
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-4">
<q-field outlined bottom-slots :stack-label="defaultInformation.cardid != null" label="เลขประจำตัวประชาชน" counter maxlength="12" dense>
<q-field
:outlined="status == 'register' || status == 'rejectRegister'"
bottom-slots
:stack-label="defaultInformation.cardid != null"
label="เลขประจำตัวประชาชน"
dense
:readonly="!(status == 'register' || status == 'rejectRegister')"
:class="getClass(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
:rules="[(val) => !!val || `${'กรุณากรอก เลขประจำตัวประชาชน'}`]"
>
<template v-slot:prepend>
<q-btn round flat dense size="md" @click="idDialog">
<q-btn
round
flat
dense
size="md"
@click="idDialog"
v-if="status == 'register' || status == 'rejectRegister'"
>
<q-icon name="mdi-pencil-outline" color="primary" />
</q-btn>
</template>
<template v-slot:control>
<div class="self-center full-width no-outline" tabindex="0">{{defaultInformation.cardid}}</div>
<div class="self-center full-width no-outline" tabindex="0">
{{ defaultInformation.cardid }}
</div>
</template>
</q-field>
<!-- <q-input
@ -58,6 +77,7 @@
:options="prefixOptions"
option-value="id"
:label="`${'คำนำหน้า'}`"
@update:model-value="(value) => selectPrefix()"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
@ -86,14 +106,15 @@
:label="`${'นามสกุล'}`"
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3"><!-- :borderless="!false" -->
<div class="col-xs-12 col-sm-3 col-md-3">
<!-- :borderless="!false" -->
<q-select
:class="getClass(false)"
:class="getClass(status == 'register' || status == 'rejectRegister')"
dense
:outlined="status == 'register' || status == 'rejectRegister'"
:readonly="!(status == 'register' ||status == 'rejectRegister')"
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
lazy-rules
lazy-rules
v-model="defaultInformation.nationality"
:options="opNat"
:rules="[(val) => !!val || `${'กรุณากรอก สัญชาติ'}`]"
@ -128,6 +149,7 @@
week-start="0"
:max-date="new Date()"
:disabled="!(status == 'register' || status == 'rejectRegister')"
@update:modelValue="selectBirthDate"
>
<template #year="{ year }">
{{ year + 543 }}
@ -223,7 +245,8 @@
:label="`${'โทรศัพท์มือถือ'}`"
/>
</div> -->
<div class="col-xs-12 col-sm-3 col-md-3"><!-- style="padding: 0 12px" -->
<div class="col-xs-12 col-sm-3 col-md-3">
<!-- style="padding: 0 12px" -->
<q-input
:class="getClass(status == 'register' || status == 'rejectRegister')"
dense
@ -239,7 +262,7 @@
</div>
<div class="row col-xs-12 col-sm-6 col-md-3 justify-end">
<q-card bordered class="col-11 q-pa-sm justify-center text-center q-mt-sm">
<div class=" text-weight-medium q-py-xs">ปโหลดรปถาย</div>
<div class="text-weight-medium q-py-xs">ปโหลดรปถาย</div>
<div class="containerimage row justify-center col-xs-6 col-sm-10 col-md-12">
<label for="file-upload" class="col-12 row justify-center">
<q-img v-if="img == ''" src="@/assets/avatar_user.jpg" class="col-6">
@ -263,7 +286,7 @@
</label>
<input id="file-upload" type="file" accept="image/*" @change="uploadImage" />
</div>
<div class=" text-caption q-pt-sm text-grey-7">
<div class="text-caption q-pt-sm text-grey-7">
<div>ปถายหนาตรง ดสภาพ</div>
<div>ไมสวมหมวก/แวนตาดำ</div>
<div>และไมลวดลายใด บนรปถาย</div>
@ -288,54 +311,54 @@
<!-- dialog กรอกเลขบตร -->
<q-dialog v-model="idModel">
<q-card style="width: 350px">
<q-card-section class="bg-grey-2 q-py-sm">
<div class="text-subtitle1 text-weight-medium">กรอกเลขประจำตวประชาชน</div>
</q-card-section>
<q-separator color="grey-4" />
<q-card-section>
<q-input
:class="getClass(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
type="tel"
mask="#############"
:counter="status == 'register' || status == 'rejectRegister' ? true : false"
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultInformation.cardid"
maxlength="13"
:rules="[
(val) => val.length == 13 || `${'กรุณากรอก เลขประจำตัวประชาชน'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกเลขประจำตัวประชาชนให้ถูกต้อง'}`
]"
label="เลขบัตรประจำตัวประชาชน"
class="q-mb-sm"
/>
<q-input
:class="getClass(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
type="tel"
mask="#############"
:counter="status == 'register' || status == 'rejectRegister' ? true : false"
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultInformation.cardid"
maxlength="13"
:rules="[
(val) => val.length == 13 || `${'กรุณากรอกยืนยันเลขประจำตัวประชาชน'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกยืนยันเลขประจำตัวประชาชนให้ถูกต้อง'}`
]"
label="ยืนยันเลขบัตรประจำตัวประชาชน"
/>
</q-card-section>
<q-separator color="grey-4" />
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat label="ยกเลิก" color="red" v-close-popup />
<q-btn flat label="ตกลง" class="bg-teal-1" v-close-popup />
</q-card-actions>
<q-card-section class="bg-grey-2 q-py-sm">
<div class="text-subtitle1 text-weight-medium">กรอกเลขประจำตวประชาชน</div>
</q-card-section>
<q-separator color="grey-4" />
<q-card-section>
<q-input
:class="getClass(true)"
:outlined="true"
dense
type="tel"
mask="#############"
:counter="true ? true : false"
lazy-rules
:readonly="!true"
:borderless="!true"
v-model="cardid1"
maxlength="13"
:rules="[
(val) => val.length == 13 || `${'กรุณากรอก เลขประจำตัวประชาชน'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกเลขประจำตัวประชาชนให้ถูกต้อง'}`
]"
label="เลขบัตรประจำตัวประชาชน"
class="q-mb-sm"
/>
<q-input
:class="getClass(true)"
:outlined="true"
dense
type="tel"
mask="#############"
:counter="true ? true : false"
lazy-rules
:readonly="!true"
:borderless="!true"
v-model="cardid2"
maxlength="13"
:rules="[
(val) => val.length == 13 || `${'กรุณากรอกยืนยันเลขประจำตัวประชาชน'}`,
(val) => /^[0-9]*$/.test(val) || `${'กรุณากรอกยืนยันเลขประจำตัวประชาชนให้ถูกต้อง'}`
]"
label="ยืนยันเลขบัตรประจำตัวประชาชน"
/>
</q-card-section>
<q-separator color="grey-4" />
<q-card-actions align="right" class="bg-white text-teal">
<q-btn flat label="ยกเลิก" color="red" v-close-popup />
<q-btn flat label="ตกลง" @click="checkCardId" class="bg-teal-1" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
@ -379,7 +402,7 @@ const emit = defineEmits(['update:form'])
const $q = useQuasar()
const mixin = useCounterMixin()
const { date2Thai, calAge, success, messageError } = mixin
const { date2Thai, calAge, success, messageError, notifyError, calAgeYear } = mixin
const dataStore = useDataStore()
const { loaderPage } = dataStore
const districtOptions = ref<DataOption[]>([])
@ -390,11 +413,12 @@ const edit = ref<boolean>(true)
const myform = ref<any>({})
const img = ref<string>('')
const fileProfile = ref<File[]>([])
const cardid1 = ref<string>('')
const cardid2 = ref<string>('')
const opNat = ref(['ไทย'])
const idModel = ref<boolean>(false)
watch(myform, async (count: any, prevCount: any) => {
emit('update:form', count)
})
@ -417,6 +441,7 @@ const fetchData = async () => {
.then((res) => {
const data = res.data.result
defaultInformation.value.prefixId = data.prefixId
selectPrefix()
defaultInformation.value.lastname = data.lastName
defaultInformation.value.provinceId = data.citizenProvinceId
defaultInformation.value.districtId = data.citizenDistrictId
@ -446,6 +471,33 @@ const fetchData = async () => {
})
}
const checkCardId = async () => {
if (cardid2.value == cardid1.value) {
idModel.value = false
defaultInformation.value.cardid = cardid2.value
} else {
notifyError($q, 'เลขบัตรไม่ตรงกัน')
}
}
const selectPrefix = async () => {
defaultInformation.value.prefix =
props.prefixOptions.filter((x) => x.id == defaultInformation.value.prefixId).length == 0
? ''
: props.prefixOptions.filter((x) => x.id == defaultInformation.value.prefixId)[0].name
}
const selectBirthDate = async () => {
if (defaultInformation.value.birthDate != null) {
console.log(calAgeYear(defaultInformation.value.birthDate))
if (calAgeYear(defaultInformation.value.birthDate) < 18) {
defaultInformation.value.birthDate = null
notifyError($q, 'อายุไม่ถึง18')
} else if (calAgeYear(defaultInformation.value.birthDate) > 60) {
defaultInformation.value.birthDate = null
notifyError($q, 'อายุเกิน60')
}
}
}
const fetchImgData = async () => {
loaderPage(true)
await http

View file

@ -7,7 +7,7 @@
{{ `ครั้งที่${round}/${yearly == null ? '' : yearly + 543}` }}
</div>
<div class="col-12">
{{ position }}{{ positionLevel == null ? null : '/' + positionLevel }}
{{ position }}
</div>
</q-toolbar-title>
</q-toolbar>