รายละเอียดทุนการศึกษา/ฝึกอบรม

This commit is contained in:
STW_TTTY\stwtt 2024-04-11 18:01:59 +07:00
parent 49b53430d2
commit 7666554388
5 changed files with 477 additions and 111 deletions

View file

@ -1,17 +1,22 @@
<script setup lang="ts">
import { ref, onMounted,watch } from "vue";
import { ref, onMounted, watch } from "vue";
import { useRouter } from "vue-router";
import type { QTableProps } from "quasar";
import { useQuasar, type QTableProps } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { DataOptions } from "@/modules/09_scholarship/interface/index/Main";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin();
const { date2Thai } = mixin;
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
const router = useRouter();
const $q = useQuasar();
const filterKeyword = ref<string>("");
const profilId = ref<string>('')
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const page = ref<number>(1);
@ -51,126 +56,43 @@ const pagination = ref({
const columns = ref<QTableProps["columns"]>([
{
name: "citizenId",
name: "scholarshipYear",
align: "left",
label: "เลขประจำตัวประชาชน ",
label: "ปีงบประมาณที่ได้รับทุน ",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
field: "scholarshipYear",
headerStyle: "font-size: 14px ;width:20%",
style: "font-size: 14px",
},
{
name: "fullName",
name: "scholarshipType",
align: "left",
label: "ชื่อ-นามสกุล",
label: "ประเภททุน",
sortable: true,
field: "fullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "posType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posLevel",
align: "left",
label: "ระดับตำแหน่ง",
sortable: true,
field: "posLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posExecutive",
align: "left",
label: "ตำแหน่งทางการบริหาร",
sortable: true,
field: "posExecutive",
field: "scholarshipType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"citizenId",
"fullName",
"position",
"posType",
"posLevel",
"posExecutive",
]);
const visibleColumns = ref<string[]>(["scholarshipYear", "scholarshipType"]);
/** ดึงข้อมูล */
function getData() {
const data = [
{
id: "e81c39e3-c6d7-4761-8807-a0f1cfe4d4d1",
citizenId: "5555512312321",
fullName: "นายณัฐพงศ์ ดิษยบุตร",
position: null,
posType: null,
posLevel: null,
posExecutive: null,
},
{
id: "e81c39e3-c6d7-4761-8807-a0f1cfe4d4d2",
citizenId: "0000000000021",
fullName: "นางสาวชญาน์นันท์ วรดรเกรียรติวรา",
position: "นักจัดการงานทั่วไป",
posType: "ทั่วไป",
posLevel: "ชำนาญงาน",
posExecutive: "ผู้ช่วยหัวหน้าสำนักงาน",
},
{
id: "e81c39e3-c6d7-4761-8807-a0f1cfe4d4d3",
citizenId: "0000000000010",
fullName: "นางจิตรา ทันนิเทศ",
position: "เจ้าพนักงานธุรการ",
posType: "ทั่วไป",
posLevel: "ปฏิบัติงาน",
posExecutive: "นักการช่าง",
},
{
id: "e81c39e3-c6d7-4761-8807-a0f1cfe4d4d9",
citizenId: "0000000000016",
fullName: "นางสาวปุณณภาภัค เจรจาปรีดี",
position: "นักจัดการทั่วไป",
posType: "ทั่วไป",
posLevel: "ชำนาญงาน",
posExecutive: null,
},
];
rows.value = data;
// showLoader();
// await http
// .get(config.API.orgPrefix)
// .then(async (res) => {
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
http
.get(config.API.developmentScholarship+`/user/${profilId.value}`)
.then((res)=>{
rows.value = res.data.result
}).catch((e)=>{
messageError($q,e)
}).finally(()=>{
})
}
function onEdit(id: string) {
router.push(`/KPI/${id}`);
router.push(`/scholarship/${id}`);
}
watch(
@ -190,8 +112,37 @@ watch(
}
);
function getProfileId() {
showLoader();
http
.get(config.API.profilePosition())
.then((res) => {
profilId.value = res.data.result.profileId
getData()
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
function convertType(val: string) {
switch (val) {
case "DOMESTICE":
return "การศึกษาในประเทศ";
case "NOABROAD":
return "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่ไม่มีการไปต่างประเทศ)";
case "ABROAD":
return "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรที่มีการไปต่างประเทศ)";
case "EXECUTIVE":
return "ฝึกอบรมในประเทศที่ส่งไปพัฒนากับหน่วยวงานภายนอก (หลักสูตรประเภทนักบริหาร)";
}
}
onMounted(async () => {
getData();
getProfileId();
});
</script>
@ -335,7 +286,6 @@ onMounted(async () => {
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
@ -345,8 +295,11 @@ onMounted(async () => {
:key="col.id"
@click="onEdit(props.row.id)"
>
<div v-if="col.name == 'createDate'">
{{ col.value ? date2Thai(col.value) : "-" }}
<div v-if="col.name == 'scholarshipYear'">
{{ col.value ? col.value + 543 : "-" }}
</div>
<div v-else-if="col.name == 'scholarshipType'">
{{ col.value ? convertType(col.value): "-" }}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}