hrms-mgt/src/modules/03_recruiting/views/02_qualify/DisableDetail.vue

524 lines
15 KiB
Vue
Raw Normal View History

2023-06-01 12:54:58 +07:00
<!-- page:detail page สรรหา -->
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
2024-09-17 15:56:06 +07:00
import { useQuasar } from "quasar";
2023-08-04 10:04:59 +07:00
2023-06-01 12:54:58 +07:00
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
2024-09-17 15:56:06 +07:00
import type { RecruitDetailResponse } from "@/modules/03_recruiting/interface/response/Period";
2025-02-26 17:15:19 +07:00
import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
2025-10-14 11:57:31 +07:00
import DialogCandidates from "@/modules/03_recruiting/components/DialogCandidates.vue";
2024-09-17 15:56:06 +07:00
import Table from "@/modules/03_recruiting/components/Table.vue";
2025-01-05 21:56:56 +07:00
import genReportXLSX from "@/plugins/genreportxlsx";
2023-06-01 12:54:58 +07:00
const $q = useQuasar();
2024-09-17 15:56:06 +07:00
const router = useRouter();
const route = useRoute();
const mixin = useCounterMixin();
2025-10-17 17:22:40 +07:00
const {
messageError,
success,
showLoader,
hideLoader,
onSearchDataTable,
convertDateToAPI,
} = mixin;
2023-08-04 10:04:59 +07:00
2023-06-01 12:54:58 +07:00
const year = ref<string>("2566");
const round = ref<string>("1");
const name = ref<string>("");
2025-02-26 17:15:19 +07:00
const initialPagination = ref<Pagination>({
page: 1,
2025-02-26 17:15:19 +07:00
rowsPerPage: 0,
sortBy: "examID",
});
2024-09-17 15:56:06 +07:00
2023-06-01 12:54:58 +07:00
const count = ref<number>(0);
const pass = ref<number>(0);
const notpass = ref<number>(0);
const missed_exam = ref<number>(0);
const other = ref<number>(0);
2025-09-24 11:37:49 +07:00
const total = ref<number>(0);
const totalList = ref<number>(0);
2023-06-01 12:54:58 +07:00
const importId = ref<string>(route.params.id as string); // Period Import Id
2024-09-17 15:56:06 +07:00
2023-06-01 12:54:58 +07:00
const filter = ref<string>(""); //search data table
2025-10-17 10:02:24 +07:00
const examResult = ref<string>(""); // กรองผลการสอบ
2023-06-01 12:54:58 +07:00
const visibleColumns = ref<String[]>([
"examID",
"profileID",
"fullName",
"hddPosition",
2023-06-01 12:54:58 +07:00
"dateOfBirth",
"gender",
"position_name",
"university",
"degree",
"major",
"certificateIssueDate",
"certificateNo",
"examAttribute",
"examScore",
"examResult",
2025-10-17 10:02:24 +07:00
"number",
2023-06-01 12:54:58 +07:00
"applyDate",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "examID",
align: "left",
label: "เลขประจำตัวสอบ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "examID",
headerStyle: "font-size: 14px; min-width: 20px",
style: "font-size: 14px",
},
{
name: "profileID",
align: "left",
label: "เลขประจำตัวประชาชน",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "profileID",
headerStyle: "font-size: 14px; min-width: 20px",
style: "font-size: 14px; ",
},
{
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "personName",
headerStyle: "font-size: 14px; min-width: 250px",
style: "font-size: 14px; ",
},
{
name: "hddPosition",
align: "left",
label: "บัญชีสอบ",
2025-10-17 10:02:24 +07:00
sortable: false,
field: "hddPosition",
headerStyle: "font-size: 14px; min-width: 250px",
style: "font-size: 14px; ",
},
2023-06-01 12:54:58 +07:00
{
name: "dateOfBirth",
align: "left",
label: "วัน เดือน ปีเกิด",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "dateOfBirth",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "gender",
align: "left",
label: "เพศ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "gender",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position_name",
align: "left",
label: "ตำแหน่งที่สมัคร",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "position_name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "university",
align: "left",
label: "สถานศึกษา",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "university",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "degree",
align: "left",
label: "วุฒิการศึกษา",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "degree",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "major",
align: "left",
label: "สาขาวิชาเอก",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "major",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "certificateNo",
align: "left",
label: "เลขที่ใบประกอบวิชาชีพ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "certificateNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "certificateIssueDate",
align: "left",
label: "วันที่ได้รับใบประกอบวิชาชีพฯ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "certificateIssueDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "examAttribute",
align: "left",
label: "สถานะการคัดกรองคุณสมบัติ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "examAttribute",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "examScore",
2024-12-26 10:32:22 +07:00
align: "left",
2023-06-01 12:54:58 +07:00
label: "คะแนนรวม",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "examScore",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "examResult",
align: "left",
2025-10-14 10:10:33 +07:00
label: "ผลการสอบ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "examResult",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
2025-10-14 10:10:33 +07:00
{
2025-10-17 10:02:24 +07:00
name: "number",
2025-10-14 10:10:33 +07:00
align: "center",
label: "ลำดับที่สอบได้",
2025-10-17 10:02:24 +07:00
sortable: false,
field: "number",
2025-10-14 10:10:33 +07:00
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
2023-06-01 12:54:58 +07:00
{
name: "applyDate",
align: "left",
label: "วันที่สมัครสอบ",
2025-10-17 10:02:24 +07:00
sortable: false,
2023-06-01 12:54:58 +07:00
field: "applyDate",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
2024-09-17 15:56:06 +07:00
const rows = ref<RecruitDetailResponse[]>([]);
const rowsData = ref<RecruitDetailResponse[]>([]);
2023-06-01 12:54:58 +07:00
2024-09-17 15:56:06 +07:00
/**
* ไปหนารายละเอยด ดการรอบคดเลอกคนพการ
* @param examID id รอบ
*/
function clickDetail(examID: string) {
router.push(`/disable/import/${importId.value}/${examID}`);
}
2023-06-01 12:54:58 +07:00
2024-09-17 15:56:06 +07:00
/** ส่งออกข้อมูลผู้มีสิทธิ์สอบ */
async function downloadExam() {
2023-08-04 10:04:59 +07:00
showLoader();
2023-06-01 12:54:58 +07:00
await http
2025-01-05 21:56:56 +07:00
.get(config.API.exportDisableExam(importId.value))
.then(async (res) => {
const dataList = res.data.result;
await genReportXLSX(dataList, "ส่งออกข้อมูลผู้มีสิทธิ์สอบ");
2023-06-01 12:54:58 +07:00
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
2023-06-01 12:54:58 +07:00
})
.finally(() => {
2023-08-04 10:04:59 +07:00
hideLoader();
2023-06-01 12:54:58 +07:00
});
2024-09-17 15:56:06 +07:00
}
2023-06-01 12:54:58 +07:00
2024-09-17 15:56:06 +07:00
/** ส่งออกข้อมูลผู้สอบผ่านภาค */
async function downloadPassExam() {
2023-08-04 10:04:59 +07:00
showLoader();
2023-06-01 12:54:58 +07:00
await http
2025-01-05 21:56:56 +07:00
.get(config.API.exportDisablePassExam(importId.value))
.then(async (res) => {
const dataList = res.data.result;
await genReportXLSX(dataList, "ส่งออกข้อมูลผู้สอบผ่านภาค");
2023-06-01 12:54:58 +07:00
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
2023-06-01 12:54:58 +07:00
})
.finally(() => {
2023-08-04 10:04:59 +07:00
hideLoader();
2023-06-01 12:54:58 +07:00
});
2024-09-17 15:56:06 +07:00
}
2023-06-01 12:54:58 +07:00
2024-09-17 15:56:06 +07:00
/** ส่งออกข้อมูลผู้คัดเลือกคนพิการได้ */
async function downloadPassResultExam() {
2023-08-04 10:04:59 +07:00
showLoader();
2023-06-01 12:54:58 +07:00
await http
2025-01-05 21:56:56 +07:00
.get(config.API.exportDisablePassResultExam(importId.value))
.then(async (res) => {
const dataList = res.data.result;
await genReportXLSX(dataList, "ส่งออกข้อมูลผู้คัดเลือกคนพิการได้");
2023-06-01 12:54:58 +07:00
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
2023-06-01 12:54:58 +07:00
})
.finally(() => {
2023-08-04 10:04:59 +07:00
hideLoader();
2023-06-01 12:54:58 +07:00
});
2024-09-17 15:56:06 +07:00
}
2023-06-01 12:54:58 +07:00
2024-09-17 15:56:06 +07:00
/** ดึงข้อมูลรายละเอียด */
async function fetchData() {
2023-08-04 10:04:59 +07:00
showLoader();
2023-06-01 12:54:58 +07:00
await http
.post(config.API.getDisableExamResultById(importId.value), {
examAttribute: "",
2025-09-23 18:01:15 +07:00
keyword: filter.value,
2025-10-17 10:02:24 +07:00
examResult: examResult.value ? examResult.value : "",
page: initialPagination.value.page,
pageSize: initialPagination.value.rowsPerPage,
2023-06-01 12:54:58 +07:00
})
.then((res) => {
var _data = res.data.result;
var header = res.data.result.header;
count.value = header.count;
pass.value = header.pass;
notpass.value = header.notpass;
missed_exam.value = header.missed_exam;
other.value = header.other;
2025-09-24 11:37:49 +07:00
total.value = res.data.result.total;
totalList.value = Math.ceil(
2025-09-24 11:37:49 +07:00
res.data.result.total / initialPagination.value.rowsPerPage
);
2023-06-01 12:54:58 +07:00
const data = res.data.result.data;
let result: RecruitDetailResponse[] = [];
if (data.length > 0) {
data.map((r: RecruitDetailResponse) => {
r.personName = `${r.prefix}${r.fullName}`;
result.push(r);
});
}
rows.value = result;
rowsData.value = result;
2023-06-01 12:54:58 +07:00
if (result.length > 0) name.value = result[0].exam_name as string;
round.value = _data.round;
year.value = _data.year;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
2023-08-04 10:04:59 +07:00
hideLoader();
2023-06-01 12:54:58 +07:00
});
2024-09-17 15:56:06 +07:00
}
2024-09-17 15:56:06 +07:00
/** บรรจุผู้ผ่านการคัดเลือกผู้พิการ */
2025-10-14 12:12:25 +07:00
async function onSubmitCandidates(date: Date) {
$q.dialog({
title: "ยืนยันการนำผู้ผ่านคัดเลือกคนพิการเข้าสู่ระบบบรรจุ",
message: "ต้องการนำผู้ผ่านคัดเลือกคนพิการเข้าสู่ระบบบรรจุใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
2023-08-04 10:04:59 +07:00
showLoader();
await http
2025-10-14 12:12:25 +07:00
.post(config.API.periodDisableToPlacement(importId.value), {
2025-10-17 17:22:40 +07:00
accountStartDate: convertDateToAPI(date),
2025-10-14 12:12:25 +07:00
})
2025-10-14 11:57:31 +07:00
.then(() => {
success($q, "นำผู้ผ่านคัดเลือกคนพิการเข้าสู่ระบบบรรจุ");
2025-10-14 11:57:31 +07:00
modalCandidates.value = false;
router.go(-1);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
2023-08-04 10:04:59 +07:00
hideLoader();
});
})
.onCancel(() => {})
.onDismiss(() => {});
2024-09-17 15:56:06 +07:00
}
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
2025-10-14 11:57:31 +07:00
const modalCandidates = ref(false); // dialog บรรจุผู้ผ่านการสอบแข่งขัน
/** ฟังก์ชันเปิดโมดัลสำหรับผู้ส่งผ่านคัดเลือก */
function openModalCandidates() {
modalCandidates.value = true;
}
2024-09-17 15:56:06 +07:00
onMounted(async () => {
hideLoader();
await fetchData();
});
2023-06-01 12:54:58 +07:00
</script>
2024-09-17 15:56:06 +07:00
<template>
<div class="toptitle text-dark col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="router.go(-1)"
/>
รายชอผสมครสอบรอบ {{ name }} ครงท {{ round }}/{{ year }}
<q-space />
<q-btn
size="md"
icon="mdi-content-save-move-outline"
round
flat
color="indigo"
v-if="rows.length > 0"
2025-10-14 11:57:31 +07:00
@click="openModalCandidates"
2024-09-17 15:56:06 +07:00
>
<q-tooltip>บรรจานการคดเลอกผการ</q-tooltip>
</q-btn>
<q-btn class="bg-teal-1" icon="mdi-download" round color="primary" flat>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
<q-menu>
<q-list style="min-width: 100px">
<q-item clickable v-close-popup @click="downloadExam()">
<q-item-section class="text-blue"
>งออกขอมลผทธสอบ</q-item-section
>
</q-item>
<q-item clickable v-close-popup @click="downloadPassExam()">
<q-item-section class="text-primary"
>งออกขอมลผสอบผานภาค .</q-item-section
>
</q-item>
<q-item clickable v-close-popup @click="downloadPassResultExam()">
<q-item-section class="text-amber-9"
>งออกขอมลผดเลอกคนพการได</q-item-section
>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
<q-card flat bordered class="col-12 row q-mt-sm q-pt-sm q-pa-md">
<div class="col-12">
<Table
:count="count"
:pass="pass"
:notpass="notpass"
:missed_exam="missed_exam"
:other="other"
v-model:totalList="totalList"
2024-09-17 15:56:06 +07:00
:rows="rows"
:columns="columns"
v-model:filter="filter"
:onSearch="onSearch"
2025-02-26 17:15:19 +07:00
:pagination="initialPagination"
2024-09-17 15:56:06 +07:00
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
2025-09-24 11:37:49 +07:00
v-model:total="total"
2024-09-17 15:56:06 +07:00
v-model:inputvisible="visibleColumns"
2025-10-17 10:02:24 +07:00
v-model:exam-result="examResult"
2024-09-17 15:56:06 +07:00
:nornmalData="false"
:conclude="true"
:fetchData="fetchData"
2024-09-17 15:56:06 +07:00
>
<template #columns="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
@click="clickDetail(props.row.examID)"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
<div class="row col-12 items-center">
<img
:src="props.row.avatar"
class="q-mr-sm col-4"
style="width: 28px; height: 28px; border-radius: 50%"
/>
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.fullname }}
</div>
<div class="text-weight-light">
{{ props.row.citizenId }}
</div>
</div>
</div>
</div>
<div v-else-if="col.name == 'c1'">
<q-checkbox disable v-model="props.row.c1" />
</div>
<div v-else-if="col.name == 'c2'">
<q-checkbox disable v-model="props.row.c2" />
</div>
<div v-else-if="col.name == 'c3'">
<q-checkbox disable v-model="props.row.c3" />
</div>
<div v-else-if="col.name == 'c4'">
<q-checkbox disable v-model="props.row.c4" />
</div>
<div v-else-if="col.name == 'c5'">
<q-checkbox disable v-model="props.row.c5" />
</div>
2025-10-17 10:02:24 +07:00
<div v-else-if="col.name == 'number'">
{{ col.value ? col.value : "" }}
2025-10-14 10:10:33 +07:00
</div>
2024-09-17 15:56:06 +07:00
<div v-else>
2025-10-14 10:10:33 +07:00
{{ col.value ? col.value : "-" }}
2024-09-17 15:56:06 +07:00
</div>
</q-td>
</q-tr>
</template>
</Table>
</div>
</q-card>
2025-10-14 11:57:31 +07:00
<DialogCandidates
:title="'ส่งผู้ผ่านคัดเลือกคนพิการเข้าสู่ระบบบรรจุ'"
v-model:modal="modalCandidates"
:on-submit="onSubmitCandidates"
/>
2024-09-17 15:56:06 +07:00
</template>
2023-06-01 12:54:58 +07:00
<style></style>