Refactoring code module 03_recruiting
This commit is contained in:
parent
b223c2433e
commit
87e2e3b080
36 changed files with 6139 additions and 6335 deletions
|
|
@ -1,4 +1,284 @@
|
|||
<!-- step กรอกข้อมูล -->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import Profile from "@/modules/03_recruiting/components/Profile.vue";
|
||||
import {
|
||||
defaultInformation,
|
||||
defaultOccupation,
|
||||
defaultContact,
|
||||
defaultAddress,
|
||||
defaultEducation,
|
||||
} from "@/modules/03_recruiting/interface/index/Main";
|
||||
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const {
|
||||
success,
|
||||
dateToISO,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
notifyError,
|
||||
} = mixin;
|
||||
|
||||
const examId = ref<string>(route.params.examId.toString());
|
||||
const candidateId = ref<string>(route.params.candidateId.toString());
|
||||
const modal = ref<boolean>(false);
|
||||
const modalReverseOfficer = ref<boolean>(false);
|
||||
const approve = ref<string>("1");
|
||||
const reason = ref<string>("");
|
||||
const formInformation = ref<any>({});
|
||||
const formAddress = ref<any>({});
|
||||
const formEducation = ref<any>({});
|
||||
const formOccupation = ref<any>({});
|
||||
const formContact = ref<any>({});
|
||||
const status = ref<string>("");
|
||||
const rejectDetail = ref<string>("");
|
||||
|
||||
/** ดึงข้อมูลสถานะ */
|
||||
async function fetchStatus() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.candidateId(candidateId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
status.value = data.status;
|
||||
rejectDetail.value = data.rejectDetail;
|
||||
console.log(rejectDetail.value);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ยืนยัน ตรวจสอบข้อมูลสำเร็จ*/
|
||||
async function confirm(status: boolean, reason: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.candidateCheckRegister(candidateId.value), {
|
||||
status: status,
|
||||
reason: reason,
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
||||
router.push(`/qualify/manage/${examId.value}`);
|
||||
});
|
||||
}
|
||||
|
||||
/** ปฏิเสธ ตรวจสอบข้อมูลสำเร็จ */
|
||||
async function reject(reason: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.candidateRejectRegister(candidateId.value), {
|
||||
reason: reason,
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
||||
router.push(`/qualify/manage/${examId.value}`);
|
||||
});
|
||||
}
|
||||
|
||||
/** บันทึกตรวจสอบ */
|
||||
function checkSaveReverse() {
|
||||
rejectReverse(reason.value);
|
||||
}
|
||||
|
||||
/** save ข้อมูล */
|
||||
function checkSave() {
|
||||
if (approve.value == "1") {
|
||||
confirm(true, "");
|
||||
} else if (approve.value == "2") {
|
||||
confirm(false, reason.value);
|
||||
} else {
|
||||
reject(reason.value);
|
||||
}
|
||||
}
|
||||
|
||||
/** บันทึกตรวจสอบ */
|
||||
async function rejectReverse(reason: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.candidateCheckRegisterReject(candidateId.value), {
|
||||
reason: reason,
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
success($q, "สำเร็จ");
|
||||
router.push(`/qualify/manage/${examId.value}`);
|
||||
});
|
||||
}
|
||||
|
||||
/** dialog ย้อนกลับให้เจ้าหน้าที่ตรวจสอบ*/
|
||||
function modalReverse() {
|
||||
modalReverseOfficer.value = true;
|
||||
}
|
||||
|
||||
/** ปิด dialog ย้อนกลับให้เจ้าหน้าที่ตรวจสอบ */
|
||||
function closeReverse() {
|
||||
modalReverseOfficer.value = false;
|
||||
}
|
||||
|
||||
/** ปิด dialog */
|
||||
function close() {
|
||||
modal.value = false;
|
||||
}
|
||||
|
||||
/** บันทึกข้อมูล คุณสมบัติผู้สมัครสอบรอบคัดเลือก */
|
||||
async function clickSave() {
|
||||
await formInformation.value.validate().then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formAddress.value.validate().then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formEducation.value.validate().then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formOccupation.value
|
||||
.validate()
|
||||
.then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formContact.value
|
||||
.validate()
|
||||
.then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.candidateId(candidateId.value), {
|
||||
prefixId: 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, "บันทึกข้อมูลส่วนตัวสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchStatus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
|
|
@ -191,274 +471,4 @@
|
|||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import Profile from "@/modules/03_recruiting/components/Profile.vue";
|
||||
import {
|
||||
defaultInformation,
|
||||
defaultOccupation,
|
||||
defaultContact,
|
||||
defaultAddress,
|
||||
defaultEducation,
|
||||
} from "@/modules/03_recruiting/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const router = useRouter();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
|
||||
const {
|
||||
success,
|
||||
dateToISO,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
notifyError,
|
||||
} = mixin;
|
||||
const route = useRoute();
|
||||
const examId = ref<string>(route.params.examId.toString());
|
||||
const candidateId = ref<string>(route.params.candidateId.toString());
|
||||
const modal = ref<boolean>(false);
|
||||
const modalReverseOfficer = ref<boolean>(false);
|
||||
const approve = ref<string>("1");
|
||||
const reason = ref<string>("");
|
||||
const formInformation = ref<any>({});
|
||||
const formAddress = ref<any>({});
|
||||
const formEducation = ref<any>({});
|
||||
const formOccupation = ref<any>({});
|
||||
const formContact = ref<any>({});
|
||||
const status = ref<string>("");
|
||||
const rejectDetail = ref<string>("");
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchStatus();
|
||||
});
|
||||
|
||||
const fetchStatus = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.candidateId(candidateId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
status.value = data.status;
|
||||
rejectDetail.value = data.rejectDetail;
|
||||
console.log(rejectDetail.value);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const confirm = async (status: boolean, reason: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.candidateCheckRegister(candidateId.value), {
|
||||
status: status,
|
||||
reason: reason,
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
||||
router.push(`/qualify/manage/${examId.value}`);
|
||||
});
|
||||
};
|
||||
|
||||
const reject = async (reason: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.candidateRejectRegister(candidateId.value), {
|
||||
reason: reason,
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
||||
router.push(`/qualify/manage/${examId.value}`);
|
||||
});
|
||||
};
|
||||
|
||||
const checkSaveReverse = () => {
|
||||
rejectReverse(reason.value);
|
||||
};
|
||||
|
||||
const checkSave = () => {
|
||||
if (approve.value == "1") {
|
||||
confirm(true, "");
|
||||
} else if (approve.value == "2") {
|
||||
confirm(false, reason.value);
|
||||
} else {
|
||||
reject(reason.value);
|
||||
}
|
||||
};
|
||||
|
||||
const modalCheck = () => {
|
||||
modal.value = true;
|
||||
};
|
||||
|
||||
const rejectReverse = async (reason: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.candidateCheckRegisterReject(candidateId.value), {
|
||||
reason: reason,
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
success($q, "สำเร็จ");
|
||||
router.push(`/qualify/manage/${examId.value}`);
|
||||
});
|
||||
};
|
||||
|
||||
const modalReverse = () => {
|
||||
modalReverseOfficer.value = true;
|
||||
};
|
||||
|
||||
const closeReverse = () => {
|
||||
modalReverseOfficer.value = false;
|
||||
};
|
||||
const close = () => {
|
||||
modal.value = false;
|
||||
};
|
||||
|
||||
const clickSave = async () => {
|
||||
await formInformation.value.validate().then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formAddress.value.validate().then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formEducation.value.validate().then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formOccupation.value
|
||||
.validate()
|
||||
.then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
await formContact.value
|
||||
.validate()
|
||||
.then(async (suc: boolean) => {
|
||||
if (suc) {
|
||||
showLoader();
|
||||
await http
|
||||
.post(config.API.candidateId(candidateId.value), {
|
||||
prefixId: 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, "บันทึกข้อมูลส่วนตัวสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
notifyError($q, "กรุณากรอกข้อมูลให้ครบถ้วน");
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue