fix รายการข้าราชการ ฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-11 14:34:26 +07:00
parent ff7610e60d
commit db069e0ff9
2 changed files with 52 additions and 18 deletions

View file

@ -267,6 +267,9 @@ async function fetchDataDetail(id: string) {
isStatus.value = data.status; isStatus.value = data.status;
isGov.value = data.citizenId ? true : false; isGov.value = data.citizenId ? true : false;
isGuarantor.value = data.guarantorCitizenId ? true : false; isGuarantor.value = data.guarantorCitizenId ? true : false;
if (isStatus.value !== "PENDING") {
router.push(`/development/scholarship-detail/${id}`);
}
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);

View file

@ -91,6 +91,19 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
}, },
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
format(val, row) {
return conventStatus(val);
},
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]); ]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"year", "year",
@ -100,6 +113,7 @@ const visibleColumns = ref<string[]>([
"posType", "posType",
"posLevel", "posLevel",
"posExecutive", "posExecutive",
"status",
]); ]);
const scholarshipTypeOp = ref<DataOption[]>([ const scholarshipTypeOp = ref<DataOption[]>([
@ -138,13 +152,16 @@ function fetchList() {
http http
.get( .get(
config.API.devScholarship + config.API.devScholarship +
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword.trim()}&year=${formQuery.year}&scholarshipType=${formQuery.type}` `?page=${formQuery.page}&pageSize=${
formQuery.pageSize
}&keyword=${formQuery.keyword.trim()}&year=${
formQuery.year
}&scholarshipType=${formQuery.type}`
) )
.then((res) => { .then((res) => {
const data = res.data.result.data; const data = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize); maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
totalList.value = res.data.result.total; totalList.value = res.data.result.total;
rows.value = data; rows.value = data;
}) })
.catch((err) => { .catch((err) => {
@ -177,23 +194,36 @@ function updatePagination(newPagination: NewPagination) {
formQuery.pageSize = newPagination.rowsPerPage; formQuery.pageSize = newPagination.rowsPerPage;
} }
/** download file */ function conventStatus(val: string) {
function onDownload() { switch (val) {
showLoader(); case "PENDING":
http return "กำลังศึกษา";
.get(config.API.developmentReportScholarship()) case "GRADUATE":
.then((res) => { return "เรียนจบ";
const dataList = res.data.result; case "NOTGRADUATE":
genReportXLSX(dataList, "รายการข้าราชการ ฯ ที่ได้รับทุนการศึกษา/ฝึกอบรม"); return "เรียนไม่จบ";
}) default:
.catch((e) => { break;
messageError($q, e); }
})
.finally(() => {
hideLoader();
});
} }
// /** download file */
// function onDownload() {
// showLoader();
// http
// .get(config.API.developmentReportScholarship())
// .then((res) => {
// const dataList = res.data.result;
// genReportXLSX(dataList, " /");
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// }
/** เช็ค เมื่อมีการเปลี่ยนค่าของ ข้อมูลในเเถว */ /** เช็ค เมื่อมีการเปลี่ยนค่าของ ข้อมูลในเเถว */
watch( watch(
() => formQuery.pageSize, () => formQuery.pageSize,
@ -370,8 +400,9 @@ onMounted(() => {
flat flat
dense dense
round round
:disable="props.row.status !== 'PENDING'"
icon="edit" icon="edit"
color="edit" :color="props.row.status !== 'PENDING' ? 'grey-6' : 'edit'"
@click="onClickAddOrView(true, props.row.id)" @click="onClickAddOrView(true, props.row.id)"
> >
<q-tooltip>แกไขขอม</q-tooltip> <q-tooltip>แกไขขอม</q-tooltip>