휴가 기능오류수정
This commit is contained in:
parent
6e161fc2b3
commit
10c429f9f1
@ -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) => ({
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user