Refactoring code module 06_retirement

This commit is contained in:
STW_TTTY\stwtt 2024-09-18 15:18:57 +07:00
parent 1225254062
commit ea921b39b0
29 changed files with 730 additions and 823 deletions

View file

@ -9,6 +9,8 @@ import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import type { RetirementList } from "@/modules/06_retirement/interface/index/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
@ -55,7 +57,7 @@ const dataProfile = ref<Object>([]);
/** คอลัมน์ที่แสดง */
const columns = ref<any["columns"]>([]);
const rows = ref<any[]>([]);
const rows = ref<RetirementList[]>([]);
const visibleColumns = ref<string[]>([
"order",
"name",
@ -71,13 +73,13 @@ const visibleColumns = ref<string[]>([
/**
* งกนป Dialog
*/
const closeDialog = () => {
function closeDialog() {
modalNote.value = false;
modalUpload.value = false;
};
}
// fecthlist
const fecthlistprofile = async (id: string) => {
async function fecthlistprofile(id: string) {
showLoader();
await http
.get(config.API.listRetire(id))
@ -191,10 +193,10 @@ const fecthlistprofile = async (id: string) => {
hideLoader();
});
};
}
//
const fecthCheck = async (id: string) => {
async function fecthCheck(id: string) {
await http
.get(config.API.checkfileupload(id))
.then((res) => {
@ -203,10 +205,10 @@ const fecthCheck = async (id: string) => {
.catch((err) => {
messageError($q, err);
});
};
}
// DelProfile
const clickDelete = () => {
function clickDelete() {
dialogRemove(
$q,
async () => {
@ -230,10 +232,10 @@ const clickDelete = () => {
"ยืนยันการลบข้อมูล",
"ต้องการลบข้อมูลนี้ใช่หรือไม่ ?"
);
};
}
//
const saveNote = () => {
function saveNote() {
dialogConfirm(
$q,
async () => {
@ -257,18 +259,18 @@ const saveNote = () => {
"ยืนยันการบันทึกข้อมูล",
"ต้องการบันทึกข้อมูลนี้ใช่หรือไม่ ?"
);
};
}
// ListId
const UpdateListId = (retireld: string, pId: string) => {
function UpdateListId(retireld: string, pId: string) {
profileId.value = pId;
fecthlistprofile(retireld);
};
}
//
const backHistory = () => {
function backHistory() {
window.history.back();
};
}
const visibleNote = computed(() => {
if (note.value === "" || note.value === undefined) {
@ -279,7 +281,7 @@ const visibleNote = computed(() => {
//
const modalUpload = ref<boolean>(false);
const signDate = ref<Date | null>(null);
const uploadFile = async (event: any, signDate: any) => {
async function uploadFile(event: any, signDate: any) {
if (myForm.value !== null) {
myForm.value.validate().then((successmyForm) => {
if (successmyForm) {
@ -317,7 +319,7 @@ const uploadFile = async (event: any, signDate: any) => {
}
});
}
};
}
/**
* ดาวหโหลด ไฟล
@ -341,7 +343,7 @@ async function downloadAttachment(type: string, id: string) {
}
//
const saveEdiitReport = (reason: string) => {
function saveEdiitReport(reason: string) {
const formdata = new FormData();
formdata.append("Detail", reason);
dialogConfirm(
@ -363,12 +365,12 @@ const saveEdiitReport = (reason: string) => {
"ยืนยันการแก้ไขข้อมูล",
"ต้องการยืนยันการแก้ไขข้อมูลนี้หรือไม่ ?"
);
};
}
// popup
const openmodalEditReport = () => {
function openmodalEditReport() {
modalEdit.value = true;
};
}
/** Setting Pagination */
const paging = ref<boolean>(true);
@ -378,16 +380,21 @@ const pagination = ref({
page: 1,
rowsPerPage: 10,
});
const paginationLabel = (start: number, end: number, total: number) => {
function paginationLabel(start: number, end: number, total: number) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
}
/**
* อมลในทะเบยนประว
* @param id คคล
*/
function onclickViewinfo(id: string) {
modalPersonal.value = true;
personId.value = id;
}
/** ทะเบียนประวัติ */
function updatemodalPersonal(modal: boolean) {
modalPersonal.value = modal;
}
@ -489,22 +496,6 @@ onMounted(() => {
</q-menu>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
<!-- <q-file
bg-color="white"
clearable
outlined
dense
v-model="fileUpload"
accept=".pdf"
:style="fileUpload === null ? 'width: 150px' : 'width: auto'"
label="อัปโหลดไฟล์"
v-if="statusUpload !== true"
>
<template v-slot:prepend>
<q-icon color="light-blue" name="attach_file" />
<q-tooltip>ปโหลดไฟล</q-tooltip>
</template>
</q-file> -->
</div>
<q-space />
<div class="row">