fix: คัดเลือกผู้พิการ

This commit is contained in:
setthawutttty 2025-09-05 14:42:12 +07:00
parent c51c28483a
commit 86b98eac0d
10 changed files with 271 additions and 102 deletions

View file

@ -41,10 +41,12 @@ const year = ref<number>(new Date().getFullYear() + 543);
const round = ref<number>(1);
const files = ref<any>(null);
const files_score = ref<any>(null);
const files_result = ref<any>(null);
const files_candidate = ref<any>(null);
const modalAdd = ref<boolean>(false);
const modalScore = ref<boolean>(false);
const modalCandidate = ref<boolean>(false);
const modalResult = ref<boolean>(false);
const selected_row_id = ref<string>("");
const rowsHistory = ref<ResponseHistoryObject[]>([]); //select data history
const tittleHistory = ref<string>("ประวัติการนำเข้าข้อมูล"); //
@ -56,6 +58,7 @@ const filterHistory = ref<string>(""); //search data table
const textTittle = ref<string>("");
const textTittleScore = ref<string>("");
const textTittleCandidate = ref<string>("");
const textTittleResult = ref<string>("");
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
sortBy: "year",
@ -67,6 +70,7 @@ const visibleColumns = ref<String[]>([
"year",
"examCount",
"scoreCount",
"result",
]);
const columns = ref<QTableProps["columns"]>([
@ -112,7 +116,7 @@ const columns = ref<QTableProps["columns"]>([
},
{
name: "examCount",
label: "จำนวนผู้สอบทั้งหมด",
label: "ข้อมูลผู้สมัครสอบ",
align: "right",
field: "examCount",
sortable: true,
@ -121,13 +125,22 @@ const columns = ref<QTableProps["columns"]>([
},
{
name: "scoreCount",
label: "จำนวนที่บันทึกผลสอบ",
label: "บัญชีรวมคะแนน",
align: "right",
field: "scoreCount",
sortable: true,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "result",
label: "ผลการสอบ",
align: "right",
field: "result",
sortable: true,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columnsHistory = ref<QTableProps["columns"]>([
@ -177,7 +190,7 @@ async function clickPassExam(id: string) {
.then(async (res) => {
const data = res.data.result;
data.reportName = `CandidateList`;
await genReport(data, data.reportName, "pdf");
await genReport(data, "รายชื่อผู้สอบแข่งขันได้", "pdf");
})
.catch(async (e) => {
messageError($q, e);
@ -195,7 +208,7 @@ async function clickCandidateList(id: string) {
.then(async (res) => {
const data = res.data.result;
data.reportName = `CandidateList`;
await genReport(data, data.reportName, "pdf");
await genReport(data, "รายชื่อผู้มีสิทธิ์สอบ", "pdf");
})
.catch(async (e) => {
messageError($q, e);
@ -256,14 +269,24 @@ function clickDetail(id: string) {
/** นำเข้าไฟล์ผลคะแนนสอบ */
async function clickEdit(id: string) {
modalScore.value = true;
textTittleScore.value = "นำเข้าผลการคัดเลือกคนพิการ";
textTittleScore.value = "นำเข้าบัญชีรวมคะแนน";
selected_row_id.value = id;
}
/** นำเข้าไฟล์ผู้สมัครสอบ */
async function clickUpload(id: string) {
modalCandidate.value = true;
textTittleCandidate.value = "นำเข้าผู้สมัครคัดเลือกคนพิการ";
textTittleCandidate.value = "นำเข้าผู้สมัครสอบคัดเลือก";
selected_row_id.value = id;
}
/**
* นำเขาไฟลลำด
* @param id รอบสอบเเขงข
*/
async function clickResult(id: string) {
modalResult.value = true;
textTittleResult.value = "นำเข้าไฟล์ผลการสอบ";
selected_row_id.value = id;
}
@ -345,6 +368,12 @@ async function clickCloseCandidate() {
files_candidate.value = null;
}
/** ปิด dialog เลือกไฟล์ผลการสอบ */
async function clickCloseResult() {
modalResult.value = false;
files_result.value = null;
}
/** บันทึก รอบการคัดเลือก */
async function checkSaveCandidate() {
const fd = new FormData();
@ -387,6 +416,28 @@ async function checkSaveScore() {
});
}
/** บันทึกข้อมูล เลือกไฟล์ผลการสอบแข่งขันฯ */
async function checkSaveResult() {
const fd = new FormData();
fd.append("attachment", files_result.value[0]);
showLoader();
await http
.post(config.API.uploadResult(selected_row_id.value), fd)
.then((res) => {
success($q, "นำเข้าข้อมูลผลการสอบแข่งขันฯ (บัญชีรายชื่อ)");
modalResult.value = false;
files_result.value = null;
selected_row_id.value = "";
fetchData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/** บันทึกข้อมูล */
async function checkSave() {
const fd = new FormData();
@ -513,7 +564,9 @@ onMounted(async () => {
name="mdi-history"
/>
</q-item-section>
<q-item-section>แสดงประวการนำเขาขอม</q-item-section>
<q-item-section
>แสดงประวการนำเขาขอม</q-item-section
>
</q-item>
</q-list>
</q-menu>
@ -526,54 +579,6 @@ onMounted(async () => {
<div v-else-if="col.name == 'name'" class="table_ellipsis2">
{{ col.value }}
</div>
<div v-else-if="col.name == 'scoreCount'" class="table_ellipsis2">
<q-btn
flat
dense
size="12px"
round
color="green"
:disable="props.row.examCount == 0"
@click.stop.prevent="clickEdit(props.row.id)"
v-if="
col.value == null && checkPermission($route)?.attrIsUpdate
"
>
<q-icon name="mdi-file-excel-outline" size="20px" />
<!-- นำเขาไฟลผลคะแนนสอบ -->
<q-tooltip>นำเขาไฟลผลคะแนนสอบ</q-tooltip>
</q-btn>
<div v-else>
{{ col.value }}
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
size="12px"
flat
round
color="green"
@click.stop.prevent="clickEdit(props.row.id)"
icon="mdi-file-excel-outline"
>
<q-tooltip>นำเขาไฟลผลคะแนนสอบอกคร</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
dense
size="12px"
flat
round
color="indigo"
@click.stop.prevent="clickPassExam(props.row.id)"
icon="mdi-clipboard-arrow-down"
>
<q-tooltip
>ดาวนโหลดรายชอผสอบคดเลอกคนพการได</q-tooltip
>
</q-btn>
</div>
</div>
<div v-else-if="col.name == 'examCount'" class="table_ellipsis2">
<q-btn
flat
@ -620,6 +625,91 @@ onMounted(async () => {
</q-btn>
</div>
</div>
<div v-else-if="col.name == 'scoreCount'" class="table_ellipsis2">
<q-btn
flat
dense
size="12px"
round
color="green"
:disable="props.row.examCount == 0"
@click.stop.prevent="clickEdit(props.row.id)"
v-if="
col.value == null && checkPermission($route)?.attrIsUpdate
"
>
<q-icon name="mdi-file-excel-outline" size="20px" />
<!-- นำเขาไฟลผลคะแนนสอบ -->
<q-tooltip>นำเขาไฟลผลคะแนนสอบ</q-tooltip>
</q-btn>
<div v-else>
{{ col.value }}
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
size="12px"
flat
round
color="green"
@click.stop.prevent="clickEdit(props.row.id)"
icon="mdi-file-excel-outline"
>
<q-tooltip>นำเขาไฟลผลคะแนนสอบอกคร</q-tooltip>
</q-btn>
</div>
</div>
<div v-else-if="col.name == 'result'" class="table_ellipsis2">
<q-btn
:disable="props.row.score == null"
flat
dense
size="12px"
color="green"
round
@click.stop.prevent="clickResult(props.row.id)"
v-if="
(props.row.score == null || props.row.score.resultCount == 0) &&
checkPermission($route)?.attrIsUpdate
"
>
<q-icon name="mdi-file-excel-outline" size="20px" />
<q-tooltip>นำเขาไฟลผลการสอบ (ญชรายช)</q-tooltip>
</q-btn>
<div v-else>
{{ props.row.score.resultCount }}
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
dense
size="12px"
flat
round
color="green"
@click.stop.prevent="clickResult(props.row.id)"
icon="mdi-file-excel-outline"
>
<q-tooltip
>นำเขาไฟลผลการสอบ (ญชรายช) กคร</q-tooltip
>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
dense
size="12px"
flat
round
color="indigo"
@click.stop.prevent="clickPassExam(props.row.id)"
icon="mdi-clipboard-arrow-down"
>
<q-tooltip
>ดาวนโหลดรายชอผสอบแขงขนได</q-tooltip
>
</q-btn>
</div>
</div>
<div v-else>
{{ col.value }}
</div>
@ -738,13 +828,57 @@ onMounted(async () => {
</q-card>
</q-dialog>
<q-dialog v-model="modalScore" persistent>
<q-dialog v-model="modalCandidate" persistent>
<q-card style="width: 600px">
<q-form ref="myFormScore">
<DialogHeadTemplate
:title="textTittleCandidate"
:close="clickCloseCandidate"
title-type="ข้อมูลผู้สมัครสอบ"
/>
<q-separator />
<q-card-section>
<div class="col-12 row items-center q-col-gutter-sm">
<div class="col-12">
<q-file
v-model="files_candidate"
dense
label="เลือกไฟล์ผู้สมัครสอบคัดเลือก"
outlined
use-chips
multiple
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions class="text-primary q-py-sm">
<q-space />
<q-btn
flat
round
color="public"
@click="checkSaveCandidate"
icon="mdi-content-save-outline"
>
<q-tooltip>นท</q-tooltip>
</q-btn>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
<q-dialog v-model="modalScore" persistent>
<q-card style="width: 600px">
<q-form ref="myFormScore">
<DialogHeadTemplate
:title="textTittleScore"
:close="clickCloseScore"
title-type="สรรหา_สอบคัดเลือกคนพิการ_จำนวนที่บันทึกผลสอบ"
title-type="บัญชีรวมคะแนน"
/>
<q-separator />
<q-card-section>
@ -753,7 +887,7 @@ onMounted(async () => {
<q-file
v-model="files_score"
dense
label="เลือกไฟล์ผลการคัดเลือกคนพิการ"
label="เลือกไฟล์บัญชีรวมคะแนน"
outlined
use-chips
multiple
@ -782,22 +916,22 @@ onMounted(async () => {
</q-card>
</q-dialog>
<q-dialog v-model="modalCandidate" persistent>
<q-dialog v-model="modalResult" persistent>
<q-card style="width: 600px">
<q-form ref="myFormScore">
<DialogHeadTemplate
:title="textTittleCandidate"
:close="clickCloseCandidate"
title-type="สรรหา_สอบคัดเลือกคนพิการ_จำนวนผู้สอบทั้งหมด"
:title="textTittleResult"
:close="clickCloseResult"
title-type="ผลการสอบ (บัญชีรายชื่อ)"
/>
<q-separator />
<q-card-section>
<div class="col-12 row items-center q-col-gutter-sm">
<div class="col-12">
<q-file
v-model="files_candidate"
v-model="files_result"
dense
label="เลือกไฟล์ผู้สมัครคัดเลือกคนพิการ"
label="เลือกไฟล์การสอบ"
outlined
use-chips
multiple
@ -816,7 +950,7 @@ onMounted(async () => {
flat
round
color="public"
@click="checkSaveCandidate"
@click="checkSaveResult"
icon="mdi-content-save-outline"
>
<q-tooltip>นท</q-tooltip>