feat(retirement): add Page retire-old

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-10-02 17:25:20 +07:00
parent a97775e66a
commit 8674269934
5 changed files with 432 additions and 4 deletions

View file

@ -108,4 +108,6 @@ export default {
// แก้ไขข้อมูลการลาออก
updateResign: (path: string, id: string) =>
`${retirement}/${path}/admin-update/resign-info/${id}`,
exRetirement: `${env.API_URI}/org/ex/retirement`,
};

View file

@ -20,4 +20,17 @@ interface QuestionDesc {
question10Desc: string;
}
export type { OptionQuestions, OptionQuestions2,QuestionDesc };
interface FilterRetirementOld {
type: string;
retireYear: number;
citizenID: string;
firstNameTH: string;
lastNameTH: string;
}
export type {
OptionQuestions,
OptionQuestions2,
QuestionDesc,
FilterRetirementOld,
};

View file

@ -68,7 +68,33 @@ interface SeqTypeRow {
keycloakId: string;
approveStatus: string;
comment: string;
rejectDate: Date|null;
rejectDate: Date | null;
}
interface RetirementOld {
dataRecords: DataRecords[];
rowPerPage: number;
startRecord: number;
totalRecords: number;
}
interface DataRecords {
citizenID: string;
firstNameTH: string;
lastNameTH: string;
organizeID: string;
organizeNameTH: string;
positionID: string;
positionLevelID: string;
positionLevelNameTH: string;
positionNameTH: string;
positionTypeID: string;
positionTypeNameTH: string;
recordRow: number;
retireDate: string;
retireTypeID: string;
retireTypeNameTH: string;
retireYear: string;
}
export type {
@ -79,5 +105,7 @@ export type {
FileList,
CheckBoxType,
RowsType,
SeqTypeRow
SeqTypeRow,
RetirementOld,
DataRecords,
};

View file

@ -66,9 +66,11 @@ const outDetailOnlyEmp = () =>
import("@/modules/06_retirement/components/06_dismissOrder/DetailEMP.vue");
/** รายงาน*/
const ReportView = () => import("@/modules/06_retirement/views/07_report.vue");
const RetirementOld = () =>
import("@/modules/06_retirement/views/09_retirementOld.vue");
export default [
{
path: "/retirement",
@ -356,4 +358,15 @@ export default [
Role: "STAFF",
},
},
{
path: "retire-old",
name: "retireOld",
component: RetirementOld,
meta: {
Auth: true,
Key: "SYS_RETIRE_OLD",
Role: "STAFF",
},
},
];

View file

@ -0,0 +1,372 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { usePagination } from "@/composables/usePagination";
import type { QTableColumn } from "quasar";
import type { DataOption } from "@/modules/06_retirement/interface/index/Main";
import type { FilterRetirementOld } from "@/modules/06_retirement/interface/request/Main";
import type {
RetirementOld,
DataRecords,
} from "@/modules/06_retirement/interface/response/Main";
const $q = useQuasar();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const { pagination, params, onRequest } = usePagination(
"",
fetchDataRetirement
);
const optionStatusMain = ref<DataOption[]>([
{ name: "ข้าราชการ", id: "officer" },
{ name: "ลูกจ้างชั่วคราว", id: "employee" },
]);
const optionStatus = ref<DataOption[]>(optionStatusMain.value);
const filter = ref<FilterRetirementOld>({
type: "officer",
retireYear: new Date().getFullYear() - 1,
citizenID: "",
firstNameTH: "",
lastNameTH: "",
});
const rows = ref<DataRecords[]>([]); //
const columns = ref<QTableColumn[]>([
{
name: "recordRow",
align: "left",
label: "ลำดับ",
sortable: false,
field: "recordRow",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenID",
align: "left",
label: "เลขบัตรประชาชน",
sortable: false,
field: "citizenID",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullName",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: false,
field: "fullName",
format(val, row) {
return `${row.firstNameTH} ${row.lastNameTH}`;
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionNameTH",
align: "left",
label: "ตำแหน่ง",
sortable: false,
field: "positionNameTH",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionTypeNameTH",
align: "left",
label: "ตำแหน่งประเภท",
sortable: false,
field: "positionTypeNameTH",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionLevelNameTH",
align: "left",
label: "ระดับ",
sortable: false,
field: "positionLevelNameTH",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organizeNameTH",
align: "left",
label: "สังกัด",
sortable: false,
field: "organizeNameTH",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "retireYear",
align: "left",
label: "ปีที่พ้น",
sortable: false,
field: "retireYear",
format(val, row) {
return val ? (Number(val) + 543).toString() : "-";
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "retireTypeNameTH",
align: "left",
label: "เหตุผลของการพ้นจากตำแหน่ง",
sortable: false,
field: "retireTypeNameTH",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/** ฟังก์ชันสำหรับดึงข้อมูลผู้พ้นราชการ */
async function fetchDataRetirement() {
showLoader();
try {
const response = await http.post(config.API.exRetirement, {
page: params.value.page,
type: filter.value.type,
retireYear: filter.value.retireYear.toString(),
citizenID: filter.value.citizenID,
firstNameTH: filter.value.firstNameTH.trim(),
lastNameTH: filter.value.lastNameTH.trim(),
});
const data: RetirementOld = response.data.data;
pagination.value.rowsNumber = data.totalRecords;
rows.value = data.dataRecords;
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
/**
* งกนสำหรบกรองตวเลอกสถานะ
* @param inputValue าทกรอกในชองคนหา
* @param doneFn งกนทเรยกเมอกรองเสร
*/
function filterOption(inputValue: string, doneFn: Function) {
const needle = inputValue.toLowerCase();
optionStatus.value = optionStatusMain.value.filter(
(v) => v.name.toLowerCase().indexOf(needle) > -1
);
doneFn();
}
/** ฟังก์ชันสำหรับค้นหาข้อมูลผู้พ้นราชการ */
function searchData() {
pagination.value.page = 1; // Reset to first page on new search
fetchDataRetirement();
}
/** ฟังก์ชันสำหรับรีเซ็ตตัวกรอง */
function resetFilter() {
filter.value = {
type: "officer",
retireYear: new Date().getFullYear(),
citizenID: "",
firstNameTH: "",
lastNameTH: "",
};
}
onMounted(() => {
pagination.value.rowsPerPage = 25;
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
อมลผนราชการกอนป 2568
</div>
<!-- Filter Section -->
<q-form greedy @submit.prevent @validation-success="searchData">
<q-card class="q-mb-sm" flat bordered>
<q-card-section>
<div class="row q-col-gutter-md">
<!-- Position Type -->
<div class="col-12 col-md-6 col-lg-3">
<div class="row q-col-gutter-sm">
<!-- Type of Position -->
<div class="col">
<q-select
v-model="filter.type"
label="ประเภทตำแหน่ง"
option-label="name"
:options="optionStatus"
option-value="id"
dense
emit-value
map-options
outlined
use-input
hide-selected
fill-input
readonly
@filter="(inputValue:string,doneFn:Function) => filterOption(inputValue, doneFn)"
class="full-width"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<!-- Retirement Year -->
<div class="col">
<datepicker
menu-class-name="modalfix"
v-model="filter.retireYear"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
:max-date="`${new Date().getFullYear() - 1}, 11, 31`"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
:model-value="Number(filter.retireYear) + 543"
label="ปีที่ออกจากราชการ"
bg-color="white"
class="full-width"
>
<template v-slot:prepend>
<q-icon name="event" color="primary" />
</template>
</q-input>
</template>
</datepicker>
</div>
</div>
</div>
<!-- Citizen ID -->
<div class="col-12 col-md-6 col-lg-3">
<q-input
outlined
v-model="filter.citizenID"
dense
label="เลขบัตรประชาชน"
hide-bottom-space
maxlength="13"
mask="#############"
>
</q-input>
</div>
<!-- Name Filters -->
<div class="col-12 col-md-6 col-lg-3">
<q-input
outlined
v-model="filter.firstNameTH"
dense
label="ชื่อ"
hide-bottom-space
>
</q-input>
</div>
<div class="col-12 col-md-6 col-lg-3">
<q-input
outlined
v-model="filter.lastNameTH"
dense
label="นามสกุล"
hide-bottom-space
>
</q-input>
</div>
<!-- Search Actions -->
<div class="row col-12 justify-end">
<div class="row col-md-6 col-lg-3 q-gutter-sm full-height">
<q-space />
<q-btn
color="primary"
icon="search"
label="ค้นหา"
no-caps
type="submit"
/>
<q-btn
color="grey-6"
icon="refresh"
label="รีเซ็ต"
@click="resetFilter"
outline
no-caps
/>
</div>
</div>
</div>
</q-card-section>
</q-card>
</q-form>
<!-- Results Section -->
<q-card flat bordered>
<q-card-section>
<p-table
ref="table"
:columns="columns"
:rows="rows"
row-key="personId"
flat
bordered
:paging="true"
dense
class="custom-header-table"
:rows-per-page-options="[25]"
v-model:pagination="pagination"
@request="onRequest"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th
v-for="col in props.cols"
:key="col.name"
:props="props"
style="color: #000000; font-weight: 500"
>
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</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 v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div>
{{ col.value ?? "-" }}
</div>
</q-td>
</q-tr>
</template>
</p-table>
</q-card-section>
</q-card>
</template>
<style scoped></style>