refactor code

This commit is contained in:
Kittapath 2023-05-16 22:23:32 +07:00
parent d2c352de17
commit 92fc21033d
50 changed files with 652 additions and 2170 deletions

View file

@ -48,12 +48,12 @@
จะใชการทชอบดวยกฏหมายและเปนธรรมในการเกบรวบรวมขอมลสวนบคคลอยางจำกดเพยงเทาทจำเปนภายใตตถประสงคการทำงานของกรงเทพมหานครฯ
เพอใชเปนขอมลประกอบการพจารณาคดเลอกตามตำแหนงทใหอมลประสงคจะสมครรบการคดเลอกโดยกรงเทพมหานครฯ
จะเกบรวบรวมขอมลสวนบคคลของทาน งน
<ul style="list-style-type: circle;">
<li>-นามสก เพอตดตอกบทางกรงเทพมหานครฯ</li>
<li>เมล เพอใชในการตดตอกบกรงเทพมหานครฯ</li>
<li>เบอรโทร เพอใชสมครงานกบทางกรงเทพมหานครฯ</li>
<li>อย เพอใชสมครงานกบทางกรงเทพมหานครฯ</li>
<li>ประวการทำงาน, ประวการศกษา, ประวการฝกอบรม ตามขอมลขางต</li>
<ul style="list-style-type: circle">
<li>-นามสก เพอตดตอกบทางกรงเทพมหานครฯ</li>
<li>เมล เพอใชในการตดตอกบกรงเทพมหานครฯ</li>
<li>เบอรโทร เพอใชสมครงานกบทางกรงเทพมหานครฯ</li>
<li>อย เพอใชสมครงานกบทางกรงเทพมหานครฯ</li>
<li>ประวการทำงาน, ประวการศกษา, ประวการฝกอบรม ตามขอมลขางต</li>
</ul>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;งนอมลสวนบคคลดงกลาวเปนขอมลทจำเปนสำหรบการทำงานของกรงเทพมหานครฯ
หากไมอมลดงกลาว อาจสงผลตอกระบวนการพจารณาคณสมบของผสมคร
@ -80,7 +80,13 @@
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal justify-center">
<q-btn label="ยอมรับ" style="width: 150px;" :color="!acceptTermOfUse ? 'grey':'primary'" @click="ok" :disable="!acceptTermOfUse" />
<q-btn
label="ยอมรับ"
style="width: 150px"
:color="!acceptTermOfUse ? 'grey' : 'primary'"
@click="ok"
:disable="!acceptTermOfUse"
/>
</q-card-actions>
</template>
@ -88,10 +94,6 @@
import { ref } from 'vue'
import keycloak from '@/plugins/keycloak'
const props = defineProps({
close: {
type: Function,
default: () => console.log('not function')
},
ok: {
type: Function,
default: () => console.log('not function')

View file

@ -20,17 +20,11 @@
<div class="">เลขประจำตวสอบ :</div>
<div class="text-black text-bold q-pl-sm">{{ examNumber }}</div>
</div>
<!-- <div class="q-pt-xs row">
<div class="">เวลาสอบ :</div>
<div class="text-black q-pl-sm">{{ examTime }}</div>
</div> -->
<div class="q-pt-xs row">
<div class="">เลขทงสอบ :</div>
<div class="text-black text-bold q-pl-sm">{{ examSeat }}</div>
</div>
<div class="q-pt-xs row">
<!-- <div class="">คะแนน</div>
<div class="text-black text-bold q-pl-sm">{{ point }}</div> -->
<div class="col-12 text-weight-bold">ผลการสอบ</div>
<div class="row items-center q-gutter-y-sm col-12">
<div class="col-xs-4 col-sm-5 text-weight-medium text-grey-7">ประเภท</div>
@ -81,14 +75,6 @@
</div>
</div>
</div>
<!-- <div class="q-pt-xs row">
<div class="">องสอบ :</div>
<div class="text-black q-pl-sm">{{ examRoom }}</div>
</div>
<div class="q-pt-xs row">
<div class="">เลขท :</div>
<div class="text-black q-pl-sm">{{ seatNumber }}</div>
</div> -->
</div>
<q-card-section class="col-4 flex flex-center">
@ -114,15 +100,19 @@
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import http from '@/plugins/http'
import config from '@/app.config'
import { useQuasar } from 'quasar'
const $q = useQuasar()
const route = useRoute()
const mixin = useCounterMixin() //
const { dateThaiRange, modalDelete, modalConfirm, dateToISO, success, date2Thai } = mixin
const { date2Thai, messageError } = mixin
const dataStore = useDataStore()
const { loaderPage } = dataStore
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const loader = ref<boolean>(false)
const fullName = ref<string>('')
const examNumber = ref<string>('')
const citizenId = ref<string>('')
@ -143,7 +133,7 @@ onMounted(async () => {
})
const fetchStatus = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => {
@ -180,25 +170,16 @@ const fetchStatus = async () => {
score_expired.value = new Date(data.announcementDate)
number.value = data.number
})
.catch(() => {
// acceptTermOfUse.value = false
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const download = () => {
window.print()
// var printContent = document.getElementById('print')
// var WinPrint = window.open()
// if (WinPrint != null && printContent != null) {
// WinPrint.document.write(printContent.innerHTML)
// // WinPrint.document.close()
// // WinPrint.focus()
// // WinPrint.print()
// // WinPrint.close()
// }
}
</script>

View file

@ -20,8 +20,8 @@
</template>
<script setup lang="ts">
import type { PropType } from 'vue'
import type { ExamCard } from '../interface/index/Main'
import { useCounterMixin } from '@/stores/mixin'
import type { ExamCard } from '../interface/index/Main'
const mixin = useCounterMixin()
const { date2Thai } = mixin

View file

@ -9,7 +9,6 @@
เปดรบสมครวนท {{ date2Thai(exam.startDate) }} - {{ date2Thai(exam.endDate) }}
</div>
<div class="text-subtitle2 q-py-sm">าธรรมเนยมการสมคร {{ exam.fee }} บาท</div>
<!-- <div v-html="exam.htmlBody.html"></div> -->
</q-card-section>
<div class="text-subtitle1 text-center text-primary">เอกสารเกยวกบการสอบน</div>
@ -28,13 +27,6 @@
</p>
</div>
</div>
<!-- <template v-slot:body-cell-name="props">
<q-td :props="props">
<div>
<a href="https://quasar.dev/vue-components/table#QTable-API" />
</div>
</q-td>
</template> -->
</q-card>
<div class="col-12">
<div class="text-h6 q-py-sm">อควรระว</div>
@ -67,15 +59,12 @@ const props = defineProps({
fetchStep: {
type: Function,
default: () => console.log('not function')
},
step: {
type: Number,
required: true
}
})
const mixin = useCounterMixin()
const mixin = useCounterMixin() //
const { date2Thai } = mixin
const exam = ref<any>({
contentItemId: null,
displayText: 'การสอบภาค ข.พิเศษ สำหรับผู้สอบผ่านของ่วนราชการแล้ว',
@ -94,8 +83,8 @@ const exam = ref<any>({
]
})
const applyCandidate = () => {
props.fetchStep()
const applyCandidate = async () => {
await props.fetchStep()
}
</script>

View file

@ -88,6 +88,9 @@ import { onMounted, ref } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useRoute } from 'vue-router'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useQuasar } from 'quasar'
import ExamCard from '@/modules/01_exam/components/ExamCard.vue'
const props = defineProps({
@ -101,10 +104,14 @@ const props = defineProps({
}
})
const $q = useQuasar()
const route = useRoute()
const dataStore = useDataStore()
const { loaderPage } = dataStore
const mixin = useCounterMixin()
const { messageError } = mixin
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const loader = ref<boolean>(false)
const fullName = ref<string>('')
const examNumber = ref<string>('')
const citizenId = ref<string>('')
@ -117,7 +124,6 @@ const scoreSumFull = ref<number | null>(null)
const scoreSum = ref<number | null>(null)
const examResultinscore = ref<string>('')
const avatar = ref<string>('')
const dialog = ref<boolean>(false)
const rating = ref<number>(5)
const text = ref<string>('')
@ -127,7 +133,7 @@ onMounted(async () => {
})
const fetchStatus = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => {
@ -153,27 +159,27 @@ const fetchStatus = async () => {
avatar.value = data.avatar
if (data.reviewPoint == null) dialog.value = true
})
.catch(() => {
// acceptTermOfUse.value = false
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const sendRating = async () => {
loader.value = true
loaderPage(true)
await http
.put(config.API.candidateReview(examId.value, positionId.value), {
reviewPoint: rating.value, //
review: text.value //
})
.then((res) => {})
.catch(() => {
// acceptTermOfUse.value = false
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
dialog.value = false
})
}
@ -188,10 +194,6 @@ const getClass = (val: string) => {
size: A4;
margin: 0;
}
/* #print {
display: none;
visibility: none;
} */
@media print {
@page {

View file

@ -44,9 +44,9 @@
import { onMounted, ref } from 'vue'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import http from '@/plugins/http'
import config from '@/app.config'
import Profile from '@/modules/01_exam/components/Form/Profile.vue'
import { useRoute } from 'vue-router'
import {
defaultInformation,
@ -54,6 +54,7 @@ import {
defaultAddress,
defaultFamily
} from '@/modules/01_exam/interface/index/Main'
import Profile from '@/modules/01_exam/components/Form/Profile.vue'
const props = defineProps({
fetchStep: {
@ -68,8 +69,9 @@ const props = defineProps({
const $q = useQuasar()
const mixin = useCounterMixin() //
const { modalConfirm, modalError, success, dateToISO } = mixin
const loader = ref<boolean>(false)
const { modalConfirm, modalError, success, dateToISO, messageError } = mixin
const dataStore = useDataStore()
const { loaderPage } = dataStore
const statusEdit = ref<boolean>(false)
const acceptTermOfUse = ref<boolean>(false)
const route = useRoute()
@ -82,9 +84,6 @@ const formOccupation = ref<any>({})
const saveAuto = ref<boolean>(false)
onMounted(async () => {
// if (props.status !== 'register') {
// acceptTermOfUse.value = true
// }
await fetchStatus()
})
@ -103,31 +102,30 @@ const okModalConfirm = () => {
}
const fetchStatus = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => {
acceptTermOfUse.value = true
})
.catch(() => {
.catch((e) => {
acceptTermOfUse.value = false
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const saveForm = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateRegister(examId.value, positionId.value))
.then(() => {
// success($q, '')
.then(() => {})
.catch((e) => {
messageError($q, e)
})
.catch(() => {})
.finally(async () => {
await props.fetchStep()
loader.value = false
})
}
@ -156,7 +154,7 @@ const saveData = async () => {
type.value = defaultOccupation.value.employee
if (defaultOccupation.value.status == 'other')
type.value = defaultOccupation.value.other
loader.value = true
loaderPage(true)
await http
.post(config.API.candidateId(examId.value, positionId.value), {
prefixId: defaultInformation.value.prefixId,
@ -227,14 +225,10 @@ const saveData = async () => {
success($q, 'บันทึกข้อมูลส่วนตัวสำเร็จ')
if (saveAuto.value) await saveForm()
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
await props.fetchStep()
})
}

View file

@ -83,21 +83,6 @@
accept="image/*"
@change="uploadImage"
/>
<!-- <q-file
id="file-upload"
v-model="filePayment"
dense
label="อัพโหลดหลักฐานชำระเงิน"
outlined
use-chips
multiple
class="q-pl-sm"
v-if="status == 'payment' || status == 'rejectPayment'"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file> -->
</div>
</div>
</div>
@ -169,7 +154,6 @@
</div>
<div class="col-xs-12 col-sm-5">
<label for="file-upload" class="col-12 row">
<!-- :src="img" -->
<q-img
src="@/assets/ex_slip.jpeg"
fit="contain"
@ -196,21 +180,6 @@
accept="image/*"
@change="uploadImage"
/>
<!-- <q-file
id="file-upload"
v-model="filePayment"
dense
label="อัพโหลดหลักฐานชำระเงิน"
outlined
use-chips
multiple
class="q-pl-sm"
v-if="status == 'payment' || status == 'rejectPayment'"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file> -->
</div>
</div>
</div>
@ -230,11 +199,11 @@
/>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import http from '@/plugins/http'
import config from '@/app.config'
import { useRoute } from 'vue-router'
@ -252,10 +221,11 @@ const props = defineProps({
const $q = useQuasar()
const mixin = useCounterMixin() //
const { success, modalError } = mixin
const { success, modalError, messageError } = mixin
const dataStore = useDataStore()
const { loaderPage } = dataStore
const rejectMessage = ref<string>('')
const img = ref<string>('')
const loader = ref<boolean>(false)
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
@ -269,7 +239,7 @@ onMounted(async () => {
})
const fetchPaymentExam = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.periodExamPayment(examId.value))
.then((res) => {
@ -277,14 +247,16 @@ const fetchPaymentExam = async () => {
bank.value = data.bankExam
fee.value = data.fee
})
.catch(() => {})
.finally(async () => {
loader.value = false
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loaderPage(false)
})
}
const fetchData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidatePayment(examId.value, positionId.value))
.then((res) => {
@ -292,9 +264,11 @@ const fetchData = async () => {
img.value = data.paymentImg
rejectMessage.value = data.rejectDetail
})
.catch(() => {})
.finally(async () => {
loader.value = false
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loaderPage(false)
})
}
@ -302,17 +276,18 @@ const clickPayment = async () => {
if (img.value != null || img.value != '') {
const formData = new FormData()
formData.append('', filePayment.value[0])
loader.value = true
loaderPage(true)
await http
.post(config.API.candidatePayment(examId.value, positionId.value))
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
props.fetchStep()
filePayment.value = []
await props.fetchStep()
})
} else {
modalError($q, 'ไม่สามารถยืนยันการชำระเงินได้', 'กรุณาอัปโหลดเอกสารหลักฐานชำระเงิน')
@ -324,16 +299,17 @@ const uploadImage = async (file: any) => {
if (input.length > 0) {
const formData = new FormData()
formData.append('', input[0])
loader.value = true
loaderPage(true)
await http
.put(config.API.candidatePayment(examId.value, positionId.value), formData)
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
props.fetchStep()
await props.fetchStep()
await fetchData()
file = []
})
@ -343,15 +319,19 @@ const uploadImage = async (file: any) => {
}
const downloadBillPayment = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateBill(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
window.open(data)
})
.catch(() => {})
.finally(async () => {})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loaderPage(false)
})
}
</script>

View file

@ -8,7 +8,6 @@
:editOnly="false"
:editData="false"
/>
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-xs">
<div class="col-xs-12">
@ -25,7 +24,6 @@
:rules="[(val) => !!val || `${'กรุณากรอก ที่อยู่ตามทะเบียนบ้าน'}`]"
:label="`${'ที่อยู่ตามทะเบียนบ้าน'}`"
/>
<!-- :filled="(status == 'register' || status == 'rejectRegister')" -->
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<q-select
@ -215,10 +213,13 @@ import { ref, onMounted, watch } from 'vue'
import type { PropType } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useRoute } from 'vue-router'
import { useQuasar } from 'quasar'
import type { Address, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultAddress, changeData } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import { useRoute } from 'vue-router'
const props = defineProps({
provinceOptions: {
@ -234,20 +235,23 @@ const props = defineProps({
required: true
}
})
const emit = defineEmits(['update:form'])
const $q = useQuasar()
const dataStore = useDataStore()
const { loaderPage } = dataStore
const mixin = useCounterMixin()
const { messageError } = mixin
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const edit = ref<boolean>(true)
const myform = ref<any>({})
const loader = ref<boolean>(false)
const districtOptions = ref<DataOption[]>([])
const districtCOptions = ref<DataOption[]>([])
const subdistrictOptions = ref<DataOption[]>([])
const subdistrictCOptions = ref<DataOption[]>([])
const emit = defineEmits(['update:form'])
watch(myform, async (count: any, prevCount: any) => {
emit('update:form', count)
})
@ -269,31 +273,35 @@ onMounted(async () => {
})
const fetchData = async () => {
// loader.value = true;
loaderPage(true)
await http
.get(config.API.candidateAddress(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
defaultAddress.value.address = data.registAddress
defaultAddress.value.addressC = data.currentAddress
defaultAddress.value.provinceId = data.registProvinceId
defaultAddress.value.provinceIdC = data.currentProvinceId
defaultAddress.value.districtId = data.registDistrictId
defaultAddress.value.districtIdC = data.currentDistrictId
defaultAddress.value.subdistrictId = data.registSubDistrictId
defaultAddress.value.subdistrictIdC = data.currentSubDistrictId
defaultAddress.value.code = data.registZipCode
defaultAddress.value.codeC = data.currentZipCode
defaultAddress.value.same =
data.registSame == true ? '1' : data.registSame == false ? '0' : null
if (data != null) {
defaultAddress.value.address = data.registAddress
defaultAddress.value.addressC = data.currentAddress
defaultAddress.value.provinceId = data.registProvinceId
defaultAddress.value.provinceIdC = data.currentProvinceId
defaultAddress.value.districtId = data.registDistrictId
defaultAddress.value.districtIdC = data.currentDistrictId
defaultAddress.value.subdistrictId = data.registSubDistrictId
defaultAddress.value.subdistrictIdC = data.currentSubDistrictId
defaultAddress.value.code = data.registZipCode
defaultAddress.value.codeC = data.currentZipCode
defaultAddress.value.same =
data.registSame == true ? '1' : data.registSame == false ? '0' : null
}
})
.catch((e) => {
messageError($q, e)
})
.catch(() => {})
.finally(() => {
// loader.value = false;
loaderPage(false)
})
}
const selectProvince = (e: string, name: string) => {
const selectProvince = async (e: string, name: string) => {
if (name == '1') {
defaultAddress.value.districtId = ''
defaultAddress.value.subdistrictId = ''
@ -304,10 +312,10 @@ const selectProvince = (e: string, name: string) => {
defaultAddress.value.codeC = null
}
myform.value.resetValidation()
fetchDistrict(e, name)
await fetchDistrict(e, name)
}
const selectDistrict = (e: string, name: string) => {
const selectDistrict = async (e: string, name: string) => {
if (name == '1') {
defaultAddress.value.subdistrictId = ''
defaultAddress.value.code = null
@ -316,7 +324,7 @@ const selectDistrict = (e: string, name: string) => {
defaultAddress.value.codeC = null
}
myform.value.resetValidation()
fetchSubDistrict(e, name)
await fetchSubDistrict(e, name)
}
const selectSubDistrict = (e: string, name: string) => {
@ -332,7 +340,7 @@ const selectSubDistrict = (e: string, name: string) => {
}
const fetchDistrict = async (id: string, position: string) => {
loader.value = true
loaderPage(true)
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -347,14 +355,16 @@ const fetchDistrict = async (id: string, position: string) => {
districtCOptions.value = option
}
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const fetchSubDistrict = async (id: string, position: string) => {
loader.value = true
loaderPage(true)
await http
.get(config.API.listSubDistrict(id))
.then((res) => {
@ -373,9 +383,11 @@ const fetchSubDistrict = async (id: string, position: string) => {
subdistrictCOptions.value = option
}
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}

View file

@ -11,7 +11,6 @@
v-model:editvisible="edit"
:add="clickAdd"
:edit="clickEdit"
:cancel="clickCancel"
:addData="false"
:editData="status == 'register' || status == 'rejectRegister'"
name="ประวัติการทำงาน/ฝึกงาน"
@ -51,7 +50,6 @@
</template>
</Table>
</q-form>
<!-- popup Edit window-->
<q-dialog v-model="modal" persistent>
<q-card style="width: 600px">
<q-form ref="myForm">
@ -165,7 +163,6 @@
</q-card-section>
<q-separator />
<DialogFooter
:cancel="clickCancel"
:edit="clickEdit"
:save="clickSave"
:validate="validateData"
@ -185,9 +182,11 @@
import { onMounted, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import http from '@/plugins/http'
import config from '@/app.config'
import { useExamDataStore } from '@/modules/01_exam/store'
import { useRoute } from 'vue-router'
import type {
RequestItemsObject,
Columns,
@ -197,7 +196,6 @@ import type { ResponseObject } from '@/modules/01_exam/interface/response/Career
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
import { useRoute } from 'vue-router'
const props = defineProps({
status: {
@ -208,10 +206,11 @@ const props = defineProps({
const $q = useQuasar()
const mixin = useCounterMixin() //
const { dateThaiRange, modalDelete, modalConfirm, dateToISO, success } = mixin
const { dateThaiRange, modalDelete, modalConfirm, dateToISO, success, messageError } = mixin
const store = useExamDataStore()
const { examData, changeExamColumns } = store
const loader = ref<boolean>(false)
const dataStore = useDataStore()
const { loaderPage } = dataStore
const id = ref<string>('')
const location = ref<string>()
const position = ref<string>()
@ -297,7 +296,7 @@ onMounted(async () => {
})
const fetchData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateCareer(examId.value, positionId.value))
.then((res) => {
@ -311,16 +310,18 @@ const fetchData = async () => {
})
})
})
.catch(() => {})
.catch((e) => {
// messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
/**
* กดดอมลกอนหน
*/
const clickPrevious = () => {
const clickPrevious = async () => {
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
location.value = row.location
@ -329,13 +330,13 @@ const clickPrevious = () => {
duration.value = row.duration
reason.value = row.reason
id.value = row.id
checkRowPage()
await checkRowPage()
}
/**
* กดดอมลตอไป
*/
const clickNext = () => {
const clickNext = async () => {
rowIndex.value += 1
const row = rows.value[rowIndex.value]
location.value = row.location
@ -344,7 +345,7 @@ const clickNext = () => {
duration.value = row.duration
reason.value = row.reason
id.value = row.id
checkRowPage()
await checkRowPage()
}
/**
@ -366,7 +367,6 @@ const checkRowPage = () => {
* กดปมแกไขใน dialog
*/
const clickEdit = () => {
// edit.value = true
next.value = false
previous.value = false
}
@ -374,8 +374,8 @@ const clickEdit = () => {
/**
* กดปมเพมดานบน table
*/
const clickAdd = () => {
addRow()
const clickAdd = async () => {
await addRow()
}
const checkDelete = (row: RequestItemsObject) => {
@ -388,26 +388,20 @@ const checkDelete = (row: RequestItemsObject) => {
*/
const clickDeleteRow = async () => {
if (rawItem.value != null) {
loader.value = true
loaderPage(true)
await http
.delete(config.API.candidateCareer(rawItem.value.id, ''))
.then(() => {
success($q, 'ลบข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
await fetchData()
// edit.value = false
})
} else {
await fetchData()
// edit.value = false
}
}
@ -417,15 +411,11 @@ const clickDeleteRow = async () => {
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
// if (store.consend == true) {
if (modalEdit.value) {
await editData()
} else {
await saveData()
}
// } else {
// modalConsend.value = true
// }
}
})
}
@ -434,7 +424,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loader.value = true
loaderPage(true)
await http
.post(config.API.candidateCareer(examId.value, positionId.value), {
name: location.value,
@ -447,15 +437,10 @@ const saveData = async () => {
.then(() => {
success($q, 'บันทึกข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
// edit.value = false
modal.value = false
await fetchData()
})
@ -465,7 +450,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loader.value = true
loaderPage(true)
await http
.put(config.API.candidateCareer(id.value, ''), {
name: location.value,
@ -478,15 +463,10 @@ const editData = async () => {
.then(() => {
success($q, 'บันทึกข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
// edit.value = false
modal.value = false
await fetchData()
})
@ -527,12 +507,8 @@ const selectData = (props: DataProps) => {
duration.value = props.row.duration
reason.value = props.row.reason
id.value = props.row.id
// if (edit.value == true) {
next.value = false
previous.value = false
// } else {
// checkRowPage()
// }
}
/**
@ -548,13 +524,6 @@ const addRow = () => {
reason.value = ''
}
/**
* งกนปมยกเลกการแกไขขอม
*/
const clickCancel = async () => {
// edit.value = false
}
/**
* เชความการแกไขขอม
*/

View file

@ -81,18 +81,6 @@
<q-uploader-add-trigger />
<q-tooltip>เลอกไฟล</q-tooltip>
</q-btn>
<!-- <q-btn
v-if="scope.canUpload"
icon="cloud_upload"
label="อัพโหลดไฟล์"
@click="scope.upload"
round
dense
flat
>
<q-tooltip>พโหลดไฟล</q-tooltip>
</q-btn> -->
<q-btn v-if="scope.isUploading" icon="clear" @click="scope.abort" round dense flat>
<q-tooltip>ยกเลกการอปโหลด</q-tooltip>
</q-btn>
@ -142,12 +130,15 @@
</q-card>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import HeaderTop from '@/components/top.vue'
import { onMounted, ref } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useRoute } from 'vue-router'
import { useQuasar } from 'quasar'
import type { UploadType } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
const props = defineProps({
status: {
@ -155,16 +146,21 @@ const props = defineProps({
required: true
}
})
const emit = defineEmits(['update:loader'])
const $q = useQuasar()
const dataStore = useDataStore()
const { loaderPage } = dataStore
const mixin = useCounterMixin()
const { messageError } = mixin
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const uploader = ref<any>()
const loader = ref<boolean>(false)
const edit = ref<boolean>(props.status == 'register' || props.status == 'rejectRegister')
const name = ref<string>('')
const files = ref<UploadType[]>([])
const file = ref<File[]>([])
const emit = defineEmits(['update:loader'])
onMounted(async () => {
await getData()
@ -176,21 +172,25 @@ const fileAdd = async (val: any) => {
}
const getData = async () => {
loader.value = true
name.value = ''
uploader.value.reset()
loaderPage(true)
await http
.get(config.API.candidateUpload(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
files.value = data
})
.catch(() => {})
.catch((e) => {
// messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const deleteData = async (id: string) => {
loader.value = true
loaderPage(true)
const params = {
documentId: id
}
@ -198,35 +198,30 @@ const deleteData = async (id: string) => {
.delete(config.API.candidateUpload(examId.value, positionId.value), {
params
})
.then((res) => {
const data = res.data.result
.then((res) => {})
.catch((e) => {
messageError($q, e)
})
.catch(() => {})
.finally(async () => {
loader.value = false
await getData()
})
}
const uploadData = async () => {
console.log('asdasd')
const blob = file.value.slice(0, file.value[0].size)
const newFile = new File(blob, name.value, {
type: file.value[0].type
})
const formData = new FormData()
formData.append('', newFile)
loader.value = true
loaderPage(true)
await http
.put(config.API.candidateUpload(examId.value, positionId.value), formData)
.then((res) => {
const data = res.data.result
.then((res) => {})
.catch((e) => {
messageError($q, e)
})
.catch(() => {})
.finally(async () => {
loader.value = false
name.value = ''
uploader.value.reset()
await getData()
})
}

View file

@ -11,7 +11,6 @@
v-model:editvisible="edit"
:add="clickAdd"
:edit="clickEdit"
:cancel="clickCancel"
:addData="false"
:editData="status == 'register' || status == 'rejectRegister'"
name="ประวัติการศีกษา"
@ -48,7 +47,6 @@
</template>
</Table>
</q-form>
<!-- popup Edit window-->
<q-dialog v-model="modal" persistent>
<q-card style="width: 600px">
<q-form ref="myForm">
@ -166,7 +164,6 @@
</q-card-section>
<q-separator />
<DialogFooter
:cancel="clickCancel"
:edit="clickEdit"
:save="clickSave"
:validate="validateData"
@ -184,11 +181,14 @@
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue'
import type { PropType } from 'vue'
import { useQuasar } from 'quasar'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import http from '@/plugins/http'
import config from '@/app.config'
import { useExamDataStore } from '@/modules/01_exam/store'
import { useRoute } from 'vue-router'
import type {
RequestItemsObject,
Columns,
@ -199,9 +199,12 @@ import type { ResponseObject } from '@/modules/01_exam/interface/response/Educat
import Table from '@/components/Table.vue'
import DialogHeader from '@/components/DialogHeader.vue'
import DialogFooter from '@/components/DialogFooter.vue'
import { useRoute } from 'vue-router'
const props = defineProps({
educationLevelOptions: {
type: Array as PropType<DataOption[]>,
required: true
},
status: {
type: String,
required: true
@ -210,14 +213,14 @@ const props = defineProps({
const $q = useQuasar()
const mixin = useCounterMixin() //
const { dateThaiRange, modalDelete, modalConfirm, dateToISO, success } = mixin
const { dateThaiRange, modalDelete, modalConfirm, dateToISO, success, messageError } = mixin
const store = useExamDataStore()
const { examData, changeExamColumns } = store
const loader = ref<boolean>(false)
const dataStore = useDataStore()
const { loaderPage } = dataStore
const id = ref<string>('')
const educationLevel = ref<string>()
const educationLevelId = ref<string>()
const educationLevelOptions = ref<DataOption[]>([])
const major = ref<string>()
const scores = ref<number | null>()
const name = ref<string>()
@ -298,11 +301,10 @@ watch(visibleColumns, async (count: String[], prevCount: String[]) => {
onMounted(async () => {
await fetchData()
await fetcheducationLevel()
})
const fetchData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateEducation(examId.value, positionId.value))
.then((res) => {
@ -317,34 +319,18 @@ const fetchData = async () => {
})
})
})
.catch(() => {})
.finally(() => {
loader.value = false
.catch((e) => {
// messageError($q, e)
})
}
const fetcheducationLevel = async () => {
loader.value = true
await http
.get(config.API.educationLevel)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: DataOption) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
})
educationLevelOptions.value = option
})
.catch(() => {})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
/**
* กดดอมลกอนหน
*/
const clickPrevious = () => {
const clickPrevious = async () => {
rowIndex.value -= 1
const row = rows.value[rowIndex.value]
educationLevel.value = row.educationLevel
@ -354,13 +340,13 @@ const clickPrevious = () => {
name.value = row.name
duration.value = row.duration
id.value = row.id
checkRowPage()
await checkRowPage()
}
/**
* กดดอมลตอไป
*/
const clickNext = () => {
const clickNext = async () => {
rowIndex.value += 1
const row = rows.value[rowIndex.value]
educationLevel.value = row.educationLevel
@ -370,7 +356,7 @@ const clickNext = () => {
name.value = row.name
duration.value = row.duration
id.value = row.id
checkRowPage()
await checkRowPage()
}
/**
@ -392,7 +378,6 @@ const checkRowPage = () => {
* กดปมแกไขใน dialog
*/
const clickEdit = () => {
// edit.value = true
next.value = false
previous.value = false
}
@ -400,8 +385,8 @@ const clickEdit = () => {
/**
* กดปมเพมดานบน table
*/
const clickAdd = () => {
addRow()
const clickAdd = async () => {
await addRow()
}
const checkDelete = (row: RequestItemsObject) => {
@ -414,26 +399,20 @@ const checkDelete = (row: RequestItemsObject) => {
*/
const clickDeleteRow = async () => {
if (rawItem.value != null) {
loader.value = true
loaderPage(true)
await http
.delete(config.API.candidateEducation(rawItem.value.id, ''))
.then(() => {
success($q, 'ลบข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
await fetchData()
// edit.value = false
})
} else {
await fetchData()
// edit.value = false
}
}
@ -443,15 +422,11 @@ const clickDeleteRow = async () => {
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
// if (store.consend == true) {
if (modalEdit.value) {
await editData()
} else {
await saveData()
}
// } else {
// modalConsend.value = true
// }
}
})
}
@ -460,7 +435,7 @@ const clickSave = async () => {
* นทกเพมขอม
*/
const saveData = async () => {
loader.value = true
loaderPage(true)
await http
.post(config.API.candidateEducation(examId.value, positionId.value), {
educationLevelId: educationLevelId.value,
@ -473,15 +448,10 @@ const saveData = async () => {
.then(() => {
success($q, 'บันทึกข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
// edit.value = false
modal.value = false
await fetchData()
})
@ -491,7 +461,7 @@ const saveData = async () => {
* นทกแกไขขอม
*/
const editData = async () => {
loader.value = true
loaderPage(true)
await http
.put(config.API.candidateEducation(id.value, ''), {
educationLevelId: educationLevelId.value,
@ -504,15 +474,10 @@ const editData = async () => {
.then(() => {
success($q, 'บันทึกข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
// modalErrorTittle.value = ''
// modalErrorDetail.value = e.response.data.message
// statusCode.value = e.response.data.status
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
// edit.value = false
modal.value = false
await fetchData()
})
@ -554,12 +519,8 @@ const selectData = (props: DataProps) => {
name.value = props.row.name
duration.value = props.row.duration
id.value = props.row.id
// if (edit.value == true) {
next.value = false
previous.value = false
// } else {
// checkRowPage()
// }
}
/**
@ -576,13 +537,6 @@ const addRow = () => {
duration.value = [new Date(), new Date()]
}
/**
* งกนปมยกเลกการแกไขขอม
*/
const clickCancel = async () => {
// edit.value = false
}
/**
* เชความการแกไขขอม
*/

View file

@ -8,7 +8,6 @@
:editOnly="false"
:editData="false"
/>
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 q-gutter-sm items-center flex q-my-sm">
@ -35,11 +34,11 @@
<div class="col-xs-12 col-sm-2 col-md-2" v-if="defaultFamily.same == '1'">
<q-select
hide-bottom-space
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
:rules="[(val) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
v-model="defaultFamily.prefixIdC"
@ -54,9 +53,9 @@
<div class="col-xs-6 col-sm-3 col-md-3" v-if="defaultFamily.same == '1'">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
@ -68,9 +67,9 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3" v-if="defaultFamily.same == '1'">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
@ -82,29 +81,27 @@
</div>
<div class="col-xs-12 col-sm-2 col-md-2" v-if="defaultFamily.same == '1'">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultFamily.occupationC"
:rules="[(val) => !!val || `${'กรุณากรอก อาชีพ'}`]"
:label="`${'อาชีพ'}`"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2" v-if="defaultFamily.same == '1'">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultFamily.nationalityC"
:rules="[(val) => !!val || `${'กรุณากรอก สัญชาติ'}`]"
:label="`${'สัญชาติ'}`"
/>
</div>
@ -113,11 +110,11 @@
<div class="col-xs-12 col-sm-2 col-md-2">
<q-select
hide-bottom-space
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
:rules="[(val) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
v-model="defaultFamily.prefixIdM"
@ -132,9 +129,9 @@
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
@ -146,9 +143,9 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
@ -160,29 +157,27 @@
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultFamily.occupationM"
:rules="[(val) => !!val || `${'กรุณากรอก อาชีพ'}`]"
:label="`${'อาชีพ'}`"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultFamily.nationalityM"
:rules="[(val) => !!val || `${'กรุณากรอก สัญชาติ'}`]"
:label="`${'สัญชาติ'}`"
/>
</div>
@ -191,11 +186,11 @@
<div class="col-xs-12 col-sm-2 col-md-2">
<q-select
hide-bottom-space
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
:rules="[(val) => !!val || `${'กรุณาเลือก คำนำหน้า'}`]"
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
v-model="defaultFamily.prefixIdF"
@ -209,9 +204,9 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
@ -223,9 +218,9 @@
</div>
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
@ -237,29 +232,27 @@
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultFamily.occupationF"
:rules="[(val) => !!val || `${'กรุณากรอก อาชีพ'}`]"
:label="`${'อาชีพ'}`"
/>
</div>
<div class="col-xs-12 col-sm-2 col-md-2">
<q-input
:class="getClass((status == 'register' || status == 'rejectRegister'))"
:class="getClass(status == 'register' || status == 'rejectRegister')"
hide-bottom-space
:outlined="(status == 'register' || status == 'rejectRegister')"
:outlined="status == 'register' || status == 'rejectRegister'"
dense
lazy-rules
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultFamily.nationalityF"
:rules="[(val) => !!val || `${'กรุณากรอก สัญชาติ'}`]"
:label="`${'สัญชาติ'}`"
/>
</div>
@ -271,10 +264,13 @@ import { onMounted, ref, watch } from 'vue'
import type { PropType } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useRoute } from 'vue-router'
import { useQuasar } from 'quasar'
import type { Family, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultFamily, changeData } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import { useRoute } from 'vue-router'
const props = defineProps({
prefixOptions: {
@ -290,15 +286,18 @@ const props = defineProps({
required: true
}
})
const emit = defineEmits(['update:form'])
const $q = useQuasar()
const dataStore = useDataStore()
const { loaderPage } = dataStore
const mixin = useCounterMixin()
const { messageError } = mixin
const edit = ref<boolean>(true)
const myform = ref<any>({})
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const loader = ref<boolean>(false)
const emit = defineEmits(['update:form'])
watch(myform, async (count: any, prevCount: any) => {
emit('update:form', count)
@ -313,43 +312,38 @@ onMounted(async () => {
})
const fetchData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateFamily(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
defaultFamily.value.prefixIdC = data.marryPrefixId
defaultFamily.value.firstnameC = data.marryFirstName
defaultFamily.value.lastnameC = data.marryLastName
defaultFamily.value.occupationC = data.marryOccupation
defaultFamily.value.nationalityC = data.marryNationality
defaultFamily.value.prefixIdM = data.fatherPrefixId
defaultFamily.value.firstnameM = data.fatherFirstName
defaultFamily.value.lastnameM = data.fatherLastName
defaultFamily.value.occupationM = data.fatherOccupation
defaultFamily.value.nationalityM = data.fatherNationality
defaultFamily.value.prefixIdF = data.motherPrefixId
defaultFamily.value.firstnameF = data.motherFirstName
defaultFamily.value.lastnameF = data.motherLastName
defaultFamily.value.occupationF = data.motherOccupation
defaultFamily.value.nationalityF = data.motherNationality
defaultFamily.value.same = data.marry == true ? '1' : data.marry == false ? '0' : null
if (data != null) {
defaultFamily.value.prefixIdC = data.marryPrefixId
defaultFamily.value.firstnameC = data.marryFirstName
defaultFamily.value.lastnameC = data.marryLastName
defaultFamily.value.occupationC = data.marryOccupation
defaultFamily.value.nationalityC = data.marryNationality
defaultFamily.value.prefixIdM = data.fatherPrefixId
defaultFamily.value.firstnameM = data.fatherFirstName
defaultFamily.value.lastnameM = data.fatherLastName
defaultFamily.value.occupationM = data.fatherOccupation
defaultFamily.value.nationalityM = data.fatherNationality
defaultFamily.value.prefixIdF = data.motherPrefixId
defaultFamily.value.firstnameF = data.motherFirstName
defaultFamily.value.lastnameF = data.motherLastName
defaultFamily.value.occupationF = data.motherOccupation
defaultFamily.value.nationalityF = data.motherNationality
defaultFamily.value.same = data.marry == true ? '1' : data.marry == false ? '0' : null
}
})
.catch((e) => {
messageError($q, e)
})
.catch(() => {})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const selectRadio = (e: boolean) => {
if (!e) {
defaultFamily.value.prefixIdC = ''
defaultFamily.value.firstnameC = ''
defaultFamily.value.lastnameC = ''
defaultFamily.value.occupationC = ''
}
}
const getClass = (val: boolean) => {
return {
'full-width inputgreen cursor-pointer': val,

View file

@ -8,7 +8,6 @@
:editOnly="false"
:editData="false"
/>
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform" class="col-12 row q-col-gutter-x-sm justify-center q-col-gutter-sm">
<div class="row col-xs-12 col-sm-12 col-md-10 items-center q-col-gutter-x-sm q-col-gutter-y-xs">
<div class="col-xs-12 col-sm-2 col-md-2">
@ -347,15 +346,16 @@
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import http from '@/plugins/http'
import config from '@/app.config'
import type { PropType } from 'vue'
import type { Information, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultInformation, changeData } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import { useRoute } from 'vue-router'
import keycloak from '@/plugins/keycloak'
import { useQuasar } from 'quasar'
import type { Information, DataOption } from '@/modules/01_exam/interface/index/Main'
import { defaultInformation, changeData } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
const props = defineProps({
prefixOptions: {
@ -379,24 +379,21 @@ const props = defineProps({
required: true
}
})
const emit = defineEmits(['update:form'])
const $q = useQuasar()
const mixin = useCounterMixin()
const { date2Thai, calAge, modalError, success } = mixin
const { date2Thai, calAge, success, messageError } = mixin
const dataStore = useDataStore()
const { loaderPage } = dataStore
const districtOptions = ref<DataOption[]>([])
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const edit = ref<boolean>(true)
const myform = ref<any>({})
const disabledPic = ref<boolean>(false)
const fileData = ref<File | null>()
const loader = ref<boolean>(false)
const img = ref<string>('')
const fileProfile = ref<File[]>([])
const fileDataUpload = ref<File>()
const emit = defineEmits(['update:form'])
watch(myform, async (count: any, prevCount: any) => {
emit('update:form', count)
@ -414,7 +411,7 @@ onMounted(async () => {
})
const fetchData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateInformation(examId.value, positionId.value))
.then((res) => {
@ -445,21 +442,23 @@ const fetchData = async () => {
keycloak.tokenParsed == null ? '' : keycloak.tokenParsed.family_name
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const fetchImgData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateProfile(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
img.value = data
})
.catch(() => {})
.finally(async () => {
loader.value = false
.catch((e) => {
// messageError($q, e)
})
.finally(() => {
loaderPage(false)
})
}
@ -468,16 +467,16 @@ const uploadImage = async (e: any) => {
if (input.length > 0) {
const formData = new FormData()
formData.append('', input[0])
// loaderPage(true);
loaderPage(true)
await http
.put(config.API.candidateProfile(examId.value, positionId.value), formData)
.then((res) => {
success($q, 'อัพโหลดรูปสำเร็จ')
})
.catch((e) => {})
.catch((e) => {
messageError($q, e)
})
.finally(async () => {
loader.value = false
// await fetchData()
await fetchImgData()
fileProfile.value = []
})
@ -485,14 +484,14 @@ const uploadImage = async (e: any) => {
}
}
const selectProvince = (val: string) => {
const selectProvince = async (val: string) => {
defaultInformation.value.districtId = ''
myform.value.resetValidation()
fetchDistrict(val)
await fetchDistrict(val)
}
const fetchDistrict = async (id: string) => {
loader.value = true
loaderPage(true)
await http
.get(config.API.listDistrict(id))
.then((res) => {
@ -503,14 +502,12 @@ const fetchDistrict = async (id: string) => {
})
districtOptions.value = option
})
.catch(() => {})
.finally(() => {
loader.value = false
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loaderPage(false)
})
}
const savePic = () => {
disabledPic.value = false
}
const getClass = (val: boolean) => {

View file

@ -8,7 +8,6 @@
:editOnly="false"
:editData="false"
/>
<!-- :changeBtn="changeBtn" -->
<q-form ref="myform">
<div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-xs">
<div class="col-12 row q-pb-lg">
@ -22,7 +21,7 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.official"
:rules="[(val) => !!val || `${'กรุณากรอก สำนัก/บริษัท'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
:disable="
defaultOccupation.status !== 'official' ||
!(status == 'register' || status == 'rejectRegister')
@ -52,7 +51,7 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.personnel"
:rules="[(val) => !!val || `${'กรุณากรอก สำนัก/บริษัท'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
:disable="
defaultOccupation.status !== 'personnel' ||
!(status == 'register' || status == 'rejectRegister')
@ -82,7 +81,7 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.officialsOther"
:rules="[(val) => !!val || `${'กรุณากรอก สำนัก/บริษัท'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
:disable="
defaultOccupation.status !== 'officialsOther' ||
!(status == 'register' || status == 'rejectRegister')
@ -112,7 +111,7 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.employee"
:rules="[(val) => !!val || `${'กรุณากรอก สำนัก/บริษัท'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
:disable="
defaultOccupation.status !== 'employee' ||
!(status == 'register' || status == 'rejectRegister')
@ -153,7 +152,7 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.other"
:rules="[(val) => !!val || `${'กรุณากรอก สำนัก/บริษัท'}`]"
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง'}`]"
:disable="
defaultOccupation.status !== 'other' ||
!(status == 'register' || status == 'rejectRegister')
@ -185,8 +184,8 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.company"
:rules="[(val) => !!val || `${'กรุณากรอก สำนัก/บริษัท'}`]"
:label="`${'สำนัก/บริษัท'}`"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
@ -200,8 +199,8 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.department"
:rules="[(val) => !!val || `${'กรุณากรอก กอง/ฝ่าย'}`]"
:label="`${'กอง/ฝ่าย'}`"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
@ -216,12 +215,12 @@
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.email"
:rules="[
(val) => !!val || 'กรุณากรอก E-mail address',
(val) =>
/^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/.test(val) ||
'E-mail address ไม่ถูกต้อง'
]"
:label="`${'E-mail address'}`"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-3 col-md-3">
@ -238,11 +237,9 @@
:readonly="!(status == 'register' || status == 'rejectRegister')"
:borderless="!(status == 'register' || status == 'rejectRegister')"
v-model="defaultOccupation.tel"
:rules="[
(val) => !!val || `${'กรุณากรอก โทรศัพท์'}`,
(val) => /^[0-9]*$/.test(val) || 'กรุณากรอก โทรศัพท์ให้ถูกต้อง'
]"
:rules="[(val) => /^[0-9]*$/.test(val) || 'กรุณากรอก โทรศัพท์ให้ถูกต้อง']"
:label="`${'โทรศัพท์'}`"
hide-bottom-space
/>
</div>
</div>
@ -252,10 +249,13 @@
import { ref, onMounted, watch } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useRoute } from 'vue-router'
import { useQuasar } from 'quasar'
import type { Occupation } from '@/modules/01_exam/interface/index/Main'
import { defaultOccupation, changeData } from '@/modules/01_exam/interface/index/Main'
import HeaderTop from '@/components/top.vue'
import { useRoute } from 'vue-router'
const props = defineProps({
status: {
@ -267,16 +267,19 @@ const props = defineProps({
required: true
}
})
const emit = defineEmits(['update:form'])
const $q = useQuasar()
const dataStore = useDataStore()
const { loaderPage } = dataStore
const mixin = useCounterMixin()
const { messageError } = mixin
const edit = ref<boolean>(true)
const myform = ref<any>({})
const loader = ref<boolean>(false)
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const emit = defineEmits(['update:form'])
watch(myform, async (count: any, prevCount: any) => {
emit('update:form', count)
})
@ -290,30 +293,34 @@ onMounted(async () => {
})
const fetchData = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateOccupation(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
defaultOccupation.value.status = data.occupationType
defaultOccupation.value.company = data.occupationCompany
defaultOccupation.value.department = data.occupationDepartment
defaultOccupation.value.email = data.occupationEmail
defaultOccupation.value.tel = data.occupationTelephone
defaultOccupation.value.official =
data.occupationType == 'official' ? data.occupationPosition : null
defaultOccupation.value.personnel =
data.occupationType == 'personnel' ? data.occupationPosition : null
defaultOccupation.value.officialsOther =
data.occupationType == 'officialsOther' ? data.occupationPosition : null
defaultOccupation.value.employee =
data.occupationType == 'employee' ? data.occupationPosition : null
defaultOccupation.value.other =
data.occupationType == 'other' ? data.occupationPosition : null
if (data != null) {
defaultOccupation.value.status = data.occupationType
defaultOccupation.value.company = data.occupationCompany
defaultOccupation.value.department = data.occupationDepartment
defaultOccupation.value.email = data.occupationEmail
defaultOccupation.value.tel = data.occupationTelephone
defaultOccupation.value.official =
data.occupationType == 'official' ? data.occupationPosition : null
defaultOccupation.value.personnel =
data.occupationType == 'personnel' ? data.occupationPosition : null
defaultOccupation.value.officialsOther =
data.occupationType == 'officialsOther' ? data.occupationPosition : null
defaultOccupation.value.employee =
data.occupationType == 'employee' ? data.occupationPosition : null
defaultOccupation.value.other =
data.occupationType == 'other' ? data.occupationPosition : null
}
})
.catch((e) => {
messageError($q, e)
})
.catch(() => {})
.finally(() => {
loader.value = false
loaderPage(false)
})
}

View file

@ -27,7 +27,7 @@
<q-separator class="q-my-lg bg-gray" size="5px" />
<div class="q-px-sm">
<Education :status="status" />
<Education :educationLevelOptions="educationLevelOptions" :status="status" />
</div>
<q-separator class="q-my-lg bg-gray" size="5px" />
@ -44,6 +44,9 @@
import { ref, onMounted, watch } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useQuasar } from 'quasar'
import type { DataOption } from '@/modules/01_exam/interface/index/Main'
import Information from '@/modules/01_exam/components/Form/Information.vue'
import Address from '@/modules/01_exam/components/Form/Address.vue'
@ -75,16 +78,6 @@ const props = defineProps({
required: true
}
})
const loader = ref<boolean>(true)
const prefixOptions = ref<DataOption[]>([])
const relationshipOptions = ref<DataOption[]>([])
const provinceOptions = ref<DataOption[]>([])
const formInformation = ref<any>({})
const formAddress = ref<any>({})
const formFamily = ref<any>({})
const formOccupation = ref<any>({})
const emit = defineEmits([
'update:formInformation',
'update:formAddress',
@ -92,6 +85,20 @@ const emit = defineEmits([
'update:formOccupation'
])
const $q = useQuasar()
const dataStore = useDataStore()
const { loaderPage } = dataStore
const mixin = useCounterMixin()
const { messageError } = mixin
const prefixOptions = ref<DataOption[]>([])
const relationshipOptions = ref<DataOption[]>([])
const provinceOptions = ref<DataOption[]>([])
const educationLevelOptions = ref<DataOption[]>([])
const formInformation = ref<any>({})
const formAddress = ref<any>({})
const formFamily = ref<any>({})
const formOccupation = ref<any>({})
watch(formInformation, async (count: Object, prevCount: Object) => {
emit('update:formInformation', count)
})
@ -108,63 +115,45 @@ watch(formOccupation, async (count: Object, prevCount: Object) => {
emit('update:formOccupation', count)
})
onMounted(() => {
fetchPrefix()
fetchRelationship()
fetchProvince()
onMounted(async () => {
await fetchPerson()
})
const fetchPrefix = async () => {
loader.value = true
const fetchPerson = async () => {
loaderPage(true)
await http
.get(config.API.prefix)
.get(config.API.person)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
let optionPrefix: DataOption[] = []
data.prefixs.map((r: any) => {
optionPrefix.push({ id: r.id.toString(), name: r.name.toString() })
})
prefixOptions.value = option
})
.catch((e) => {})
.finally(() => {
loader.value = false
})
}
prefixOptions.value = optionPrefix
const fetchRelationship = async () => {
loader.value = true
await http
.get(config.API.relationship)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
let optionRelationship: DataOption[] = []
data.relationships.map((r: any) => {
optionRelationship.push({ id: r.id.toString(), name: r.name.toString() })
})
relationshipOptions.value = option
})
.catch((e) => {})
.finally(() => {
loader.value = false
})
}
relationshipOptions.value = optionRelationship
const fetchProvince = async () => {
loader.value = true
await http
.get(config.API.province)
.then((res) => {
const data = res.data.result
let option: DataOption[] = []
data.map((r: any) => {
option.push({ id: r.id.toString(), name: r.name.toString() })
let optionProvince: DataOption[] = []
data.provinces.map((r: any) => {
optionProvince.push({ id: r.id.toString(), name: r.name.toString() })
})
provinceOptions.value = option
provinceOptions.value = optionProvince
let optionEducationLevel: DataOption[] = []
data.educationLevels.map((r: any) => {
optionEducationLevel.push({ id: r.id.toString(), name: r.name.toString() })
})
educationLevelOptions.value = optionEducationLevel
})
.catch((e) => {
messageError($q, e)
})
.catch((e) => {})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
</script>

View file

@ -1,16 +1,6 @@
const Main = () => import('@/modules/01_exam/views/ExamMain.vue')
const Detail = () => import('@/modules/01_exam/views/ExamDetail.vue')
export default [
// {
// path: '/exam',
// name: 'exam',
// component: Main,
// meta: {
// Auth: true
// // Key: [7]
// }
// },
{
path: '/exam/:id/:positionId',
name: 'examDetail',

View file

@ -61,7 +61,7 @@
</q-stepper>
<q-dialog :model-value="modalConsend" persistent>
<q-card :style="$q.screen.gt.xs ? 'min-width: 55vw' : 'min-width: 80vw'">
<Conference :ok="consendOk" :close="consenClose" />
<Consendform :ok="consendOk" />
</q-card>
</q-dialog>
</template>
@ -70,6 +70,7 @@
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useCounterMixin } from '@/stores/mixin'
import { useDataStore } from '@/stores/data'
import { useQuasar } from 'quasar'
import { useExamDataStore } from '@/modules/01_exam/store'
import http from '@/plugins/http'
@ -77,12 +78,14 @@ import config from '@/app.config'
import ExamForm from '@/modules/01_exam/components/ExamForm.vue'
import ExamPayment from '@/modules/01_exam/components/ExamPayment.vue'
import ExamFinished from '@/modules/01_exam/components/ExamFinished.vue'
import Conference from '@/modules/01_exam/components/Conference.vue'
import Consendform from '@/modules/01_exam/components/Consendform.vue'
const $q = useQuasar()
const store = useExamDataStore()
const storeExam = useExamDataStore()
const mixin = useCounterMixin()
const { modalError } = mixin
const { modalError, messageError } = mixin
const dataStore = useDataStore()
const { loaderPage } = dataStore
const step = ref<number>(1)
const stepRaw = ref<number>(1)
const tittle = ref<string>('')
@ -90,7 +93,6 @@ const position = ref<string>('')
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const loader = ref<boolean>(false)
const status = ref<string>('register')
const modalConsend = ref<boolean>(false)
const stepPayment = ref<boolean>(true)
@ -99,19 +101,17 @@ const round = ref<number | null>(null)
const yearly = ref<number | null>(null)
onMounted(async () => {
// stepRaw.value = 3
// step.value = 3
await fetchPeriodExam()
await candidateCheck()
})
const candidateCheck = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateCheckCreate(examId.value, positionId.value))
.then(async (res) => {
const data = res.data.result
store.consend = data.consend
storeExam.consend = data.consend
const positionExam = data.positionExam
stepPayment.value = data.payment
if (
@ -128,7 +128,7 @@ const candidateCheck = async () => {
closeWindow
)
} else {
if (store.consend == true) {
if (storeExam.consend == true) {
await fetchStep()
} else {
modalConsend.value = true
@ -137,20 +137,20 @@ const candidateCheck = async () => {
}
}
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
const closeWindow = async () => {
// window.close()
// window.closed = true
// console.log(window)
}
const fetchStep = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.candidateStatus(examId.value, positionId.value))
.then((res) => {
@ -194,15 +194,17 @@ const fetchStep = async () => {
step.value = 4
}
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
store.changeStatus(status.value)
loaderPage(false)
storeExam.changeStatus(status.value)
})
}
const fetchPeriodExam = async () => {
loader.value = true
loaderPage(true)
await http
.get(config.API.periodExamPosition(examId.value, positionId.value))
.then((res) => {
@ -212,9 +214,11 @@ const fetchPeriodExam = async () => {
yearly.value = data.year
position.value = data.posiiton == null ? '' : 'ตำแหน่ง: ' + data.posiiton.positionName
})
.catch(() => {})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
loader.value = false
loaderPage(false)
})
}
@ -224,8 +228,6 @@ const consenClose = () => {
const consendOk = () => {
modalConsend.value = false
// store.consend = true
// saveData()
}
</script>
<style>

View file

@ -1,235 +0,0 @@
<!-- page:main page รายการสอบทงหมด -->
<template>
<q-toolbar class="q-py-sm q-px-md bg-grey-2">
<q-toolbar-title class="toptitle text-dark col-12 row items-center"
>รายการสอบทงหมด</q-toolbar-title
>
</q-toolbar>
<div class="q-pa-md q-gutter-md">
<CardExam v-for="row in ExamData" :key="row.id" :items="row" @click="next(row.id)" />
<!-- <data-table
style="height: 80vh"
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
:pagination="initialPagination"
:nornmalData="true"
:paging="true"
>
<template #columns="props">
<q-tr :props="props" @click="next(props.row.id)" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'" class="table_ellipsis">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
<div class="row col-12 items-center">
<img
:src="props.row.avatar"
class="q-mr-sm col-4"
style="width: 28px; height: 28px; border-radius: 50%"
/>
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.fullname }}
</div>
<div class="text-weight-light">
{{ props.row.citizenId }}
</div>
</div>
</div>
</div>
<div v-else class="table_ellipsis">
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>
</data-table> -->
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import { useExamDataStore } from '@/modules/01_exam/store'
import type { RequestItemsObject, Columns } from '@/modules/01_exam/interface/request/Main'
import type { ResponseObject } from '@/modules/01_exam/interface/response/Main'
import type { Pagination, ExamCard } from '@/modules/01_exam/interface/index/Main'
import { defaultCard } from '@/modules/01_exam/interface/index/Main'
import CardExam from '../components/ExamCrad.vue'
const router = useRouter()
const store = useExamDataStore()
const { examData, changeExamColumns } = store
const filter = ref<string>('') //search data table
const initialPagination = ref<Pagination>({
rowsPerPage: 0
})
const ExamData = ref<ExamCard[]>(defaultCard)
const visibleColumns = ref<String[]>([])
examData.main.columns.length == 0
? (visibleColumns.value = [
'no',
'fullname',
'position',
'line',
'linePosition',
'level',
'positionFormalManage',
'positionManage',
'numberPosition',
'government'
])
: (visibleColumns.value = examData.main.columns)
const columns = ref<Columns>([
{
name: 'no',
align: 'left',
label: 'ลำดับ',
sortable: true,
field: 'no',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'fullname',
align: 'left',
label: 'ชื่อ-สกุล',
sortable: true,
field: 'fullname',
headerStyle: 'font-size: 14px; min-width: 200px',
style: 'font-size: 14px; '
},
{
name: 'position',
align: 'left',
label: 'ตำแหน่ง',
sortable: true,
field: 'position',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'line',
align: 'left',
label: 'สายงาน',
sortable: true,
field: 'line',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'linePosition',
align: 'left',
label: 'ตำแหน่งในสายงาน',
sortable: true,
field: 'linePosition',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'level',
align: 'left',
label: 'ระดับ',
sortable: true,
field: 'level',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'positionFormalManage',
align: 'left',
label: 'ตำแหน่งทางการบริหาร',
sortable: true,
field: 'positionFormalManage',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'positionManage',
align: 'left',
label: 'ตำแหน่งการบริหาร',
sortable: true,
field: 'positionManage',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'numberPosition',
align: 'left',
label: 'เลขที่ตำแหน่ง',
sortable: true,
field: 'numberPosition',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
},
{
name: 'government',
align: 'left',
label: 'หน่วยงาน/ส่วนราชการ',
sortable: true,
field: 'government',
headerStyle: 'font-size: 14px',
style: 'font-size: 14px'
}
])
const rows = ref<RequestItemsObject[]>([
{
id: 1,
fullname: 'นางสาวณัฐกา ชมสิน',
avatar: 'https://cdn.quasar.dev/img/boy-avatar.png',
citizenId: '4016500103241',
position: 'นักจัดการงานทั่วไป',
line: 'จัดการทั่วไป',
linePosition: 'ทั่วไป ',
level: 'ต้น',
positionFormalManage: 'นักจัดการทั่วไป',
positionManage: 'นักจัดการทั่วไป',
numberPosition: 'กทข.1',
government: 'กองบริหารทั่วไป'
},
{
id: 2,
fullname: 'นางสาวรัชภรณ์ ภักดี',
avatar: 'https://cdn.quasar.dev/img/boy-avatar.png',
citizenId: '4016500092355',
position: 'นักจัดการงานทั่วไป',
line: 'จัดการทั่วไป',
linePosition: 'ทั่วไป ',
level: 'ต้น',
positionFormalManage: 'นักจัดการทั่วไป',
positionManage: 'นักจัดการทั่วไป',
numberPosition: 'กทข.1',
government: 'กองบริหารทั่วไป'
},
{
id: 3,
fullname: 'นางสาวภาพรรณ ลออ',
avatar: 'https://cdn.quasar.dev/img/boy-avatar.png',
citizenId: '4016500086436',
position: 'นักจัดการงานทั่วไป',
line: 'จัดการทั่วไป',
linePosition: 'ทั่วไป ',
level: 'ต้น',
positionFormalManage: 'นักจัดการทั่วไป',
positionManage: 'นักจัดการทั่วไป',
numberPosition: 'กทข.1',
government: 'กองบริหารทั่วไป'
}
])
watch(visibleColumns, async (count: String[], prevCount: String[]) => {
await changeExamColumns('main', count)
})
const next = (id: string) => {
router.push(`/exam/${id}`)
}
</script>
<style></style>

View file

@ -1,10 +0,0 @@
interface Pagination {
rowsPerPage: number
}
interface DataOption {
id: string
name: string
}
export type { Pagination, DataOption }

View file

@ -1,28 +0,0 @@
interface DataProps {
row: RequestItemsObject
rowIndex: number
}
//ข้อมูล
interface RequestItemsObject {
id: string
name: string
certiNumber: string
start: Date
end: Date
}
//columns
interface Columns {
[index: number]: {
name: String
align: String
label: String
sortable: Boolean
field: String
headerStyle: String
style: String
}
}
export type { RequestItemsObject, Columns, DataProps }

View file

@ -1,11 +0,0 @@
//ข้อมูล
interface ResponseObject {
id: string
date: Date
status: string
level: string
refNo: string
refDate: Date
}
export type { ResponseObject }

View file

@ -1,13 +0,0 @@
const Meta = () => import('@/modules/02_meta/views/Meta02View.vue')
export default [
{
path: '/meta02',
name: 'meta02',
component: Meta,
meta: {
Auth: true
// Key: [7]
}
}
]

View file

@ -1,10 +0,0 @@
import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
export const useMetaStore = defineStore('meta', () => {
const meta = ref<string>('')
return {
meta
}
})

View file

@ -1,15 +0,0 @@
<template>
<div class="about">
<h1>This is an about META02</h1>
</div>
</template>
<style>
@media (min-width: 1024px) {
.about {
min-height: 100vh;
display: flex;
align-items: center;
}
}
</style>