From 32d18eec3d28a3177b7b22f405cc69dc524481c2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 9 Aug 2023 12:04:57 +0700 Subject: [PATCH] =?UTF-8?q?API=20=E0=B8=97=E0=B8=B3=E0=B9=80=E0=B8=A3?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=87=E0=B8=A5=E0=B8=B2=E0=B8=AD=E0=B8=AD?= =?UTF-8?q?=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/leave/api.leave.ts | 3 + src/modules/03_leave/views/AddLeave.vue | 341 ++++++++++++++++-------- src/modules/03_leave/views/Main.vue | 54 ++-- 3 files changed, 265 insertions(+), 133 deletions(-) diff --git a/src/api/leave/api.leave.ts b/src/api/leave/api.leave.ts index ad050cf..5bd9331 100644 --- a/src/api/leave/api.leave.ts +++ b/src/api/leave/api.leave.ts @@ -5,6 +5,9 @@ const retirementResign = `${env.API_URI}/retirement` export default { listUser: () => `${retirementResign}/resign/user`, + listResign: () => `${retirementResign}/resign`, + resingByid: (id: string) => `${retirementResign}/resign/${id}`, + } diff --git a/src/modules/03_leave/views/AddLeave.vue b/src/modules/03_leave/views/AddLeave.vue index d3a421e..8dcc1d5 100644 --- a/src/modules/03_leave/views/AddLeave.vue +++ b/src/modules/03_leave/views/AddLeave.vue @@ -1,115 +1,240 @@ diff --git a/src/modules/03_leave/views/Main.vue b/src/modules/03_leave/views/Main.vue index d4272f3..7e193fe 100644 --- a/src/modules/03_leave/views/Main.vue +++ b/src/modules/03_leave/views/Main.vue @@ -3,6 +3,7 @@ import type { QTableProps } from "quasar"; import { ref, onMounted } from "vue"; import { useQuasar } from "quasar"; import { useRouter } from "vue-router"; +import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -10,6 +11,9 @@ import Table from "@/components/Table.vue"; const router = useRouter(); const $q = useQuasar(); +const mixin = useCounterMixin(); +const { date2Thai, dateToISO, success, messageError, showLoader, hideLoader } = + mixin; const filter = ref(""); const visibleColumns = ref([ @@ -66,26 +70,7 @@ const columns = ref([ style: "font-size: 14px; width:10%;", }, ]); -const rows = ref([ - { - placeLeave: "สํานักงานกรุงเทพมหานคร ", - dateStartLeave: "02/02/2566", - dateLeave: "10/03/2565", - status: "รอดำเนินการ", - }, - { - placeLeave: "สํานักงานกรุงเทพมหานคร ", - dateStartLeave: "02/02/2566", - dateLeave: "10/03/2565", - status: "เสร็จสิ้น", - }, - { - placeLeave: "สํานักงานกรุงเทพมหานคร ", - dateStartLeave: "02/02/2566", - dateLeave: "10/03/2565", - status: "เสร็จสิ้น", - }, -]); +const rows = ref([]); const initialPagination = ref({ rowsPerPage: 0, }); @@ -95,9 +80,28 @@ onMounted(() => { }); const fectListleave = async () => { - // console.log(config.API.listUser()); - - await http.get(config.API.listUser()).then((res:any)=>{}).catch((e:any)=>{}); + showLoader(); + await http + .get(config.API.listUser()) + .then((res: any) => { + // console.log(res); + let data = res.data.result; + console.log(data); + rows.value = data.map((e: any) => ({ + id: e.id, + placeLeave: e.location, + dateStartLeave: date2Thai(e.sendDate), + dateLeave: date2Thai(e.activeDate), + status: e.status, + })); + }) + .catch((e: any) => { + console.log(e); + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }; const clickAdd = async () => { @@ -139,7 +143,7 @@ const clickAdd = async () => {
@@ -148,7 +152,7 @@ const clickAdd = async () => {