โหลดใบสมัคร
This commit is contained in:
parent
96f92a5b69
commit
428670b515
5 changed files with 312 additions and 152 deletions
|
|
@ -41,5 +41,7 @@ export default {
|
||||||
candidateReview: (examId: string, positionId: string) =>
|
candidateReview: (examId: string, positionId: string) =>
|
||||||
`${candidate}review/${examId}/${positionId}`,
|
`${candidate}review/${examId}/${positionId}`,
|
||||||
candidate,
|
candidate,
|
||||||
candidateBill: (examId: string, positionId: string) => `${candidate}bill/${examId}/${positionId}`
|
candidateBill: (examId: string, positionId: string) => `${candidate}bill/${examId}/${positionId}`,
|
||||||
|
|
||||||
|
candidateReport: (candidateId: string) => `${env.API_URI_V2}/report/candidate/pdf/${candidateId}`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,37 @@
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const env = ref<string>(process.env.NODE_ENV || 'development')
|
const env = ref<string>(process.env.NODE_ENV || 'development')
|
||||||
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG
|
export const apiUrlConfig = `${import.meta.env.VITE_API_URI_CONFIG}/v1`
|
||||||
|
export const apiUrlConfigV2 = `${import.meta.env.VITE_API_URI_CONFIG}/v2`
|
||||||
|
|
||||||
const config = ref<any>({
|
const config = ref<any>({
|
||||||
development: {
|
development: {
|
||||||
// API_URI: 'https://localhost:7007/api/v1',
|
// API_URI: 'https://localhost:7007/api/v1',
|
||||||
API_URI: apiUrlConfig,
|
API_URI: apiUrlConfig,
|
||||||
|
API_URI_V2: apiUrlConfigV2,
|
||||||
MEET_URI: 'meet.frappet.com'
|
MEET_URI: 'meet.frappet.com'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
API_URI: 'http://localhost:5010/api/v1',
|
API_URI: 'http://localhost:5010/api/v1',
|
||||||
|
API_URI_V2: 'http://localhost:5010/api/v2',
|
||||||
MEET_URI: 'meet.frappet.com'
|
MEET_URI: 'meet.frappet.com'
|
||||||
},
|
},
|
||||||
production: {
|
production: {
|
||||||
// API_URI: "https://localhost:5010",
|
// API_URI: "https://localhost:5010",
|
||||||
API_URI: apiUrlConfig,
|
API_URI: apiUrlConfig,
|
||||||
|
API_URI_V2: apiUrlConfigV2,
|
||||||
MEET_URI: 'meet.frappet.com'
|
MEET_URI: 'meet.frappet.com'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const API_URI = ref<string>(config.value[env.value].API_URI)
|
const API_URI = ref<string>(config.value[env.value].API_URI)
|
||||||
|
const API_URI_V2 = ref<string>(config.value[env.value].API_URI_V2)
|
||||||
const MEET_URI = ref<string>(config.value[env.value].MEET_URI)
|
const MEET_URI = ref<string>(config.value[env.value].MEET_URI)
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
env: env.value,
|
env: env.value,
|
||||||
config: config.value,
|
config: config.value,
|
||||||
API_URI: API_URI.value,
|
API_URI: API_URI.value,
|
||||||
|
API_URI_V2: API_URI_V2.value,
|
||||||
MEET_URI: MEET_URI.value
|
MEET_URI: MEET_URI.value
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@ const score_expired = ref<Date | null>(new Date())
|
||||||
const number = ref<string>('')
|
const number = ref<string>('')
|
||||||
const reviewPoint = ref<number>(0)
|
const reviewPoint = ref<number>(0)
|
||||||
const review = ref<string>('-')
|
const review = ref<string>('-')
|
||||||
|
const candidateId = ref<string>('')
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchStatus()
|
await fetchStatus()
|
||||||
|
|
@ -232,6 +233,7 @@ const fetchStatus = async () => {
|
||||||
positionLevel.value = data.positionLevel
|
positionLevel.value = data.positionLevel
|
||||||
reviewPoint.value = data.reviewPoint
|
reviewPoint.value = data.reviewPoint
|
||||||
review.value = data.review == null ? '-' : data.review
|
review.value = data.review == null ? '-' : data.review
|
||||||
|
candidateId.value = data.id
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e)
|
messageError($q, e)
|
||||||
|
|
@ -241,8 +243,33 @@ const fetchStatus = async () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const download = () => {
|
const download = async () => {
|
||||||
window.print()
|
loaderPage(true)
|
||||||
|
await http
|
||||||
|
.get(config.API.candidateReport(candidateId.value), {
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data
|
||||||
|
downloadFilePDF(data, `ใบสมัครสอบ.pdf`)
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loaderPage(false)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const downloadFilePDF = async (res: string, fileName: string) => {
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = window.URL.createObjectURL(
|
||||||
|
new Blob([res], {
|
||||||
|
type: 'application/vnd.ms-excel'
|
||||||
|
})
|
||||||
|
)
|
||||||
|
link.setAttribute('download', fileName)
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,11 +237,11 @@ const clickSave = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveData = async () => {
|
const saveData = async () => {
|
||||||
if (defaultInformation.value.profileImg == null || '') {
|
if (saveAuto.value == true) {
|
||||||
|
if (defaultInformation.value.profileImg == null || defaultInformation.value.profileImg == '') {
|
||||||
notifyError($q, 'กรุณาอัพโหลดรูปถ่าย')
|
notifyError($q, 'กรุณาอัพโหลดรูปถ่าย')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log(defaultInformation.value.tel)
|
|
||||||
await formInformation.value.validate().then(async (suc: boolean) => {
|
await formInformation.value.validate().then(async (suc: boolean) => {
|
||||||
if (suc) {
|
if (suc) {
|
||||||
await formAddress.value.validate().then(async (suc: boolean) => {
|
await formAddress.value.validate().then(async (suc: boolean) => {
|
||||||
|
|
@ -313,7 +313,7 @@ const saveData = async () => {
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
success($q, 'บันทึกข้อมูลส่วนตัวสำเร็จ')
|
success($q, 'บันทึกข้อมูลส่วนตัวสำเร็จ')
|
||||||
if (saveAuto.value) await saveForm()
|
await saveForm()
|
||||||
await props.fetchStep()
|
await props.fetchStep()
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
@ -341,6 +341,72 @@ const saveData = async () => {
|
||||||
notifyError($q, 'กรุณากรอกข้อมูลให้ครบถ้วน')
|
notifyError($q, 'กรุณากรอกข้อมูลให้ครบถ้วน')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
loaderPage(true)
|
||||||
|
await http
|
||||||
|
.post(config.API.candidateId(examId.value, positionId.value), {
|
||||||
|
prefixId: defaultInformation.value.prefixId,
|
||||||
|
prefixName: defaultInformation.value.prefixId,
|
||||||
|
lastName: defaultInformation.value.lastname,
|
||||||
|
dateOfBirth:
|
||||||
|
defaultInformation.value.birthDate == null
|
||||||
|
? null
|
||||||
|
: dateToISO(defaultInformation.value.birthDate),
|
||||||
|
citizenId: defaultInformation.value.cardid,
|
||||||
|
firstName: defaultInformation.value.firstname,
|
||||||
|
religionId: defaultInformation.value.religionId,
|
||||||
|
nationality: defaultInformation.value.nationality,
|
||||||
|
email: defaultInformation.value.email,
|
||||||
|
mobilePhone: defaultInformation.value.phone,
|
||||||
|
telephone: defaultInformation.value.tel,
|
||||||
|
knowledge: defaultInformation.value.knowledge,
|
||||||
|
occupationOrg: defaultOccupation.value.org,
|
||||||
|
occupationPile: defaultOccupation.value.pile,
|
||||||
|
occupationGroup: defaultOccupation.value.group,
|
||||||
|
occupationSalary: defaultOccupation.value.salary,
|
||||||
|
occupationPosition: defaultOccupation.value.position,
|
||||||
|
occupationPositionType: defaultOccupation.value.positionType,
|
||||||
|
occupationTelephone: defaultOccupation.value.tel,
|
||||||
|
registAddress: defaultAddress.value.address,
|
||||||
|
currentAddress: defaultAddress.value.addressC,
|
||||||
|
registProvinceId: defaultAddress.value.provinceId,
|
||||||
|
currentProvinceId: defaultAddress.value.provinceIdC,
|
||||||
|
registDistrictId: defaultAddress.value.districtId,
|
||||||
|
currentDistrictId: defaultAddress.value.districtIdC,
|
||||||
|
registSubDistrictId: defaultAddress.value.subdistrictId,
|
||||||
|
currentSubDistrictId: defaultAddress.value.subdistrictIdC,
|
||||||
|
registZipCode: defaultAddress.value.code,
|
||||||
|
currentZipCode: defaultAddress.value.codeC,
|
||||||
|
registSame:
|
||||||
|
defaultAddress.value.same == '1' ? true : defaultAddress.value.same == '0' ? false : null,
|
||||||
|
educationLevelExamId: defaultEducation.value.educationLevelExamId,
|
||||||
|
educationName: defaultEducation.value.educationName,
|
||||||
|
educationMajor: defaultEducation.value.educationMajor,
|
||||||
|
educationLocation: defaultEducation.value.educationLocation,
|
||||||
|
educationType: defaultEducation.value.educationType,
|
||||||
|
educationEndDate:
|
||||||
|
defaultEducation.value.educationEndDate == null
|
||||||
|
? null
|
||||||
|
: dateToISO(defaultEducation.value.educationEndDate),
|
||||||
|
educationScores: defaultEducation.value.educationScores,
|
||||||
|
educationLevelHighId: defaultEducation.value.educationLevelHighId,
|
||||||
|
|
||||||
|
contactprefixId: defaultContact.value.contactprefixId,
|
||||||
|
contactfirstname: defaultContact.value.contactfirstname,
|
||||||
|
contactlastname: defaultContact.value.contactlastname,
|
||||||
|
contactrelations: defaultContact.value.contactrelations,
|
||||||
|
contacttel: defaultContact.value.contacttel
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
success($q, 'บันทึกข้อมูลส่วนตัวสำเร็จ')
|
||||||
|
await props.fetchStep()
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e)
|
||||||
|
loaderPage(false)
|
||||||
|
})
|
||||||
|
.finally(async () => {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@
|
||||||
</template>
|
</template>
|
||||||
<template #bottom="props">
|
<template #bottom="props">
|
||||||
<div :props="props" class="row col-11 justify-end">
|
<div :props="props" class="row col-11 justify-end">
|
||||||
<span class="text-weight-medium text-subtitle2">รวมระยะเวลา : <span class="q-pl-sm">{{ total }} วัน</span></span>
|
<span class="text-weight-medium text-subtitle2"
|
||||||
|
>รวมระยะเวลา : <span class="q-pl-sm">{{ total }}</span></span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Table>
|
</Table>
|
||||||
|
|
@ -286,7 +288,7 @@ const org = ref<string | null>()
|
||||||
const startDate = ref<Date>(new Date())
|
const startDate = ref<Date>(new Date())
|
||||||
const endDate = ref<Date>(new Date())
|
const endDate = ref<Date>(new Date())
|
||||||
const rangeDate = ref<string | null>()
|
const rangeDate = ref<string | null>()
|
||||||
const total = ref<string>('0')
|
const total = ref<string>('-')
|
||||||
const myForm = ref<any>() //form data input
|
const myForm = ref<any>() //form data input
|
||||||
const edit = ref<boolean>(true) //เช็คการกดปุ่มแก้ไขใน dialog
|
const edit = ref<boolean>(true) //เช็คการกดปุ่มแก้ไขใน dialog
|
||||||
const modal = ref<boolean>(false) //modal add detail
|
const modal = ref<boolean>(false) //modal add detail
|
||||||
|
|
@ -449,12 +451,53 @@ const calDate = async () => {
|
||||||
}${dayDiff > 0 ? dayDiff + ' วัน ' : ''}`
|
}${dayDiff > 0 ? dayDiff + ' วัน ' : ''}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const calDateSplit = async (startDate: Date, endDate: Date) => {
|
||||||
|
let _startDate = new Date(startDate.toISOString().substr(0, 10))
|
||||||
|
let _endDate = new Date(endDate.toISOString().substr(0, 10))
|
||||||
|
_endDate.setDate(_endDate.getDate() + 1)
|
||||||
|
if (_startDate > _endDate) {
|
||||||
|
const swap = _startDate
|
||||||
|
_startDate = _endDate
|
||||||
|
_endDate = swap
|
||||||
|
}
|
||||||
|
const startYear = _startDate.getFullYear()
|
||||||
|
const february = (startYear % 4 === 0 && startYear % 100 !== 0) || startYear % 400 === 0 ? 29 : 28
|
||||||
|
const daysInMonth = [31, february, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
||||||
|
|
||||||
|
let yearDiff = _endDate.getFullYear() - startYear
|
||||||
|
let monthDiff = _endDate.getMonth() - _startDate.getMonth()
|
||||||
|
if (monthDiff < 0) {
|
||||||
|
yearDiff--
|
||||||
|
monthDiff += 12
|
||||||
|
}
|
||||||
|
let dayDiff = _endDate.getDate() - _startDate.getDate()
|
||||||
|
if (dayDiff < 0) {
|
||||||
|
if (monthDiff > 0) {
|
||||||
|
monthDiff--
|
||||||
|
} else {
|
||||||
|
yearDiff--
|
||||||
|
monthDiff = 11
|
||||||
|
}
|
||||||
|
dayDiff += daysInMonth[_startDate.getMonth()]
|
||||||
|
}
|
||||||
|
var obj = {
|
||||||
|
yearDiff: yearDiff,
|
||||||
|
monthDiff: monthDiff,
|
||||||
|
dayDiff: dayDiff
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
loaderPage(true)
|
loaderPage(true)
|
||||||
await http
|
await http
|
||||||
.get(config.API.candidateCareer(examId.value, positionId.value))
|
.get(config.API.candidateCareer(examId.value, positionId.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result
|
const data = res.data.result
|
||||||
|
var yearDiff = 0
|
||||||
|
var monthDiff = 0
|
||||||
|
var dayDiff = 0
|
||||||
|
total.value = '-'
|
||||||
rows.value = []
|
rows.value = []
|
||||||
data.map((r: any) => {
|
data.map((r: any) => {
|
||||||
rows.value.push({
|
rows.value.push({
|
||||||
|
|
@ -462,6 +505,22 @@ const fetchData = async () => {
|
||||||
startDate: new Date(r.durationStart),
|
startDate: new Date(r.durationStart),
|
||||||
endDate: new Date(r.durationEnd)
|
endDate: new Date(r.durationEnd)
|
||||||
})
|
})
|
||||||
|
calDateSplit(new Date(r.durationStart), new Date(r.durationEnd)).then((d) => {
|
||||||
|
yearDiff = yearDiff + d.yearDiff
|
||||||
|
monthDiff = monthDiff + d.monthDiff
|
||||||
|
dayDiff = dayDiff + d.dayDiff
|
||||||
|
if (dayDiff > 30) {
|
||||||
|
dayDiff = dayDiff % 30
|
||||||
|
monthDiff = monthDiff + parseInt((dayDiff / 30).toString())
|
||||||
|
}
|
||||||
|
if (monthDiff > 12) {
|
||||||
|
monthDiff = monthDiff % 12
|
||||||
|
yearDiff = yearDiff + parseInt((monthDiff / 12).toString())
|
||||||
|
}
|
||||||
|
total.value = `${yearDiff > 0 ? yearDiff + ' ปี ' : ''}${
|
||||||
|
monthDiff > 0 ? monthDiff + ' เดือน ' : ''
|
||||||
|
}${dayDiff > 0 ? dayDiff + ' วัน ' : ''}`
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue