api รอบการขึ้นเงินเดือน

This commit is contained in:
setthawutttty 2024-02-23 10:53:16 +07:00
parent d9a1462cfc
commit 2a88403f6a
5 changed files with 746 additions and 5 deletions

View file

@ -1,6 +1,49 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type { QTableProps } from "quasar";
import type { RowList, Row } from '@/modules/13_salary/interface/response/Main'
import { useCounterMixin } from "@/stores/mixin";
// store
export const useSalaryDataStore = defineStore("salaryDataStore", () => {
return {};
const rows = ref<RowList[]>([]);
const visibleColumns = ref<string[]>([]);
const columns = ref<QTableProps["columns"]>([]);
const mixin = useCounterMixin()
const{ date2Thai }= mixin
function fetchDataMap(data: RowList[]) {
rows.value = data.map((i: RowList) => ({
id: i.id,
period: i.period !== null ? statusTothai(i.period) : null,
isActive: i.isActive !== null ? i.isActive : null,
effectiveDate: i.effectiveDate !== null ? date2Thai(i.effectiveDate as Date) : null,
status: i.status !== null ? i.status : null,
}));
}
/**
* status Text
* @param val status
* @returns text
*/
function statusTothai(val: string) {
switch (val) {
case "SPECIAL":
return "รอบพิเศษ";
case "APR":
return "รอบเมษายน";
case "OCT":
return "รอบตุลาคม";
default:
return "-";
}
};
return {
rows,
visibleColumns,
columns,
fetchDataMap
};
});