From c9271aebfc9d30992779eb07999db5242f715036 Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 11 Mar 2025 14:35:45 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9C=B4=EA=B0=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/VacationModal.vue | 16 ++++++++++++---- src/views/vacation/VacationManagement.vue | 14 ++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/modal/VacationModal.vue b/src/components/modal/VacationModal.vue index c4f56c3..9b249aa 100644 --- a/src/components/modal/VacationModal.vue +++ b/src/components/modal/VacationModal.vue @@ -57,17 +57,25 @@ const emit = defineEmits(["close"]); // 사용한 휴가(선물,연차사용) let globalCounter = 0; + const usedVacations = computed(() => { - return props.myVacations.flatMap((v) => { - const count = v.used_quota || 1; // 사용한 휴가 개수 - return Array.from({ length: count }, (_, i) => ({ + const data = props.myVacations.flatMap((v) => { + console.log("📌 usedVacations 처리 전 데이터:", v); + + const count = v.used_quota + return Array.from({ length: Math.ceil(count) }, (_, i) => ({ ...v, category: "used", - used_quota: 1, // 개별적인 휴가로 나누기 위해 1로 설정 + code: v.LOCVACTYP, + used_quota: count, // 반차 강제 포함 _expandIndex: globalCounter++, })); }); + + console.log("✅ usedVacations 생성됨:", data); + return data; }); + // 받은 휴가 const receivedVacations = computed(() => props.receivedVacations.map((v) => ({ diff --git a/src/views/vacation/VacationManagement.vue b/src/views/vacation/VacationManagement.vue index 8f02969..1a203f4 100644 --- a/src/views/vacation/VacationManagement.vue +++ b/src/views/vacation/VacationManagement.vue @@ -384,13 +384,12 @@ async function fetchVacationHistory(year) { const response = await axios.get(`vacation/history?year=${year}`); if (response.status === 200 && response.data) { myVacations.value = response.data.data.usedVacations || []; - receivedVacations.value = response.data.data.receivedVacations || []; + console.log(myVacations.value) } } catch (error) { console.error(`🚨 휴가 데이터 불러오기 실패:`, error); } } - // 모든 사원 연차 내역 및 그래프화 async function fetchVacationData(year, month) { try { @@ -434,12 +433,14 @@ function updateCalendarEvents() { display: "background", classNames: [getVacationTypeClass(type), "selected-event"] })); - - // 기존 이벤트 중 receiverId가 있는 것은 제외 const filteredFetchedEvents = fetchedEvents.value.filter(event => { - return !(event.receiverId && event.memberSeq === userStore.user.id); + if (event.saved && selectedDates.value.get(event.start) === "delete") { + if (event.memberSeq === userStore.user.id) { + return false; + } + } + return true; }); - calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents]; } // 휴가 종류에 따른 클래스명 @@ -477,6 +478,7 @@ function toggleHalfDay(type) { /* 페이지 이동 시 변경 사항 확인 */ router.beforeEach((to, from, next) => { if (hasChanges.value) { + console.log('휴가!!!!!'); const answer = window.confirm("저장하지 않은 변경 사항이 있습니다. 이동하시겠습니까?"); if (!answer) { return next(false);