This commit is contained in:
yoon 2025-02-22 14:05:20 +09:00
commit f621efca29

View File

@ -123,17 +123,19 @@
}; };
// //
//
const handleProfileClick = async (user) => { const handleProfileClick = async (user) => {
try { try {
if (user.MEMBERSEQ === userStore.user.id) { if (user.MEMBERSEQ === userStore.user.id) {
const response = await axios.get(`vacation/history`); const year = new Date().getFullYear(); //
//
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 || []; receivedVacations.value = response.data.data.receivedVacations || [];
isModalOpen.value = true; isModalOpen.value = true;
// //
modalYear.value = new Date().getFullYear(); modalYear.value = year;
modalMonth.value = String(new Date().getMonth() + 1).padStart(2, "0");
isGrantModalOpen.value = false; isGrantModalOpen.value = false;
} else { } else {
console.warn("❌ 연차 내역을 불러오지 못했습니다."); console.warn("❌ 연차 내역을 불러오지 못했습니다.");
@ -188,8 +190,9 @@
// computed: modalYear // computed: modalYear
const filteredMyVacations = computed(() => { const filteredMyVacations = computed(() => {
const filtered = myVacations.value.filter(vac => { const filtered = myVacations.value.filter(vac => {
console.log(vac) // vac.date vac.LOCVACUDT
const year = vac.date ? vac.date.split("T")[0].substring(0, 4) : null; const dateStr = vac.date || vac.LOCVACUDT;
const year = dateStr ? dateStr.split("T")[0].substring(0, 4) : null;
console.log("vacation year:", year, "modalYear:", modalYear.value); console.log("vacation year:", year, "modalYear:", modalYear.value);
return year === String(modalYear.value); return year === String(modalYear.value);
}); });
@ -199,12 +202,10 @@
const filteredReceivedVacations = computed(() => { const filteredReceivedVacations = computed(() => {
return receivedVacations.value.filter(vac => { return receivedVacations.value.filter(vac => {
console.log( const dateStr = vac.date || vac.LOCVACUDT;
vac.date, const year = dateStr ? dateStr.split("T")[0].substring(0, 4) : null;
vac.date ? vac.date.split("T")[0].substring(0, 4) : null, console.log("vacation year:", year, "modalYear:", modalYear.value);
modalYear.value return dateStr && year === String(modalYear.value);
);
return vac.date && vac.date.split("T")[0].substring(0, 4) === String(modalYear.value);
}); });
}); });