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

View File

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