ต่อ api ใบเข้าสอบ

This commit is contained in:
Kittapath 2023-04-06 22:52:53 +07:00
parent 8d53b576e2
commit 04bbc10531
8 changed files with 112 additions and 53 deletions

View file

@ -31,5 +31,6 @@ export default {
periodExamPosition: (examId: string, positionId: string) => periodExamPosition: (examId: string, positionId: string) =>
`${periodExam}position/${examId}/${positionId}`, `${periodExam}position/${examId}/${positionId}`,
periodExamPayment: (examId: string) => `${periodExam}payment/${examId}`, periodExamPayment: (examId: string) => `${periodExam}payment/${examId}`,
candidateCard: (examId: string, positionId: string) => `${candidate}card/${examId}/${positionId}`,
candidate candidate
} }

View file

@ -2,15 +2,23 @@
<div class="q-pa-md row items-center justify-center"> <div class="q-pa-md row items-center justify-center">
<div class="col-xs-12 col-sm-8 col-md-6"> <div class="col-xs-12 col-sm-8 col-md-6">
<q-card flat class="q-pa-md q-mb-sm" :class="getClass(status)"> <q-card flat class="q-pa-md q-mb-sm" :class="getClass(status)">
<div v-if="status != 'done' && status != 'checkPoint'" class="text-orange-6 text-bold"> <div v-if="status == 'checkRegister'" class="text-orange-6 text-bold">
<q-icon <q-icon
name="mdi-timer-sand" name="mdi-timer-sand"
size="22px" size="22px"
color="orange-5" color="orange-5"
class="q-mr-sm" class="q-mr-sm"
/> />
</div> </div>
<div v-else class="text-green-6 text-bold"> <div v-else-if="status == 'checkPoint'" class="text-orange-6 text-bold">
<q-icon
name="mdi-timer-sand"
size="22px"
color="orange-5"
class="q-mr-sm"
/>
</div>
<div v-else-if="status == 'done'" class="text-green-6 text-bold">
<q-icon <q-icon
name="mdi-checkbox-marked-circle-outline" name="mdi-checkbox-marked-circle-outline"
size="22px" size="22px"
@ -18,6 +26,14 @@
class="q-mr-sm" class="q-mr-sm"
/> />
</div> </div>
<div v-else class="text-orange-6 text-bold">
<q-icon
name="mdi-timer-sand"
size="22px"
color="orange-5"
class="q-mr-sm"
/>
</div>
</q-card> </q-card>
<q-card bordered flat class="col-12 row"> <q-card bordered flat class="col-12 row">
@ -34,24 +50,24 @@
<div class="text-black text-bold q-pl-sm">{{ fullName }}</div> <div class="text-black text-bold q-pl-sm">{{ fullName }}</div>
</div> </div>
<div class="q-pt-xs row"> <div class="q-pt-xs row">
<div class="">เลขประจำตสอบ :</div> <div class="">เลขประจำตประชาชน :</div>
<div class="text-black text-bold q-pl-sm">{{ examNumber }}</div> <div class="text-black text-bold q-pl-sm">{{ citizenId }}</div>
</div> </div>
<div class="q-pt-xs row"> <div class="q-pt-xs row">
<div class="">เลขประจำตประชาชน :</div> <div class="">เลขประจำตสอบ :</div>
<div class="text-black q-pl-sm">{{ citizenId }}</div> <div class="text-black text-bold q-pl-sm">{{ examNumber }}</div>
</div> </div>
<!-- <div class="q-pt-xs row"> <!-- <div class="q-pt-xs row">
<div class="">เวลาสอบ :</div> <div class="">เวลาสอบ :</div>
<div class="text-black q-pl-sm">{{ examTime }}</div> <div class="text-black q-pl-sm">{{ examTime }}</div>
</div> --> </div> -->
<div class="q-pt-xs row"> <div class="q-pt-xs row">
<div class="">สถานทสอบ :</div> <div class="">เลขทสอบ :</div>
<div class="text-black q-pl-sm">{{ examLocation }}</div> <div class="text-black text-bold q-pl-sm">{{ examSeat }}</div>
</div> </div>
<div class="q-pt-xs row"> <div class="q-pt-xs row">
<div class="">คะแนน</div> <div class="">คะแนน</div>
<div class="text-black q-pl-sm">{{ floor }}</div> <div class="text-black text-bold q-pl-sm">{{ point }}</div>
</div> </div>
<!-- <div class="q-pt-xs row"> <!-- <div class="q-pt-xs row">
<div class="">องสอบ :</div> <div class="">องสอบ :</div>
@ -79,6 +95,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useRoute } from 'vue-router'
const props = defineProps({ const props = defineProps({
fetchStep: { fetchStep: {
@ -91,16 +110,42 @@ const props = defineProps({
} }
}) })
const fullName = ref<string>('นางพิมพ์ภา วงศ์สวัสดิ์') const route = useRoute()
const examNumber = ref<string>('CDE-004') const examId = ref<string>(route.params.id.toString())
const citizenId = ref<string>('1100700954521') const positionId = ref<string>(route.params.positionId.toString())
const examTime = ref<string>('09:00-12:00') const loader = ref<boolean>(false)
const examLocation = ref<string>('ศูนย์สอบ 01 กรุงเทพฯและนนทบุรี') const fullName = ref<string>('')
const floor = ref<string>('4') const examNumber = ref<string>('')
const examRoom = ref<string>('CB-706') const citizenId = ref<string>('')
const seatNumber = ref<string>('75') const examSeat = ref<string>('')
const point = ref<string>('')
onMounted(async () => {
await fetchStatus()
})
const fetchStatus = async () => {
loader.value = true
await http
.get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
fullName.value = data.prefix + data.firstName + ' ' + data.lastName
examNumber.value = data.examIdenNumber
citizenId.value = data.citizenId
examSeat.value = data.seatNumber
point.value = data.point
})
.catch(() => {
// acceptTermOfUse.value = false
})
.finally(() => {
loader.value = false
})
}
const download = () => {} const download = () => {}
const getClass = (val: string) => { const getClass = (val: string) => {
return val == 'done' || val == 'checkPoint' ? 'bg-green-1' : 'bg-yellow-2' return val == 'done' || val == 'checkPoint' ? 'bg-green-1' : 'bg-yellow-2'
} }

View file

@ -23,7 +23,7 @@
label="บันทึกข้อมูล" label="บันทึกข้อมูล"
outline outline
icon="mdi-content-save" icon="mdi-content-save"
@click="saveData" @click="saveAuto = false && saveData"
v-if="status === 'register' || status === 'rejectRegister'" v-if="status === 'register' || status === 'rejectRegister'"
:disable="!acceptTermOfUse || statusEdit" :disable="!acceptTermOfUse || statusEdit"
/> />
@ -79,6 +79,7 @@ const formInformation = ref<any>({})
const formAddress = ref<any>({}) const formAddress = ref<any>({})
const formFamily = ref<any>({}) const formFamily = ref<any>({})
const formOccupation = ref<any>({}) const formOccupation = ref<any>({})
const saveAuto = ref<boolean>(false)
onMounted(async () => { onMounted(async () => {
// if (props.status !== 'register') { // if (props.status !== 'register') {
@ -91,36 +92,35 @@ const okModalConfirm = () => {
if (statusEdit.value == true) { if (statusEdit.value == true) {
modalError($q, 'ไม่สามารถสมัครสอบได้', 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล') modalError($q, 'ไม่สามารถสมัครสอบได้', 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล')
} else { } else {
saveAuto.value = true
modalConfirm( modalConfirm(
$q, $q,
'ยืนยันการสมัครสอบ?', 'ยืนยันการสมัครสอบ?',
'เมื่อยืนยันการสมัครสอบแล้วจะไม่สามารถแก้ไขข้อมูลได้', 'เมื่อยืนยันการสมัครสอบแล้วจะไม่สามารถแก้ไขข้อมูลได้',
saveForm saveData
) )
} }
} }
const fetchStatus = async () => { const fetchStatus = async () => {
loader.value = true loader.value = true
await http await http
.get(config.API.candidateStatus(examId.value, positionId.value)) .get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => { .then((res) => {
acceptTermOfUse.value = true acceptTermOfUse.value = true
}) })
.catch(() => { .catch(() => {})
acceptTermOfUse.value = false
})
.finally(() => { .finally(() => {
loader.value = false loader.value = false
}) })
} }
const saveForm = async () => { const saveForm = async () => {
//saveform
loader.value = true loader.value = true
await http await http
.get(config.API.candidateRegister(examId.value, positionId.value)) .get(config.API.candidateRegister(examId.value, positionId.value))
.then(() => { .then(() => {
success($q, 'สมัครสอบสำเร็จสำเร็จ') // success($q, '')
}) })
.catch(() => {}) .catch(() => {})
.finally(async () => { .finally(async () => {
@ -227,6 +227,7 @@ const saveData = async () => {
}) })
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
if (saveAuto.value) await saveForm()
await props.fetchStep() await props.fetchStep()
}) })
} }

View file

@ -12,9 +12,9 @@
<q-item-label class="text-weight-medium text-subtitle1" <q-item-label class="text-weight-medium text-subtitle1"
>ชำระเงนคาสมครสอบผานสำน/หนวยงาน</q-item-label >ชำระเงนคาสมครสอบผานสำน/หนวยงาน</q-item-label
> >
<q-item-label caption class="gt-xs" <!-- <q-item-label caption class="gt-xs"
>อนหลงแจงการโอนภายใน 24 วโมง</q-item-label >อนหลงแจงการโอนภายใน 24 วโมง</q-item-label
> > -->
</q-item-section> </q-item-section>
<!-- <q-item-section avatar class="gt-xs"> <!-- <q-item-section avatar class="gt-xs">
<q-avatar size="32px"> <q-avatar size="32px">
@ -129,9 +129,9 @@
<q-item-label class="text-weight-medium text-subtitle1" <q-item-label class="text-weight-medium text-subtitle1"
>ชำระเงนคาสมครสอบผานธนาคารกรงไทย</q-item-label >ชำระเงนคาสมครสอบผานธนาคารกรงไทย</q-item-label
> >
<q-item-label caption class="gt-xs" <!-- <q-item-label caption class="gt-xs"
>อนหลงแจงการโอนภายใน 24 วโมง</q-item-label >อนหลงแจงการโอนภายใน 24 วโมง</q-item-label
> > -->
</q-item-section> </q-item-section>
<!-- <q-item-section avatar class="gt-xs"> <!-- <q-item-section avatar class="gt-xs">
<q-avatar size="32px"> <q-avatar size="32px">
@ -235,6 +235,8 @@
</div> </div>
<div class="row col-12 justify-center"> <div class="row col-12 justify-center">
<q-btn <q-btn
icon="mdi-check"
color="primary"
style="width: 200px" style="width: 200px"
label="แจ้งการชำระเงิน" label="แจ้งการชำระเงิน"
@click="clickPayment" @click="clickPayment"
@ -300,7 +302,6 @@ const fetchPaymentExam = async () => {
.catch(() => {}) .catch(() => {})
.finally(async () => { .finally(async () => {
loader.value = false loader.value = false
props.fetchStep()
}) })
} }

View file

@ -201,7 +201,6 @@ const getData = async () => {
.get(config.API.candidateUpload(examId.value, positionId.value)) .get(config.API.candidateUpload(examId.value, positionId.value))
.then((res) => { .then((res) => {
const data = res.data.result const data = res.data.result
// console.log(data)
files.value = data files.value = data
}) })
.catch(() => {}) .catch(() => {})
@ -221,7 +220,6 @@ const deleteData = async (id: string) => {
}) })
.then((res) => { .then((res) => {
const data = res.data.result const data = res.data.result
console.log(data)
}) })
.catch(() => {}) .catch(() => {})
.finally(async () => { .finally(async () => {
@ -238,7 +236,6 @@ const uploadData = async () => {
.put(config.API.candidateUpload(examId.value, positionId.value), formData) .put(config.API.candidateUpload(examId.value, positionId.value), formData)
.then((res) => { .then((res) => {
const data = res.data.result const data = res.data.result
console.log(data)
}) })
.catch(() => {}) .catch(() => {})
.finally(async () => { .finally(async () => {
@ -257,7 +254,6 @@ const downloadData = async (id: string) => {
.get(config.API.candidateDownload(id)) .get(config.API.candidateDownload(id))
.then((res) => { .then((res) => {
const data = res const data = res
console.log(data)
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {

View file

@ -15,6 +15,7 @@ export const useExamDataStore = defineStore('exam', () => {
}) })
const consend = ref<boolean>(false) const consend = ref<boolean>(false)
const status = ref<string>('')
const changeExamColumns = (system: String, val: String[]) => { const changeExamColumns = (system: String, val: String[]) => {
if (system == 'main') examData.value.main.columns = val if (system == 'main') examData.value.main.columns = val
@ -27,9 +28,15 @@ export const useExamDataStore = defineStore('exam', () => {
examData.value = JSON.parse(localStorage.getItem('exam') || '{}') examData.value = JSON.parse(localStorage.getItem('exam') || '{}')
} }
const changeStatus = (val: string) => {
status.value = val
}
return { return {
examData, examData,
changeExamColumns, changeExamColumns,
consend consend,
status,
changeStatus
} }
}) })

View file

@ -3,7 +3,7 @@
<q-toolbar class="q-pa-sm text-center"> <q-toolbar class="q-pa-sm text-center">
<q-toolbar-title class="text-dark"> <q-toolbar-title class="text-dark">
{{ tittle }} {{ tittle }}
<div class="text-light">ตำแหน..&nbsp;&nbsp;{{ position }}</div> <div class="text-light text-body2">{{ position }}</div>
</q-toolbar-title> </q-toolbar-title>
</q-toolbar> </q-toolbar>
<q-stepper <q-stepper
@ -102,15 +102,9 @@ const candidateCheck = async () => {
store.consend = data.consend store.consend = data.consend
const positionExam = data.positionExam const positionExam = data.positionExam
stepPayment.value = data.bank stepPayment.value = data.bank
// console.log('qwe')
// console.log(positionId.value != '00000000-0000-0000-0000-000000000000')
// console.log(positionId.value)
// console.log(positionExam)
// console.log(positionExam.id)
// console.log(data.status != 'register')
// console.log(data.status != 'rejectRegister')
if ( if (
positionId.value != '00000000-0000-0000-0000-000000000000' && positionId.value != '00000000-0000-0000-0000-000000000000' &&
positionExam != null &&
positionExam.id != positionId.value && positionExam.id != positionId.value &&
data.status != 'register' && data.status != 'register' &&
data.status != 'rejectRegister' data.status != 'rejectRegister'
@ -118,7 +112,8 @@ const candidateCheck = async () => {
modalError( modalError(
$q, $q,
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว', 'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว',
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว' 'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว',
closeWindow
) )
} else { } else {
if (store.consend == true) { if (store.consend == true) {
@ -136,6 +131,12 @@ const candidateCheck = async () => {
}) })
} }
const closeWindow = async () => {
// window.close()
// window.closed = true
// console.log(window)
}
const fetchStep = async () => { const fetchStep = async () => {
loader.value = true loader.value = true
await http await http
@ -147,8 +148,8 @@ const fetchStep = async () => {
stepRaw.value = 2 stepRaw.value = 2
step.value = 2 step.value = 2
} else if (data == 'checkRegister') { } else if (data == 'checkRegister') {
stepRaw.value = 2 stepRaw.value = 3
step.value = 2 step.value = 3
} else if (data == 'payment') { } else if (data == 'payment') {
stepRaw.value = 3 stepRaw.value = 3
step.value = 3 step.value = 3
@ -156,8 +157,8 @@ const fetchStep = async () => {
stepRaw.value = 2 stepRaw.value = 2
step.value = 2 step.value = 2
} else if (data == 'checkPayment') { } else if (data == 'checkPayment') {
stepRaw.value = 3 stepRaw.value = 4
step.value = 3 step.value = 4
} else if (data == 'rejectPayment') { } else if (data == 'rejectPayment') {
stepRaw.value = 3 stepRaw.value = 3
step.value = 3 step.value = 3
@ -171,10 +172,15 @@ const fetchStep = async () => {
stepRaw.value = 4 stepRaw.value = 4
step.value = 4 step.value = 4
} }
if (stepPayment.value == false && data != 'register' && data != 'rejectRegister') {
stepRaw.value = 4
step.value = 4
}
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {
loader.value = false loader.value = false
store.changeStatus(status.value)
}) })
} }
@ -185,7 +191,7 @@ const fetchPeriodExam = async () => {
.then((res) => { .then((res) => {
const data = res.data.result const data = res.data.result
tittle.value = data.name tittle.value = data.name
position.value = data.posiiton == null ? '' : '(' + data.posiiton.positionName + ')' position.value = data.posiiton == null ? '' : 'ตำแหน่ง: ' + data.posiiton.positionName
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {

View file

@ -4,8 +4,9 @@ import { onMounted, ref } from 'vue'
// import keycloak from '@/plugins/keycloak' // import keycloak from '@/plugins/keycloak'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { menuList, options, notiList } from '../interface/main/index' import { menuList, options, notiList } from '../interface/main/index'
import keycloak from '@/plugins/keycloak' import { useExamDataStore } from '@/modules/01_exam/store'
import { useCounterMixin } from '@/stores/mixin' import { useCounterMixin } from '@/stores/mixin'
import keycloak from '@/plugins/keycloak'
import http from '@/plugins/http' import http from '@/plugins/http'
import config from '@/app.config' import config from '@/app.config'
@ -13,6 +14,7 @@ const route = useRoute()
const $q = useQuasar() const $q = useQuasar()
const mixin = useCounterMixin() // const mixin = useCounterMixin() //
const { statusCandidate } = mixin const { statusCandidate } = mixin
const store = useExamDataStore()
const miniState = ref<boolean>(false) const miniState = ref<boolean>(false)
const active = ref<number>(0) const active = ref<number>(0)
const drawerL = ref<boolean>(false) const drawerL = ref<boolean>(false)
@ -136,8 +138,8 @@ const getFontColor = (val: string) => {
<!-- <q-badge flat color="blue" class="q-mr-md text-bold"> <!-- <q-badge flat color="blue" class="q-mr-md text-bold">
{{ statusCandidate(status) }} {{ statusCandidate(status) }}
</q-badge> --> </q-badge> -->
<div class="q-mr-md text-bold" :class="getFontColor(status)"> <div class="q-mr-md text-bold" :class="getFontColor(store.status)">
{{ statusCandidate(status) }}&nbsp;&nbsp; {{ statusCandidate(store.status) }}&nbsp;&nbsp;
</div> </div>
<q-btn <q-btn
v-if="$q.screen.gt.xs" v-if="$q.screen.gt.xs"