api ระบบ รอบการปฏิบัติงาน
This commit is contained in:
parent
aeaa8c8df2
commit
48e8037099
7 changed files with 383 additions and 235 deletions
|
|
@ -1,85 +1,96 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import type { dataRowRound,roundShow } from "@/modules/09_leave/interface/response/round.ts";
|
||||
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<string[]>([
|
||||
"round",
|
||||
"amRound",
|
||||
"pmRound",
|
||||
"note",
|
||||
"status"
|
||||
]);
|
||||
export const useRoundDataStore = defineStore("roundWorkStore", () => {
|
||||
/** ค้นหา คอลัมน์ คอลัมน์ที่แสดง */
|
||||
const visibleColumns = ref<string[]>([
|
||||
"round",
|
||||
"morningRound",
|
||||
"afternoonRound",
|
||||
"isActive",
|
||||
]);
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
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 columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "round",
|
||||
align: "left",
|
||||
label: "รอบ",
|
||||
sortable: true,
|
||||
field: "round",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "morningRound",
|
||||
align: "left",
|
||||
label: "ช่วงเช้า",
|
||||
sortable: true,
|
||||
field: "morningRound",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "afternoonRound",
|
||||
align: "left",
|
||||
label: "ช่วงบ่าย",
|
||||
sortable: true,
|
||||
field: "afternoonRound",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "isActive",
|
||||
align: "center",
|
||||
label: "สถานะการใช้งาน",
|
||||
sortable: true,
|
||||
field: "isActive",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
|
||||
// ข้อมูลในตาราง
|
||||
const rows = ref<dataRowRound[]>([]);
|
||||
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,
|
||||
};
|
||||
/** ข้อมูลในตาราง */
|
||||
const rows = ref<dataRowRound[]>([]);
|
||||
/**
|
||||
* Function รับข้อมูลจาก API map
|
||||
* @param data รับข้อมูลจาก API
|
||||
*/
|
||||
function fetchData(data: dataRowRound[]) {
|
||||
let datalist: roundShow[] = data.map((e: dataRowRound) => {
|
||||
return {
|
||||
id: e.id,
|
||||
round: `${e.startTimeMorning}-${e.endTimeAfternoon}`,
|
||||
morningRound: `${e.startTimeMorning}-${e.endTimeMorning}`,
|
||||
afternoonRound: `${e.startTimeAfternoon}-${e.endTimeAfternoon}`,
|
||||
createdAt: e.createdAt,
|
||||
createdFullName: e.createdFullName,
|
||||
createdUserId: e.createdUserId,
|
||||
description: e.description,
|
||||
endTimeAfternoon: e.endTimeAfternoon,
|
||||
endTimeMorning: e.endTimeMorning,
|
||||
startTimeMorning: e.startTimeMorning,
|
||||
startTimeAfternoon: e.startTimeAfternoon,
|
||||
lastUpdateFullName: e.lastUpdateFullName,
|
||||
lastUpdateUserId: e.lastUpdateUserId,
|
||||
lastUpdatedAt: e.lastUpdatedAt,
|
||||
isActive: e.isActive,
|
||||
isDefault: e.isDefault,
|
||||
};
|
||||
});
|
||||
rows.value = datalist;
|
||||
}
|
||||
|
||||
return {
|
||||
visibleColumns,
|
||||
columns,
|
||||
rows,
|
||||
fetchData
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
visibleColumns,
|
||||
columns,
|
||||
rows,
|
||||
fetchData,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue