Merge branch 'vacation'

This commit is contained in:
dyhj625 2025-03-20 10:25:25 +09:00
commit e955ac144a
7 changed files with 154 additions and 100 deletions

View File

@ -157,7 +157,7 @@
.fc-toolbar-title { .fc-toolbar-title {
cursor: pointer; cursor: pointer;
} }
/* 클릭 가능한 날짜 (오늘 + 미래) */ /* 클릭 가능한 날짜 */
.fc-daygrid-day.clickable { .fc-daygrid-day.clickable {
cursor: pointer; cursor: pointer;
transition: background-color 0.2s ease-in-out; transition: background-color 0.2s ease-in-out;
@ -362,6 +362,28 @@
background-color: #0b5ed7 !important; background-color: #0b5ed7 !important;
color: white; color: white;
} }
/* 풀 연차 버튼 스타일 */
.vac-btn-primary {
color: #fff;
background-color: #28a745; /* 녹색 */
border-color: #28a745;
box-shadow: 0 0.125rem 0.25rem 0 rgba(40, 167, 69, 0.4);
font-size: 28px;
transition: all 0.2s ease-in-out;
}
/* 풀 연차 버튼 활성화 스타일 */
.vac-btn-primary.active {
background-color: #218838 !important;
color: #fff;
border: 3px solid #91d091 !important;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.3);
transform: scale(1.1);
}
/* 풀 연차 버튼이 눌렸을 때 효과 */
.vac-btn-primary:active {
transform: scale(0.9);
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
}
/* 버튼 기본 */ /* 버튼 기본 */
.vac-btn-success { .vac-btn-success {
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;

View File

@ -1,67 +1,72 @@
<template> <template>
<div class="row gx-2 mb-4"> <div class="row gx-2 mb-4">
<div class="col-4"> <div class="col-3">
<div class="ratio ratio-1x1"> <div class="ratio ratio-1x1">
<!-- 오전 반차 버튼 --> <!-- 오전 반차 버튼 -->
<button class="vac-btn vac-btn-warning rounded-circle d-flex align-items-center justify-content-center" :class="{ active: halfDayType === 'AM' }" <button class="vac-btn vac-btn-warning rounded-circle d-flex align-items-center justify-content-center"
@click="toggleHalfDay('AM')"> :class="{ active: halfDayType === 'AM' }"
<i class="bi bi-sun"></i> @click="toggleHalfDay('AM')">
</button> <i class="bi bi-sun"></i>
</button>
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-3">
<div class="ratio ratio-1x1"> <div class="ratio ratio-1x1">
<!-- 오후 반차 버튼 --> <!-- 오후 반차 버튼 -->
<button class="vac-btn vac-btn-info rounded-circle d-flex align-items-center justify-content-center" :class="{ active: halfDayType === 'PM' }" <button class="vac-btn vac-btn-info rounded-circle d-flex align-items-center justify-content-center"
@click="toggleHalfDay('PM')"> :class="{ active: halfDayType === 'PM' }"
<i class="bi bi-moon"></i> @click="toggleHalfDay('PM')">
</button> <i class="bi bi-moon"></i>
</button>
</div> </div>
</div> </div>
<div class="col-4"> <div class="col-3">
<div class="ratio ratio-1x1"> <div class="ratio ratio-1x1">
<button class="vac-btn-success rounded-circle d-flex align-items-center justify-content-center" @click="addVacationRequests" <!-- 연차 버튼 -->
:class="{ active: !isDisabled, disabled: isDisabled }"> <button class="vac-btn vac-btn-primary rounded-circle d-flex align-items-center justify-content-center"
:class="{ active: halfDayType === 'FULL' }"
</button> @click="toggleHalfDay('FULL')">
<i class="bi bi-calendar"></i>
</button>
</div>
</div>
<div class="col-3">
<div class="ratio ratio-1x1">
<!-- 저장 버튼 -->
<button class="vac-btn-success rounded-circle d-flex align-items-center justify-content-center"
@click="addVacationRequests"
:class="{ active: !isDisabled, disabled: isDisabled }">
</button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { defineEmits, ref, defineProps, watch } from "vue"; import { defineEmits, ref, defineProps } from "vue";
const props = defineProps({ const props = defineProps({
isDisabled: Boolean, isDisabled: Boolean
selectedDate: String // props
}); });
const emit = defineEmits(["toggleHalfDay", "addVacationRequests", "resetHalfDay"]); const emit = defineEmits(["toggleHalfDay", "addVacationRequests", "resetHalfDay"]);
const halfDayType = ref(null); const halfDayType = ref(null);
const toggleHalfDay = (type) => { const toggleHalfDay = (type) => {
halfDayType.value = halfDayType.value === type ? null : type; halfDayType.value = halfDayType.value === type ? null : type;
emit("toggleHalfDay", halfDayType.value); emit("toggleHalfDay", halfDayType.value);
}; };
// `selectedDate` //
watch(() => props.selectedDate, (newDate) => {
if (newDate) {
resetHalfDay();
}
});
//
const resetHalfDay = () => { const resetHalfDay = () => {
halfDayType.value = null; halfDayType.value = null;
emit("resetHalfDay"); emit("resetHalfDay");
}; };
const addVacationRequests = () => { const addVacationRequests = () => {
emit("addVacationRequests"); emit("addVacationRequests");
}; };
defineExpose({ resetHalfDay }); defineExpose({ resetHalfDay });
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div v-if="isOpen" class="vac-modal-dialog" @click.self="closeModal"> <div v-if="isOpen" class="vac-modal-dialog" @click.self="closeModal">
<div class="vac-modal-content p-5 modal-scroll"> <div class="vac-modal-content p-5 modal-scroll">
<h5 class="vac-modal-title">📅 연차 내역</h5> <h5 class="vac-modal-title">📅 연차 (누적 개수)</h5>
<button class="close-btn" @click="closeModal"></button> <button class="close-btn" @click="closeModal"></button>
<!-- 연차 목록 --> <!-- 연차 목록 -->
<div class="vac-modal-body" v-if="mergedVacations.length > 0"> <div class="vac-modal-body" v-if="mergedVacations.length > 0">
@ -11,9 +11,6 @@
:key="vac._expandIndex" :key="vac._expandIndex"
class="vacation-item" class="vacation-item"
> >
<span v-if="vac.category === 'used'" class="fw-bold text-dark me-2">
{{ usedVacationIndexMap[vac._expandIndex] }})
</span>
<span :class="vac.category === 'used' ? 'fw-bold text-danger me-2' : 'fw-bold text-primary me-2'"> <span :class="vac.category === 'used' ? 'fw-bold text-danger me-2' : 'fw-bold text-primary me-2'">
{{ vac.category === 'used' ? '-' : '+' }} {{ vac.category === 'used' ? '-' : '+' }}
</span> </span>
@ -22,6 +19,9 @@
> >
{{ formatDate(vac.date) }} {{ formatDate(vac.date) }}
</span> </span>
<span v-if="vac.category === 'used'" class="fw-bold text-dark ms-1">
( {{ usedVacationIndexMap[vac._expandIndex] }} )
</span>
</li> </li>
</ol> </ol>
</div> </div>

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router';
import { useAuthStore } from '@s/useAuthStore'; import { useAuthStore } from '@s/useAuthStore';
import { useUserInfoStore } from '@s/useUserInfoStore'; import { useUserInfoStore } from '@s/useUserInfoStore';
@ -6,7 +6,7 @@ import { useUserInfoStore } from '@s/useUserInfoStore';
const routes = [ const routes = [
{ {
path: '/', path: '/',
name: "Home", name: 'Home',
component: () => import('@v/MainView.vue'), component: () => import('@v/MainView.vue'),
meta: { requiresAuth: true } meta: { requiresAuth: true }
}, },
@ -18,23 +18,23 @@ const routes = [
{ {
path: '', path: '',
name: 'BoardList', name: 'BoardList',
component: () => import('@v/board/BoardList.vue') component: () => import('@v/board/BoardList.vue'),
}, },
{ {
path: 'write', path: 'write',
component: () => import('@v/board/BoardWrite.vue') component: () => import('@v/board/BoardWrite.vue'),
}, },
{ {
path: ':id', path: ':id',
name: 'BoardDetail', name: 'BoardDetail',
component: () => import('@v/board/BoardView.vue') component: () => import('@v/board/BoardView.vue'),
}, },
{ {
path: 'edit/:id', path: 'edit/:id',
name: 'BoardEdit', name: 'BoardEdit',
component: () => import('@v/board/BoardEdit.vue') component: () => import('@v/board/BoardEdit.vue'),
} },
] ],
}, },
{ {
path: '/wordDict', path: '/wordDict',
@ -71,14 +71,13 @@ const routes = [
children: [ children: [
{ {
path: '', path: '',
component: () => import('@v/voteboard/voteBoardList.vue') component: () => import('@v/voteboard/voteBoardList.vue'),
}, },
{ {
path: 'write', path: 'write',
component: () => import('@v/voteboard/voteboardWrite.vue') component: () => import('@v/voteboard/voteboardWrite.vue'),
}, },
],
]
}, },
{ {
path: '/projectlist', path: '/projectlist',
@ -93,25 +92,37 @@ const routes = [
{ {
path: '/authorization', path: '/authorization',
component: () => import('@v/admin/TheAuthorization.vue'), component: () => import('@v/admin/TheAuthorization.vue'),
meta: { requiresAuth: true } meta: { requiresAuth: true },
}, },
{ path: "/error/400", name: "Error400", component: () => import('@v/error/Error400.vue'), meta: {layout: 'NoLayout'} },
{ path: "/error/500", name: "Error500", component: () => import('@v/error/Error500.vue'), meta: {layout: 'NoLayout'} },
{ {
path: "/:anything(.*)", path: '/error/400',
name: "Error404", component: () => import('@v/error/Error404.vue'), meta: {layout: 'NoLayout'} name: 'Error400',
component: () => import('@v/error/Error400.vue'),
meta: { layout: 'NoLayout' },
},
{
path: '/error/500',
name: 'Error500',
component: () => import('@v/error/Error500.vue'),
meta: { layout: 'NoLayout' },
},
{
path: '/:anything(.*)',
name: 'Error404',
component: () => import('@v/error/Error404.vue'),
meta: { layout: 'NoLayout' },
}, },
]; ];
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
routes: routes, routes: routes,
}) });
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
const authStore = useAuthStore(); const authStore = useAuthStore();
await authStore.checkAuthStatus(); // 로그인 상태 확인 await authStore.checkAuthStatus(); // 로그인 상태 확인
const allowedUserId = 1; // 특정 ID (변경필요!!) const allowedUserId = 1; // 특정 ID (변경필요!!)
const userStore = useUserInfoStore(); const userStore = useUserInfoStore();
const userId = userStore.user?.id ?? null; const userId = userStore.user?.id ?? null;
@ -120,9 +131,9 @@ router.beforeEach(async (to, from, next) => {
return next({ name: 'Login', query: { redirect: to.fullPath } }); return next({ name: 'Login', query: { redirect: to.fullPath } });
} }
// Authorization 페이지는 ID가 1이 아니면 접근 차단 // Authorization 페이지는 ID가 26이 아니면 접근 차단
if (to.path === "/authorization" && userId !== allowedUserId) { if (to.path === '/authorization' && userId !== allowedUserId) {
return next("/"); return next('/');
} }
// 비로그인 사용자만 접근 가능한 페이지인데 로그인된 경우 → 홈으로 이동 // 비로그인 사용자만 접근 가능한 페이지인데 로그인된 경우 → 홈으로 이동
@ -148,7 +159,7 @@ axios.interceptors.response.use(
} }
return Promise.reject(error); return Promise.reject(error);
} },
); );
export default router export default router;

View File

@ -12,7 +12,7 @@
<h5>{{ user.name }}</h5> <h5>{{ user.name }}</h5>
</div> </div>
<!-- 권한 토글 버튼 --> <!-- 권한 토글 버튼 -->
<label class="switch"> <label class="switch me-0">
<input type="checkbox" :checked="user.isAdmin" @change="toggleAdmin(user)" /> <input type="checkbox" :checked="user.isAdmin" @change="toggleAdmin(user)" />
<span class="slider round"></span> <span class="slider round"></span>
</label> </label>
@ -32,7 +32,7 @@ const users = ref([]);
const toastStore = useToastStore(); const toastStore = useToastStore();
const baseUrl = axios.defaults.baseURL.replace(/api\/$/, ""); const baseUrl = axios.defaults.baseURL.replace(/api\/$/, "");
const defaultProfile = "/img/icons/icon.png"; const defaultProfile = "/img/icons/icon.png";
const allowedUserId = 1; // ID (!!)
// //
async function fetchUsers() { async function fetchUsers() {
try { try {
@ -43,14 +43,17 @@ async function fetchUsers() {
throw new Error("올바른 데이터 형식이 아닙니다."); throw new Error("올바른 데이터 형식이 아닙니다.");
} }
// ( ) // MEMBERSEQ 1
users.value = response.data.data.map(user => ({ users.value = response.data.data
id: user.MEMBERSEQ, .filter(user => user.MEMBERSEQ !== allowedUserId) // MEMBERSEQ 1
name: user.MEMBERNAM, .map(user => ({
photo: user.MEMBERPRF ? `${baseUrl}upload/img/profile/${user.MEMBERPRF}` : defaultProfile, id: user.MEMBERSEQ,
color: user.MEMBERCOL, name: user.MEMBERNAM,
isAdmin: user.MEMBERROL === 'ROLE_ADMIN', photo: user.MEMBERPRF ? `${baseUrl}upload/img/profile/${user.MEMBERPRF}` : defaultProfile,
})); color: user.MEMBERCOL,
isAdmin: user.MEMBERROL === 'ROLE_ADMIN',
}));
} catch (error) { } catch (error) {
toastStore.onToast('사용자 목록을 불러오지 못했습니다.', 'e'); toastStore.onToast('사용자 목록을 불러오지 못했습니다.', 'e');
} }

View File

@ -232,12 +232,12 @@
} catch (error) {} } catch (error) {}
}; };
// //
const fetchNoticePosts = async () => { const fetchNoticePosts = async () => {
try { try {
const { data } = await axios.get('board/notices', { const { data } = await axios.get("board/notices", {
params: { searchKeyword: searchText.value }, params: { searchKeyword: searchText.value }
}); });
if (data?.data) { if (data?.data) {
noticeList.value = data.data.map(post => ({ noticeList.value = data.data.map(post => ({

View File

@ -106,6 +106,7 @@ const isGrantModalOpen = ref(false);
const fullCalendarRef = ref(null); const fullCalendarRef = ref(null);
const calendarEvents = ref([]); const calendarEvents = ref([]);
const selectedDates = ref(new Map()); const selectedDates = ref(new Map());
const halfDayType = ref(null); const halfDayType = ref(null);
const vacationCodeMap = ref({}); const vacationCodeMap = ref({});
const holidayDates = ref(new Set()); const holidayDates = ref(new Set());
@ -118,7 +119,6 @@ const lastRemainingMonth = ref(String(new Date().getMonth() + 1).padStart(2, "0"
// ref // ref
const calendarDatepicker = ref(null); const calendarDatepicker = ref(null);
let fpInstance = null; let fpInstance = null;
/* 변경사항 여부 확인 */ /* 변경사항 여부 확인 */
const hasChanges = computed(() => { const hasChanges = computed(() => {
return ( return (
@ -173,40 +173,53 @@ function handleDateClick(info) {
return; return;
} }
const isMyVacation = myVacations.value.some(vac => { //
const vacDate = vac.date ? vac.date.substring(0, 10) : ""; const currentValue = selectedDates.value.get(clickedDateStr);
return vacDate === clickedDateStr && !vac.receiverId;
});
if (isMyVacation) { const isMyVacation = myVacations.value.some(vac => vac.date.substring(0, 10) === clickedDateStr && !vac.receiverId);
if (selectedDates.value.get(clickedDateStr) === "delete") {
selectedDates.value.delete(clickedDateStr); //
if (currentValue && currentValue !== "delete") {
console.log("🛑 활성화된 날짜 비활성화:", clickedDateStr);
selectedDates.value.delete(clickedDateStr);
updateCalendarEvents();
return;
}
// -
if (!halfDayType.value) {
if (isMyVacation) {
if (currentValue === "delete") {
selectedDates.value.delete(clickedDateStr);
} else {
selectedDates.value.set(clickedDateStr, "delete");
}
} else { } else {
selectedDates.value.set(clickedDateStr, "delete"); selectedDates.value.set(clickedDateStr, "700103");
} }
updateCalendarEvents(); updateCalendarEvents();
return; return;
} }
if (selectedDates.value.has(clickedDateStr)) { // -
selectedDates.value.delete(clickedDateStr); if (isMyVacation) {
updateCalendarEvents(); console.log("🗑 기존 휴가 삭제 후 새로운 상태 추가:", clickedDateStr);
return; selectedDates.value.set(clickedDateStr, "delete");
} }
const type = halfDayType.value
? (halfDayType.value === "AM" ? "700101" : "700102") const type = halfDayType.value === "AM" ? "700101" :
: "700103"; halfDayType.value === "PM" ? "700102" :
"700103"; //
selectedDates.value.set(clickedDateStr, type); selectedDates.value.set(clickedDateStr, type);
if (halfDayType.value) { // ()
halfDayType.value = null; halfDayType.value = null;
}
updateCalendarEvents();
if (halfDayButtonsRef.value) { if (halfDayButtonsRef.value) {
halfDayButtonsRef.value.resetHalfDay(); halfDayButtonsRef.value.resetHalfDay();
} }
updateCalendarEvents();
} }
function markClickableDates() { function markClickableDates() {