2024-09-17 15:56:06 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { checkPermission } from "@/utils/permissions";
|
2025-09-10 11:08:18 +07:00
|
|
|
import { ref, useAttrs, watch } from "vue";
|
2025-10-17 11:04:59 +07:00
|
|
|
import type {
|
|
|
|
|
Pagination,
|
|
|
|
|
ExamResultOption,
|
|
|
|
|
} from "@/modules/03_recruiting/interface/index/Main";
|
2024-09-17 15:56:06 +07:00
|
|
|
|
|
|
|
|
const attrs = ref<any>(useAttrs());
|
|
|
|
|
const table = ref<any>(null);
|
|
|
|
|
const filterRef = ref<any>(null);
|
2025-02-26 17:15:19 +07:00
|
|
|
|
2025-10-17 10:02:24 +07:00
|
|
|
const filter = defineModel<string>("filter", { required: false });
|
|
|
|
|
const examResult = defineModel<string>("examResult", {
|
|
|
|
|
required: false,
|
|
|
|
|
default: "",
|
|
|
|
|
});
|
2025-09-10 11:08:18 +07:00
|
|
|
const pagination = defineModel<Pagination>("pagination", { required: true });
|
2025-02-26 17:15:19 +07:00
|
|
|
|
2024-09-17 15:56:06 +07:00
|
|
|
const props = defineProps({
|
2025-02-26 16:04:28 +07:00
|
|
|
onSearch: Function,
|
2025-09-10 11:08:18 +07:00
|
|
|
fetchData: Function,
|
2024-09-17 15:56:06 +07:00
|
|
|
count: Number,
|
2025-09-10 11:08:18 +07:00
|
|
|
totalList: Number,
|
2025-09-24 11:37:49 +07:00
|
|
|
total: Number,
|
2024-09-17 15:56:06 +07:00
|
|
|
pass: Number,
|
|
|
|
|
notpass: Number,
|
2025-09-10 11:08:18 +07:00
|
|
|
missed_exam: Number,
|
|
|
|
|
other: Number,
|
2024-09-17 15:56:06 +07:00
|
|
|
|
|
|
|
|
inputfilter: String,
|
|
|
|
|
name: String,
|
|
|
|
|
icon: String,
|
|
|
|
|
inputvisible: Array,
|
|
|
|
|
editvisible: Boolean,
|
|
|
|
|
add: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
validate: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log("not function"),
|
|
|
|
|
},
|
|
|
|
|
nornmalData: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: true,
|
|
|
|
|
},
|
|
|
|
|
conclude: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
defualt: false,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2025-10-17 11:04:59 +07:00
|
|
|
const optionsStatus = ref<ExamResultOption[]>([
|
2025-10-17 10:02:24 +07:00
|
|
|
{ label: "ทั้งหมด", value: "" },
|
2025-10-17 11:04:59 +07:00
|
|
|
{ label: "ขาดสอบ", value: "missed_exam" },
|
2025-10-17 10:02:24 +07:00
|
|
|
{ label: "ผ่าน", value: "pass" },
|
|
|
|
|
{ label: "ไม่ผ่าน", value: "notpass" },
|
|
|
|
|
]);
|
|
|
|
|
|
2024-09-17 15:56:06 +07:00
|
|
|
const emit = defineEmits([
|
|
|
|
|
"update:inputfilter",
|
|
|
|
|
"update:inputvisible",
|
|
|
|
|
"update:editvisible",
|
|
|
|
|
]);
|
2025-09-10 11:08:18 +07:00
|
|
|
|
2024-09-17 15:56:06 +07:00
|
|
|
const updateVisible = (value: []) => {
|
|
|
|
|
emit("update:inputvisible", value);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param start
|
|
|
|
|
* @param end
|
|
|
|
|
* @param total
|
|
|
|
|
*/
|
|
|
|
|
function paginationLabel(start: string, end: string, total: string) {
|
|
|
|
|
return start + "-" + end + " ใน " + total;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** fn เพิ่มข้อมูล */
|
|
|
|
|
function checkAdd() {
|
|
|
|
|
props.add();
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-10 11:08:18 +07:00
|
|
|
function updatePagination(newPagination: any) {
|
|
|
|
|
if (!props.nornmalData) {
|
|
|
|
|
pagination.value.page = 1;
|
|
|
|
|
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-24 11:37:49 +07:00
|
|
|
function getList(enter?: string) {
|
|
|
|
|
if (enter == "enter") {
|
2025-09-23 18:01:15 +07:00
|
|
|
pagination.value.page = 1;
|
|
|
|
|
props.fetchData?.();
|
|
|
|
|
} else {
|
|
|
|
|
props.fetchData?.();
|
|
|
|
|
}
|
2024-09-17 15:56:06 +07:00
|
|
|
}
|
2025-09-10 11:08:18 +07:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => pagination.value.rowsPerPage,
|
|
|
|
|
async () => {
|
|
|
|
|
getList();
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-09-17 15:56:06 +07:00
|
|
|
</script>
|
2025-10-17 10:02:24 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
<template>
|
2023-07-13 09:00:38 +07:00
|
|
|
<div class="q-pb-sm row q-col-gutter-sm">
|
2024-08-01 18:03:39 +07:00
|
|
|
<div
|
|
|
|
|
class="q-gutter-sm"
|
|
|
|
|
v-if="nornmalData == true && checkPermission($route)?.attrIsCreate"
|
|
|
|
|
>
|
2023-07-13 09:00:38 +07:00
|
|
|
<q-btn
|
|
|
|
|
size="12px"
|
|
|
|
|
flat
|
|
|
|
|
round
|
2024-12-04 16:13:12 +07:00
|
|
|
color="primary"
|
2023-07-13 09:00:38 +07:00
|
|
|
@click="checkAdd"
|
|
|
|
|
icon="mdi-plus"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip>เพิ่มข้อมูล</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row q-gutter-sm q-pb-sm" v-if="conclude == true">
|
|
|
|
|
<q-card bordered flat class="q-px-md no-wrap row">
|
|
|
|
|
<div class="col-12 text-subtitle2 row items-center">
|
|
|
|
|
<span class="text-weight-medium text-dark">ผู้สมัครสอบ</span>
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-badge
|
|
|
|
|
color="white"
|
2025-09-10 11:08:18 +07:00
|
|
|
class="text-weight-bold text-subtitle1 text-blue-7"
|
|
|
|
|
:label="`${count?.toLocaleString()}`"
|
2023-07-13 09:00:38 +07:00
|
|
|
rounded
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<q-card bordered flat class="q-px-md no-wrap row">
|
|
|
|
|
<div class="col-12 text-subtitle2 row items-center">
|
|
|
|
|
<span class="text-weight-medium text-dark">สอบผ่าน</span>
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-badge
|
|
|
|
|
color="white"
|
2025-09-10 11:08:18 +07:00
|
|
|
class="text-weight-bold text-subtitle1 text-primary"
|
|
|
|
|
:label="`${pass?.toLocaleString()}`"
|
2023-07-13 09:00:38 +07:00
|
|
|
rounded
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<q-card bordered flat class="q-px-md no-wrap row">
|
|
|
|
|
<div class="col-12 text-subtitle2 row items-center">
|
|
|
|
|
<span class="text-weight-medium text-dark">สอบไม่ผ่าน</span>
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-badge
|
|
|
|
|
color="white"
|
|
|
|
|
class="text-weight-bold text-subtitle1 text-pink"
|
2025-09-10 11:08:18 +07:00
|
|
|
:label="`${notpass?.toLocaleString()}`"
|
|
|
|
|
rounded
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<q-card
|
|
|
|
|
v-if="missed_exam && missed_exam !== 0"
|
|
|
|
|
bordered
|
|
|
|
|
flat
|
|
|
|
|
class="q-px-md no-wrap row"
|
|
|
|
|
>
|
|
|
|
|
<div class="col-12 text-subtitle2 row items-center">
|
|
|
|
|
<span class="text-weight-medium text-dark">ขาดสอบ</span>
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-badge
|
|
|
|
|
color="white"
|
|
|
|
|
class="text-weight-bold text-subtitle1 text-orange"
|
|
|
|
|
:label="`${missed_exam?.toLocaleString()}`"
|
|
|
|
|
rounded
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
<q-card
|
|
|
|
|
v-if="other && other !== 0"
|
|
|
|
|
bordered
|
|
|
|
|
flat
|
|
|
|
|
class="q-px-md no-wrap row"
|
|
|
|
|
>
|
|
|
|
|
<div class="col-12 text-subtitle2 row items-center">
|
|
|
|
|
<span class="text-weight-medium text-dark">อื่น ๆ</span>
|
|
|
|
|
<q-space />
|
|
|
|
|
<q-badge
|
|
|
|
|
color="white"
|
|
|
|
|
class="text-weight-bold text-subtitle1 text-info"
|
|
|
|
|
:label="`${other?.toLocaleString()}`"
|
2023-07-13 09:00:38 +07:00
|
|
|
rounded
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</div>
|
|
|
|
|
<q-space />
|
|
|
|
|
<div class="items-center q-gutter-sm" style="display: flex">
|
2025-10-17 10:02:24 +07:00
|
|
|
<q-select
|
|
|
|
|
v-if="conclude"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
:options="optionsStatus"
|
|
|
|
|
option-value="value"
|
|
|
|
|
option-label="label"
|
|
|
|
|
label="ผลการสอบ"
|
|
|
|
|
map-options
|
|
|
|
|
emit-value
|
|
|
|
|
style="min-width: 140px"
|
|
|
|
|
:clearable="examResult !== ''"
|
|
|
|
|
@clear="examResult = ''"
|
|
|
|
|
v-model="examResult"
|
|
|
|
|
@update:model-value="
|
|
|
|
|
nornmalData ? props.onSearch?.() : getList('enter')
|
|
|
|
|
"
|
|
|
|
|
/>
|
2023-07-13 09:00:38 +07:00
|
|
|
<!-- ค้นหาข้อความใน table -->
|
|
|
|
|
<q-input
|
|
|
|
|
standout
|
|
|
|
|
dense
|
2025-02-26 16:04:28 +07:00
|
|
|
v-model="filter"
|
2023-07-13 09:00:38 +07:00
|
|
|
ref="filterRef"
|
|
|
|
|
outlined
|
|
|
|
|
placeholder="ค้นหา"
|
|
|
|
|
style="max-width: 200px"
|
2025-09-23 18:01:15 +07:00
|
|
|
@keydown.enter.prevent="
|
2025-09-24 11:37:49 +07:00
|
|
|
nornmalData ? props.onSearch?.() : getList('enter')
|
2025-09-23 18:01:15 +07:00
|
|
|
"
|
2023-07-13 09:00:38 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:append>
|
2025-02-26 16:04:28 +07:00
|
|
|
<q-icon name="search" />
|
2023-07-13 09:00:38 +07:00
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
<!-- แสดงคอลัมน์ใน table -->
|
|
|
|
|
<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
|
2024-11-05 16:33:46 +07:00
|
|
|
style="min-width: 140px"
|
2023-07-13 09:00:38 +07:00
|
|
|
class="gt-xs"
|
|
|
|
|
>
|
|
|
|
|
<template> </template>
|
|
|
|
|
</q-select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-07-07 15:18:37 +07:00
|
|
|
<d-table
|
2023-07-13 09:00:38 +07:00
|
|
|
ref="table"
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
|
|
|
|
class="custom-header-table"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
virtual-scroll
|
|
|
|
|
:virtual-scroll-sticky-size-start="48"
|
|
|
|
|
dense
|
|
|
|
|
:pagination-label="paginationLabel"
|
2025-09-10 11:19:39 +07:00
|
|
|
:rows-per-page-options="nornmalData ? [0] : [10, 25, 50, 100]"
|
2025-09-10 11:08:18 +07:00
|
|
|
@update:pagination="updatePagination"
|
2023-07-13 09:00:38 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:header="props">
|
|
|
|
|
<q-tr :props="props">
|
2024-07-24 16:37:04 +07:00
|
|
|
<q-th auto-width v-if="nornmalData == true" />
|
2023-07-13 09:00:38 +07:00
|
|
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
|
<span class="text-weight-medium" v-html="col.label" />
|
|
|
|
|
</q-th>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
<template #body="props">
|
|
|
|
|
<slot v-bind="props" name="columns"></slot>
|
|
|
|
|
</template>
|
2025-09-10 11:08:18 +07:00
|
|
|
<template v-if="!nornmalData" v-slot:pagination="scope">
|
2025-09-24 11:37:49 +07:00
|
|
|
ทั้งหมด {{ props.total?.toLocaleString() }} รายการ
|
2025-09-10 11:08:18 +07:00
|
|
|
<q-pagination
|
|
|
|
|
v-model="pagination.page"
|
|
|
|
|
active-color="primary"
|
|
|
|
|
color="dark"
|
|
|
|
|
:max="totalList"
|
|
|
|
|
size="sm"
|
|
|
|
|
boundary-links
|
|
|
|
|
direction-links
|
|
|
|
|
:max-pages="5"
|
|
|
|
|
@update:model-value="getList"
|
|
|
|
|
></q-pagination>
|
|
|
|
|
</template>
|
2025-07-07 15:18:37 +07:00
|
|
|
</d-table>
|
2023-06-01 12:54:58 +07:00
|
|
|
</template>
|
2023-07-13 09:00:38 +07:00
|
|
|
|
2023-06-01 12:54:58 +07:00
|
|
|
<style lang="scss">
|
|
|
|
|
.icon-color {
|
2023-07-13 09:00:38 +07:00
|
|
|
color: #4154b3;
|
2023-06-01 12:54:58 +07:00
|
|
|
}
|
|
|
|
|
</style>
|