ทะเบียนประวัติ => ข้อมูลผลงานและเครื่องราชฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-16 17:47:18 +07:00
parent 08817cc0de
commit b37ff5f3a5
5 changed files with 200 additions and 95 deletions

View file

@ -216,28 +216,40 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdatedAt",
]);
async function onSubmit() {
/**
* นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* form อมลใบอนญาตประกอบวชาช
*/
function closeDialog() {
dialog.value = false;
}
/**
* popup ประวการแกไขขอมลใบอนญาตประกอบวชาช
*/
function closeHistoryDialog() {
historyDialog.value = false;
}
async function fetchData(id: string) {
/**
* fetch อมลรายการใบอนญาตประกอบวชาช
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewCertificateByProfileId(id, empType.value))
.then(async (res) => {
rows.value = res.data.result;
@ -250,6 +262,9 @@ async function fetchData(id: string) {
});
}
/**
* เคลยร form อมลใบอนญาตประกอบวชาช
*/
function clearForm() {
profesLicenseData.expireDate = null;
profesLicenseData.issueDate = new Date();
@ -258,6 +273,10 @@ function clearForm() {
profesLicenseData.issuer = "";
}
/**
* เป form แกไขขอมลใบอนญาตประกอบวชาช
* @param row อมลใบอนญาตประกอบวชาช
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
@ -269,16 +288,21 @@ function editForm(row: any) {
dialog.value = true;
}
async function addData() {
await http
/**
* เพมรายการขอมลใบอนญาตประกอบวชาช
*/
function addData() {
showLoader();
http
.post(config.API.profileNewCertificate(empType.value), {
...profesLicenseData,
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -288,8 +312,13 @@ async function addData() {
});
}
async function editData(idData: string) {
await http
/**
* แกไขขอมลใบอนญาตประกอบวชาช
* @param idData รายการขอมลใบอนญาตประกอบวชาช
*/
function editData(idData: string) {
showLoader();
http
.patch(
config.API.profileNewCertificateByCertificateId(idData, empType.value),
{
@ -297,9 +326,10 @@ async function editData(idData: string) {
profileId: undefined,
}
)
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((err) => {
messageError($q, err);
@ -309,25 +339,12 @@ async function editData(idData: string) {
});
}
// function deleteData(idData: string) {
// dialogRemove($q, () =>
// http
// .delete(config.API.profileNewCertificateByCertificateId(idData))
// .then(() => {
// fetchData(id.value);
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// })
// );
// }
async function fetchHistoryData(id: string) {
/**
* fetch อมลประวการแกไขขอมลใบอนญาตประกอบวชาช
*/
function fetchHistoryData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewCertificateHisByCertificateId(id, empType.value))
.then(async (res) => {
historyRows.value = res.data.result;
@ -340,8 +357,8 @@ async function fetchHistoryData(id: string) {
});
}
onMounted(async () => {
await fetchData(id.value);
onMounted(() => {
fetchData(id.value);
});
</script>

View file

@ -353,18 +353,23 @@ const historyVisibleColumns = ref<string[]>([
"lastUpdatedAt", //
]);
async function onSubmit() {
/**
* นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
dialogStatus.value === "create" ? addData() : editData(editId.value);
closeDialog();
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* เคลยร form กอบรม/งาน
*/
function clearForm() {
isDate.value = "false";
trainData.name = "";
@ -379,6 +384,9 @@ function clearForm() {
trainData.endDate = new Date();
}
/**
* เป popoup แกไขขอมลฝกอบรม/งาน
*/
function editForm(row: any) {
dialogStatus.value = "edit";
editId.value = row.id;
@ -398,8 +406,12 @@ function editForm(row: any) {
dialog.value = true;
}
async function addData() {
await http
/**
* เพมขอมลการฝกอบรม/งาน
*/
function addData() {
showLoader();
http
.post(config.API.profileNewTraining(empType.value), {
...trainData,
startYear: undefined,
@ -408,9 +420,10 @@ async function addData() {
profileId: empType.value === "" ? id.value : undefined,
profileEmployeeId: empType.value !== "" ? id.value : undefined,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
closeDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -420,8 +433,13 @@ async function addData() {
});
}
async function editData(idData: string) {
await http
/**
* แกไขขอมลการฝกอบรม/งาน
* @param idData รายการฝกอบรม/งาน
*/
function editData(idData: string) {
showLoader();
http
.patch(config.API.profileNewTrainingByTrainingId(idData, empType.value), {
...trainData,
profileId: undefined,
@ -429,9 +447,10 @@ async function editData(idData: string) {
finishYear: undefined,
isDate: isDate.value === "false" ? false : true,
})
.then(() => {
fetchData(id.value);
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchData(id.value);
closeDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -441,36 +460,29 @@ async function editData(idData: string) {
});
}
function deleteData(idData: string) {
dialogRemove($q, () =>
http
.delete(config.API.profileNewTrainingByTrainingId(idData, empType.value))
.then(() => {
fetchData(id.value);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
})
);
/**
* from การฝกอบรม/งาน
*/
function closeDialog() {
dialog.value = false;
clearForm();
}
function closeDialog() {
clearForm();
dialog.value = false;
}
/**
* ประวการแกไขการฝกอบรม/งาน
*/
function closeHistoryDialog() {
historyDialog.value = false;
}
async function fetchData(id: string) {
/**
* fetch รายการการฝกอบรม/งาน
*/
function fetchData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewTrainingByProfileId(id, empType.value))
.then(async (res) => {
.then((res) => {
rows.value = res.data.result;
})
.catch((err) => {
@ -481,11 +493,14 @@ async function fetchData(id: string) {
});
}
async function fetchHistoryData(id: string) {
/**
* fetch ประวรายการแกไขการฝกอบรม/งาน
*/
function fetchHistoryData(id: string) {
showLoader();
await http
http
.get(config.API.profileNewTrainingHisByTrainingId(id, empType.value))
.then(async (res) => {
.then((res) => {
historyRows.value = res.data.result;
})
.catch((err) => {
@ -496,8 +511,8 @@ async function fetchHistoryData(id: string) {
});
}
onMounted(async () => {
await fetchData(id.value);
onMounted(() => {
fetchData(id.value);
});
</script>

View file

@ -444,9 +444,11 @@ const visibleColumnsHistory = ref<String[]>([
"lastUpdatedAt",
]);
/**
* fetch อมลรายการเครองราชอสรยาภรณ
*/
async function fetchData() {
if (!profileId.value) return;
showLoader();
try {
const res = await http.get(
@ -460,6 +462,9 @@ async function fetchData() {
}
}
/**
* fetch อมลเครองราชอสรยาภรณ
*/
async function fetchInsignia() {
showLoader();
try {
@ -473,9 +478,13 @@ async function fetchInsignia() {
}
}
/**
* นทกขอมลเครองราชอสรยาภรณ
* @param editStatus แกไข,เพ
*/
async function addEditData(editStatus: boolean = false) {
if (!profileId.value) return;
showLoader();
const url = editStatus
? config.API.profileNewInsignById(id.value, empType.value)
: config.API.profileNewInsign(empType.value);
@ -489,8 +498,9 @@ async function addEditData(editStatus: boolean = false) {
};
try {
await http[method](url, reqBody);
success($q, "บันทึกข้อมูลสำเร็จ");
await fetchData();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
} catch (e) {
messageError($q, e);
} finally {
@ -498,6 +508,9 @@ async function addEditData(editStatus: boolean = false) {
}
}
/**
* เป form อมลเครองราชอสรยาภรณ
*/
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true;
isEdit.value = editStatus;
@ -523,15 +536,20 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
}
}
async function clickClose() {
/**
* form อมลเครองราชอสรยาภรณ
*/
function clickClose() {
clearData();
modal.value = false;
}
/**
* fetch อมลประวการแกไขรายการขอมลเครองราชอสรยาภรณ
*/
async function clickHistory(row: ResponseObject) {
modalHistory.value = true;
filterSearch.value = "";
showLoader();
try {
const res = await http.get(
@ -545,18 +563,26 @@ async function clickHistory(row: ResponseObject) {
}
}
/**
* นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
() => {
addEditData(isEdit.value);
modal.value = false;
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* ลเตอรอมลจาก input
* @param val าทอนให input
* @param update function จาก quasar
* @param refData type กำหนด ของ input นๆ
*/
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "insigniaOptions":
@ -571,6 +597,9 @@ function filterSelector(val: string, update: Function, refData: string) {
}
}
/**
* นหาลำดบช
*/
function insigniaTypeSelection() {
const insigniaTypeFilter = Ops.value.insigniaOptions.filter(
(r: DataOptionInsignia) => r.id === insigniaForm.insigniaId
@ -580,6 +609,9 @@ function insigniaTypeSelection() {
}
}
/**
* เคลยร formDฟta
*/
function clearData() {
id.value = "";
(insigniaType.value = ""), (insigniaForm.year = 0);

View file

@ -220,6 +220,9 @@ const historyPagination = ref({
rowsPerPage: 10,
});
/**
* fetch รายการขอมลประกาศเกยรต
*/
async function fetchData() {
if (!profileId.value) return;
@ -236,9 +239,14 @@ async function fetchData() {
}
}
/**
* นทกขอมลประกาศเกยรต
* @param editStatus แกไข,เพ
*/
async function addEditData(editStatus: boolean = false) {
if (!profileId.value) return;
showLoader();
const url = editStatus
? config.API.profileNewHonorById(id.value, empType.value)
: config.API.profileNewHonor(empType.value);
@ -258,8 +266,9 @@ async function addEditData(editStatus: boolean = false) {
try {
await http[method](url, reqBody);
success($q, "บันทึกข้อมูลสำเร็จ");
await fetchData();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
} catch (e) {
messageError($q, e);
} finally {
@ -267,6 +276,9 @@ async function addEditData(editStatus: boolean = false) {
}
}
/**
* เป form อมลประกาศเกยรต
*/
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true;
isEdit.value = editStatus;
@ -286,11 +298,17 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
}
}
/**
* form อมลประกาศเกยรต
*/
async function clickClose() {
clearData();
modal.value = false;
}
/**
* fetch อมลประวการแกไขรายการขอมลประกาศเกยรต
*/
async function clickHistory(row: ResponseObject) {
modalHistory.value = true;
filterSearch.value = "";
@ -308,18 +326,23 @@ async function clickHistory(row: ResponseObject) {
}
}
/**
* นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
addEditData(isEdit.value);
modal.value = false;
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* เคลยร formDฟta
*/
function clearData() {
id.value = "";
issueDateYear.value = new Date().getFullYear();
@ -331,8 +354,8 @@ function clearData() {
declHonorForm.isDate = "false";
}
onMounted(async () => {
await fetchData();
onMounted(() => {
fetchData();
});
</script>
<template>

View file

@ -44,11 +44,6 @@ const resPerformForm = reactive<RequestItemsObject>({
pointSum: 0,
date: null,
});
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const currentPageHistory = ref<number>(1);
const maxPageHistory = ref<number>(1);
const isEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modeView = ref<string>("table");
@ -292,6 +287,9 @@ const historyPagination = ref({
rowsPerPage: 10,
});
/**
* fetch รายการขอมลผลการประเมนการปฏราชการ
*/
async function fetchData() {
if (!profileId.value) return;
@ -311,9 +309,14 @@ async function fetchData() {
}
}
/**
* นทกขอมลผลการประเมนการปฏราชการ
* @param editStatus แกไข,เพ
*/
async function addEditData(editStatus: boolean = false) {
if (!profileId.value) return;
showLoader();
const url = editStatus
? config.API.profileNewAssessmentsById(id.value, empType.value)
: config.API.profileNewAssessments(empType.value);
@ -328,8 +331,9 @@ async function addEditData(editStatus: boolean = false) {
try {
await http[method](url, reqBody);
success($q, "บันทึกข้อมูลสำเร็จ");
await fetchData();
await success($q, "บันทึกข้อมูลสำเร็จ");
modal.value = false;
} catch (e) {
messageError($q, e);
} finally {
@ -337,6 +341,9 @@ async function addEditData(editStatus: boolean = false) {
}
}
/**
* เป form อมลผลการประเมนการปฏราชการ
*/
function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
modal.value = true;
isEdit.value = editStatus;
@ -356,11 +363,17 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
}
}
/**
* form อมลผลการประเมนการปฏราชการ
*/
async function clickClose() {
clearData();
modal.value = false;
}
/**
* fetch อมลประวการแกไขรายการขอมลผลการประเมนการปฏราชการ
*/
async function clickHistory(row: ResponseObject) {
modalHistory.value = true;
filterSearch.value = "";
@ -379,18 +392,23 @@ async function clickHistory(row: ResponseObject) {
}
}
/**
* นยนการบนทกขอม
*/
function onSubmit() {
dialogConfirm(
$q,
async () => {
addEditData(isEdit.value);
modal.value = false;
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
/**
* เคลยร formDฟta
*/
function clearData() {
(id.value = ""),
(resPerformForm.name = ""),
@ -403,8 +421,8 @@ function clearData() {
(resPerformForm.date = null);
}
onMounted(async () => {
await fetchData();
onMounted(() => {
fetchData();
});
</script>
<template>