58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { defineStore } from "pinia";
|
|
import { ref } from "vue";
|
|
|
|
/** import Type */
|
|
import type { QTableProps } from "quasar";
|
|
|
|
export const useWorklistDataStore = defineStore("work", () => {
|
|
/** ข้อมูล Table */
|
|
const columns = ref<QTableProps["columns"]>([]);
|
|
const visibleColumns = ref<string[]>([]);
|
|
|
|
/** ค้นหาวัน ข้อมูล Table */
|
|
const selectDate = ref<Date | null>(new Date());
|
|
|
|
// function filterFn(val: string, update: Function) {
|
|
// if (val == "") {
|
|
// update(() => {
|
|
// optionStatus.value = optionStatusMain.value;
|
|
// });
|
|
// } else {
|
|
// update(() => {
|
|
// optionStatus.value = optionStatusMain.value.filter(
|
|
// (e: any) => e.name.search(val) !== -1
|
|
// );
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
// convertSatatus
|
|
/**
|
|
* function แปลงค่าสถานะ
|
|
* @param val ค่าสถานนะ
|
|
*/
|
|
function convertSatatus(val: string) {
|
|
switch (val) {
|
|
case "NORMAL ":
|
|
return "ปกติ";
|
|
case "LATE":
|
|
return "สาย";
|
|
case "ABSENT":
|
|
return "ขาดราชการ";
|
|
}
|
|
}
|
|
return {
|
|
//ข้อมูลในตาราง
|
|
|
|
columns,
|
|
visibleColumns,
|
|
// fetchListLog,
|
|
// fetchListTime,
|
|
//ค้นหาข้อมูล
|
|
|
|
selectDate,
|
|
|
|
// filterFn,
|
|
convertSatatus,
|
|
};
|
|
});
|