fix Load การลา
This commit is contained in:
parent
3817416ba9
commit
ce94ea009a
5 changed files with 184 additions and 80 deletions
|
|
@ -17,7 +17,7 @@ import type {
|
|||
import type { DataOption } from "../14_IDP/interface/Main";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
|
||||
const { date2Thai, showLoader, hideLoader } = mixin;
|
||||
const type = ref<string>("00000000-0000-0000-0000-000000000000");
|
||||
const status = ref<string>("ALL");
|
||||
export const useLeaveStore = defineStore("Leave", () => {
|
||||
|
|
@ -27,6 +27,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
|||
const LeaveStatus = ref<string | null>("0");
|
||||
const fiscalYearyear = ref<Number | null>(new Date().getFullYear());
|
||||
const rows = ref<ListLeaveTable[]>([]);
|
||||
const leaveTypeData = ref<TypeLeave[]>([]);
|
||||
|
||||
/**
|
||||
* function เรียกข้อมูลรายการลา Table
|
||||
|
|
@ -134,10 +135,9 @@ export const useLeaveStore = defineStore("Leave", () => {
|
|||
* @param update อัพเดทค่า
|
||||
* @param refData ดาต้าที่ต้องการฟิลเตอร์
|
||||
*/
|
||||
function filterOption(val: any, update: Function, refData: string) {
|
||||
function filterOption(val: string, update: Function, refData: string) {
|
||||
switch (refData) {
|
||||
case "LeaveTypeOption":
|
||||
type.value = "";
|
||||
update(() => {
|
||||
typeOptions.value = typeOptionsMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
|
|
@ -145,7 +145,6 @@ export const useLeaveStore = defineStore("Leave", () => {
|
|||
});
|
||||
break;
|
||||
case "LeaveStatusOption":
|
||||
status.value = "";
|
||||
update(() => {
|
||||
statusOptions.value = statusOptionsMain.value.filter(
|
||||
(v: any) => v.name.indexOf(val) > -1
|
||||
|
|
@ -403,6 +402,21 @@ export const useLeaveStore = defineStore("Leave", () => {
|
|||
restDayCurrentTotal.value = 0;
|
||||
}
|
||||
|
||||
/** ฟังก์ชันเรียกข้อมูลประเภทการลา */
|
||||
async function fetchLeaveTypeData() {
|
||||
if (leaveTypeData.value.length > 0) {
|
||||
return leaveTypeData.value;
|
||||
} else {
|
||||
try {
|
||||
const res = await http.get(config.API.leaveType());
|
||||
leaveTypeData.value = res.data.result;
|
||||
return leaveTypeData.value;
|
||||
} catch (error) {
|
||||
console.error("Fetch leave type error:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
tabValue,
|
||||
typeOptions,
|
||||
|
|
@ -457,5 +471,7 @@ export const useLeaveStore = defineStore("Leave", () => {
|
|||
currentAddress,
|
||||
rangeOptions,
|
||||
converstType,
|
||||
|
||||
fetchLeaveTypeData,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue