Merge branch 'main' of http://192.168.0.251:3000/localnet/localhost-front
This commit is contained in:
commit
f621efca29
@ -123,30 +123,32 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 프로필 클릭 시 연차 내역 가져오기
|
// 프로필 클릭 시 연차 내역 가져오기
|
||||||
const handleProfileClick = async (user) => {
|
// 프로필 클릭 시 연차 내역 가져오기
|
||||||
try {
|
const handleProfileClick = async (user) => {
|
||||||
if (user.MEMBERSEQ === userStore.user.id) {
|
try {
|
||||||
const response = await axios.get(`vacation/history`);
|
if (user.MEMBERSEQ === userStore.user.id) {
|
||||||
if (response.status === 200 && response.data) {
|
const year = new Date().getFullYear(); // 현재 연도
|
||||||
myVacations.value = response.data.data.usedVacations || [];
|
// 연도 파라미터를 전달하여 전체 연도의 연차 내역을 조회
|
||||||
receivedVacations.value = response.data.data.receivedVacations || [];
|
const response = await axios.get(`vacation/history?year=${year}`);
|
||||||
isModalOpen.value = true;
|
if (response.status === 200 && response.data) {
|
||||||
// 모달을 열 때 기준 연도와 기준 월 갱신
|
myVacations.value = response.data.data.usedVacations || [];
|
||||||
modalYear.value = new Date().getFullYear();
|
receivedVacations.value = response.data.data.receivedVacations || [];
|
||||||
modalMonth.value = String(new Date().getMonth() + 1).padStart(2, "0");
|
isModalOpen.value = true;
|
||||||
isGrantModalOpen.value = false;
|
// 모달을 열 때 기준 연도 갱신
|
||||||
} else {
|
modalYear.value = year;
|
||||||
console.warn("❌ 연차 내역을 불러오지 못했습니다.");
|
isGrantModalOpen.value = false;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
selectedUser.value = user;
|
console.warn("❌ 연차 내역을 불러오지 못했습니다.");
|
||||||
isGrantModalOpen.value = true;
|
|
||||||
isModalOpen.value = false;
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} else {
|
||||||
console.error("🚨 연차 데이터 불러오기 실패:", error);
|
selectedUser.value = user;
|
||||||
|
isGrantModalOpen.value = true;
|
||||||
|
isModalOpen.value = false;
|
||||||
}
|
}
|
||||||
};
|
} catch (error) {
|
||||||
|
console.error("🚨 연차 데이터 불러오기 실패:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const fetchUserList = async () => {
|
const fetchUserList = async () => {
|
||||||
try {
|
try {
|
||||||
@ -186,10 +188,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 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);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user