แก้ไขตาม task
This commit is contained in:
parent
bf8fb777cf
commit
90a47d43ad
26 changed files with 2652 additions and 228 deletions
64
src/modules/09_leave/stores/WorkStore.ts
Normal file
64
src/modules/09_leave/stores/WorkStore.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai } = mixin;
|
||||
export const useWorklistDataStore = defineStore("work", () => {
|
||||
// ข้อมูลในตาราง
|
||||
const rows = ref<any>([])
|
||||
const dataMain = ref<any>([])
|
||||
function fecthList(data: any) {
|
||||
let datalist = data.map((e: any) => ({
|
||||
fullName: e.fullName,
|
||||
timeIn: e.timeIn,
|
||||
coordinatesIn: e.coordinatesIn,
|
||||
latIn: e.latIn,
|
||||
longIn: e.longIn,
|
||||
timeOut: e.timeOut,
|
||||
coordinatesOut: e.coordinatesOut,
|
||||
latOut: e.latOut,
|
||||
longOut: e.longOut,
|
||||
status: convertSatatus(e.status)
|
||||
}))
|
||||
dataMain.value = datalist
|
||||
searchDataFn(selectDate.value, selectStatus.value)
|
||||
}
|
||||
|
||||
//ค้นหาข้อมูล
|
||||
const filterTable = ref<string>('')
|
||||
const selectDate = ref<Date | null>(null);
|
||||
const selectStatus = ref<String>('all')
|
||||
const optionStatus = ref<any[]>([{ id: "all", name: 'ทั้งหมด' }, { id: "1", name: 'ลงเวลาเรียบร้อย' }, { id: "2", name: 'สายทำงานครบ' }])
|
||||
function searchDataFn(searchDate: any, srarchStatus: any) {
|
||||
srarchStatus = srarchStatus || "all";
|
||||
if (searchDate == null && srarchStatus == "all") {
|
||||
rows.value = dataMain.value
|
||||
} else if (searchDate == null && srarchStatus !== "all") {
|
||||
rows.value = dataMain.value.filter((e: any) => e.status === convertSatatus(srarchStatus))
|
||||
}
|
||||
}
|
||||
// convertSatatus
|
||||
function convertSatatus(val: string) {
|
||||
switch (val) {
|
||||
case "1":
|
||||
return "ลงเวลาเรียบร้อย"
|
||||
case "2":
|
||||
return "สายทำงานครบ"
|
||||
default:
|
||||
return "ยังไม่ได้ลงเวลา"
|
||||
}
|
||||
}
|
||||
return {
|
||||
//ข้อมูลในตาราง
|
||||
rows,
|
||||
fecthList,
|
||||
//ค้นหาข้อมูล
|
||||
filterTable,
|
||||
selectDate,
|
||||
selectStatus,
|
||||
optionStatus,
|
||||
searchDataFn,
|
||||
convertSatatus
|
||||
|
||||
};
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue