API รับทุนการศึกษา/ฝึกอบรม

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-05 16:31:36 +07:00
parent 7c5cf3794b
commit d42e421f14
8 changed files with 1912 additions and 178 deletions

View file

@ -1,17 +1,22 @@
import env from "../index"; import env from "../index";
const development = `${env.API_URI}/development`; const development = `${env.API_URI}/development`;
const developmentOrg = `${env.API_URI}/org` const developmentOrg = `${env.API_URI}/org`;
const devScholarship = `${env.API_URI}/development/scholarship`;
export default { export default {
development, development,
/** history */ /** history */
developmentHistoryList: (type:string) => `${development}/history/${type}/`, developmentHistoryList: (type: string) => `${development}/history/${type}/`,
developmentHistoryAdd: (type:string) => `${development}/history/${type}`, developmentHistoryAdd: (type: string) => `${development}/history/${type}`,
developmentProjectSearch: () => `${development}/main/search`, developmentProjectSearch: () => `${development}/main/search`,
/** history employee */ /** history employee */
developmentProjectSearchEmployee:()=>`${developmentOrg}/profile-employee/`, developmentProjectSearchEmployee: () => `${developmentOrg}/profile-employee/`,
/** รายการโครงการ*/ /** รายการโครงการ*/
developmentMain: `${development}/main`, developmentMain: `${development}/main`,
developmentMainById: (id: string) => `${development}/main/${id}`, developmentMainById: (id: string) => `${development}/main/${id}`,
/** ทุนการศึกษา/ฝึกอบรม*/
devScholarship,
devScholarshipByid: (id: string) => `${devScholarship}/${id}`,
}; };

View file

@ -55,6 +55,13 @@ interface DataPerson {
[key: string]: any; [key: string]: any;
} }
interface ItemsDownload {
label: string;
value: string;
icon: string;
color: string;
}
export type { export type {
DataOption, DataOption,
DataOptionCheckBox, DataOptionCheckBox,
@ -62,4 +69,5 @@ export type {
NewPagination, NewPagination,
FormFilter, FormFilter,
DataPerson, DataPerson,
ItemsDownload
}; };

View file

@ -63,7 +63,7 @@ interface FormFollowOther {
interface FormAddHistory { interface FormAddHistory {
id: string; id: string;
name: string|null; name: string | null;
prefix: string; prefix: string;
rank: string; rank: string;
firstName: string; firstName: string;
@ -82,7 +82,7 @@ interface FormAddHistory {
interface FormAddHistoryEmployee { interface FormAddHistoryEmployee {
id: string; id: string;
name: string|null; name: string | null;
prefix: string; prefix: string;
rank: string; rank: string;
firstName: string; firstName: string;

View file

@ -0,0 +1,53 @@
interface FormsSholarship {
rank: string; //ยศ
prefix: string; //คำนำหน้าชื่อ
firstName: string; //ชื่อ
lastName: string; //นามสกุล
citizenId: string; //เลขประจำตัวประชาชน
position: string; //ตำแหน่ง
posExecutive: string; //ชื่อตำแหน่งทางการบริหาร
posLevelId: string | null; //ไอดีระดับตำแหน่ง
posTypeId: string | null; //ไอดีประเภทตำแหน่ง
guarantorRank: string; //ยศ(ผู้ค้ำ)
guarantorPrefix: string; //คำนำหน้าชื่อ(ผู้ค้ำ)
guarantorFirstName: string; //ชื่อ(ผู้ค้ำ)
guarantorLastName: string; //นามสกุล(ผู้ค้ำ)
guarantorCitizenId: string; //เลขประจำตัวประชาชน(ผู้ค้ำ)
guarantorPosition: string; //ตำแหน่ง(ผู้ค้ำ)
guarantorPosExecutive: string; //ชื่อตำแหน่งทางการบริหาร(ผู้ค้ำ)
posLevelguarantorId: string | null; //ไอดีระดับตำแหน่ง(ผู้ค้ำ)
posTypeguarantorId: string | null; //ไอดีประเภทตำแหน่ง(ผู้ค้ำ)
scholarshipYear: number | null; //ปีงบประมาณที่ได้รับทุน
budgetSource: string; //แหล่งงบประมาณ
budgetApprove: number | string | null; //งบประมาณที่ได้รับอนุมัติตลอดหลักสูตร
bookNo: string; //เลขที่หนังสืออนุมัติ
bookNoDate: Date | null; //ลงวันที่(หนังสือ)
bookApproveDate: Date | null; //หนังสืออนุมัติเมื่อวันที่
useOfficialTime: boolean; //ใช้เวลาราชการ
changeDetail: string; //เปลี่ยนแปลงรายละเอียด
scholarshipType: string; //เลือกประเภททุน
fundType: string; //ประเภททุน
contractNo: string; //เลขที่สัญญา
contractDate: Date | null; //ลงวันที่(เลขที่สัญญา)
reportBackNo: string; //เลขที่หนังสือรายงานตัวกลับ
reportBackNoDate: Date | null; //ลงวันที่(เลขที่หนังสือรายงานตัวกลับ)
reportBackDate: Date | null; //รายงานตัวกลับวันที่
degreeLevel: string; //ระดับปริญญา
course: string; //หลักสูตรการศึกษา/หลักสูตรการฝึกอบรม
field: string; //สาขาวิชา/สาขา
faculty: string; //คณะ
educationalInstitution: string; //สถาบันการศึกษา/สถาบันการศึกษา_หน่วยงานผู้จัดการฝึกอบรม/สถานที่ไปศึกษาดูงานในประเทศ
startDate: Date | null; //วันเริ่มต้นการศึกษา/วันเริ่มต้นการฝึกอบรม/วันเริ่มต้นการศึกษาดูงานในประเทศ
endDate: Date | null; //วันสิ้นสุดการศึกษา/วันสิ้นสุดการฝึกอบรม/วันสิ้นสุดการศึกษาดูงานในประเทศ
studyPlace: string; //สถานที่ไปศึกษาดูงาน
studyTopic: string; //หัวข้อการไปศึกษาดูงาน/หัวข้อการไปศึกษาดูงานในประเทศ
studyStartDate: Date | null; //วันเริ่มต้นการศึกษาดูงาน
studyEndDate: Date | null; //วันสิ้นสุดการศึกษาดูงาน
studyCountry: string; //ประเทศที่เดินทางไปศึกษาดูงาน
studyAbroadTopic: string; //หัวข้อการไปศึกษาดูงานต่างประเทศ
studyAbroadStartDate: Date | null; //วันเริ่มต้นการศึกษาดูงานต่างประเทศ
studyAbroadEndDate: Date | null; //วันสิ้นสุดการศึกษาดูงานต่างประเทศ
totalPeriod: string; //รวมระยะเวลาในการศึกษา/รวมระยะเวลาในการฝึกอบรม
}
export type { FormsSholarship };

View file

@ -0,0 +1,67 @@
interface ListSholarship {
citizenId: string;
fullName: string;
id: string;
posExecutive: string;
posLevel: string;
posType: string;
position: string;
}
interface DataSholarship {
rank: string; //ยศ
prefix: string; //คำนำหน้าชื่อ
firstName: string; //ชื่อ
lastName: string; //นามสกุล
citizenId: string; //เลขประจำตัวประชาชน
position: string; //ตำแหน่ง
posExecutive: string; //ชื่อตำแหน่งทางการบริหาร
posLevelId: string; //ไอดีระดับตำแหน่ง
posTypeId: string; //ไอดีประเภทตำแหน่ง
posTypeName: string; //ไอดีระดับตำแหน่ง
posLevelName: string; //ไอดีประเภทตำแหน่ง
guarantorRank: string; //ยศ(ผู้ค้ำ)
guarantorPrefix: string; //คำนำหน้าชื่อ(ผู้ค้ำ)
guarantorFirstName: string; //ชื่อ(ผู้ค้ำ)
guarantorLastName: string; //นามสกุล(ผู้ค้ำ)
guarantorCitizenId: string; //เลขประจำตัวประชาชน(ผู้ค้ำ)
guarantorPosition: string; //ตำแหน่ง(ผู้ค้ำ)
guarantorPosExecutive: string; //ชื่อตำแหน่งทางการบริหาร(ผู้ค้ำ)
posLevelguarantorId: string; //ไอดีระดับตำแหน่ง(ผู้ค้ำ)
posTypeguarantorId: string; //ไอดีประเภทตำแหน่ง(ผู้ค้ำ)
posTypeguarantorName: string; //ไอดีระดับตำแหน่ง(ผู้ค้ำ)
posLevelguarantorName: string; //ไอดีประเภทตำแหน่ง(ผู้ค้ำ)
scholarshipYear: number | null; //ปีงบประมาณที่ได้รับทุน
budgetSource: string; //แหล่งงบประมาณ
budgetApprove: number | null; //งบประมาณที่ได้รับอนุมัติตลอดหลักสูตร
bookNo: string; //เลขที่หนังสืออนุมัติ
bookNoDate: Date | null; //ลงวันที่(หนังสือ)
bookApproveDate: Date | null; //หนังสืออนุมัติเมื่อวันที่
useOfficialTime: boolean; //ใช้เวลาราชการ
changeDetail: string; //เปลี่ยนแปลงรายละเอียด
scholarshipType: string; //เลือกประเภททุน
fundType: string; //ประเภททุน
contractNo: string; //เลขที่สัญญา
contractDate: Date | null; //ลงวันที่(เลขที่สัญญา)
reportBackNo: string; //เลขที่หนังสือรายงานตัวกลับ
reportBackNoDate: Date | null; //ลงวันที่(เลขที่หนังสือรายงานตัวกลับ)
reportBackDate: Date | null; //รายงานตัวกลับวันที่
degreeLevel: string; //ระดับปริญญา
course: string; //หลักสูตรการศึกษา/หลักสูตรการฝึกอบรม
field: string; //สาขาวิชา/สาขา
faculty: string; //คณะ
educationalInstitution: string; //สถาบันการศึกษา/สถาบันการศึกษา_หน่วยงานผู้จัดการฝึกอบรม/สถานที่ไปศึกษาดูงานในประเทศ
startDate: Date | null; //วันเริ่มต้นการศึกษา/วันเริ่มต้นการฝึกอบรม/วันเริ่มต้นการศึกษาดูงานในประเทศ
endDate: Date | null; //วันสิ้นสุดการศึกษา/วันสิ้นสุดการฝึกอบรม/วันสิ้นสุดการศึกษาดูงานในประเทศ
studyPlace: string; //สถานที่ไปศึกษาดูงาน
studyTopic: string; //หัวข้อการไปศึกษาดูงาน/หัวข้อการไปศึกษาดูงานในประเทศ
studyStartDate: Date | null; //วันเริ่มต้นการศึกษาดูงาน
studyEndDate: Date | null; //วันสิ้นสุดการศึกษาดูงาน
studyCountry: string; //ประเทศที่เดินทางไปศึกษาดูงาน
studyAbroadTopic: string; //หัวข้อการไปศึกษาดูงานต่างประเทศ
studyAbroadStartDate: Date | null; //วันเริ่มต้นการศึกษาดูงานต่างประเทศ
studyAbroadEndDate: Date | null; //วันสิ้นสุดการศึกษาดูงานต่างประเทศ
totalPeriod: string; //รวมระยะเวลาในการศึกษา/รวมระยะเวลาในการฝึกอบรม
}
export type { DataSholarship, ListSholarship };

View file

@ -230,7 +230,11 @@ onMounted(() => {
v-if="formQuery.keyword !== ''" v-if="formQuery.keyword !== ''"
name="clear" name="clear"
class="cursor-pointer" class="cursor-pointer"
@click="(formQuery.keyword = ''), fetchListProject()" @click="
(formQuery.keyword = ''),
fetchListProject(),
(formQuery.page = 1)
"
/> />
</template> </template>
</q-input> </q-input>
@ -253,19 +257,6 @@ onMounted(() => {
</div> </div>
</div> </div>
</q-toolbar> </q-toolbar>
<!-- <q-toolbar class="q-gutter-x-sm" style="padding: 0px">
<div>
</div>
<q-space />
<div class="row q-gutter-md">
</div>
</q-toolbar> -->
<div class="col-12"> <div class="col-12">
<d-table <d-table

View file

@ -1,18 +1,26 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, onMounted } from "vue"; import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar, type QTableProps } from "quasar"; import { useQuasar, type QTableProps } from "quasar";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
import type {
DataOption,
ItemsDownload,
NewPagination,
} from "@/modules/15_development/interface/index/Main";
import type { ListSholarship } from "@/modules/15_development/interface/response/Scholarship";
/** importStore*/ /** importStore*/
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const $q = useQuasar(); const $q = useQuasar();
const router = useRouter(); const router = useRouter();
const { showLoader, hideLoader } = useCounterMixin(); const { showLoader, hideLoader, messageError } = useCounterMixin();
/** หัวตาราง */ /** หัวตาราง */
const rows = ref<any>([]); const rows = ref<ListSholarship[]>([]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "citizenId", name: "citizenId",
@ -24,11 +32,11 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "name", name: "fullName",
align: "left", align: "left",
label: "ชื่อ-นามสกุล", label: "ชื่อ-นามสกุล",
sortable: true, sortable: true,
field: "name", field: "fullName",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
@ -43,49 +51,61 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "type", name: "posType",
align: "left", align: "left",
label: "ประเภทตำแหน่ง", label: "ประเภทตำแหน่ง",
sortable: true, sortable: true,
field: "type", field: "posType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "level", name: "posLevel",
align: "left", align: "left",
label: "ระดับตำแหน่ง", label: "ระดับตำแหน่ง",
sortable: true, sortable: true,
field: "level", field: "posLevel",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{ {
name: "positionPath", name: "posExecutive",
align: "left", align: "left",
label: "ตำแหน่งทางการบริหาร", label: "ตำแหน่งทางการบริหาร",
sortable: true, sortable: true,
field: "positionPath", field: "posExecutive",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"citizenId", "citizenId",
"name", "fullName",
"position", "position",
"type", "posType",
"level", "posLevel",
"positionPath", "posExecutive",
]); ]);
const options = ref<any>([ const scholarshipTypeOp = ref<DataOption[]>([
"การศึกษาในประเทศ", {
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่ไม่มีการไปต่างประเทศ)", id: "DOMESTICE",
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่มีการไปต่างประเทศ)", name: "การศึกษาในประเทศ",
"ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรประเภทนักบริหาร)", },
{
id: "NOABROAD",
name: "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่ไม่มีการไปต่างประเทศ)",
},
{
id: "ABROAD",
name: "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่มีการไปต่างประเทศ)",
},
{
id: "EXECUTIVE",
name: "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรประเภทนักบริหาร)",
},
]); ]);
const itemDownload = ref<any>([ const itemDownload = ref<ItemsDownload[]>([
{ {
label: "ดาวน์โหลด 1", label: "ดาวน์โหลด 1",
value: "", value: "",
@ -106,40 +126,38 @@ const itemDownload = ref<any>([
}, },
]); ]);
const formFilter = reactive({ const formQuery = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
year: new Date().getFullYear(), year: new Date().getFullYear(),
type: "การศึกษาในประเทศ", type: "DOMESTICE",
keyword: "", keyword: "",
}); });
const totalList = ref<number>(1); //
function fetchList() { function fetchList() {
showLoader(); showLoader();
const data = [ http
{ .get(
id: "1", config.API.devScholarship +
citizenId: "123XXXXXXXXXXX", `?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}&year=${formQuery.year}&scholarshipType=${formQuery.type}`
name: "นางสาวสาวิตรี ศรีสมัย", )
position: "นักทรัพยากรบุคคล", .then((res) => {
type: "ทั่วไป", const data = res.data.result.data;
level: "ปฏิบัติงาน", totalList.value = Math.ceil(res.data.result.total / formQuery.pageSize);
positionPath: "นักทรัพยากรบุคคล", rows.value = data;
}, })
{ .catch((err) => {
id: "2", messageError($q, err);
citizenId: "1234XXXXXXXXXX", })
name: "นายณัฐพงศ์ ดิษยบุตร", .finally(() => {
position: "นักทรัพยากรบุคคล", hideLoader();
type: "ทั่วไป", });
level: "ปฏิบัติงาน", }
positionPath: "",
}, function fetchNewList() {
]; formQuery.page = 1;
rows.value = data; fetchList();
setTimeout(() => {
hideLoader();
}, 500);
} }
function onClickAddOrView(status: boolean = false, id: string = "") { function onClickAddOrView(status: boolean = false, id: string = "") {
@ -148,6 +166,22 @@ function onClickAddOrView(status: boolean = false, id: string = "") {
: router.push("/development/scholarship/add"); : router.push("/development/scholarship/add");
} }
/**
* function updatePagination
* @param newPagination อม Pagination ใหม
*/
function updatePagination(newPagination: NewPagination) {
formQuery.page = 1;
formQuery.pageSize = newPagination.rowsPerPage;
}
watch(
() => formQuery.pageSize,
() => {
fetchNewList();
}
);
onMounted(() => { onMounted(() => {
fetchList(); fetchList();
}); });
@ -163,11 +197,12 @@ onMounted(() => {
<div> <div>
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="formFilter.year" v-model="formQuery.year"
:locale="'th'" :locale="'th'"
autoApply autoApply
year-picker year-picker
:enableTimePicker="false" :enableTimePicker="false"
@update:model-value="fetchNewList"
> >
<template #year="{ year }">{{ year + 543 }}</template> <template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{ <template #year-overlay-value="{ value }">{{
@ -178,7 +213,7 @@ onMounted(() => {
dense dense
lazy-rules lazy-rules
outlined outlined
:model-value="Number(formFilter.year) + 543" :model-value="Number(formQuery.year) + 543"
:label="`${'ปีงบประมาณ'}`" :label="`${'ปีงบประมาณ'}`"
> >
<template v-slot:prepend> <template v-slot:prepend>
@ -197,9 +232,14 @@ onMounted(() => {
<q-select <q-select
dense dense
outlined outlined
v-model="formFilter.type" v-model="formQuery.type"
:options="options" :options="scholarshipTypeOp"
emit-value
map-options
option-value="id"
option-label="name"
label="เลือกประเภททุน" label="เลือกประเภททุน"
@update:model-value="fetchNewList"
/> />
</div> </div>
</div> </div>
@ -244,18 +284,19 @@ onMounted(() => {
<q-input <q-input
standout standout
dense dense
v-model="formFilter.keyword" v-model="formQuery.keyword"
ref="filterRef" ref="filterRef"
outlined outlined
placeholder="ค้นหา" placeholder="ค้นหา"
@keyup.enter="fetchNewList()"
> >
<template v-slot:append> <template v-slot:append>
<q-icon v-if="formFilter.keyword == ''" name="search" /> <q-icon v-if="formQuery.keyword == ''" name="search" />
<q-icon <q-icon
v-if="formFilter.keyword !== ''" v-if="formQuery.keyword !== ''"
name="clear" name="clear"
class="cursor-pointer" class="cursor-pointer"
@click="formFilter.keyword = ''" @click="(formQuery.keyword = ''), fetchNewList()"
/> />
</template> </template>
</q-input> </q-input>
@ -291,6 +332,8 @@ onMounted(() => {
dense dense
class="custom-header-table" class="custom-header-table"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:rows-per-page-options="[2, 10, 25, 50, 100]"
@update:pagination="updatePagination"
> >
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
@ -313,6 +356,19 @@ onMounted(() => {
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope">
<q-pagination
v-model="formQuery.page"
active-color="primary"
color="dark"
:max="Number(totalList)"
size="sm"
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchList"
></q-pagination>
</template>
</d-table> </d-table>
</div> </div>
</q-card> </q-card>