hrms-mgt/src/modules/14_KPI/views/report.vue

874 lines
25 KiB
Vue
Raw Normal View History

2024-06-13 11:43:38 +07:00
<script setup lang="ts">
2024-07-10 10:40:48 +07:00
import { ref, onMounted, reactive, watch } from "vue";
2024-06-13 11:43:38 +07:00
import { useQuasar } from "quasar";
import { VuePDF, usePDF } from "@tato30/vue-pdf";
import config from "@/app.config";
import http from "@/plugins/http";
import axios from "axios";
import genReport from "@/plugins/genreport";
2024-06-13 11:43:38 +07:00
2024-07-10 10:40:48 +07:00
/**
* importType
*/
2024-06-25 16:28:33 +07:00
import type { QTableProps } from "quasar";
2024-07-10 10:40:48 +07:00
import type {
DataOption,
NewPagination,
} from "@/modules/14_KPI/interface/index/Main";
import type {
ResRoundEvaluate,
ResOrg,
ResReport,
ResPerson,
} from "@/modules/14_KPI/interface/response/Main";
2024-06-25 16:28:33 +07:00
2024-07-10 10:40:48 +07:00
/**
* importComponents
*/
2024-06-25 16:28:33 +07:00
import DialogHeader from "@/components/DialogHeader.vue";
2024-07-10 10:40:48 +07:00
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
2024-08-07 17:26:54 +07:00
import { checkPermission } from "@/utils/permissions";
2024-08-20 10:39:17 +07:00
import { useRoute } from "vue-router";
2024-07-10 10:40:48 +07:00
/**
* use
*/
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
2024-08-20 10:39:17 +07:00
const route = useRoute();
2024-06-13 11:43:38 +07:00
2024-07-10 10:40:48 +07:00
/**
* วแปรงาน
*/
2024-06-13 11:43:38 +07:00
const year = ref<number | null>(new Date().getFullYear());
const round = ref<string>("");
const organization = ref<string>("");
const roundOp = ref<DataOption[]>([]);
const organizationOpsMain = ref<DataOption[]>([]);
const organizationOps = ref<DataOption[]>([]);
2024-06-19 15:51:15 +07:00
const typeReport = ref<string>("");
const listReportMain = ref<DataOption[]>([
{
2024-06-25 16:28:33 +07:00
id: "KPI1",
2024-06-20 09:45:58 +07:00
name: "รายงานสรุปผลการประเมินผลการปฏิบัติราชการระดับบุคคล แสดงจำนวนผู้มีผลการประเมินระดับต่างๆ ในแต่ละรอบการประเมินรายหน่วยงาน/ส่วนราชการ",
2024-06-19 15:51:15 +07:00
},
{
2024-06-25 16:28:33 +07:00
id: "KPI2",
2024-06-20 09:45:58 +07:00
name: "รายงานสรุปผลการประเมินผลการปฏิบัติราชการระดับบุคคล แสดงรายละเอียดผู้มีผลการประเมินระดับต่างๆ รายหน่วยงาน/ส่วนราชการ ",
2024-06-19 15:51:15 +07:00
},
{
2024-06-25 16:28:33 +07:00
id: "KPI3",
2024-06-20 09:45:58 +07:00
name: "รายงานสรุปผลการประเมินผลการปฏิบัติราชการระดับบุคคล แสดงรายละเอียดผลการประเมินของผู้ใต้บังคับบัญชา",
2024-06-19 15:51:15 +07:00
},
{
2024-06-25 16:28:33 +07:00
id: "KPI4",
2024-06-19 15:51:15 +07:00
name: "แบบสรุปผลการประเมินผลการปฏิบัติราชการระดับบุคคล (รายบุคคล)",
},
{
2024-06-25 16:28:33 +07:00
id: "KPI5",
2024-06-19 15:51:15 +07:00
name: "รายงานผลการประเมินผลการปฏิบัติราชการย้อนหลัง ๕ ปี",
},
{
2024-06-25 16:28:33 +07:00
id: "KPI6",
2024-06-19 15:51:15 +07:00
name: "รายงานผลการประเมินผลการปฏิบัติราชการย้อนหลัง ๓ ปี",
},
{
2024-06-25 16:28:33 +07:00
id: "KPI7",
2024-06-19 15:51:15 +07:00
name: "รายงานสรุปแผนพัฒนาการปฏิบัติราชการรายบุคคล",
},
{
2024-06-25 16:28:33 +07:00
id: "KPI8",
2024-06-19 15:51:15 +07:00
name: "รายงานแผนพัฒนาการปฏิบัติราชการรายบุคคล",
},
2024-06-20 09:45:58 +07:00
{
2024-06-25 16:28:33 +07:00
id: "KPI9",
2024-06-20 09:45:58 +07:00
name: "จัดทำประกาศผู้มีผลการปฏิบัติราชการระดับดีเด่นและดีมาก",
},
2024-06-19 15:51:15 +07:00
]);
2024-07-23 12:02:30 +07:00
const listReport = ref<DataOption[]>([]); // รายการรายงานทั้งหมด
2024-06-13 11:43:38 +07:00
2024-07-10 10:40:48 +07:00
/**
* funtion fetchขอมลรอบการประเม
*/
2024-06-13 11:43:38 +07:00
function fetchRoundOption() {
http
.get(
config.API.kpiPeriod +
`?page=${1}&pageSize=${10}&keyword=${""}&year=${year.value}`
)
.then(async (res) => {
const data = await res.data.result.data;
2024-07-10 10:40:48 +07:00
2024-06-13 11:43:38 +07:00
if (res.data.result.data.length > 0) {
2024-07-10 10:40:48 +07:00
const list = await data.map((e: ResRoundEvaluate) => ({
2024-06-13 11:43:38 +07:00
id: e.id,
name:
e.durationKPI === "OCT"
? "รอบที่ 2 ตุลาคม"
2024-06-13 11:43:38 +07:00
: e.durationKPI === "APR"
2024-07-12 13:49:05 +07:00
? "รอบที่ 1 เมษายน"
2024-06-13 11:43:38 +07:00
: "",
}));
roundOp.value = list;
} else {
roundOp.value = [];
round.value = "";
organization.value = "";
dataDownload.value = null;
pdfSrc.value = null;
2024-06-13 11:43:38 +07:00
}
})
.catch((err) => {
messageError($q, err);
});
}
2024-07-10 10:40:48 +07:00
/**
* function fetch อมลโครงสรางปจจ
*/
2024-06-13 11:43:38 +07:00
function fetchActiveId() {
showLoader();
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
fetchListOrg(data.activeId);
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}
2024-07-10 10:40:48 +07:00
/**
* function fetch อมลหนวยงาน
* @param id โครงสรางปจจ
*/
2024-06-13 11:43:38 +07:00
function fetchListOrg(id: string) {
showLoader();
http
2024-08-20 10:39:17 +07:00
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
2024-06-13 11:43:38 +07:00
.then(async (res) => {
2024-07-10 10:40:48 +07:00
const data = await res.data.result.map((item: ResOrg) => ({
2024-06-13 11:43:38 +07:00
id: item.orgTreeId,
name: item.orgName,
}));
organizationOpsMain.value = data;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
2024-07-10 10:40:48 +07:00
/**
* function fetch รายงาน
*/
function fetchReport() {
2024-06-25 16:28:33 +07:00
showLoader();
const body = {
type: typeReport.value,
periodId: round.value,
root: organization.value,
2024-07-10 10:40:48 +07:00
profileId: persanalId.value ? persanalId.value : undefined,
2024-06-25 16:28:33 +07:00
};
http
.post(config.API.kpiReport(), body)
.then((res) => {
dataDownload.value = res.data.result;
page.value = 1;
genPDf(res.data.result);
})
.catch((err) => {
messageError($q, err);
hideLoader();
});
}
/**
* function เรยกไฟล PDF
* @param data อมลบญชนลา
*/
2024-07-10 10:40:48 +07:00
function genPDf(data: ResReport) {
showLoader();
2024-06-19 15:51:15 +07:00
axios
.post(config.API.reportTemplate + `/docx`, data, {
headers: {
accept: "application/pdf",
"content-Type": "application/json",
},
responseType: "blob",
})
.then(async (res) => {
const blob = new Blob([res.data]);
const objectUrl = URL.createObjectURL(blob);
const pdfData = await usePDF(`${objectUrl}`);
showLoader();
setTimeout(() => {
pdfSrc.value = pdfData.pdf.value;
numOfPages.value = pdfData.pages.value;
hideLoader();
}, 1500);
})
.catch(async (e) => {
hideLoader();
2024-07-04 09:43:48 +07:00
messageError($q, e);
});
}
2024-07-10 10:40:48 +07:00
/**
* function เปลยนประเภทรายงาน
* @param val ประเภทรายงาน
*/
2024-06-25 16:28:33 +07:00
function changOption(val: string) {
if (
val === "KPI1" ||
val === "KPI2" ||
val === "KPI3" ||
val === "KPI7" ||
val === "KPI8" ||
2024-06-25 16:28:33 +07:00
val === "KPI9"
) {
persanalId.value = val === "KPI8" ? persanalId.value : "";
organization.value = val === "KPI8" ? "" : organization.value;
if (round.value && organization.value) {
fetchReport();
} else if (round.value && persanalId.value) {
2024-06-25 16:28:33 +07:00
fetchReport();
}
} else {
round.value = "";
organization.value = "";
if (persanalId.value) {
fetchReport();
}
2024-06-25 16:28:33 +07:00
}
}
2024-06-13 11:43:38 +07:00
2024-07-10 10:40:48 +07:00
/**
* function นหาคำใน select
* @param val คำคนหา
* @param update function
* @param type ประเภท select
*/
2024-06-19 15:51:15 +07:00
function filterSelector(val: string, update: Function, type: string) {
switch (type) {
case "typereport":
update(() => {
2024-07-16 13:08:40 +07:00
typeReport.value = val ? "" : typeReport.value;
2024-06-19 15:51:15 +07:00
listReport.value = listReportMain.value.filter(
(v: DataOption) => v.name.toLowerCase().indexOf(val) > -1
);
});
break;
case "organization":
update(() => {
2024-07-16 13:08:40 +07:00
organization.value = val ? "" : organization.value;
2024-06-19 15:51:15 +07:00
organizationOps.value = organizationOpsMain.value.filter(
(v: DataOption) => v.name.toLowerCase().indexOf(val) > -1
);
});
break;
default:
break;
}
2024-06-13 11:43:38 +07:00
}
2024-07-10 10:40:48 +07:00
/**
* อม file
*/
2024-06-13 11:43:38 +07:00
const splitterModel = ref(14);
const numOfPages = ref<number>(0);
const page = ref<number>(1);
const pdfSrc = ref<any>();
2024-07-10 10:40:48 +07:00
const dataDownload = ref<ResReport | null>();
2024-06-13 11:43:38 +07:00
2024-07-10 10:40:48 +07:00
/**
* function โหลดไฟล
* @param data อมลไฟล
* @param type นามสกลไฟล
*/
function downloadReport(data: ResReport | null | undefined, type: string) {
2024-06-20 09:45:58 +07:00
const name =
listReportMain.value.find((e) => e.id === typeReport.value)?.name ?? "";
var fileName = name;
genReport(data, fileName, type);
2024-06-13 11:43:38 +07:00
}
2024-07-10 10:40:48 +07:00
/**
* ไปหนาตอไปของรายงาน
*/
2024-06-13 11:43:38 +07:00
function nextPage() {
if (page.value < numOfPages.value) {
page.value++;
}
}
2024-07-10 10:40:48 +07:00
/**
* กลบหนากอนหนาของรายงาน
*/
2024-06-13 11:43:38 +07:00
function backPage() {
if (page.value !== 1) {
page.value--;
}
}
2024-07-10 10:40:48 +07:00
/**
* popup เลอกราชช
*/
2024-06-25 16:28:33 +07:00
const modal = ref<boolean>(false);
const persanalId = ref<string>("");
2024-07-10 10:40:48 +07:00
const typeFilter = ref<DataOption[]>([
{ id: "fullName", name: "ชื่อ-นามสกุล" },
{ id: "citizenId", name: "เลขประจำตัวประชาชน" },
2024-06-25 16:28:33 +07:00
]);
2024-07-10 10:40:48 +07:00
const formFilter = reactive({
page: 1,
pageSize: 10,
searchField: "fullName",
searchKeyword: "",
});
const maxPage = ref<number>(1);
const total = ref<number>(0);
2024-07-12 11:01:15 +07:00
const roundRef = ref<any>(null);
2024-07-10 10:40:48 +07:00
const rowsPerson = ref<ResPerson[]>([]);
2024-06-25 16:28:33 +07:00
const columns = ref<QTableProps["columns"]>([
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: false,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ-นามสกุล",
field: "name",
2024-07-10 10:40:48 +07:00
format(val, row) {
return `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`;
},
2024-06-25 16:28:33 +07:00
sortable: false,
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: false,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่งในสายงาน",
sortable: false,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posType",
align: "left",
label: "ตำแหน่งประเภท",
sortable: false,
field: "posType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posLevel",
align: "left",
label: "ระดับ",
sortable: false,
field: "posLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
2024-07-10 10:40:48 +07:00
/**
* function เป popup เลอกราชช
*/
2024-06-25 16:28:33 +07:00
function onClickModal() {
2024-07-12 11:01:15 +07:00
if (typeReport.value === "KPI8") {
roundRef.value.validate();
if (!roundRef.value.hasError) {
modal.value = true;
fetchListPerson();
}
} else {
modal.value = true;
fetchListPerson();
}
2024-06-25 16:28:33 +07:00
}
2024-07-10 10:40:48 +07:00
/**
* function popup เลอกราชช
*/
2024-06-27 15:23:00 +07:00
function onCloseModal() {
modal.value = false;
2024-07-10 10:40:48 +07:00
formFilter.page = 1;
formFilter.searchField = "fullName";
formFilter.searchKeyword = "";
2024-06-27 15:23:00 +07:00
}
2024-07-10 10:40:48 +07:00
/**
* function fetch รายชอขอมลทะเบยนประว
*/
function fetchListPerson() {
showLoader();
let queryParams = {
page: formFilter.page,
pageSize: formFilter.pageSize,
};
if (formFilter.searchKeyword) {
queryParams = Object.assign({}, queryParams, {
searchField: formFilter.searchField,
searchKeyword: formFilter.searchKeyword,
});
}
http
.get(config.API.registryNew(""), { params: queryParams })
.then((res) => {
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
rowsPerson.value = res.data.result.data;
total.value = res.data.result.total;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
2024-06-25 16:28:33 +07:00
2024-07-10 10:40:48 +07:00
/**
* functiuon เลอกราชช
* @param id profile ID
*/
2024-06-25 16:28:33 +07:00
function onSelectPerson(id: string) {
persanalId.value = id;
2024-06-27 15:23:00 +07:00
onCloseModal();
2024-06-25 16:28:33 +07:00
fetchReport();
}
2024-07-10 10:40:48 +07:00
/**
* function เปลยนแถวตอหน
* @param newPagination อม Paging
*/
function updatePageSizePagination(newPagination: NewPagination) {
formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage;
}
watch(
() => formFilter.pageSize,
() => {
fetchListPerson();
}
);
2024-06-13 11:43:38 +07:00
onMounted(() => {
fetchRoundOption();
fetchActiveId();
});
</script>
<template>
2024-06-19 15:51:15 +07:00
<div class="toptitle text-dark col-12 row items-center">รายงาน</div>
2024-06-13 11:43:38 +07:00
<q-card flat bordered>
2024-06-19 15:51:15 +07:00
<q-card-section class="q-gutter-y-sm">
2024-06-13 11:43:38 +07:00
<q-toolbar style="padding: 0">
<div class="row q-gutter-sm">
2024-06-19 15:51:15 +07:00
<q-select
2024-08-07 17:26:54 +07:00
:readonly="!checkPermission($route)?.attrIsGet"
2024-06-19 15:51:15 +07:00
style="min-width: 100px"
dense
hide-bottom-space
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="typeReport"
:options="listReport"
label="รายงาน"
use-input
2024-06-25 16:28:33 +07:00
@update:model-value="changOption"
2024-06-19 15:51:15 +07:00
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn ,'typereport')"
2024-07-10 13:40:39 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template></q-select
>
2024-06-19 15:51:15 +07:00
</div>
<q-space />
<q-btn
2024-08-07 17:26:54 +07:00
v-if="checkPermission($route)?.attrIsGet"
2024-06-19 15:51:15 +07:00
flat
round
color="primary"
icon="download"
:disable="!dataDownload"
>
<q-menu>
<q-list style="min-width: 150px">
<q-item
clickable
v-close-popup
@click="downloadReport(dataDownload, 'pdf')"
>
<q-item-section avatar
><q-icon color="red" name="mdi-file-pdf"
/></q-item-section>
2024-11-28 09:34:00 +07:00
<q-item-section>ไฟล .pdf</q-item-section>
2024-06-19 15:51:15 +07:00
</q-item>
<q-item
clickable
v-close-popup
@click="downloadReport(dataDownload, 'docx')"
>
<q-item-section avatar
><q-icon color="blue" name="mdi-file-word"
/></q-item-section>
<q-item-section>ไฟล .docx</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-toolbar>
<q-toolbar
class="q-pa-sm bg-grey-2"
style="padding: 0; border-radius: 5px"
v-if="typeReport"
>
<div
class="row q-gutter-sm"
v-if="
2024-06-25 16:28:33 +07:00
typeReport === 'KPI1' ||
typeReport === 'KPI2' ||
typeReport === 'KPI3' ||
typeReport === 'KPI7' ||
typeReport === 'KPI8' ||
2024-06-25 16:28:33 +07:00
typeReport === 'KPI9'
2024-06-19 15:51:15 +07:00
"
>
2024-06-13 11:43:38 +07:00
<datepicker
menu-class-name="modalfix"
v-model="year"
style="width: 150px"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:model-value="fetchRoundOption()"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
hide-bottom-space
:model-value="!!year ? year + 543 : null"
:label="`${'ปีงบประมาณ'}`"
2024-06-19 15:51:15 +07:00
class="bg-white"
2024-06-13 11:43:38 +07:00
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<q-select
2024-07-12 11:01:15 +07:00
ref="roundRef"
2024-06-19 15:51:15 +07:00
class="bg-white"
2024-06-13 11:43:38 +07:00
v-model="round"
outlined
label="รอบการประเมิน"
dense
2024-07-12 11:01:15 +07:00
hide-bottom-space
2024-06-13 11:43:38 +07:00
option-label="name"
option-value="id"
:options="roundOp"
style="min-width: 150px"
emit-value
map-options
:disable="roundOp.length === 0"
2024-06-25 16:28:33 +07:00
@update:model-value="changOption(typeReport)"
2024-07-12 11:01:15 +07:00
lazy-rules
:rules="
typeReport === 'KPI8'
2024-09-20 15:23:06 +07:00
? [(val:string) => !!val || 'กรุณาเลือกรอบการประเมิน']
2024-07-12 11:01:15 +07:00
: []
"
2024-06-13 11:43:38 +07:00
/>
<q-select
v-if="typeReport !== 'KPI8'"
2024-06-19 15:51:15 +07:00
class="bg-white"
2024-06-13 11:43:38 +07:00
:disable="roundOp.length === 0"
style="min-width: 100px"
dense
hide-bottom-space
outlined
option-label="name"
option-value="id"
emit-value
2024-06-13 11:43:38 +07:00
map-options
v-model="organization"
:options="organizationOps"
label="หน่วยงาน"
use-input
2024-06-25 16:28:33 +07:00
@update:model-value="changOption(typeReport)"
2024-06-13 11:43:38 +07:00
@filter="(inputValue: string,
2024-06-19 15:51:15 +07:00
doneFn: Function) => filterSelector(inputValue, doneFn,'organization' )"
2024-07-10 13:40:39 +07:00
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template></q-select
>
2024-06-13 11:43:38 +07:00
</div>
<div
class="q-pa-sm"
v-if="
typeReport === 'KPI4' ||
typeReport === 'KPI5' ||
typeReport === 'KPI6' ||
typeReport === 'KPI8'
"
>
<q-btn
color="primary"
label="เลือกรายชื่อ"
@click="onClickModal"
:disable="roundOp.length === 0 && typeReport === 'KPI8'"
/>
2024-06-19 15:51:15 +07:00
</div>
2024-06-13 11:43:38 +07:00
</q-toolbar>
<q-splitter
v-model="splitterModel"
horizontal
style="
2024-06-19 15:51:15 +07:00
height: 70vh;
2024-06-13 11:43:38 +07:00
border: 1px solid rgb(210, 210, 210);
border-radius: 5px;
"
before-class="overflow-hidden disable"
separator-class="bg-white disabled"
>
<template v-slot:before v-if="pdfSrc">
2024-06-13 11:43:38 +07:00
<div class="q-px-sm">
<div class="row items-start items-center">
<div class="col">
<q-btn
padding="xs"
icon="mdi-chevron-left"
color="grey-2"
text-color="grey-5"
size="md"
class="my-auto"
@click="backPage"
:disable="page == 1"
/>
</div>
<div class="col-12 col-md-auto">
<div class="q-pa-md flex">
หนาท {{ page }} จาก {{ numOfPages }}
</div>
</div>
<div class="col text-right">
<q-btn
padding="xs"
icon="mdi-chevron-right"
color="grey-2"
text-color="grey-5"
size="md"
@click="nextPage"
:disable="page === numOfPages"
/>
</div>
</div>
</div>
</template>
<template v-slot:after v-if="pdfSrc">
2024-06-13 11:43:38 +07:00
<div class="q-pa-md">
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
</div>
</template>
<template v-slot:default v-if="pdfSrc">
2024-06-13 11:43:38 +07:00
<div class="q-pa-md">
<div class="row items-start items-center">
<div class="col">
<q-btn
padding="xs"
icon="mdi-chevron-left"
color="grey-2"
text-color="grey-5"
size="md"
class="my-auto"
@click="backPage"
:disable="page == 1"
/>
</div>
<div class="col-12 col-md-auto">
<div class="q-pa-md flex">
หนาท {{ page }} จาก {{ numOfPages }}
</div>
</div>
<div class="col text-right">
<q-btn
padding="xs"
icon="mdi-chevron-right"
color="grey-2"
text-color="grey-5"
size="md"
@click="nextPage"
:disable="page === numOfPages"
/>
</div>
</div>
</div>
</template>
</q-splitter>
</q-card-section>
</q-card>
2024-06-25 16:28:33 +07:00
<q-dialog v-model="modal" persistent>
2024-07-10 10:40:48 +07:00
<q-card style="width: 1000px; max-width: 100vw">
2024-06-27 15:23:00 +07:00
<DialogHeader :tittle="'เลือกราชชื่อ'" :close="onCloseModal" />
2024-06-25 16:28:33 +07:00
<q-separator />
<q-card-section class="q-col-gutter-sm">
2024-07-10 10:40:48 +07:00
<div class="row col-12 q-col-gutter-sm">
<div class="col-3">
<q-select
class="bg-white"
dense
hide-bottom-space
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="formFilter.searchField"
:options="typeFilter"
label="ค้นหาจาก"
/>
</div>
<div class="col-9">
<q-input
class="bg-white"
v-model="formFilter.searchKeyword"
outlined
clearable
hide-bottom-space
dense
label="คำค้น"
>
<template v-slot:after>
<q-btn
color="primary"
icon="search"
label="ค้นหา"
class="full-width q-py-sm q-px-md"
@click="(formFilter.page = 1), fetchListPerson()"
>
</q-btn>
</template>
</q-input>
</div>
2024-06-25 16:28:33 +07:00
</div>
<div class="col-12">
<d-table
ref="table"
:columns="columns"
:rows="rowsPerson"
:paging="true"
row-key="id"
flat
bordered
dense
:rows-per-page-options="[10, 25, 50, 100]"
2024-07-10 10:40:48 +07:00
@update:pagination="updatePageSizePagination"
2024-06-25 16:28:33 +07:00
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-tr auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td>
<q-btn
outline
color="primary"
label="เลือก"
@click="onSelectPerson(props.row.id)"
/>
</q-td>
</q-tr>
</template>
2024-07-10 10:40:48 +07:00
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="formFilter.page"
active-color="primary"
color="dark"
:max="maxPage"
:max-pages="5"
size="sm"
boundary-links
direction-links
@update:model-value="fetchListPerson()"
></q-pagination>
</template>
2024-06-25 16:28:33 +07:00
</d-table>
</div>
</q-card-section>
</q-card>
</q-dialog>
</template>
2024-06-13 11:43:38 +07:00
<style scoped></style>