แก้บัคแสดงข้อมูลการศึกษา

This commit is contained in:
Kittapath 2023-04-20 11:19:28 +07:00
parent afae9edf5f
commit 9b9432f779
5 changed files with 70 additions and 105 deletions

View file

@ -305,8 +305,8 @@ const fetchData = async () => {
data.map((r: ResponseObject) => {
rows.value.push({
...r,
educationLevelId: r.educationLevel.id,
educationLevel: r.educationLevel.name,
educationLevelId: r.educationLevelId,
educationLevel: r.educationLevelName,
duration: [r.durationStart, r.durationEnd]
})
})
@ -465,7 +465,7 @@ const saveData = async () => {
durationEnd: dateToISO(new Date(duration.value[1]))
})
.then(() => {
success($q, 'บันทึกข้อมูลร่างสำเร็จ')
success($q, 'บันทึกข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true
@ -487,7 +487,7 @@ const saveData = async () => {
const editData = async () => {
loader.value = true
await http
.put(config.API.candidateEducation(id.value,""), {
.put(config.API.candidateEducation(id.value, ''), {
educationLevelId: educationLevelId.value,
major: major.value,
scores: scores.value,
@ -496,7 +496,7 @@ const editData = async () => {
durationEnd: dateToISO(new Date(duration.value[1]))
})
.then(() => {
success($q, 'บันทึกข้อมูลร่างสำเร็จ')
success($q, 'บันทึกข้อมูลสำเร็จ')
})
.catch(() => {
// modalError.value = true

View file

@ -324,9 +324,9 @@
</div>
</q-img>
</label>
<!-- <input id="file-upload" type="file" /> -->
<input id="file-upload" type="file" accept="image/*" @change="uploadImage" />
</div>
<q-file
<!-- <q-file
id="file-upload"
v-model="fileProfile"
dense
@ -345,7 +345,7 @@
<q-btn outline dense color="black" icon="mdi-content-save-outline" @click="clickProfile">
<q-tooltip content-class="bg-grey-2 text-black">นทกร</q-tooltip>
</q-btn>
</div>
</div> -->
</div>
<div class="col-xs-12 col-sm-9 col-md-12">
<q-input
@ -481,30 +481,52 @@ const fetchImgData = async () => {
})
}
const clickProfile = async () => {
if (fileProfile.value.length > 0) {
const blob = fileProfile.value.slice(0, fileProfile.value[0].size)
const newFile = new File(blob, fileProfile.value[0].name, {
type: fileProfile.value[0].type
})
fileDataUpload.value = newFile
// const clickProfile = async () => {
// if (fileProfile.value.length > 0) {
// const blob = fileProfile.value.slice(0, fileProfile.value[0].size)
// const newFile = new File(blob, fileProfile.value[0].name, {
// type: fileProfile.value[0].type
// })
// fileDataUpload.value = newFile
// const formData = new FormData()
// formData.append('', fileDataUpload.value)
// loader.value = true
// await http
// .put(config.API.candidateProfile(examId.value, positionId.value), formData)
// .then(() => {
// success($q, '')
// })
// .catch(() => {})
// .finally(async () => {
// loader.value = false
// await fetchData()
// await fetchImgData()
// fileProfile.value = []
// })
// } else {
// modalError($q, '', '')
// }
// }
const uploadImage = async (e: any) => {
let input = e.target.files
if (input.length > 0) {
const formData = new FormData()
formData.append('', fileDataUpload.value)
loader.value = true
formData.append('', input[0])
// loaderPage(true);
await http
.put(config.API.candidateProfile(examId.value, positionId.value), formData)
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
.then((res) => {
success($q, 'อัพโหลดรูปสำเร็จ')
})
.catch(() => {})
.catch((e) => {})
.finally(async () => {
loader.value = false
await fetchData()
await fetchImgData()
fileProfile.value = []
})
} else {
modalError($q, 'ไม่สามารถอัพโหลดไฟล์ได้', 'กรุณาเลือกไฟล์ที่ต้องการอัพโหลด')
return
}
}