From 1216fa33e20173641ff0eb09a82609d0d665def5 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 27 Feb 2024 14:52:53 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=95=E0=B8=A3=E0=B8=A7=E0=B8=88=E0=B8=AA=E0=B8=AD?= =?UTF-8?q?=E0=B8=9A=E0=B9=80=E0=B8=87=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99?= =?UTF-8?q?=E0=B9=84=E0=B8=82=E0=B8=95=E0=B9=88=E0=B8=B2=E0=B8=87=20?= =?UTF-8?q?=E0=B9=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resign/ResignByid.vue | 252 ++++++++++++++++-- .../06_retirement/interface/response/Main.ts | 15 +- 2 files changed, 250 insertions(+), 17 deletions(-) diff --git a/src/modules/06_retirement/components/resign/ResignByid.vue b/src/modules/06_retirement/components/resign/ResignByid.vue index 2ffe37424..2c0d764f9 100644 --- a/src/modules/06_retirement/components/resign/ResignByid.vue +++ b/src/modules/06_retirement/components/resign/ResignByid.vue @@ -13,11 +13,13 @@ import keycloak from "@/plugins/keycloak"; import type { TypeFile, rowFile, + FileList, + CheckBoxType, } from "@/modules/06_retirement/interface/response/Main"; import type { QTableProps } from "quasar"; import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue"; - -const avatar = ref('') + +const avatar = ref(""); const modalPersonal = ref(false); const personId = ref(""); /** Use */ @@ -34,6 +36,7 @@ const { success, dialogMessage, dialogConfirm, + dialogRemove, } = mixin; const { statusText } = RetirementData; @@ -43,6 +46,7 @@ const id = ref(route.params.id.toString()); const myForm = ref(null); const myFormConfirm = ref(null); const edit = ref(false); +const conditions = ref(false); const dataDetail = ref({ datetext: "", activeDate: new Date(), @@ -117,6 +121,14 @@ const columns = ref([ const closeModal = () => (modal.value = false); const openModal = () => (modal.value = true); +const file = ref(null); +const fileList = ref([]); +const checkboxGroup = ref([]); +const checkboxOp = ref([ + { label: "ไม่เป็นหนี้สหกรณ์", value: "debt" }, + { label: "test1", value: "test1" }, + { label: "test2", value: "test2" }, +]); /** Hook */ onMounted(async () => { fetchData(id.value); @@ -180,7 +192,7 @@ const fetchData = async (id: string) => { location.value = data.location ?? ""; status.value = data.status ?? ""; remarkHorizontal.value = data.remarkHorizontal ?? "-"; - getAvatar(data.profileId) + getAvatar(data.profileId); }) .catch((e) => { messageError($q, e); @@ -190,19 +202,17 @@ const fetchData = async (id: string) => { }); }; -function getAvatar(id:string){ - if(id){ +function getAvatar(id: string) { + if (id) { http - .get(config.API.profileAvaId(id)) - .then((res)=>{ - console.log(res) - const dataList = res.data.result - avatar.value = dataList.avatar - }).catch((e)=>{ - - }).finally(()=>{ - - }) + .get(config.API.profileAvaId(id)) + .then((res) => { + console.log(res); + const dataList = res.data.result; + avatar.value = dataList.avatar; + }) + .catch((e) => {}) + .finally(() => {}); } } @@ -298,6 +308,38 @@ const clickCancel = async () => { await fetchData(id.value); edit.value = false; }; +/** + * กดยกเลิก + */ +const clickCancelConditions = async () => { + await fetchData(id.value); + conditions.value = false; +}; + + +const saveConditions = () => { + if (myForm.value !== null) { + myForm.value.validate().then((success) => { + if (success) { + dialogMessage( + $q, + "ต้องการแก้ไขข้อมูลหรือไม่?", + "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย", + "mdi-help-circle-outline", + "ตกลง", + "public", + async () => await dataSave(), + undefined + ); + } + }); + } +}; + +//Save จาก Api +const dataSave = async () => { + +}; /** * Functionบันทึก @@ -320,6 +362,8 @@ const conditionSave = () => { }); } }; + + //Save จาก Api const saveData = async () => { const formData = new FormData(); @@ -418,6 +462,54 @@ function onclickViewinfo(id: string) { function updatemodalPersonal(modal: boolean) { modalPersonal.value = modal; } + +function uploadFiles() { + const Data = new FormData(); + Data.append("file", file.value); + showLoader(); + http + .put(config.API.investigateRelevantUploadFile(id.value), Data) + .then((res) => { + success($q, "อัปโหลดไฟล์สำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + hideLoader(); + file.value = null; + }); +} + +function downloadFiles(link: string) { + window.open(link, "_blank"); +} + +/** + * ลบไฟล์ + * @param id id file + */ +function removeFile(id: string) { + dialogRemove($q, () => confirmRemove(id)); +} + +/** + * ยืนยัน ลบ ไฟล์ + * @param id id file + */ +function confirmRemove(fileId: string) { + showLoader(); + http + .delete(config.API.investigateRelevantFileDelete(id.value, fileId)) + .then((res) => { + success($q, `ลบไฟล์สำเร็จ`); + fetchData(id.value); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => {}); +}