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