휴가 기능오류수정

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

View File

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