From dd27f0c8352333d96a0b73e3e0eb0cd239740b81 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 11 Sep 2023 17:16:35 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1ap?= =?UTF-8?q?i=20download=20=E0=B9=80=E0=B8=AD=E0=B8=81=E0=B8=AA=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interface/response/dashboard/dashboard.ts | 9 +- src/views/Dashboard.vue | 104 ++++++++---------- 2 files changed, 51 insertions(+), 62 deletions(-) diff --git a/src/interface/response/dashboard/dashboard.ts b/src/interface/response/dashboard/dashboard.ts index 5f144bb2b..601438691 100644 --- a/src/interface/response/dashboard/dashboard.ts +++ b/src/interface/response/dashboard/dashboard.ts @@ -1,6 +1,9 @@ +interface attachments { + name: string; + url: string; +} interface ResponseInbox { body: string; - createdAt: Date; createdFullName: string; createdUserId: string; id: string; @@ -9,7 +12,7 @@ interface ResponseInbox { lastUpdateUserId: string; lastUpdatedAt: Date; openDate: Date | null; - payload: string; + payload: {attachments:attachments[]} receiveDate: Date; receiverUserId: string; subject: string; @@ -21,7 +24,7 @@ interface DataInbox { subject: string; timereceive: Date; body: string; - payload: string; + payload: {attachments:attachments[]} ratingModel: number; } diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 8a930a28d..98f426457 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -20,41 +20,15 @@ const { success, messageError, date2Thai, - dialogRemove + dialogRemove, } = mixin; const iteminbox = ref([]); const splitterModel = ref(30); const link = ref("0"); -const inboxList = ref([ - // { - // no: "1", - // sender: "เจ้าหน้าที่ทะเบียนประวัติ", - // subject: "ขอแก้ไขข้อมูลทะเบียนประวัติ", - // timereceive: new Date(), - // body: "ขอแก้ไขข้อมูลทะเบียนประวัติ เรื่อง ชื่อ-นามสกุล", - // ratingModel: 0, - // }, - // { - // no: "2", - // sender: "เจ้าหน้าที่ทะเบียนประวัติ", - // subject: "ขอแก้ไขข้อมูลทะเบียนประวัติ", - // timereceive: new Date(), - // body: "ขอแก้ไขข้อมูลทะเบียนประวัติ เรื่อง ชื่อ-นามสกุล", - // ratingModel: 0, - // }, -]); -const data = ref([ - // { - // no: "1", - // sender: "เจ้าหน้าที่ทะเบียนประวัติ", - // subject: "ขอแก้ไขข้อมูลทะเบียนประวัติ", - // timereceive: new Date(), - // body: "ขอแก้ไขข้อมูลทะเบียนประวัติ เรื่อง ชื่อ-นามสกุล", - // ratingModel: 0, - // }, -]); -const payLoadtext = ref() +const inboxList = ref([]); +const data = ref([]); +const payLoadtext = ref(); const btnReply = ref(true); const listpayload = ref([]); const listpayloadNolink = ref([]); @@ -86,10 +60,10 @@ const getData = async () => { await http .get(config.API.msgInbox) .then((res: any) => { - const response = res.data.result; - console.log(response); + const data = res.data.result; + console.log(data); let list: DataInbox[] = []; - response.map((e: ResponseInbox) => { + data.map((e: ResponseInbox) => { list.push({ no: e.id ?? "", sender: @@ -104,7 +78,10 @@ const getData = async () => { }); }); inboxList.value = list; - }) + console.log("🚀 ~ file: Dashboard.vue:82 ~ .then ~ inboxList:", inboxList.value) + } + ) + .catch((e) => { // messageError($q, e); }) @@ -117,26 +94,29 @@ const selectInbox = (id: string) => { link.value = id; data.value = inboxList.value.filter((r) => r.no == id); }; -const deleteData = (id:string) => { - dialogRemove($q, () => removeData(id)) -} +const deleteData = (id: string) => { + dialogRemove($q, () => removeData(id)); +}; //รอ api ลบ -const removeData = async (id:string) => { - console.log("delete=",id) - showLoader(); -await http -.delete(config.API.msgInboxDelete(id)) -.then((res) => { - success($q, "ลบข้อมูลสำเร็จ"); -}) -.catch((e) => { - messageError($q, e); -}) -.finally(() => { - getData() - hideLoader() -}) +const removeData = async (id: string) => { + console.log("delete=", id); + showLoader(); + await http + .delete(config.API.msgInboxDelete(id)) + .then((res) => { + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + getData(); + hideLoader(); + }); +}; +const fileOpen = (url:string) => { + window.open(url, '_blank'); } @@ -170,6 +150,7 @@ await http :key="contact.no" class="q-pt-sm" > + --> {{ d.body }} +
-
- -
- เอกสารแนบ -
-
+ + + + + {{ link.name }} + + + + +