2023-06-01 12:54:58 +07:00
|
|
|
<template>
|
|
|
|
|
<div class="q-px-md q-pb-md">
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-card bordered flat class="col-12 row q-py-sm items-center bg-grey-1" v-show="statusPayment">
|
2023-10-05 11:40:16 +07:00
|
|
|
<div class="col-12 row q-col-gutter-sm">
|
|
|
|
|
<span class="text-subtitle1">{{ titleText }}</span>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-select dense outlined :model-value="inputvisibleFilter" :options="optionsFilter" option-value="id"
|
|
|
|
|
option-label="name" map-options class="col-xs-12 col-sm-3" label="สถานะ" emit-value
|
|
|
|
|
@update:model-value="updateVisibleFilter" v-if="optionsFilter != undefined && optionsFilter.length > 0" />
|
|
|
|
|
<q-file v-model="files" dense :label="setSeat == false ? 'อัปโหลดที่นั่งสอบ' : 'อัปโหลดคะแนนสอบ'" outlined
|
|
|
|
|
use-chips multiple class="col-xs-12 col-sm-4" v-if="statusPayment">
|
2023-10-05 11:40:16 +07:00
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="attach_file" color="blue" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-file>
|
2023-10-09 13:06:55 +07:00
|
|
|
<div>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-btn size="md" icon="mdi-upload" round flat color="blue" v-if="statusPayment" @click="uploadFile">
|
2023-10-09 13:06:55 +07:00
|
|
|
<q-tooltip v-if="setSeat == false">อัปโหลดที่นั่งสอบ</q-tooltip>
|
|
|
|
|
<q-tooltip v-if="setSeat == true">อัปโหลดคะแนนสอบ</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
2023-10-05 11:40:16 +07:00
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<div class="col-12 row q-py-sm items-center q-col-gutter-sm">
|
|
|
|
|
<div class="col-xs-12 col-sm-3" v-show="!statusPayment">
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-select dense outlined :model-value="inputvisibleFilter" :options="optionsFilter" option-value="id"
|
|
|
|
|
option-label="name" map-options class="" label="สถานะ" emit-value @update:model-value="updateVisibleFilter"
|
|
|
|
|
v-if="optionsFilter != undefined && optionsFilter.length > 0" />
|
2023-10-05 11:40:16 +07:00
|
|
|
</div>
|
|
|
|
|
<div>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-btn size="md" icon="mdi-playlist-check" round flat color="primary" @click="candidateCheckProfileDialog"
|
|
|
|
|
:disabled="attrs.rows.filter((r: any) => r.status == 'checkRegister').length == 0 ||
|
2023-10-13 17:33:39 +07:00
|
|
|
selected.length == 0
|
2023-10-25 00:07:58 +07:00
|
|
|
">
|
2023-10-12 04:17:27 +07:00
|
|
|
<q-tooltip>ตรวจสอบข้อมูล/ได้รับใบสมัครแล้ว</q-tooltip>
|
2023-10-05 11:40:16 +07:00
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn icon="mdi-download" round color="green-6" flat>
|
|
|
|
|
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
|
|
|
|
<q-menu>
|
|
|
|
|
<q-list style="min-width: 100px">
|
|
|
|
|
<q-item clickable v-close-popup @click="downloadFileDashboard">
|
2023-10-06 01:28:25 +07:00
|
|
|
<q-item-section>ดาวน์โหลดสรุปข้อมูลสมัครสอบ</q-item-section>
|
2023-10-05 11:40:16 +07:00
|
|
|
</q-item>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-item clickable v-close-popup @click.stop.prevent="clickCandidateList()">
|
2023-10-06 01:28:25 +07:00
|
|
|
<q-item-section>ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ</q-item-section>
|
2023-10-05 11:40:16 +07:00
|
|
|
</q-item>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-item clickable v-close-popup @click.stop.prevent="clickPassExam()">
|
|
|
|
|
<q-item-section>ดาวน์โหลดรายชื่อผู้สอบคัดเลือกได้</q-item-section>
|
2023-10-05 11:40:16 +07:00
|
|
|
</q-item>
|
|
|
|
|
<q-item clickable v-close-popup @click="downloadFile()">
|
2023-10-06 01:28:25 +07:00
|
|
|
<q-item-section>ดาวน์โหลดจัดการรายชื่อผู้สมัคร</q-item-section>
|
2023-10-05 11:40:16 +07:00
|
|
|
</q-item>
|
|
|
|
|
<q-item clickable v-close-popup @click="downloadFileDetail()">
|
2023-10-06 01:28:25 +07:00
|
|
|
<q-item-section>ดาวน์โหลดข้อมูลผู้สมัคร</q-item-section>
|
2023-10-05 11:40:16 +07:00
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
2023-10-06 01:28:25 +07:00
|
|
|
<div>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-btn size="md" icon="mdi-content-save-move-outline" round flat color="indigo"
|
|
|
|
|
v-if="statusPayment && setSeat == true" @click="candidateToPlacement">
|
2023-10-05 11:40:16 +07:00
|
|
|
<q-tooltip>บรรจุผู้ผ่านการคัดเลือก</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-space />
|
2023-10-05 11:40:16 +07:00
|
|
|
<div class="items-center gt-xs" style="display: flex">
|
2023-06-01 12:54:58 +07:00
|
|
|
<!-- ค้นหาข้อความใน table -->
|
2023-10-27 11:01:13 +07:00
|
|
|
<!-- @keydown.enter.prevent:model-value="updateInput" -->
|
|
|
|
|
<q-input :model-value="inputfilter" @keydown.enter.prevent="submitInput" @update:model-value="updateInput"
|
|
|
|
|
ref="filterRef" standout dense outlined debounce="300" placeholder="ค้นหา" style="max-width: 200px"
|
|
|
|
|
class="q-ml-sm">
|
2023-06-01 12:54:58 +07:00
|
|
|
<template v-slot:append>
|
|
|
|
|
<q-icon v-if="inputfilter == ''" name="search" />
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-icon v-if="inputfilter !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
|
2023-06-01 12:54:58 +07:00
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
<!-- แสดงคอลัมน์ใน table -->
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-select :model-value="inputvisible" @update:model-value="updateVisible" :display-value="$q.lang.table.columns"
|
|
|
|
|
multiple outlined dense :options="attrs.columns" options-dense option-value="name" map-options emit-value
|
|
|
|
|
style="min-width: 150px" class="q-ml-sm" />
|
2023-06-01 12:54:58 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-10-25 00:07:58 +07:00
|
|
|
|
|
|
|
|
<q-table ref="table" flat bordered class="custom-header-table" v-bind="attrs" virtual-scroll
|
|
|
|
|
:virtual-scroll-sticky-size-start="48" dense :pagination="initialPagination"
|
|
|
|
|
:rows-per-page-options="paging == true ? [25, 50, 100, 500] : []" row-key="id" selection="multiple"
|
2023-10-27 11:01:13 +07:00
|
|
|
v-model:selected="selected" @update:pagination="updatePagination" :filter="false">
|
2023-10-18 09:51:08 +07:00
|
|
|
<template v-slot:pagination="scope">
|
2023-10-25 00:07:58 +07:00
|
|
|
ทั้งหมด {{ props.total }} รายการ
|
2023-10-27 11:01:13 +07:00
|
|
|
<q-pagination v-model="currentPage" active-color="primary" color="dark" :max-pages="5" size="sm" boundary-links
|
|
|
|
|
direction-links :max="props.maxPage < 1 ? 1 : props.maxPage"></q-pagination>
|
2023-10-18 09:51:08 +07:00
|
|
|
</template>
|
2023-06-01 12:54:58 +07:00
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr :props="props">
|
2023-10-04 15:03:17 +07:00
|
|
|
<q-th auto-width>
|
2023-10-06 01:28:25 +07:00
|
|
|
<q-checkbox v-model="props.selected" />
|
2023-10-04 15:03:17 +07:00
|
|
|
</q-th>
|
2023-06-01 12:54:58 +07:00
|
|
|
<q-th auto-width v-if="boss == true" />
|
|
|
|
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
<span class="text-weight-medium">{{ col.label }}</span>
|
|
|
|
|
</q-th>
|
2023-10-25 00:07:58 +07:00
|
|
|
<q-th auto-width v-if="editvisible == true || nextPageVisible == true || history == true
|
|
|
|
|
" />
|
2023-06-01 12:54:58 +07:00
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template #body="props">
|
|
|
|
|
<slot v-bind="props" name="columns"></slot>
|
|
|
|
|
</template>
|
|
|
|
|
</q-table>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
2023-10-25 00:07:58 +07:00
|
|
|
import { ref, useAttrs, watch, watchEffect } from "vue";
|
2023-07-26 18:49:20 +07:00
|
|
|
import { useRoute, useRouter } from "vue-router";
|
2023-08-04 10:04:59 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
|
|
|
|
import { useQuasar } from "quasar";
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
2023-07-26 18:49:20 +07:00
|
|
|
const router = useRouter();
|
2023-08-04 10:04:59 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const { dateToISO, success, modalError, dialogMessage } = mixin;
|
|
|
|
|
const $q = useQuasar(); // show dialog
|
|
|
|
|
const attrs = ref<any>(useAttrs());
|
|
|
|
|
const table = ref<any>(null);
|
|
|
|
|
const files = ref<File[]>([]);
|
|
|
|
|
const filterRef = ref<any>(null);
|
|
|
|
|
const examId = ref<string>(route.params.examId.toString());
|
2023-10-02 11:39:20 +07:00
|
|
|
const candidateId = ref<string[]>([]);
|
2023-10-04 15:03:17 +07:00
|
|
|
const selected = ref<string[]>([]);
|
2023-08-04 10:04:59 +07:00
|
|
|
const { messageError, showLoader, hideLoader } = mixin;
|
2023-10-05 11:40:16 +07:00
|
|
|
|
|
|
|
|
const dateFilter = ref<[Date, Date]>([new Date(), new Date()]); //วันที่เลือกค้นหา
|
2023-06-01 12:54:58 +07:00
|
|
|
const props = defineProps({
|
|
|
|
|
inputfilter: String,
|
|
|
|
|
inputvisible: Array,
|
|
|
|
|
inputvisibleFilter: String,
|
|
|
|
|
editvisible: Boolean,
|
|
|
|
|
titleText: String,
|
|
|
|
|
optionsFilter: {
|
|
|
|
|
type: Array,
|
|
|
|
|
defualt: [],
|
|
|
|
|
},
|
2023-10-04 15:03:17 +07:00
|
|
|
selected: {
|
|
|
|
|
type: Array,
|
|
|
|
|
defualt: [],
|
|
|
|
|
},
|
2023-06-01 12:54:58 +07:00
|
|
|
boss: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
saveNoDraft: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
history: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
paging: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
2023-10-25 00:07:58 +07:00
|
|
|
pageSize: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 25
|
|
|
|
|
},
|
|
|
|
|
page: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 1
|
|
|
|
|
},
|
|
|
|
|
maxPage: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 1
|
|
|
|
|
},
|
|
|
|
|
total: {
|
|
|
|
|
type: Number,
|
|
|
|
|
defualt: 0
|
|
|
|
|
},
|
2023-06-01 12:54:58 +07:00
|
|
|
nornmalData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
nextPageVisible: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
publicData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: true,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
updateData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: true,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
statusPayment: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
setSeat: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
},
|
|
|
|
|
publicNoBtn: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
save: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
cancel: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
publish: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
validate: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
fetchData: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
2023-10-25 00:07:58 +07:00
|
|
|
changePage: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
}
|
2023-06-01 12:54:58 +07:00
|
|
|
});
|
2023-10-25 00:07:58 +07:00
|
|
|
|
|
|
|
|
// Pagination - page & change page & get new data
|
|
|
|
|
const currentPage = ref<number>(1)
|
|
|
|
|
watch(currentPage, () => {
|
2023-10-27 11:01:13 +07:00
|
|
|
console.log(currentPage.value)
|
2023-10-25 00:07:58 +07:00
|
|
|
props.changePage(currentPage.value, props.pageSize, true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Pagination - initial pagination
|
2023-06-01 12:54:58 +07:00
|
|
|
const initialPagination = ref<any>({
|
2023-10-25 00:07:58 +07:00
|
|
|
sortBy: null,
|
|
|
|
|
descending: false,
|
|
|
|
|
page: 1,
|
|
|
|
|
rowsPerPage: props.pageSize,
|
2023-06-01 12:54:58 +07:00
|
|
|
});
|
|
|
|
|
|
2023-10-25 00:07:58 +07:00
|
|
|
// Pagination - update rowsPerPage
|
|
|
|
|
async function updatePagination(newPagination: any) {
|
|
|
|
|
props.changePage(1, newPagination.rowsPerPage, true);
|
|
|
|
|
initialPagination.value = newPagination
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
const emit = defineEmits([
|
|
|
|
|
"update:inputfilter",
|
|
|
|
|
"update:inputvisible",
|
|
|
|
|
"update:editvisible",
|
|
|
|
|
"update:titleText",
|
|
|
|
|
"update:inputvisibleFilter",
|
|
|
|
|
]);
|
|
|
|
|
|
2023-10-25 00:07:58 +07:00
|
|
|
const updateInput = async (value: any) => {
|
|
|
|
|
await emit("update:inputfilter", value);
|
2023-10-27 11:01:13 +07:00
|
|
|
};
|
2023-10-25 00:07:58 +07:00
|
|
|
|
2023-10-27 11:01:13 +07:00
|
|
|
// search & get new data by keyword
|
|
|
|
|
const submitInput = () => {
|
|
|
|
|
setTimeout(() => {
|
2023-10-25 00:07:58 +07:00
|
|
|
props.changePage(1, props.pageSize);
|
|
|
|
|
currentPage.value = 1
|
2023-10-27 11:01:13 +07:00
|
|
|
}, 500);
|
2023-06-01 12:54:58 +07:00
|
|
|
};
|
2023-10-27 11:01:13 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
const updateVisible = (value: any) => {
|
|
|
|
|
emit("update:inputvisible", value);
|
|
|
|
|
};
|
|
|
|
|
const updateVisibleFilter = (value: any) => {
|
|
|
|
|
emit("update:inputvisibleFilter", value);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const uploadFile = async () => {
|
|
|
|
|
if (files.value.length > 0) {
|
|
|
|
|
if (props.setSeat == false) {
|
|
|
|
|
uploadDataSeat();
|
|
|
|
|
} else {
|
|
|
|
|
uploadDataPoint();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
modalError(
|
|
|
|
|
$q,
|
|
|
|
|
"ไม่สามารถอัปโหลดไฟล์ได้",
|
|
|
|
|
"กรุณาเลือกไฟล์ที่ต้องการอัปโหลด"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-07-26 18:49:20 +07:00
|
|
|
const candidateToPlacement = async () => {
|
|
|
|
|
$q.dialog({
|
|
|
|
|
title: "ยืนยันการนำผู้ผ่านคัดเลือกเข้าสู่ระบบบรรจุ",
|
|
|
|
|
message: "ต้องการนำผู้ผ่านคัดเลือกเข้าสู่ระบบบรรจุใช่หรือไม่?",
|
|
|
|
|
cancel: {
|
|
|
|
|
flat: true,
|
|
|
|
|
color: "negative",
|
|
|
|
|
},
|
|
|
|
|
persistent: true,
|
|
|
|
|
})
|
|
|
|
|
.onOk(async () => {
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.periodExamToPlacement(examId.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
success($q, "นำผู้ผ่านคัดเลือกเข้าสู่ระบบบรรจุ");
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
hideLoader();
|
2023-07-26 18:49:20 +07:00
|
|
|
router.go(-1);
|
|
|
|
|
});
|
|
|
|
|
})
|
2023-10-25 00:07:58 +07:00
|
|
|
.onCancel(() => { })
|
|
|
|
|
.onDismiss(() => { });
|
2023-07-26 18:49:20 +07:00
|
|
|
};
|
|
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
const uploadDataSeat = async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
showLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append("", files.value[0]);
|
|
|
|
|
await http
|
|
|
|
|
.put(config.API.periodExamUploadSeat(examId.value), formData)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
success($q, "อัพเดทที่นั่งสอบสำเร็จ");
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
hideLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
files.value = [];
|
|
|
|
|
props.fetchData();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const uploadDataPoint = async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
showLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append("", files.value[0]);
|
|
|
|
|
await http
|
|
|
|
|
.put(config.API.periodExamUploadPoint(examId.value), formData)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
success($q, "อัพเดทคะแนนสอบสำเร็จ");
|
|
|
|
|
files.value = [];
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
hideLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
files.value = [];
|
|
|
|
|
props.fetchData();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const downloadFile = async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
showLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
await http
|
|
|
|
|
.get(config.API.periodExamDownload(examId.value), {
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data;
|
|
|
|
|
downloadFilePDF(data, `Candidate__${dateToISO(new Date())}.xlsx`);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
2023-08-04 10:04:59 +07:00
|
|
|
hideLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const downloadFileDetail = async () => {
|
2023-08-04 10:04:59 +07:00
|
|
|
showLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
await http
|
|
|
|
|
.get(config.API.periodExamDownloadDetail(examId.value), {
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data;
|
|
|
|
|
downloadFilePDF(data, `Candidate_Detail_${dateToISO(new Date())}.xlsx`);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
2023-08-04 10:04:59 +07:00
|
|
|
hideLoader();
|
2023-06-01 12:54:58 +07:00
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-02 11:39:20 +07:00
|
|
|
const checkCandidates = async () => {
|
2023-10-25 00:07:58 +07:00
|
|
|
var _selected: any[] = [];
|
2023-10-04 15:03:17 +07:00
|
|
|
selected.value.map((r: any) => {
|
|
|
|
|
_selected.push(r.id.toString());
|
|
|
|
|
});
|
2023-10-02 11:39:20 +07:00
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.post(config.API.candidateCheckRegisters, {
|
2023-10-04 15:03:17 +07:00
|
|
|
candidateId: _selected,
|
2023-10-02 11:39:20 +07:00
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
success($q, "ตรวจสอบข้อมูลสำเร็จ");
|
2023-10-06 01:28:25 +07:00
|
|
|
selected.value = [];
|
2023-10-02 11:39:20 +07:00
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
props.fetchData();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
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();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const checkSave = () => {
|
|
|
|
|
props.validate();
|
|
|
|
|
props.save();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const publishModal = () => {
|
|
|
|
|
props.validate();
|
|
|
|
|
const filter = attrs.value.rows.filter((r: any) => r.name == "");
|
|
|
|
|
|
|
|
|
|
if (filter.length == 0 || attrs.value.rows.length == 0) {
|
|
|
|
|
dialogMessage(
|
|
|
|
|
$q,
|
|
|
|
|
"ต้องการเผยแพร่ข้อมูลนี้หรือไม่?",
|
|
|
|
|
"ข้อมูลที่กำลังถูกเผยแพร่นี้จะมีผลใช้งานทันที",
|
|
|
|
|
"public",
|
|
|
|
|
"เผยแพร่",
|
|
|
|
|
"public",
|
|
|
|
|
props.publish,
|
|
|
|
|
undefined
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-02 11:39:20 +07:00
|
|
|
const candidateCheckProfileDialog = async () => {
|
|
|
|
|
dialogMessage(
|
|
|
|
|
$q,
|
|
|
|
|
"ยืนยันการตรวจสอบข้อมูลนี้หรือไม่?",
|
|
|
|
|
"ยืนยันการตรวจสอบข้อมูล",
|
|
|
|
|
"mdi-email-check-outline",
|
|
|
|
|
"ยืนยัน",
|
|
|
|
|
"public",
|
2023-10-04 15:03:17 +07:00
|
|
|
checkCandidates,
|
2023-10-02 11:39:20 +07:00
|
|
|
undefined
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-04 15:03:17 +07:00
|
|
|
// const candidateCheckProfile = async () => {
|
|
|
|
|
// const filter = attrs.value.rows.filter((r: any) => r.check == true);
|
|
|
|
|
// filter.map((r: any) => {
|
|
|
|
|
// candidateId.value.push(r.id.toString());
|
|
|
|
|
// });
|
|
|
|
|
// await checkCandidates();
|
|
|
|
|
// };
|
2023-10-02 11:39:20 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
const resetFilter = () => {
|
|
|
|
|
// reset ค่าที่ค้นหาเมื่อกดปุ่ม X ในกล่องค้นหา
|
|
|
|
|
emit("update:inputfilter", "");
|
|
|
|
|
filterRef.value.focus();
|
2023-10-25 00:07:58 +07:00
|
|
|
|
|
|
|
|
// clear keyword & get new data
|
|
|
|
|
props.changePage(1, props.pageSize);
|
|
|
|
|
currentPage.value = 1
|
2023-06-01 12:54:58 +07:00
|
|
|
};
|
2023-10-05 11:40:16 +07:00
|
|
|
|
|
|
|
|
const downloadFileDashboard = async () => {
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.put(
|
|
|
|
|
config.API.periodExamDownloadDashboard(examId.value),
|
|
|
|
|
{
|
|
|
|
|
dateStart: dateToISO(dateFilter.value[0]),
|
|
|
|
|
dateEnd: dateToISO(dateFilter.value[1]),
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const data = res.data;
|
|
|
|
|
downloadFilePDF(
|
|
|
|
|
data,
|
|
|
|
|
`Candidate_Dashboard_${dateToISO(new Date())}.xlsx`
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const clickPassExam = async () => {
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.exportExamPassExamList(examId.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
window.open(config.API.exportExamPassExamList(examId.value));
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const clickCandidateList = async () => {
|
|
|
|
|
showLoader();
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.exportExamCandidateList(examId.value))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
window.open(config.API.exportExamCandidateList(examId.value));
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
messageError($q, e);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
};
|
2023-06-01 12:54:58 +07:00
|
|
|
</script>
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.icon-color {
|
|
|
|
|
color: #4154b3;
|
|
|
|
|
}
|
2023-10-25 00:07:58 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.custom-header-table {
|
|
|
|
|
max-height: 64vh;
|
2023-10-25 00:07:58 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.q-table tr:nth-child(odd) td {
|
|
|
|
|
background: white;
|
|
|
|
|
}
|
2023-10-25 00:07:58 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.q-table tr:nth-child(even) td {
|
|
|
|
|
background: #f8f8f8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr {
|
|
|
|
|
background: #ecebeb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.q-table thead tr th {
|
|
|
|
|
position: sticky;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
2023-10-25 00:07:58 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
/* this will be the loading indicator */
|
|
|
|
|
.q-table thead tr:last-child th {
|
|
|
|
|
/* height of all previous header rows */
|
|
|
|
|
top: 48px;
|
|
|
|
|
}
|
2023-10-25 00:07:58 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
.q-table thead tr:first-child th {
|
|
|
|
|
top: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|