휴가 수정

This commit is contained in:
dyhj625 2025-03-11 14:35:45 +09:00
parent 936be84a6f
commit c9271aebfc
2 changed files with 20 additions and 10 deletions

View File

@ -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) => ({

View File

@ -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);