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 {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user