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,137 @@
|
|||
<!-- page:detail page สรรหา -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const profile_id = ref<string>("");
|
||||
const birthdate = ref<string>("");
|
||||
const gender = ref<string>("");
|
||||
const university = ref<string>("");
|
||||
const position_name = ref<string>("");
|
||||
const degree = ref<string>("");
|
||||
const major = ref<string>("");
|
||||
const cert_issuedate = ref<string>("");
|
||||
const examAttribute = ref<string>("");
|
||||
const examResultinscore = ref<string>("");
|
||||
const scoreAFull = ref<string>("");
|
||||
const scoreA = ref<string>("");
|
||||
const scoreBFull = ref<string>("");
|
||||
const scoreB = ref<string>("");
|
||||
const scoreCFull = ref<string>("");
|
||||
const scoreC = ref<string>("");
|
||||
const scoreSumFull = ref<string>("");
|
||||
const scoreSum = ref<string>("");
|
||||
const examOrder = ref<string>("");
|
||||
const number = ref<string>("");
|
||||
const score_expired = ref<string>("");
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, showLoader, hideLoader } = mixin;
|
||||
const examID = ref<string>("62150001");
|
||||
const prefix = ref<string>("นาย");
|
||||
const fullname = ref<string>("เกียรติศักดิ์ บัณฑิต");
|
||||
const importId = ref<string>(route.params.id as string); // Period Import Id
|
||||
const examId = ref<string>(route.params.examId as string); // เลขประจำตัวสอบ
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function fetchData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getExamDetail(importId.value, examId.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
if (data != null) {
|
||||
profile_id.value = data.profileID;
|
||||
examID.value = data.examID;
|
||||
prefix.value = data.prefix;
|
||||
fullname.value = data.fullName;
|
||||
birthdate.value = data.dateOfBirth;
|
||||
gender.value = data.gender;
|
||||
degree.value = data.degree;
|
||||
major.value = data.major;
|
||||
university.value = data.university;
|
||||
position_name.value = data.positionName;
|
||||
cert_issuedate.value = data.certificateIssueDate;
|
||||
examAttribute.value = data.examAttribute;
|
||||
number.value = data.number;
|
||||
examOrder.value = data.examOrder;
|
||||
score_expired.value = data.scoreExpire;
|
||||
if (data.scoreResult != null) {
|
||||
scoreAFull.value = data.scoreResult.scoreAFull;
|
||||
scoreA.value = data.scoreResult.scoreA;
|
||||
scoreBFull.value = data.scoreResult.scoreBFull;
|
||||
scoreB.value = data.scoreResult.scoreB;
|
||||
scoreCFull.value = data.scoreResult.scoreCFull;
|
||||
scoreC.value = data.scoreResult.scoreC;
|
||||
scoreSumFull.value = data.scoreResult.scoreSumFull;
|
||||
scoreSum.value = data.scoreResult.scoreSum;
|
||||
examResultinscore.value = data.scoreResult.examResult;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadScore() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.downloadScoreReport(importId.value, examId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `ผลคะแนน_${examId.value}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
async function downloadCertificate() {
|
||||
showLoader();
|
||||
let type = degree.value.includes("บัณฑิต") ? 2 : 1;
|
||||
await http
|
||||
.get(config.API.downloadExamReport(importId.value, examId.value, type), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `เอกสารรับรอง_${examId.value}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
onMounted(async () => {
|
||||
await fetchData();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
<q-btn
|
||||
|
|
@ -233,138 +366,5 @@
|
|||
</div>
|
||||
</q-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const profile_id = ref<string>("");
|
||||
const birthdate = ref<string>("");
|
||||
const gender = ref<string>("");
|
||||
const university = ref<string>("");
|
||||
const position_name = ref<string>("");
|
||||
const degree = ref<string>("");
|
||||
const major = ref<string>("");
|
||||
const cert_issuedate = ref<string>("");
|
||||
const examAttribute = ref<string>("");
|
||||
const examResultinscore = ref<string>("");
|
||||
const scoreAFull = ref<string>("");
|
||||
const scoreA = ref<string>("");
|
||||
const scoreBFull = ref<string>("");
|
||||
const scoreB = ref<string>("");
|
||||
const scoreCFull = ref<string>("");
|
||||
const scoreC = ref<string>("");
|
||||
const scoreSumFull = ref<string>("");
|
||||
const scoreSum = ref<string>("");
|
||||
const examOrder = ref<string>("");
|
||||
const number = ref<string>("");
|
||||
const score_expired = ref<string>("");
|
||||
const mixin = useCounterMixin();
|
||||
const { messageError, showLoader, hideLoader } = mixin;
|
||||
const examID = ref<string>("62150001");
|
||||
const prefix = ref<string>("นาย");
|
||||
const fullname = ref<string>("เกียรติศักดิ์ บัณฑิต");
|
||||
const importId = ref<string>(route.params.id as string); // Period Import Id
|
||||
const examId = ref<string>(route.params.examId as string); // เลขประจำตัวสอบ
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchData();
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.getExamDetail(importId.value, examId.value))
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
if (data != null) {
|
||||
profile_id.value = data.profileID;
|
||||
examID.value = data.examID;
|
||||
prefix.value = data.prefix;
|
||||
fullname.value = data.fullName;
|
||||
birthdate.value = data.dateOfBirth;
|
||||
gender.value = data.gender;
|
||||
degree.value = data.degree;
|
||||
major.value = data.major;
|
||||
university.value = data.university;
|
||||
position_name.value = data.positionName;
|
||||
cert_issuedate.value = data.certificateIssueDate;
|
||||
examAttribute.value = data.examAttribute;
|
||||
number.value = data.number;
|
||||
examOrder.value = data.examOrder;
|
||||
score_expired.value = data.scoreExpire;
|
||||
if (data.scoreResult != null) {
|
||||
scoreAFull.value = data.scoreResult.scoreAFull;
|
||||
scoreA.value = data.scoreResult.scoreA;
|
||||
scoreBFull.value = data.scoreResult.scoreBFull;
|
||||
scoreB.value = data.scoreResult.scoreB;
|
||||
scoreCFull.value = data.scoreResult.scoreCFull;
|
||||
scoreC.value = data.scoreResult.scoreC;
|
||||
scoreSumFull.value = data.scoreResult.scoreSumFull;
|
||||
scoreSum.value = data.scoreResult.scoreSum;
|
||||
examResultinscore.value = data.scoreResult.examResult;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const downloadScore = async () => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.downloadScoreReport(importId.value, examId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `ผลคะแนน_${examId.value}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
const downloadCertificate = async () => {
|
||||
showLoader();
|
||||
let type = degree.value.includes("บัณฑิต") ? 2 : 1;
|
||||
await http
|
||||
.get(config.API.downloadExamReport(importId.value, examId.value, type), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(res.data);
|
||||
a.download = `เอกสารรับรอง_${examId.value}.pdf`;
|
||||
// start download
|
||||
a.click();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue