refactor code (ยังไม่หมด)

This commit is contained in:
setthawutttty 2024-01-15 17:52:25 +07:00
parent ab4189e6ed
commit 32d4de7075
21 changed files with 309 additions and 109 deletions

View file

@ -184,8 +184,11 @@ async function addPerson(data: any) {
toggleModal();
}
/**
* เกบค list คคลไวใน row
* @param returnData ดขอม คคล
*/
function handleSave(returnData: any) {
console.log(returnData);
modalPerson.value = false;
dataStore.rowsAdd = returnData.map((item: any) => ({
profileId: item.personId,
@ -196,6 +199,10 @@ function handleSave(returnData: any) {
}));
}
/**
* งค css ออกไปตามเงอนไข
* @param val true/false
*/
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer inputgreen ": val,
@ -203,6 +210,7 @@ function inputEdit(val: boolean) {
};
}
/** อัปโหลดเอกสาร */
function uploadFile() {
/** uploadFile */
const Data = new FormData();
@ -214,7 +222,6 @@ function uploadFile() {
console.log(res);
success($q, "อัปโหลดไฟล์สำเร็จ");
props.getData();
// router.push(`/discipline/complaints`);
})
.catch((e) => {
messageError($q, e);
@ -225,10 +232,18 @@ function uploadFile() {
});
}
/**
* เปดไฟลเอกสาร
* @param link link ของไฟล
*/
function downloadFile(link: string) {
window.open(link, "_blank");
}
/**
* ลบไฟลจาก id
* @param id id ของไฟล
*/
function deleteFile(id: string) {
dialogRemove($q, () => confirmDelete(id));
}
@ -284,14 +299,17 @@ watch(props.data, async () => {
}
});
/** ปิด popup */
function close() {
modalHistory.value = false;
}
/** เปิด pop up history */
function historyStatus() {
modalHistory.value = true;
}
/** save ข้อมูล */
function onSubmit() {
dialogConfirm(
$q,
@ -318,6 +336,7 @@ function onSubmit() {
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
onMounted(() => {
dataStore.columns = columns.value;
dataStore.visibleColumns = visibleColumns.value;