캐치문 수정
All checks were successful
LocalNet_front/pipeline/head This commit looks good

This commit is contained in:
dyhj625 2025-03-18 12:26:52 +09:00
parent 00acd58995
commit f2ad06756b
2 changed files with 131 additions and 113 deletions

View File

@ -182,66 +182,72 @@ const handleSizeChange = () => {
//
const fetchGeneralPosts = async (page = 1) => {
const { data } = await axios.get("board/general", {
params: {
page,
size: selectedSize.value,
orderBy: selectedOrder.value,
searchKeyword: searchText.value
try {
const { data } = await axios.get("board/general", {
params: {
page,
size: selectedSize.value,
orderBy: selectedOrder.value,
searchKeyword: searchText.value
}
});
if (data?.data) {
const totalPosts = data.data.total;
generalList.value = data.data.list.map((post, index) => ({
realId: post.id,
id: totalPosts - ((page - 1) * selectedSize.value) - index,
title: post.title,
author: post.author || '익명',
rawDate: post.date,
date: formatDate(post.date), //
views: post.cnt || 0,
hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null,
commentCount : post.commentCount
}));
pagination.value = {
...pagination.value,
currentPage: data.data.pageNum,
pages: data.data.pages,
prePage: data.data.prePage,
nextPage: data.data.nextPage,
isFirstPage: data.data.isFirstPage,
isLastPage: data.data.isLastPage,
hasPreviousPage: data.data.hasPreviousPage,
hasNextPage: data.data.hasNextPage,
navigatePages: data.data.navigatePages,
navigatepageNums: data.data.navigatepageNums,
navigateFirstPage: data.data.navigateFirstPage,
navigateLastPage: data.data.navigateLastPage
};
}
});
if (data?.data) {
const totalPosts = data.data.total;
generalList.value = data.data.list.map((post, index) => ({
realId: post.id,
id: totalPosts - ((page - 1) * selectedSize.value) - index,
title: post.title,
author: post.author || '익명',
rawDate: post.date,
date: formatDate(post.date), //
views: post.cnt || 0,
hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null,
commentCount : post.commentCount
}));
pagination.value = {
...pagination.value,
currentPage: data.data.pageNum,
pages: data.data.pages,
prePage: data.data.prePage,
nextPage: data.data.nextPage,
isFirstPage: data.data.isFirstPage,
isLastPage: data.data.isLastPage,
hasPreviousPage: data.data.hasPreviousPage,
hasNextPage: data.data.hasNextPage,
navigatePages: data.data.navigatePages,
navigatepageNums: data.data.navigatepageNums,
navigateFirstPage: data.data.navigateFirstPage,
navigateLastPage: data.data.navigateLastPage
};
} catch (error) {
}
};
//
const fetchNoticePosts = async () => {
const { data } = await axios.get("board/notices", {
params: { searchKeyword: searchText.value }
});
try {
const { data } = await axios.get("board/notices", {
params: { searchKeyword: searchText.value }
});
if (data?.data) {
noticeList.value = data.data.map(post => ({
id: post.id,
title: post.title,
author: post.author || '관리자',
date: formatDate(post.date),
rawDate: post.date,
views: post.cnt || 0,
hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null,
commentCount : post.commentCount
}));
if (data?.data) {
noticeList.value = data.data.map(post => ({
id: post.id,
title: post.title,
author: post.author || '관리자',
date: formatDate(post.date),
rawDate: post.date,
views: post.cnt || 0,
hasAttachment: post.hasAttachment,
img: post.firstImageUrl || null,
commentCount : post.commentCount
}));
}
} catch (error) {
}
};

View File

@ -264,21 +264,24 @@ async function loadCalendarData(year, month) {
/* 프로필 구역 */
//
const handleProfileClick = async (user) => {
if (isModalOpen.value && user.MEMBERSEQ === userStore.user.id) {
return;
}
if (isGrantModalOpen.value && selectedUser.value?.MEMBERSEQ === user.MEMBERSEQ) {
return;
}
isModalOpen.value = false;
isGrantModalOpen.value = false;
if (user.MEMBERSEQ === userStore.user.id) {
const displayedYear = lastRemainingYear.value;
await fetchVacationHistory(displayedYear);
isModalOpen.value = true;
} else {
selectedUser.value = user;
isGrantModalOpen.value = true;
try {
if (isModalOpen.value && user.MEMBERSEQ === userStore.user.id) {
return;
}
if (isGrantModalOpen.value && selectedUser.value?.MEMBERSEQ === user.MEMBERSEQ) {
return;
}
isModalOpen.value = false;
isGrantModalOpen.value = false;
if (user.MEMBERSEQ === userStore.user.id) {
const displayedYear = lastRemainingYear.value;
await fetchVacationHistory(displayedYear);
isModalOpen.value = true;
} else {
selectedUser.value = user;
isGrantModalOpen.value = true;
}
} catch (error) {
}
};
//
@ -300,17 +303,19 @@ const fetchUserList = async () => {
});
} catch (error) {
console.error("📌 사용자 목록 불러오기 오류:", error);
}
};
//
const fetchRemainingVacation = async () => {
const response = await axios.get("vacation/remaining");
if (response.status === 200) {
remainingVacationData.value = response.data.data.reduce((acc, vacation) => {
acc[vacation.employeeId] = vacation.remainingQuota;
return acc;
}, {});
try {
const response = await axios.get("vacation/remaining");
if (response.status === 200) {
remainingVacationData.value = response.data.data.reduce((acc, vacation) => {
acc[vacation.employeeId] = vacation.remainingQuota;
return acc;
}, {});
}
} catch (error) {
}
};
//
@ -403,42 +408,46 @@ async function saveVacationChanges() {
/* 휴가 조회 */
//
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 || []
try {
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 || []
}
} catch (error) {
}
}
//
async function fetchVacationData(year, month) {
const response = await axios.get(`vacation/list/${year}/${month}`);
if (response.status === 200) {
const vacationList = response.data;
//
const filteredVacations = vacationList.filter(vac =>
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ] && !vac.LOCVACRMM
);
const events = filteredVacations.map(vac => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
let backgroundColor = userColors.value[vac.MEMBERSEQ];
return {
title: getVacationType(vac.LOCVACTYP),
start: dateStr,
backgroundColor,
classNames: [getVacationTypeClass(vac.LOCVACTYP)],
saved: true,
memberSeq: vac.MEMBERSEQ,
};
}).filter(event => event.start);
return events;
} else {
console.warn("📌 휴가 데이터를 불러오지 못함");
try {
const response = await axios.get(`vacation/list/${year}/${month}`);
if (response.status === 200) {
const vacationList = response.data;
//
const filteredVacations = vacationList.filter(vac =>
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ] && !vac.LOCVACRMM
);
const events = filteredVacations.map(vac => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
let backgroundColor = userColors.value[vac.MEMBERSEQ];
return {
title: getVacationType(vac.LOCVACTYP),
start: dateStr,
backgroundColor,
classNames: [getVacationTypeClass(vac.LOCVACTYP)],
saved: true,
memberSeq: vac.MEMBERSEQ,
};
}).filter(event => event.start);
return events;
} else {
console.warn("📌 휴가 데이터를 불러오지 못함");
return [];
}
} catch (error) {
return [];
}
return [];
}
//
function updateCalendarEvents() {
const selectedEvents = Array.from(selectedDates.value)
@ -499,14 +508,17 @@ const getVacationTypeClass = (type) => {
};
//
const fetchVacationCodes = async () => {
const response = await axios.get("vacation/codes");
if (response.status === 200 && response.data) {
vacationCodeMap.value = response.data.data.reduce((acc, item) => {
acc[item.code] = item.name;
return acc;
}, {});
} else {
console.warn("❌ 공통 코드 데이터를 불러오지 못했습니다.");
try {
const response = await axios.get("vacation/codes");
if (response.status === 200 && response.data) {
vacationCodeMap.value = response.data.data.reduce((acc, item) => {
acc[item.code] = item.name;
return acc;
}, {});
} else {
console.warn("❌ 공통 코드 데이터를 불러오지 못했습니다.");
}
} catch (error) {
}
};
const getVacationType = (typeCode) => {
@ -548,7 +560,7 @@ watch(() => lastRemainingYear.value, async (newYear, oldYear) => {
await fetchVacationHistory(newYear);
}
});
//
//
watch(
() => Array.from(selectedDates.value.keys()), //
(newKeys) => {