fix จำนวนสิทธิ์และวันลาที่ใช้ไป

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-04-29 14:39:18 +07:00
parent 00a68cc9e0
commit 51e50ad321
3 changed files with 20 additions and 13 deletions

View file

@ -23,6 +23,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
/** useStore*/
const $q = useQuasar();
const { leaveTypeData } = storeToRefs(useLeaveHistoryDataStore());
const { findYear } = useLeaveHistoryDataStore();
const { dialogConfirm, showLoader, success, messageError, hideLoader } =
useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
@ -77,7 +78,7 @@ const profileId = ref<string>("");
const rowId = ref<string>("");
const formData = reactive({
leaveTypeId: "", //
leaveYear: new Date().getFullYear(), //
leaveYear: findYear(new Date()), //
leaveDays: "", //
leaveDaysUsed: "", //
});
@ -148,12 +149,13 @@ async function fetchDataPerson() {
async function defineDataLeaveBeginning(data: DataLeaveBeginning) {
profileId.value = data.profileId;
rowId.value = data.id;
filterCodeLeaveTypeData(data.leaveTypeId);
formData.leaveTypeId = data.leaveTypeId;
formData.leaveYear = data.leaveYear;
formData.leaveDays = data.leaveDays ? data.leaveDays.toString() : "";
formData.leaveDays = data.leaveDays ? data.leaveDays.toString() : "0";
formData.leaveDaysUsed = data.leaveDaysUsed
? data.leaveDaysUsed.toString()
: "";
: "0";
}
/**
@ -388,12 +390,6 @@ watch(modal, async (val) => {
<!-- input -->
<div class="q-pa-md col">
<!-- <q-card bordered style="border: 1px solid #d6dee1">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md" >
อมลวนลายอนหล
</div>
<div class="col-12"><q-separator /></div> -->
<div class="row q-col-gutter-sm">
<div class="col-12">
<datepicker
@ -417,6 +413,7 @@ watch(modal, async (val) => {
outlined
:model-value="Number(formData.leaveYear) + 543"
bg-color="white"
label="ปีงบประมาณ"
>
<template v-slot:prepend>
<q-icon
@ -430,7 +427,6 @@ watch(modal, async (val) => {
</template>
</datepicker>
</div>
<div class="col-12">
<q-select
:class="classInput(true)"
@ -462,7 +458,6 @@ watch(modal, async (val) => {
</template>
</q-select>
</div>
<div class="col-12">
<q-input
:class="classInput(leaveTypeCode == 'LV-005')"
@ -487,7 +482,6 @@ watch(modal, async (val) => {
/>
</div>
</div>
<!-- </q-card> -->
</div>
</div>
</q-card-section>

View file

@ -10,7 +10,19 @@ export const useLeaveHistoryDataStore = defineStore("leaveHistory", () => {
name: "ทั้งหมด",
},
]);
/**
*
* @param date
* @returns
*/
function findYear(date: Date) {
const month = date.getMonth() + 1;
return month >= 10 ? date.getFullYear() + 1 : date.getFullYear();
}
return {
leaveTypeData,
findYear,
};
});

View file

@ -20,11 +20,12 @@ import DialogForm from "@/modules/09_leave/components/07_LeaveHistory/DialogForm
const $q = useQuasar();
const { leaveTypeData } = storeToRefs(useLeaveHistoryDataStore());
const { findYear } = useLeaveHistoryDataStore();
const { showLoader, hideLoader, messageError, dialogRemove, success } =
useCounterMixin();
const formFilter = reactive({
year: new Date().getFullYear(),
year: findYear(new Date()),
type: "00000000-0000-0000-0000-000000000000",
page: 1,
pageSize: 10,