feat(leave): add display leaveWaitingSummary

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-04-24 10:08:36 +07:00
parent ab1ea1f614
commit 0f0ffd57e5
3 changed files with 20 additions and 9 deletions

View file

@ -131,11 +131,11 @@ function onValidate() {
formData.append("leaveRangeEnd", formDataSick.leaveRangeEnd);
formData.append(
"leaveStartDate",
convertDateToAPI(formDataSick.leaveStartDate) ?? ""
convertDateToAPI(formDataSick.leaveStartDate) ?? "",
);
formData.append(
"leaveEndDate",
convertDateToAPI(formDataSick.leaveEndDate) ?? ""
convertDateToAPI(formDataSick.leaveEndDate) ?? "",
);
formData.append("leaveWrote", formDataSick.leaveWrote);
formData.append("leaveAddress", dataStore.currentAddress);
@ -202,7 +202,6 @@ function mapPropsToFormData() {
statusCheck.value = props.data.status;
leaveId.value = props.data.id;
formDataSick.leaveDocument = [];
console.log(props.data.leaveDocument);
}
}
@ -211,7 +210,7 @@ watch(
() => {
mapPropsToFormData();
},
{ deep: true }
{ deep: true },
);
/** Hook */

View file

@ -293,7 +293,7 @@ function getSearch() {
/>
<q-input
v-if="props.model === 'LV-005'"
class="col-12 col-sm-4"
class="col-md-3 col-sm-6"
dense
outlined
readonly
@ -302,7 +302,7 @@ function getSearch() {
label="จำนวนสิทธิ์การลาที่ได้รับ"
/>
<q-input
class="col-12 col-sm-4"
class="col-md-3 col-sm-6"
dense
outlined
readonly
@ -312,7 +312,7 @@ function getSearch() {
/>
<q-input
v-if="props.model === 'LV-005'"
class="col-12 col-sm-4"
class="col-md-3 col-sm-6"
dense
outlined
readonly
@ -320,6 +320,15 @@ function getSearch() {
v-model="dataStore.leaveRemain"
label="จำนวนสิทธิ์การลาคงเหลือ"
/>
<q-input
class="col-md-3 col-sm-6"
dense
outlined
readonly
bg-color="white"
v-model="dataStore.leaveWaitingSummary"
label="จำนวนวันที่อยู่ระหว่างการพิจารณา"
/>
</div>
</q-card>

View file

@ -33,7 +33,7 @@ export const useLeaveStore = defineStore("Leave", () => {
/**
* function Table
* @param data Table
* @param data TableleaveWaitingSummary
*/
async function fetchListLeave(data: ListLeave[]) {
let datalist: ListLeaveTable[] = data.map((e: ListLeave) => ({
@ -66,7 +66,6 @@ export const useLeaveStore = defineStore("Leave", () => {
isDelete: e.isDelete,
}));
rows.value = datalist;
console.log(datalist);
}
//ฟังก์ชั่นแปลง Status
@ -309,6 +308,7 @@ export const useLeaveStore = defineStore("Leave", () => {
const telephoneNumber = ref<string>("");
const currentAddress = ref<string>("");
const leaveWaitingSummary = ref<number>(0);
//ดึงข้อมูล profile จาก API
async function fetchProfile() {
@ -347,6 +347,7 @@ export const useLeaveStore = defineStore("Leave", () => {
: "-";
restDayCurrentTotal.value =
Number(data.leaveLimit) - Number(data.restDayTotalOld);
leaveWaitingSummary.value = data.leaveWaitingSummary || 0;
})
.catch((e: any) => {
console.log(e);
@ -409,6 +410,7 @@ export const useLeaveStore = defineStore("Leave", () => {
salaryText.value = "";
leaveLast.value = undefined;
restDayCurrentTotal.value = 0;
leaveWaitingSummary.value = 0;
}
/** ฟังก์ชันเรียกข้อมูลประเภทการลา */
@ -480,6 +482,7 @@ export const useLeaveStore = defineStore("Leave", () => {
currentAddress,
rangeOptions,
converstType,
leaveWaitingSummary,
fetchLeaveTypeData,
isLoadingProfile,