hrms-mgt/src/modules/09_leave/stores/RoundStores.ts

112 lines
2.6 KiB
TypeScript
Raw Normal View History

import { defineStore } from "pinia";
import { ref } from "vue";
import type { RoundRows } from "@/modules/09_leave/interface/response/round.ts";
import type { QTableProps } from "quasar";
// store ลา >> รอบการปฏิบัติงาน
export const useRoundDataStore = defineStore(
"disciplineDirector",
() => {
//ค้นหา คอลัมน์ คอลัมน์ที่แสดง
const visibleColumns = ref<string[]>([
"no",
"round",
"am",
"amOut",
"pm",
"pmOut",
"note",
"status"
]);
// หัวตาราง
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "round",
align: "left",
label: "รอบ",
sortable: true,
field: "round",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "am",
align: "left",
label: "ช่วงเช้า",
sortable: true,
field: "am",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "amOut",
align: "left",
label: "ออก",
sortable: true,
field: "amOut",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "pm",
align: "left",
label: "ช่วงบ่าย",
sortable: true,
field: "pm",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "pmOut",
align: "left",
label: "ออก",
sortable: true,
field: "pmOut",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "note",
align: "left",
label: "คำอธิบาย",
sortable: true,
field: "note",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะการใช้งาน",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
// ข้อมูลในตาราง
const rows = ref<RoundRows[]>([]);
function fetchData(data: RoundRows[]) {
rows.value = data
}
return {
visibleColumns,
columns,
rows,
fetchData
};
}
);