เพิ่มลงเวลากรณีพิเศษ (USER) #32
This commit is contained in:
parent
2dea65c4df
commit
0ec7e83d0d
8 changed files with 196 additions and 80 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import http from '@/plugins/http'
|
||||
import config from '@/app.config'
|
||||
|
||||
import type { FormData, Datalist } from '@/interface/response/checkin'
|
||||
|
||||
// importStores
|
||||
import { useCounterMixin } from '@/stores/mixin'
|
||||
|
|
@ -10,14 +10,14 @@ const mixin = useCounterMixin()
|
|||
const { date2Thai } = mixin
|
||||
|
||||
export const useChekIn = defineStore('checkin', () => {
|
||||
const rows = ref<any>()
|
||||
const rows = ref<Datalist[]>()
|
||||
|
||||
async function fetchHistoryList(data: FormData) {
|
||||
// console.log(data)
|
||||
async function fetchHistoryList(data: FormData[]) {
|
||||
rows.value = []
|
||||
const datalist = await data.map((e: any) => ({
|
||||
const datalist: Datalist[] = await data.map((e: FormData) => ({
|
||||
checkInId: e.checkInId,
|
||||
checkInDate: date2Thai(e.checkInDate),
|
||||
checkInDate: e.checkInDate ? date2Thai(e.checkInDate) : null,
|
||||
checkInDateTime: e.checkInDate,
|
||||
checkInTime: e.checkInTime,
|
||||
checkOutTime: e.checkOutTime != '' ? e.checkOutTime : '-',
|
||||
checkInStatus: convertStatus(e.checkInStatus),
|
||||
|
|
@ -42,31 +42,31 @@ export const useChekIn = defineStore('checkin', () => {
|
|||
return ''
|
||||
}
|
||||
}
|
||||
function convertStatusEdit(val: string) {
|
||||
switch (val) {
|
||||
case 'edit':
|
||||
return 'ขอแก้ไข'
|
||||
case 'wait':
|
||||
return 'รออนุมัติ'
|
||||
case 'approve':
|
||||
return 'อนุมัติ'
|
||||
}
|
||||
}
|
||||
function classColorStatus(val: string) {
|
||||
switch (val) {
|
||||
case 'wait':
|
||||
return 'orange'
|
||||
case 'approve':
|
||||
return 'green'
|
||||
case 'reject':
|
||||
return 'red'
|
||||
}
|
||||
}
|
||||
// function convertStatusEdit(val: string) {
|
||||
// switch (val) {
|
||||
// case 'edit':
|
||||
// return 'ขอแก้ไข'
|
||||
// case 'wait':
|
||||
// return 'รออนุมัติ'
|
||||
// case 'approve':
|
||||
// return 'อนุมัติ'
|
||||
// }
|
||||
// }
|
||||
// function classColorStatus(val: string) {
|
||||
// switch (val) {
|
||||
// case 'wait':
|
||||
// return 'orange'
|
||||
// case 'approve':
|
||||
// return 'green'
|
||||
// case 'reject':
|
||||
// return 'red'
|
||||
// }
|
||||
// }
|
||||
|
||||
return {
|
||||
rows,
|
||||
fetchHistoryList,
|
||||
classColorStatus,
|
||||
// classColorStatus,
|
||||
// fetchlistHistory,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -208,6 +208,36 @@ export const useCounterMixin = defineStore('mixin', () => {
|
|||
}
|
||||
}
|
||||
|
||||
const success = (q: any, val: string) => {
|
||||
// useQuasar ไม่สามารถใช้นอกไฟล์ .vue
|
||||
if (val !== '') {
|
||||
return q.notify({
|
||||
message: val,
|
||||
color: 'primary',
|
||||
icon: 'mdi-information',
|
||||
position: 'bottom-right',
|
||||
multiLine: true,
|
||||
timeout: 1000,
|
||||
badgeColor: 'positive',
|
||||
classes: 'my-notif-class',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function notify(q: any, val: string) {
|
||||
if (val !== '') {
|
||||
q.notify({
|
||||
color: 'teal-10',
|
||||
message: val,
|
||||
icon: 'mdi-information',
|
||||
position: 'bottom-right',
|
||||
multiLine: true,
|
||||
timeout: 7000,
|
||||
actions: [{ label: 'ปิด', color: 'white', handler: () => {} }],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
date2Thai,
|
||||
showLoader,
|
||||
|
|
@ -215,5 +245,7 @@ export const useCounterMixin = defineStore('mixin', () => {
|
|||
covertDateObject,
|
||||
dialogConfirm,
|
||||
messageError,
|
||||
success,
|
||||
notify,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue