- run by vite

- change camera
This commit is contained in:
Warunee Tamkoo 2023-11-14 17:47:43 +07:00
parent 782fa7f59f
commit 85d163fb64
57 changed files with 1494 additions and 1375 deletions

View file

@ -1,61 +1,61 @@
import { defineStore } from "pinia";
import { ref } from "vue";
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,
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),
}));
rows.value = datalist;
}
function convertStatus(status: string) {
switch (status) {
case "1":
return "ขาดราชการ";
case "2":
return "ปกติ";
case "3":
return "สาย";
default:
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";
}
}
return {
rows,
fetchHistoryList,
classColorStatus,
};
});
import { defineStore } from 'pinia'
import { ref } from 'vue'
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,
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),
}))
rows.value = datalist
}
function convertStatus(status: string) {
switch (status) {
case '1':
return 'ขาดราชการ'
case '2':
return 'ปกติ'
case '3':
return 'สาย'
default:
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'
}
}
return {
rows,
fetchHistoryList,
classColorStatus,
}
})

View file

@ -1,122 +1,122 @@
import { defineStore } from "pinia";
import CustomComponent from "@/components/CustomDialog.vue";
import { useQuasar } from "quasar";
const $q = useQuasar();
import { defineStore } from 'pinia'
import CustomComponent from '@/components/CustomDialog.vue'
export const useCounterMixin = defineStore("mixin", () => {
export const useCounterMixin = defineStore('mixin', () => {
function date2Thai(srcDate: Date, isFullMonth = false, isTime = false) {
if (srcDate == null) {
return null;
`
`;
return null
;`
`
}
const date = new Date(srcDate);
const isValidDate = Boolean(+date);
if (!isValidDate) return srcDate.toString();
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString();
const date = new Date(srcDate)
const isValidDate = Boolean(+date)
if (!isValidDate) return srcDate.toString()
if (isValidDate && date.getFullYear() < 1000) return srcDate.toString()
const fullMonthThai = [
"มกราคม",
"กุมภาพันธ์",
"มีนาคม",
"เมษายน",
"พฤษภาคม",
"มิถุนายน",
"กรกฎาคม",
"สิงหาคม",
"กันยายน",
"ตุลาคม",
"พฤศจิกายน",
"ธันวาคม",
];
'มกราคม',
'กุมภาพันธ์',
'มีนาคม',
'เมษายน',
'พฤษภาคม',
'มิถุนายน',
'กรกฎาคม',
'สิงหาคม',
'กันยายน',
'ตุลาคม',
'พฤศจิกายน',
'ธันวาคม',
]
const abbrMonthThai = [
"ม.ค.",
"ก.พ.",
"มี.ค.",
"เม.ย.",
"พ.ค.",
"มิ.ย.",
"ก.ค.",
"ส.ค.",
"ก.ย.",
"ต.ค.",
"พ.ย.",
"ธ.ค.",
];
let dstYear = 0;
'ม.ค.',
'ก.พ.',
'มี.ค.',
'เม.ย.',
'พ.ค.',
'มิ.ย.',
'ก.ค.',
'ส.ค.',
'ก.ย.',
'ต.ค.',
'พ.ย.',
'ธ.ค.',
]
let dstYear = 0
if (date.getFullYear() > 2500) {
dstYear = date.getFullYear();
dstYear = date.getFullYear()
} else {
dstYear = date.getFullYear() + 543;
dstYear = date.getFullYear() + 543
}
let dstMonth = "";
let dstMonth = ''
if (isFullMonth) {
dstMonth = fullMonthThai[date.getMonth()];
dstMonth = fullMonthThai[date.getMonth()]
} else {
dstMonth = abbrMonthThai[date.getMonth()];
dstMonth = abbrMonthThai[date.getMonth()]
}
let dstTime = "";
let dstTime = ''
if (isTime) {
const H = date.getHours().toString().padStart(2, "0");
const M = date.getMinutes().toString().padStart(2, "0");
const H = date.getHours().toString().padStart(2, '0')
const M = date.getMinutes().toString().padStart(2, '0')
// const S = date.getSeconds().toString().padStart(2, "0")
// dstTime = " " + H + ":" + M + ":" + S + " น."
dstTime = " " + H + ":" + M + " น.";
dstTime = ' ' + H + ':' + M + ' น.'
}
return (
date.getDate().toString().padStart(2, "0") +
" " +
date.getDate().toString().padStart(2, '0') +
' ' +
dstMonth +
" " +
' ' +
dstYear +
dstTime
);
)
}
function covertDateObject(date: string) {
if (date) {
const dateParts = date.split("/");
const dateParts = date.split('/')
// ประกาศตัวแปรเพื่อเก็บค่าวันที่, เดือน, และ ปี
const day = parseInt(dateParts[0], 10);
const month = parseInt(dateParts[1], 10) - 1;
const year = parseInt(dateParts[2], 10) + 2500;
const day = parseInt(dateParts[0], 10)
const month = parseInt(dateParts[1], 10) - 1
const year = parseInt(dateParts[2], 10) + 2500
// สร้างอ็อบเจ็กต์ Date ด้วยค่าที่ได้
const dateObject = new Date(year, month, day);
return date2Thai(dateObject);
const dateObject = new Date(year, month, day)
return date2Thai(dateObject)
}
}
type OkCallback = () => void;
type CancelCallback = () => void;
const dialogConfirm = (
type OkCallback = () => void
type CancelCallback = () => void
function dialogConfirm(
q: any,
ok?: OkCallback,
title?: string, // ถ้ามี cancel action ใส่เป็น null
desc?: string, // ถ้ามี cancel action ใส่เป็น null
cancel?: CancelCallback
) => {
) {
q.dialog({
component: CustomComponent,
componentProps: {
title: title && title != null ? title : "ยืนยันการบันทึก",
title: title && title != null ? title : 'ยืนยันการบันทึก',
message:
desc && desc != null
? desc
: "ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?",
icon: "info",
color: "public",
textOk: "ตกลง",
: 'ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?',
icon: 'info',
color: 'public',
textOk: 'ตกลง',
onlycancel: false,
},
})
.onOk(() => {
if (ok) ok();
if (ok) ok()
})
.onCancel(() => {
if (cancel) cancel();
});
};
if (cancel) cancel()
})
}
return {
date2Thai,
covertDateObject,
dialogConfirm,
};
});
}
})