From a23114b269469aa6565cffaf40d827f8a5aa37d9 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Mon, 20 Nov 2023 18:01:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=AD=20api=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableHistory.vue | 54 ++++++++++++++++----------------- src/stores/chekin.ts | 45 +++++++++++++++------------ src/views/HistoryView.vue | 2 +- 3 files changed, 53 insertions(+), 48 deletions(-) diff --git a/src/components/TableHistory.vue b/src/components/TableHistory.vue index 219b381..4d430a0 100644 --- a/src/components/TableHistory.vue +++ b/src/components/TableHistory.vue @@ -136,34 +136,34 @@ const columns = ref([ headerStyle: 'font-size: 14px', style: 'font-size: 14px; width:15%;', }, - // { - // name: "loIn", - // align: "left", - // label: "พิกัด", - // sortable: true, - // field: "loIn", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, + { + name: 'loIn', + align: 'left', + label: 'พิกัด', + sortable: true, + field: 'loIn', + headerStyle: 'font-size: 14px', + style: 'font-size: 14px', + }, - // { - // name: "loOut", - // align: "left", - // label: "พิกัด", - // sortable: true, - // field: "loOut", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px", - // }, - // { - // name: "status", - // align: "left", - // label: "สถานะ", - // sortable: true, - // field: "status", - // headerStyle: "font-size: 14px", - // style: "font-size: 14px; width:10%;", - // }, + { + name: 'loOut', + align: 'left', + label: 'พิกัด', + sortable: true, + field: 'loOut', + headerStyle: 'font-size: 14px', + style: 'font-size: 14px', + }, + { + name: 'status', + align: 'left', + label: 'สถานะ', + sortable: true, + field: 'status', + headerStyle: 'font-size: 14px', + style: 'font-size: 14px; width:10%;', + }, ]) // popup const modalPopup = ref(false) diff --git a/src/stores/chekin.ts b/src/stores/chekin.ts index 9cc2d40..c78d671 100644 --- a/src/stores/chekin.ts +++ b/src/stores/chekin.ts @@ -3,6 +3,12 @@ import { ref } from 'vue' import http from '@/plugins/http' import config from '@/app.config' +// importStores +import { useCounterMixin } from '@/stores/mixin' + +const mixin = useCounterMixin() +const { date2Thai } = mixin + export const useChekIn = defineStore('checkin', () => { const rows = ref() @@ -10,35 +16,34 @@ export const useChekIn = defineStore('checkin', () => { // console.log(data) rows.value = [] const datalist = await data.map((e: any) => ({ - id: e.id, - date: e.date, - // no: e.no, - // in: e.in, - // loIn: e.loIn, - // out: e.out, - // loOut: e.loOut, - // status: e.status, - // Morningstatus: convertStatus(e.Morningstatus), - // AfternoonStatus: convertStatus(e.AfternoonStatus), - // statusEdit: e.statusEdit, + id: e.checkInId, + date: date2Thai(e.checkInDate), + no: e.no, + in: e.checkInTime, + out: e.checkOutTime, + Morningstatus: convertStatus(e.checkInStatus), + AfternoonStatus: convertStatus(e.checkOutStatus), + loIn: e.checkInLocation, + loOut: e.checkOutLocation, + status: e.statusEdit, // statusEditName: convertStatusEdit(e.statusEdit), - checkInTime: e.checkInTime, - checkInLocation: e.checkInLocation, - checkOutTime: e.checkOutTime, - checkOutLocation: e.checkOutLocation, - checkInStatus: convertStatus(e.checkInStatus), - checkOutStatus: convertStatus(e.checkOutStatus), + // checkInTime: e.checkInTime, + // checkInLocation: e.checkInLocation, + // checkOutTime: e.checkOutTime, + // checkOutLocation: e.checkOutLocation, + // checkInStatus: convertStatus(e.checkInStatus), + // checkOutStatus: convertStatus(e.checkOutStatus), })) rows.value = datalist } function convertStatus(status: string) { switch (status) { - case '1': + case '': return 'ขาดราชการ' - case '2': + case 'NORMAL': return 'ปกติ' - case '3': + case 'LATE': return 'สาย' default: return '' diff --git a/src/views/HistoryView.vue b/src/views/HistoryView.vue index 05ef41e..b08c12a 100644 --- a/src/views/HistoryView.vue +++ b/src/views/HistoryView.vue @@ -27,7 +27,7 @@ onMounted(() => { const fetchlistHistory = async () => { showLoader() await http - .get(config.API.history()) + .get(config.API.history() + '?year=2023&page=1&pageSize=5&keyword=') .then((res) => { const data = res.data.result fetchHistoryList(data)