휴가 수정
This commit is contained in:
parent
936be84a6f
commit
c9271aebfc
@ -57,17 +57,25 @@ const emit = defineEmits(["close"]);
|
|||||||
|
|
||||||
// 사용한 휴가(선물,연차사용)
|
// 사용한 휴가(선물,연차사용)
|
||||||
let globalCounter = 0;
|
let globalCounter = 0;
|
||||||
|
|
||||||
const usedVacations = computed(() => {
|
const usedVacations = computed(() => {
|
||||||
return props.myVacations.flatMap((v) => {
|
const data = props.myVacations.flatMap((v) => {
|
||||||
const count = v.used_quota || 1; // 사용한 휴가 개수
|
console.log("📌 usedVacations 처리 전 데이터:", v);
|
||||||
return Array.from({ length: count }, (_, i) => ({
|
|
||||||
|
const count = v.used_quota
|
||||||
|
return Array.from({ length: Math.ceil(count) }, (_, i) => ({
|
||||||
...v,
|
...v,
|
||||||
category: "used",
|
category: "used",
|
||||||
used_quota: 1, // 개별적인 휴가로 나누기 위해 1로 설정
|
code: v.LOCVACTYP,
|
||||||
|
used_quota: count, // 반차 강제 포함
|
||||||
_expandIndex: globalCounter++,
|
_expandIndex: globalCounter++,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("✅ usedVacations 생성됨:", data);
|
||||||
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 받은 휴가
|
// 받은 휴가
|
||||||
const receivedVacations = computed(() =>
|
const receivedVacations = computed(() =>
|
||||||
props.receivedVacations.map((v) => ({
|
props.receivedVacations.map((v) => ({
|
||||||
|
|||||||
@ -384,13 +384,12 @@ async function fetchVacationHistory(year) {
|
|||||||
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) {
|
||||||
myVacations.value = response.data.data.usedVacations || [];
|
myVacations.value = response.data.data.usedVacations || [];
|
||||||
receivedVacations.value = response.data.data.receivedVacations || [];
|
console.log(myVacations.value)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`🚨 휴가 데이터 불러오기 실패:`, error);
|
console.error(`🚨 휴가 데이터 불러오기 실패:`, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 모든 사원 연차 내역 및 그래프화
|
// 모든 사원 연차 내역 및 그래프화
|
||||||
async function fetchVacationData(year, month) {
|
async function fetchVacationData(year, month) {
|
||||||
try {
|
try {
|
||||||
@ -434,12 +433,14 @@ 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 => {
|
||||||
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];
|
calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents];
|
||||||
}
|
}
|
||||||
// 휴가 종류에 따른 클래스명
|
// 휴가 종류에 따른 클래스명
|
||||||
@ -477,6 +478,7 @@ 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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user