휴가 기능오류수정

This commit is contained in:
dyhj625 2025-03-11 13:57:36 +09:00
parent 6e161fc2b3
commit 10c429f9f1
2 changed files with 12 additions and 21 deletions

View File

@ -1,7 +1,7 @@
<template>
<div v-if="isOpen" class="vac-modal-dialog" @click.self="closeModal">
<div class="vac-modal-content p-5 modal-scroll">
<h5 class="vac-modal-title">📅 연차 상세 내역</h5>
<h5 class="vac-modal-title">📅 연차 내역</h5>
<button class="close-btn" @click="closeModal"></button>
<!-- 연차 목록 -->
<div class="vac-modal-body" v-if="mergedVacations.length > 0">
@ -59,16 +59,15 @@ const emit = defineEmits(["close"]);
let globalCounter = 0;
const usedVacations = computed(() => {
return props.myVacations.flatMap((v) => {
const count = v.used_quota || 1;
const count = v.used_quota || 1; //
return Array.from({ length: count }, (_, i) => ({
...v,
category: "used",
code: v.LOCVACTYP,
used_quota: 1, // 1
_expandIndex: globalCounter++,
}));
});
});
//
const receivedVacations = computed(() =>
props.receivedVacations.map((v) => ({

View File

@ -383,19 +383,14 @@ async function fetchVacationHistory(year) {
try {
const response = await axios.get(`vacation/history?year=${year}`);
if (response.status === 200 && response.data) {
const newVacations = response.data.data.usedVacations || [];
const uniqueVacations = Array.from(
new Map([...myVacations.value, ...newVacations].map(v => [`${v.date}-${v.type}`, v]))
.values()
);
myVacations.value = uniqueVacations;
myVacations.value = response.data.data.usedVacations || [];
receivedVacations.value = response.data.data.receivedVacations || [];
}
} catch (error) {
console.error(`🚨 ${year}휴가 데이터 불러오기 실패:`, error);
console.error(`🚨 휴가 데이터 불러오기 실패:`, error);
}
}
//
async function fetchVacationData(year, month) {
try {
@ -404,7 +399,7 @@ async function fetchVacationData(year, month) {
const vacationList = response.data;
//
const filteredVacations = vacationList.filter(vac =>
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ]
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ] && !vac.LOCVACRMM
);
const events = filteredVacations.map(vac => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
@ -439,14 +434,12 @@ function updateCalendarEvents() {
display: "background",
classNames: [getVacationTypeClass(type), "selected-event"]
}));
// receiverId
const filteredFetchedEvents = fetchedEvents.value.filter(event => {
if (event.saved && selectedDates.value.get(event.start) === "delete") {
if (event.memberSeq === userStore.user.id) {
return false;
}
}
return true;
return !(event.receiverId && event.memberSeq === userStore.user.id);
});
calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents];
}
//
@ -484,7 +477,6 @@ function toggleHalfDay(type) {
/* 페이지 이동 시 변경 사항 확인 */
router.beforeEach((to, from, next) => {
if (hasChanges.value) {
console.log('휴가!!!!!');
const answer = window.confirm("저장하지 않은 변경 사항이 있습니다. 이동하시겠습니까?");
if (!answer) {
return next(false);