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

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

@ -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);