อัพโหลดคะแนนภาค ข ค

This commit is contained in:
Kittapath 2023-04-25 03:45:41 +07:00
parent 9b9432f779
commit b768d7e754
5 changed files with 118 additions and 27 deletions

View file

@ -66,8 +66,49 @@
<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="">คะแนน</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>
<div class="col-xs-3 col-sm-2 text-primary text-weight-bold">คะแนนเต</div>
<div class="col-xs-3 col-sm-2 text-primary text-weight-bold">คะแนนทได</div>
<div class="col-xs-2 col-sm-2 text-primary text-weight-bold"></div>
<div class="col-xs-4 col-sm-5 text-grey-7">ภาค </div>
<div class="col-xs-3 col-sm-2 q-pr-xs">
{{ scoreBFull }}
</div>
<div class="col-xs-3 col-sm-2 q-pr-xs">
{{ scoreB }}
</div>
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
<div class="col-xs-4 col-sm-5 text-grey-7">ภาค </div>
<div class="col-xs-3 col-sm-2 q-pr-xs">
{{ scoreCFull }}
</div>
<div class="col-xs-3 col-sm-2 q-pr-xs">
{{ scoreC }}
</div>
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
<div class="col-xs-4 col-sm-5 text-grey-7">รวมทงหมด</div>
<div class="col-xs-3 col-sm-2 q-pr-xs">
{{ scoreSumFull }}
</div>
<div class="col-xs-3 col-sm-2 q-pr-xs">
{{ scoreSum }}
</div>
<div class="col-xs-2 col-sm-2 q-pr-xs text-grey-7">คะแนน</div>
<div class="col-xs-4 col-sm-5 text-weight-bold q-pt-sm">ผลการสอบ</div>
<div class="col-xs-8 col-sm-6 q-pr-xs text-weight-bold text-subtitle1">
<span :class="examResultinscore != 'ผ่าน' ? 'text-red' : 'text-positive'">{{
examResultinscore
}}</span>
</div>
</div>
</div>
<!-- <div class="q-pt-xs row">
<div class="">องสอบ :</div>
@ -126,7 +167,13 @@ const fullName = ref<string>('')
const examNumber = ref<string>('')
const citizenId = ref<string>('')
const examSeat = ref<string>('')
const point = ref<string>('')
const scoreBFull = ref<number>(0)
const scoreB = ref<number>(0)
const scoreCFull = ref<number>(0)
const scoreC = ref<number>(0)
const scoreSumFull = ref<number>(0)
const scoreSum = ref<number>(0)
const examResultinscore = ref<string>('')
const avatar = ref<string>('')
onMounted(async () => {
@ -143,7 +190,14 @@ const fetchStatus = async () => {
examNumber.value = data.examIdenNumber
citizenId.value = data.citizenId
examSeat.value = data.seatNumber
point.value = data.point
scoreBFull.value = data.pointTotalB
scoreB.value = data.pointB
scoreCFull.value = data.pointTotalC
scoreC.value = data.pointC
scoreSumFull.value = parseInt(data.pointB) + parseInt(data.pointC)
scoreSum.value = parseInt(data.pointB) + parseInt(data.pointC)
scoreC.value = data.pointC
examResultinscore.value = data.pass
avatar.value = data.avatar
})
.catch(() => {

View file

@ -76,7 +76,14 @@
<div class="absolute-bottom text-center">หลกฐานชำระเง</div>
</q-img>
</label>
<q-file
<input
id="file-upload"
type="file"
v-if="status == 'payment' || status == 'rejectPayment'"
accept="image/*"
@change="uploadImage"
/>
<!-- <q-file
id="file-upload"
v-model="filePayment"
dense
@ -90,7 +97,7 @@
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</q-file> -->
</div>
</div>
</div>
@ -292,12 +299,12 @@ const fetchData = async () => {
}
const clickPayment = async () => {
if (filePayment.value.length > 0) {
if (img.value != null || img.value != '') {
const formData = new FormData()
formData.append('', filePayment.value[0])
loader.value = true
await http
.put(config.API.candidatePayment(examId.value, positionId.value), formData)
.post(config.API.candidatePayment(examId.value, positionId.value))
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
})
@ -308,12 +315,31 @@ const clickPayment = async () => {
filePayment.value = []
})
} else {
modalError($q, 'ไม่สามารถอัพโหลดไฟล์ได้', 'กรุณาเลือกไฟล์ที่ต้องการอัพโหลด')
modalError($q, 'ไม่สามารถยืนยันการชำระเงินได้', 'กรุณาอัปโหลดเอกสารหลักฐานชำระเงิน')
}
}
const uploadImage = async (e: any) => {
filePayment.value = e
const uploadImage = async (file: any) => {
let input = file.target.files
if (input.length > 0) {
const formData = new FormData()
formData.append('', input[0])
loader.value = true
await http
.put(config.API.candidatePayment(examId.value, positionId.value), formData)
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
})
.catch(() => {})
.finally(async () => {
loader.value = false
props.fetchStep()
await fetchData()
file = []
})
} else {
modalError($q, 'ไม่สามารถอัพโหลดไฟล์ได้', 'กรุณาเลือกไฟล์ที่ต้องการอัพโหลด')
}
}
const downloadBillPayment = () => {

View file

@ -71,6 +71,7 @@
:rules="[(val) => !!val || `${'กรุณากรอกสถานที่ทำงาน/ฝึกงาน'}`]"
:label="`${'สถานที่ทำงาน/ฝึกงาน'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
@ -85,6 +86,7 @@
:rules="[(val) => !!val || `${'กรุณากรอกตำแหน่ง/ลักษณะงาน'}`]"
:label="`${'ตำแหน่ง/ลักษณะงาน'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
@ -100,6 +102,7 @@
:label="`${'เงินเดือนสุดท้ายก่อนออก'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/>
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
@ -127,6 +130,7 @@
lazy-rules
:borderless="!edit"
:model-value="dateThaiRange(duration)"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon
@ -153,6 +157,7 @@
:label="`${'เหตุผลที่ออก'}`"
@update:modelValue="clickEditRow"
type="textarea"
hide-bottom-space
/>
</div>
</div>
@ -384,7 +389,7 @@ const clickDeleteRow = async () => {
if (rawItem.value != null) {
loader.value = true
await http
.delete(config.API.candidateCareer(rawItem.value.id,""))
.delete(config.API.candidateCareer(rawItem.value.id, ''))
.then(() => {
success($q, 'ลบข้อมูลสำเร็จ')
})
@ -461,7 +466,7 @@ const saveData = async () => {
const editData = async () => {
loader.value = true
await http
.put(config.API.candidateCareer(id.value,""), {
.put(config.API.candidateCareer(id.value, ''), {
name: location.value,
position: position.value,
salary: salary.value,

View file

@ -9,8 +9,9 @@
"
icon="mdi-file-document"
:addData="true"
:editOnly="true"
:editOnly="false"
:editData="status == 'register' || status == 'rejectRegister'"
:save="uploadData"
/>
<div v-if="edit" class="row justify-center row col-12">
@ -35,9 +36,8 @@
class="full-width"
text-color="dark"
:max-size="10000000"
accept=".jpg,.png,.pdf,.csv,.doc"
bordered
label="[ไฟล์ jpg,png,pdf,csv,doc ขนาดไม่เกิน 10MB]"
label="[ไฟล์ขนาดไม่เกิน 10MB]"
@added="fileAdd"
>
<template v-slot:header="scope">
@ -81,7 +81,7 @@
<q-uploader-add-trigger />
<q-tooltip>เลอกไฟล</q-tooltip>
</q-btn>
<q-btn
<!-- <q-btn
v-if="scope.canUpload"
icon="cloud_upload"
label="อัพโหลดไฟล์"
@ -91,7 +91,7 @@
flat
>
<q-tooltip>พโหลดไฟล</q-tooltip>
</q-btn>
</q-btn> -->
<q-btn v-if="scope.isUploading" icon="clear" @click="scope.abort" round dense flat>
<q-tooltip>ยกเลกการอปโหลด</q-tooltip>
@ -163,14 +163,16 @@ 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()
})
const fileAdd = async (file: any) => {
name.value = file[0].name
const fileAdd = async (val: any) => {
name.value = val[0].name
file.value = val
}
const getData = async () => {
@ -206,14 +208,15 @@ const deleteData = async (id: string) => {
})
}
const uploadData = async (file: File[]) => {
loader.value = true
const blob = file.slice(0, file[0].size)
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[0].type
type: file.value[0].type
})
const formData = new FormData()
formData.append('', newFile)
loader.value = true
await http
.put(config.API.candidateUpload(examId.value, positionId.value), formData)
.then((res) => {
@ -223,9 +226,7 @@ const uploadData = async (file: File[]) => {
.finally(async () => {
loader.value = false
name.value = ''
setTimeout(() => {
uploader.value.reset()
}, 100)
uploader.value.reset()
await getData()
})
}

View file

@ -73,6 +73,7 @@
option-label="name"
:options="educationLevelOptions"
option-value="id"
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
@ -87,6 +88,7 @@
:rules="[(val) => !!val || `${'กรุณากรอกสาขาวิชา/วิชาเอก'}`]"
:label="`${'สาขาวิชา/วิชาเอก'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
@ -102,6 +104,7 @@
:rules="[(val) => !!val || `${'กรุณากรอกคะแนนเฉลี่ยตลอดหลักสูตร'}`]"
:label="`${'คะแนนเฉลี่ยตลอดหลักสูตร'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
@ -116,6 +119,7 @@
:rules="[(val) => !!val || `${'กรุณากรอกชื่อสถานศึกษา'}`]"
:label="`${'ชื่อสถานศึกษา'}`"
@update:modelValue="clickEditRow"
hide-bottom-space
/>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
@ -143,6 +147,7 @@
lazy-rules
:borderless="!edit"
:model-value="dateThaiRange(duration)"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon