Merge branch 'develop'
This commit is contained in:
commit
e999d08610
5 changed files with 284 additions and 72 deletions
|
|
@ -1,23 +1,33 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import http from '@/plugins/http'
|
||||
import config from '@/app.config'
|
||||
|
||||
export const useChekIn = defineStore('checkin', () => {
|
||||
const rows = ref<any>()
|
||||
|
||||
function fetchHistoryList(data: any) {
|
||||
console.log(data)
|
||||
const datalist = data.map((e: any) => ({
|
||||
no: e.no,
|
||||
async function fetchHistoryList(data: any) {
|
||||
// console.log(data)
|
||||
rows.value = []
|
||||
const datalist = await data.map((e: any) => ({
|
||||
id: e.id,
|
||||
date: e.date,
|
||||
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,
|
||||
statusEditName: convertStatusEdit(e.statusEdit),
|
||||
// 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,
|
||||
// statusEditName: convertStatusEdit(e.statusEdit),
|
||||
checkInTime: e.checkInTime,
|
||||
checkInLocation: e.checkInLocation,
|
||||
checkOutTime: e.checkOutTime,
|
||||
checkOutLocation: e.checkOutLocation,
|
||||
checkInStatus: convertStatus(e.checkInStatus),
|
||||
checkOutStatus: convertStatus(e.checkOutStatus),
|
||||
}))
|
||||
rows.value = datalist
|
||||
}
|
||||
|
|
@ -57,5 +67,6 @@ export const useChekIn = defineStore('checkin', () => {
|
|||
rows,
|
||||
fetchHistoryList,
|
||||
classColorStatus,
|
||||
// fetchlistHistory,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -127,6 +127,98 @@ export const useCounterMixin = defineStore('mixin', () => {
|
|||
if (cancel) cancel()
|
||||
})
|
||||
}
|
||||
const showLoader = () => {
|
||||
Loading.show({
|
||||
spinner: QSpinnerCube,
|
||||
spinnerSize: 140,
|
||||
spinnerColor: 'primary',
|
||||
backgroundColor: 'white',
|
||||
})
|
||||
}
|
||||
|
||||
const hideLoader = () => {
|
||||
Loading.hide()
|
||||
}
|
||||
|
||||
const messageError = (q: any, e: any = '') => {
|
||||
// q.dialog.hide();
|
||||
if (e.response !== undefined) {
|
||||
if (e.response.data.status !== undefined) {
|
||||
if (e.response.data.status == 401) {
|
||||
//invalid_token
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: `พบข้อผิดพลาด`,
|
||||
message: `ล็อกอินหมดอายุ กรุณาล็อกอินใหม่อีกครั้ง`,
|
||||
icon: 'warning',
|
||||
color: 'red',
|
||||
onlycancel: true,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
const message = e.response.data.result ?? e.response.data.message
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: `พบข้อผิดพลาด`,
|
||||
message: `${message}`,
|
||||
icon: 'warning',
|
||||
color: 'red',
|
||||
onlycancel: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (e.response.status == 401) {
|
||||
//invalid_token
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: `พบข้อผิดพลาด`,
|
||||
message: `ล็อกอินหมดอายุ กรุณาล็อกอินใหม่อีกครั้ง`,
|
||||
icon: 'warning',
|
||||
color: 'red',
|
||||
onlycancel: true,
|
||||
},
|
||||
})
|
||||
} else if (e.response.data.successful === false) {
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: `พบข้อผิดพลาด`,
|
||||
message: e.response.data.message,
|
||||
icon: 'warning',
|
||||
color: 'red',
|
||||
onlycancel: true,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: `พบข้อผิดพลาด`,
|
||||
message: `ข้อมูลผิดพลาดทำให้เกิดการไม่ตอบสนองต่อการเรียกใช้งานดูเว็บไซต์`,
|
||||
icon: 'warning',
|
||||
color: 'red',
|
||||
onlycancel: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
q.dialog({
|
||||
component: CustomComponent,
|
||||
componentProps: {
|
||||
title: `พบข้อผิดพลาด`,
|
||||
message: `ข้อมูลผิดพลาดทำให้เกิดการไม่ตอบสนองต่อการเรียกใช้งานดูเว็บไซต์`,
|
||||
icon: 'warning',
|
||||
color: 'red',
|
||||
onlycancel: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function messageError(q: any, e: any = '') {
|
||||
// q.dialog.hide();
|
||||
|
|
@ -214,6 +306,9 @@ export const useCounterMixin = defineStore('mixin', () => {
|
|||
hideLoader,
|
||||
covertDateObject,
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
messageError,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue