From 2c28645488112b1c03d1fea534b590fa776b1ecf Mon Sep 17 00:00:00 2001 From: dyhj625 Date: Tue, 18 Feb 2025 14:30:14 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A8=B8=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/modal/VacationModal.vue | 198 ++++++++++++---------- src/views/board/BoardList.vue | 2 + src/views/board/BoardView.vue | 54 +++++- src/views/vacation/VacationManagement.vue | 1 + 4 files changed, 161 insertions(+), 94 deletions(-) diff --git a/src/components/modal/VacationModal.vue b/src/components/modal/VacationModal.vue index d60da1a..e1b705b 100644 --- a/src/components/modal/VacationModal.vue +++ b/src/components/modal/VacationModal.vue @@ -13,13 +13,21 @@ class="vacation-item" > - {{ totalUsedVacationCount - usedVacations.findIndex(v => v.date === vacation.date) }} ) + {{ totalUsedVacationCount - usedVacations.findIndex(v => v.date === vacation.date) }}) {{ vacation.type === 'used' ? '-' : '+' }} - {{ formatDate(vacation.date) }} + + {{ formatDate(vacation.date) }} + + ({{ vacation.halfDay ? '반차' : '풀 연차' }}) + (보낸 연차) + + @@ -57,113 +65,123 @@ const totalUsedVacationCount = computed(() => props.myVacations.length); // ✅ 사용한 연차 + 받은 연차 통합 후 내림차순 정렬 - const usedVacations = computed(() => props.myVacations.map(v => ({ ...v, type: "used" }))); - const receivedVacations = computed(() => props.receivedVacations - .filter(v => !v.senderId) // ✅ 보낸 사람이 있는 경우 리스트에서 제외 - .map(v => ({ ...v, type: "received" })) + const usedVacations = computed(() => + props.myVacations.map(v => ({ ...v, type: "used" })) ); - const mergedVacations = computed(() => { - return [...usedVacations.value, ...receivedVacations.value].sort( - (a, b) => new Date(b.date) - new Date(a.date) + const receivedVacations = computed(() => + props.receivedVacations.map(v => ({ ...v, type: "received" })) ); + + // ✅ 정확한 정렬 및 리스트 병합 + const mergedVacations = computed(() => { + return [...usedVacations.value, ...receivedVacations.value].sort( + (a, b) => new Date(b.date) - new Date(a.date) + ); }); // ✅ 날짜 형식 변환 (YYYY-MM-DD) const formatDate = (dateString) => { - const date = new Date(dateString); - return date.toISOString().split("T")[0]; // YYYY-MM-DD 형식 + const date = new Date(dateString); + return date.toISOString().split("T")[0]; // YYYY-MM-DD 형식 }; const closeModal = () => { - emit("close"); + emit("close"); }; + + /* 연차 데이터 없음 */ + .no-data { + text-align: center; + font-size: 14px; + color: gray; + margin-top: 10px; + } + diff --git a/src/views/board/BoardList.vue b/src/views/board/BoardList.vue index a5e4135..34740d2 100644 --- a/src/views/board/BoardList.vue +++ b/src/views/board/BoardList.vue @@ -190,6 +190,8 @@ const fetchGeneralPosts = async (page = 1) => { console.log(data) const totalPosts = data.data.total; // 전체 게시물 개수 받아오기 + console.log('📌 API 응답 데이터:', data.data); + generalList.value = data.data.list.map((post, index) => ({ realId: post.id, id: totalPosts - ((page - 1) * selectedSize.value) - index, diff --git a/src/views/board/BoardView.vue b/src/views/board/BoardView.vue index b6c68f4..2eb5e83 100644 --- a/src/views/board/BoardView.vue +++ b/src/views/board/BoardView.vue @@ -94,7 +94,11 @@ @updateReaction="handleUpdateReaction" @submitComment="handleCommentReply" /> - + @@ -103,7 +107,7 @@