Merge branch 'main' into commuters

This commit is contained in:
yoon 2025-03-12 23:02:09 +09:00
commit 10aaae307e
17 changed files with 417 additions and 350 deletions

View File

@ -108,7 +108,6 @@ cursor: not-allowed !important;
.vac-modal-content {
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0px -4px 5px rgba(0, 0, 0, 0.1),
0px 4px 0px rgba(0, 0, 0, 0);
max-width: 500px;
@ -207,44 +206,21 @@ cursor: not-allowed !important;
.custom-button:hover i {
color: #ff0800;
}
.custom-button:disabled {
cursor: not-allowed;
}
/* 휴가 사원프로필 */
.profile-list {
display: flex;
flex-wrap: wrap;
gap: 15px;
padding: 0;
list-style: none;
justify-content: flex-start;
cursor: pointer;
}
.profile-item {
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
width: calc(33.33% - 10px);
}
/* 오전/오후반차,저장버튼 */
/* 버튼 기본 스타일 */
.vac-btn {
width: 60px;
height: 60px;
border-radius: 50%;
font-size: 20px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease-in-out;
display: inline-block;
font-weight: 400;
line-height: 1.53;
color: #697a8d;
text-align: center;
vertical-align: middle;
cursor: pointer;
border: 1px solid transparent;
transition: all 0.2sease-in-out;
border: 2px solid transparent;
}
/* 마우스를 올렸을 때 */
.vac-btn:hover {
@ -265,8 +241,9 @@ cursor: not-allowed !important;
.vac-btn-warning{
color: #fff;
background-color: #ffc144;
border-color: #ffe605;
border-color: #ffc144;
box-shadow: 0 0.125rem 0.25rem 0 rgba(255, 171, 0, 0.4);
font-size: 28px;
}
/* AM 버튼 (선택된 상태) */
.vac-btn-warning.active {
@ -278,26 +255,20 @@ cursor: not-allowed !important;
background-color: #03c3ec;
border-color: #03c3ec;
box-shadow: 0 0.125rem 0.25rem 0 rgba(3, 195, 236, 0.4);
font-size: 28px;
}
/* PM 버튼 (선택된 상태) */
.vac-btn-info.active {
background-color: #0b5ed7 !important;
color: white;
}
/* 버튼 기본 (비활성화일 때 기본 녹색) */
/* 버튼 기본 */
.vac-btn-success {
font-size: 24px;
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease-in-out;
background-color: #871919 !important;
color: white;
cursor: pointer;
border: 1px solid transparent;
border: 2px solid transparent;
font-size: 30px;
}
/* 버튼 활성화 */
.vac-btn-success.active {
@ -309,7 +280,6 @@ cursor: not-allowed !important;
}
/* 버튼 비활성화 */
.vac-btn-success.disabled {
border: 3px solid #e6e4e4; /* 붉은색 테두리 적용 */
background-color: #bbb8b8 !important;
color: white !important;
cursor: not-allowed !important;
@ -341,17 +311,17 @@ cursor: not-allowed !important;
font-size: 22px;
}
.vac-grant-modal-title {
font-size: 16px;
font-size: 18px;
}
.vac-modal-text {
font-size: 11px;
font-size: 13px;
}
.vac-modal-title {
font-size: 14px;
font-size: 17px;
margin-bottom: 10px;
}
.vacation-item {
font-size: 12px;
font-size: 13px;
text-align: center;
margin-bottom: 5px;
}
@ -367,6 +337,16 @@ cursor: not-allowed !important;
}
}
@media (max-width: 1500px) {
.vac-grant-modal-title {
font-size: 14px;
}
.vac-modal-text {
font-size: 11px;
}
.vac-modal-title {
font-size: 13px;
margin-bottom: 10px;
}
.close-btn {
top: 5px;
right: 5px;

View File

@ -7,6 +7,7 @@
:profileName="comment.author"
:date="comment.createdAt"
:comment="comment"
:profileImg="comment.profileImg"
:showDetail="false"
:isLike="!isLike"
:isCommentPassword="isCommentPassword"
@ -23,7 +24,7 @@
class="form-control"
:value="password"
placeholder="비밀번호 입력"
@input="$emit('update:password', $event.target.value.trim())"
@input="filterInput"
/>
<button class="btn btn-primary" @click="logPasswordAndEmit">확인</button>
</div>
@ -47,7 +48,10 @@
<!-- <template v-if="isDeleted">
<p class="m-0 text-muted">댓글이 삭제되었습니다.</p>
</template> -->
<PlusButton v-if="isPlusButton" @click="toggleComment" class="mt-6" />
<PlusButton v-if="isPlusButton" @click="toggleComment" class="mt-6">
<i class="icon-base bx bx-plus beforeRotate" :class="{ rotate: isComment }"></i>
</PlusButton>
<BoardCommentArea v-if="isComment" :unknown="unknown" @submitComment="submitComment" :commnetId="comment.commentId" />
<slot name="reply"></slot>
@ -118,6 +122,11 @@
'update:password',
]);
const filterInput = (event) => {
event.target.value = event.target.value.replace(/\s/g, ""); //
emit("update:password", event.target.value);
};
const localEditedContent = ref(props.comment.content);
//
@ -173,3 +182,13 @@
emit('editClick', props.comment);
};
</script>
<style>
.beforeRotate {
transition: transform 0.3s ease-in-out;
}
.rotate {
transform: rotate(45deg);
transition: transform 0.3s ease-in-out;
}
</style>

View File

@ -34,25 +34,27 @@
</div>
<!-- 비밀번호 입력 필드 (익명이 선택된 경우에만 표시) -->
<div v-if="isCheck" class="d-flex align-items-center flex-grow-1">
<label class="form-label mb-0 me-3" for="basic-default-password">비밀번호</label>
<input
type="password"
id="basic-default-password"
class="form-control flex-grow-1"
v-model="password"
placeholder="비밀번호 입력"
@input="passwordAlertTextHandler"
/>
<span v-if="passwordAlert" class="invalid-feedback d-block text-start ms-2">{{ passwordAlert }}</span>
<span v-else class="invalid-feedback d-block text-start ms-2">{{ passwordAlert2 }}</span>
</div>
<template v-if="isCheck">
<div class="d-flex align-items-center flex-grow-1">
<label class="form-label mb-0 me-3" for="basic-default-password">비밀번호</label>
<input
type="password"
id="basic-default-password"
class="form-control flex-grow-1"
v-model="password"
placeholder="비밀번호 입력"
@input="passwordAlertTextHandler"
/>
</div>
</template>
</div>
<!-- 답변 쓰기 버튼 -->
<div class="ms-auto mt-3 mt-md-0">
<SaveBtn class="btn btn-primary" @click="handleCommentSubmit"></SaveBtn>
</div>
<span v-if="passwordAlert" class="invalid-feedback d-block text-start ms-2">{{ passwordAlert }}</span>
<span v-else class="invalid-feedback d-block text-start ms-2">{{ passwordAlert2 }}</span>
</div>
</div>
</div>
@ -101,7 +103,8 @@
textAlert.value = '';
};
const passwordAlertTextHandler = () => {
const passwordAlertTextHandler = (event) => {
event.target.value = event.target.value.replace(/\s/g, "");
passwordAlert2.value = '';
};

View File

@ -1,8 +1,8 @@
<template>
<div class="d-flex align-items-center flex-wrap">
<div class="d-flex align-items-center">
<div v-if="!unknown" class="avatar me-2">
<img :src="getProfileImage(profilePath)" alt="Avatar" class="rounded-circle" />
<div class="avatar me-2">
<img :src="getProfileImage(profileImg)" alt="Avatar" class="rounded-circle" />
</div>
<div class="me-2">
@ -60,10 +60,6 @@
type: String,
default: '',
},
profilePath: {
type: String,
default: '',
},
unknown: {
type: Boolean,
default: true,
@ -94,6 +90,10 @@
type: Boolean,
default: false,
},
profileImg: {
type: String,
default: false,
},
});
const emit = defineEmits(['updateReaction', 'editClick', 'deleteClick']);
@ -122,7 +122,7 @@
};
//
const getProfileImage = profilePath => {
return profilePath && profilePath.trim() ? `${baseUrl}upload/img/profile/${profilePath}` : defaultProfile;
const getProfileImage = profileImg => {
return profileImg && profileImg != '' ? `${baseUrl}upload/img/profile/${profileImg}` : defaultProfile;
};
</script>

View File

@ -1,27 +1,30 @@
<template>
<div class="menu gap-4 justify-content-center mt-5">
<!-- 오전 반차 버튼 -->
<button
class="vac-btn vac-btn-warning"
:class="{ active: halfDayType === 'AM' }"
@click="toggleHalfDay('AM')"
>
<i class="bi bi-sun"></i>
</button>
<!-- 오후 반차 버튼 -->
<button
class="vac-btn vac-btn-info"
:class="{ active: halfDayType === 'PM' }"
@click="toggleHalfDay('PM')"
>
<i class="bi bi-moon"></i>
</button>
<!-- 저장 버튼 -->
<div class="save-button-container">
<button class="vac-btn-success" @click="addVacationRequests"
:class="{ active: !isDisabled, disabled: isDisabled }">
<div class="row gx-2 mb-4">
<div class="col-4">
<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' }"
@click="toggleHalfDay('AM')">
<i class="bi bi-sun"></i>
</button>
</div>
</div>
<div class="col-4">
<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' }"
@click="toggleHalfDay('PM')">
<i class="bi bi-moon"></i>
</button>
</div>
</div>
<div class="col-4">
<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>
</template>

View File

@ -1,13 +1,14 @@
<template>
<button class="btn btn-label-primary btn-icon">
<i class="icon-base bx bx-plus"></i>
</button>
<slot>
<i class="icon-base bx bx-plus"></i>
</slot>
</button>
</template>
<script>
export default {
name: 'PlusButton',
methods: {
},
};
export default {
name: 'PlusButton',
methods: {},
};
</script>

View File

@ -1,7 +1,7 @@
<template>
<div v-if="isOpen" class="vac-modal-dialog" @click.self="closeModal">
<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>
<!-- 연차 목록 -->
<div class="vac-modal-body" v-if="mergedVacations.length > 0">
@ -57,26 +57,34 @@ const emit = defineEmits(["close"]);
// (,)
let globalCounter = 0;
const usedVacations = computed(() => {
return props.myVacations.flatMap((v) => {
const count = v.used_quota || 1;
return Array.from({ length: count }, (_, i) => ({
const data = props.myVacations.flatMap((v) => {
const count = v.used_quota
return Array.from({ length: Math.ceil(count) }, (_, i) => ({
...v,
category: "used",
code: v.LOCVACTYP,
used_quota: count, //
_expandIndex: globalCounter++,
}));
});
return data;
});
//
const receivedVacations = computed(() =>
props.receivedVacations.map((v) => ({
...v,
category: "received",
}))
);
const receivedVacations = computed(() => {
const data = props.receivedVacations.flatMap((v) => {
const count = v.received_quota ?? 1;
return Array.from({ length: Math.ceil(count) }, (_, i) => ({
...v,
category: "received",
_expandIndex: globalCounter++,
}));
});
return data;
});
//
const sortedUsedVacationsAsc = computed(() => {
return [...usedVacations.value].sort((a, b) => {

View File

@ -1,31 +1,42 @@
<template>
<div class="input-group mb-3 d-flex">
<input type="text" class="form-control" placeholder="Search" @change="search" @input="preventLeadingSpace" />
<button type="button" class="btn btn-primary"><i class="bx bx-search bx-md"></i></button>
<input
type="text"
class="form-control"
placeholder="Search"
v-model="searchQuery"
@keyup.enter="search"
@input="preventLeadingSpace"
/>
<button type="button" class="btn btn-primary" @click="search">
<i class="bx bx-search bx-md"></i>
</button>
</div>
</template>
<script setup>
const props = defineProps({
maxlength: {
type: Number,
default: 30,
required: false,
},
});
import { ref } from "vue";
const emits = defineEmits(['update:data']);
const props = defineProps({
maxlength: {
type: Number,
default: 30,
required: false,
},
});
const search = function (event) {
const emits = defineEmits(["update:data"]);
const searchQuery = ref("");
//Type Number maxlength
if (event.target.value.length > props.maxlength) {
event.target.value = event.target.value.slice(0, props.maxlength);
}
emits('update:data', event.target.value);
};
const preventLeadingSpace = function (event) {
event.target.value = event.target.value.trimStart();
const search = function () {
// Type Number maxlength
if (searchQuery.value.length > props.maxlength) {
searchQuery.value = searchQuery.value.slice(0, props.maxlength);
}
emits("update:data", searchQuery.value);
};
const preventLeadingSpace = function () {
searchQuery.value = searchQuery.value.trimStart();
};
</script>

View File

@ -1,28 +1,30 @@
<template>
<div class="card-body d-flex justify-content-center m-n5">
<ul class="profile-list">
<li
v-for="(user, index) in sortedUserList"
:key="index"
class="profile-item"
:class="{ newRow: (index + 1) % 4 === 0 }"
@click="$emit('profileClick', user)"
data-bs-placement="top"
:aria-label="user.MEMBERSEQ"
>
<img
class="rounded-circle profile-img"
:src="getUserProfileImage(user.MEMBERPRF)"
alt="user"
:style="getDynamicStyle(user)"
@error="setDefaultImage"
@load="showImage"
/>
<div class="">
<ul class="row gx-2 mb-2 list-inline">
<li
v-for="(user, index) in sortedUserList"
:key="index"
class="col-4 mb-3"
:class="{ newRow: (index + 1) % 4 === 0 }"
@click="$emit('profileClick', user)"
data-bs-placement="top"
:aria-label="user.MEMBERSEQ"
>
<div class="ratio ratio-1x1 mb-2 profile-list">
<img
class="rounded-circle profile-img"
:src="getUserProfileImage(user.MEMBERPRF)"
alt="user"
:style="getDynamicStyle(user)"
@error="setDefaultImage"
@load="showImage"
/>
</div>
<span class="mt-2 text-sm-center d-block fs-6 remaining-vacation">
{{ remainingVacationData[user.MEMBERSEQ] || 0 }}
</span>
</li>
</ul>
</li>
</ul>
</div>
</template>
@ -110,9 +112,7 @@ if (windowWidth.value >= 1850) {
});
const getDynamicStyle = (user) => ({
width: profileSize.value,
height: profileSize.value,
borderWidth: "4px",
borderWidth: "3px",
borderColor: user.usercolor || "#ccc",
borderStyle: "solid",
});

View File

@ -1,5 +1,5 @@
<template>
<div class="card mb-6" :class="{'disabled-class': data.localVote.LOCVOTDDT}" >
<div class="card mb-6" :class="{ 'disabled-class': data.localVote.LOCVOTDDT && (topVoters.length == 1 || data.localVote.LOCVOTRES || voteResult == 0)}">
<div class="card-body" v-if="!data.localVote.LOCVOTDEL" >
<h5 class="card-title mb-1">
<div class="list-unstyled users-list d-flex align-items-center gap-1">
@ -15,21 +15,22 @@
<div class="d-flex justify-content-between">
<div class="user-info">
<h6 class="mb-1">{{ data.localVote.MEMBERNAM }}</h6>
<!-- 투표완료시 -->
</div>
<div class="add-btn d-flex align-items-center">
<!-- 투표완료시 -->
<i v-if="yesVotetotal != '0'" class="bx bxs-check-circle link-success"></i>
<!-- 투표작성자만 수정/삭제/종료 가능 -->
<div v-if="userStore.user.id === data.localVote.LOCVOTREG">
<button
v-if="!data.localVote.LOCVOTDDT"
type="button"
class="bx btn btn-danger"
class="btn btn-label-danger btn-icon"
@click="endBtn(data.localVote.LOCVOTSEQ)"
>종료</button>
><i class="bx bx-power-off"></i>
</button>
<DeleteBtn v-if="!data.localVote.LOCVOTDDT" @click="voteDelete(data.localVote.LOCVOTSEQ)" />
</div>
<p v-if="data.localVote.LOCVOTDDT" class="btn-icon btn-danger rounded-2"><i class="bx bx-power-off"></i></p>
<i v-if="yesVotetotal != '0'" class="bx bxs-check-circle link-success"></i>
</div>
</div>
</div>
@ -54,7 +55,7 @@
<!-- 투표 결과 -->
<div v-if="data.localVote.LOCVOTDDT" class="mt-3">
<vote-result-list :data="data.voteDetails" @randomList="randomList" :randomResultNum="data.localVote.LOCVOTRES"/>
<vote-result-list :data="topVoters" @randomList="randomList" :randomResultNum="data.localVote.LOCVOTRES" :locvotreg="data.localVote.LOCVOTREG"/>
</div>
<!-- 투표완/미완 인원 -->
<vote-user-list
@ -95,6 +96,14 @@ const yesVotetotal = computed(() => {
return props.data.voteDetails.reduce((sum, item) => sum + item.yesvote, 0);
});
// (1)
const topVoters = computed(() => {
// VOTE_COUNT
const maxVoteCount = Math.max(...props.data.voteDetails.map(item => item.VOTE_COUNT));
// VOTE_COUNT
return props.data.voteDetails.filter(item => item.VOTE_COUNT === maxVoteCount);
});
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
const userStore = useUserInfoStore();
const currentDate = new Date();
@ -104,7 +113,6 @@ voteEndDate.setDate(voteEndDate.getDate() + 1);
const isVoteEnded = computed(() => {
return currentDate > voteEndDate;
});
const emit = defineEmits(['addContents','checkedNames','endVoteId','voteEnded','randomList','voteDelete','updateVote']);
onMounted(() => {
if (isVoteEnded.value && !props.data.localVote.LOCVOTDDT) {

View File

@ -2,7 +2,7 @@
<div class="card mb-6 border border-2 border-primary rounded primary-shadow">
<div class="card-body">
<!-- 1위가 여러개일때 -->
<vote-result-random v-if="topVoters.length > 1" :data="topVoters" :randomResultNum="randomResultNum"
<vote-result-random v-if="topVoters.length > 1" :data="topVoters" :randomResultNum="randomResultNum" :locvotreg="locvotreg"
@randomList="randomList"/>
<!-- 1위가 하나일때-->
<vote-result-card v-if="topVoters.length == 1" :data="topVoters"/>
@ -24,6 +24,10 @@ const props = defineProps({
type: String,
required: false,
},
locvotreg: {
type: Number,
required: false,
},
});
// (1)
const topVoters = computed(() => {

View File

@ -16,9 +16,8 @@
<span class="spinner-grow me-1" role="status" aria-hidden="true"></span>
random..
</button>
<div class="d-grid w-100 mt-6">
<div class="d-grid w-100 mt-6" v-if="userStore.user.id === locvotreg">
<button v-if="!isRandom && !randomResultNum" @click="randomList" class="btn btn-primary"><i class='bx bx-sync'></i></button>
</div>
</template>
@ -26,6 +25,7 @@
import voteResultRandomList from "@c/voteboard/voteResultRandomList.vue"
import voteResultCard from '@c/voteboard/voteResultCard.vue';
import { ref, watch } from "vue";
import { useUserInfoStore } from "@s/useUserInfoStore";
const emit = defineEmits(['randomList']);
const props = defineProps({
data: {
@ -36,7 +36,12 @@ const props = defineProps({
type: String,
required: false,
},
locvotreg: {
type: Number,
required: false,
},
});
const userStore = useUserInfoStore();
const isRandom = ref(false);
const randomList = () =>{
isRandom.value = true;

View File

@ -10,6 +10,7 @@
:boardId="currentBoardId"
:profileName="profileName"
:unknown="unknown"
:profileImg="profileImg"
:views="views"
:commentNum="commentNum"
:date="formattedBoardDate"
@ -35,7 +36,7 @@
/>
<button class="btn btn-primary" @click="submitPassword">확인</button>
</div>
<span v-if="passwordAlert" class="invalid-feedback d-block text-start">{{ passwordAlert }}</span>
<span v-if="boardPasswordAlert" class="invalid-feedback d-block text-start">{{ boardPasswordAlert }}</span>
</div>
</div>
</div>
@ -59,7 +60,7 @@
<i class="fa-solid fa-download me-2"></i>
첨부파일 ({{ attachments.length }})
</button>
<ul class="dropdown-menu">
<ul class="dropdown-menu" style="z-index: 1004">
<li v-for="(attachment, index) in attachments" :key="index">
<a class="dropdown-item" href="#" @click.prevent="downloadFile(attachment)">
{{ attachment.originalName }}.{{ attachment.extension }}
@ -150,6 +151,7 @@
const commentNum = ref(0);
const attachment = ref(false);
const comments = ref([]);
const profileImg = ref('');
const route = useRoute();
const router = useRouter();
@ -157,7 +159,7 @@
const toastStore = useToastStore();
const currentBoardId = ref(Number(route.params.id));
const unknown = computed(() => profileName.value === '익명');
const currentUserId = computed(() => userStore.user.id); // id
const currentUserId = computed(() => userStore?.user?.id); // id
const authorId = ref(''); // id
const isAuthor = computed(() => currentUserId.value === authorId.value);
@ -208,6 +210,7 @@
const isEditTextarea = ref(false);
const isDeleted = ref(true);
const commentAlert = ref('');
const boardPasswordAlert = ref('');
const updatePassword = newPassword => {
password.value = newPassword;
@ -233,24 +236,21 @@
};
//
const fetchBoardDetails = async () => {
try {
const response = await axios.get(`board/${currentBoardId.value}`);
const data = response.data.data;
const response = await axios.get(`board/${currentBoardId.value}`);
const data = response.data.data;
profileName.value = data.author || '익명';
authorId.value = data.authorId;
boardTitle.value = data.title || '제목 없음';
boardContent.value = data.content || '';
date.value = data.date || '';
views.value = data.cnt || 0;
likes.value = data.likeCount || 0;
dislikes.value = data.dislikeCount || 0;
attachment.value = data.hasAttachment || null;
commentNum.value = data.commentCount || 0;
attachments.value = data.attachments || [];
} catch (error) {
alert('게시물 데이터를 불러오는 중 오류가 발생했습니다.');
}
profileName.value = data.author || '익명';
authorId.value = data.authorId;
boardTitle.value = data.title || '제목 없음';
boardContent.value = data.content || '';
profileImg.value = data.profileImg || '';
date.value = data.date || '';
views.value = data.cnt || 0;
likes.value = data.likeCount || 0;
dislikes.value = data.dislikeCount || 0;
attachment.value = data.hasAttachment || null;
commentNum.value = data.commentCount || 0;
attachments.value = data.attachments || [];
};
// ,
@ -280,101 +280,98 @@
const handleCommentReaction = async ({ boardId, commentId, isLike, isDislike }) => {
if (!commentId) return; // ID
try {
const response = await axios.post(`/board/${boardId}/${commentId}/reaction`, {
LOCBRDSEQ: boardId, // ID
LOCCMTSEQ: commentId, // ID
LOCGOBGOD: isLike ? 'T' : 'F',
LOCGOBBAD: isDislike ? 'T' : 'F',
});
const response = await axios.post(`/board/${boardId}/${commentId}/reaction`, {
LOCBRDSEQ: boardId, // ID
LOCCMTSEQ: commentId, // ID
LOCGOBGOD: isLike ? 'T' : 'F',
LOCGOBBAD: isDislike ? 'T' : 'F',
});
await fetchComments();
} catch (error) {
alert('오류가 발생했습니다.');
}
await fetchComments();
};
//
const fetchComments = async (page = 1) => {
try {
//
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
params: {
LOCBRDSEQ: currentBoardId.value,
page,
},
//
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
params: {
LOCBRDSEQ: currentBoardId.value,
page,
},
});
const commentsList = response.data.data.list.map(comment => ({
commentId: comment.LOCCMTSEQ, // ID
boardId: comment.LOCBRDSEQ,
parentId: comment.LOCCMTPNT, // ID
author: comment.author || '익명',
authorId: comment.authorId,
content: comment.LOCCMTRPY,
likeCount: comment.likeCount || 0,
dislikeCount: comment.dislikeCount || 0,
profileImg: comment.profileImg || '',
likeClicked: comment.likeClicked || false,
dislikeClicked: comment.dislikeClicked || false,
createdAtRaw: new Date(comment.LOCCMTRDT), //
createdAt: formattedDate(comment.LOCCMTRDT), //
children: [], //
updateAtRaw: comment.LOCCMTUDT,
}));
commentsList.sort((a, b) => b.createdAtRaw - a.createdAtRaw);
for (const comment of commentsList) {
if (!comment.commentId) continue;
const replyResponse = await axios.get(`board/${currentBoardId.value}/reply`, {
params: { LOCCMTPNT: comment.commentId },
});
const commentsList = response.data.data.list.map(comment => ({
commentId: comment.LOCCMTSEQ, // ID
boardId: comment.LOCBRDSEQ,
parentId: comment.LOCCMTPNT, // ID
author: comment.author || '익명',
authorId: comment.authorId,
content: comment.LOCCMTRPY,
likeCount: comment.likeCount || 0,
dislikeCount: comment.dislikeCount || 0,
likeClicked: comment.likeClicked || false,
dislikeClicked: comment.dislikeClicked || false,
createdAtRaw: new Date(comment.LOCCMTRDT), //
createdAt: formattedDate(comment.LOCCMTRDT), //
children: [], //
updateAtRaw: comment.LOCCMTUDT,
}));
commentsList.sort((a, b) => b.createdAtRaw - a.createdAtRaw);
for (const comment of commentsList) {
if (!comment.commentId) continue;
const replyResponse = await axios.get(`board/${currentBoardId.value}/reply`, {
params: { LOCCMTPNT: comment.commentId },
});
if (replyResponse.data.data) {
comment.children = replyResponse.data.data.map(reply => ({
author: reply.author || '익명',
authorId: reply.authorId,
commentId: reply.LOCCMTSEQ,
boardId: reply.LOCBRDSEQ,
parentId: reply.LOCCMTPNT, // ID
content: reply.LOCCMTRPY || '내용 없음',
createdAtRaw: new Date(reply.LOCCMTRDT),
createdAt: formattedDate(reply.LOCCMTRDT),
likeCount: reply.likeCount || 0,
dislikeCount: reply.dislikeCount || 0,
likeClicked: false,
dislikeClicked: false,
}));
} else {
comment.children = []; //
}
if (replyResponse.data.data) {
comment.children = replyResponse.data.data.map(reply => ({
author: reply.author || '익명',
authorId: reply.authorId,
profileImg: reply.profileImg || '',
commentId: reply.LOCCMTSEQ,
boardId: reply.LOCBRDSEQ,
parentId: reply.LOCCMTPNT, // ID
content: reply.LOCCMTRPY || '내용 없음',
createdAtRaw: new Date(reply.LOCCMTRDT),
createdAt: formattedDate(reply.LOCCMTRDT),
likeCount: reply.likeCount || 0,
dislikeCount: reply.dislikeCount || 0,
likeClicked: false,
dislikeClicked: false,
}));
} else {
comment.children = []; //
}
//
comments.value = commentsList;
pagination.value = {
...pagination.value,
currentPage: response.data.data.pageNum, //
pages: response.data.data.pages, //
prePage: response.data.data.prePage, //
nextPage: response.data.data.nextPage, //
isFirstPage: response.data.data.isFirstPage, //
isLastPage: response.data.data.isLastPage, //
hasPreviousPage: response.data.data.hasPreviousPage, //
hasNextPage: response.data.data.hasNextPage, //
navigatePages: response.data.data.navigatePages, //
navigatepageNums: response.data.data.navigatepageNums, //
navigateFirstPage: response.data.data.navigateFirstPage, //
navigateLastPage: response.data.data.navigateLastPage, //
};
} catch (error) {
alert('오류가 발생했습니다.');
}
commentsList;
//
comments.value = commentsList;
pagination.value = {
...pagination.value,
currentPage: response.data.data.pageNum, //
pages: response.data.data.pages, //
prePage: response.data.data.prePage, //
nextPage: response.data.data.nextPage, //
isFirstPage: response.data.data.isFirstPage, //
isLastPage: response.data.data.isLastPage, //
hasPreviousPage: response.data.data.hasPreviousPage, //
hasNextPage: response.data.data.hasNextPage, //
navigatePages: response.data.data.navigatePages, //
navigatepageNums: response.data.data.navigatepageNums, //
navigateFirstPage: response.data.data.navigateFirstPage, //
navigateLastPage: response.data.data.navigateLastPage, //
};
};
//
const handleCommentSubmit = async data => {
closeAllEditTextareas();
closeAllPasswordAreas();
togglePassword('close');
if (!data) {
return;
}
@ -453,7 +450,9 @@
//
const deleteClick = unknown => {
if (unknown) {
const isUnknown = unknown?.unknown ?? false;
if (isUnknown) {
togglePassword('delete');
} else {
deletePost();
@ -477,32 +476,34 @@
const editComment = comment => {
password.value = '';
passwordCommentAlert.value = '';
currentPasswordCommentId.value = null;
//currentPasswordCommentId.value = null;
isPassword.value = false; //
const targetComment = findCommentById(comment.commentId, comments.value);
if (!targetComment) {
return;
}
const isMyComment = comment.authorId === currentUserId.value;
const isAnonymous = comment.author === '익명';
if (isMyComment) {
if (targetComment.isEditTextarea) {
//
targetComment.isEditTextarea = false;
currentPasswordCommentId.value = comment.commentId;
} else {
//
closeAllEditTextareas();
currentPasswordCommentId.value = null;
//
targetComment.isEditTextarea = true;
}
} else if (isAnonymous) {
if (currentPasswordCommentId.value === comment.commentId) {
//
toggleCommentPassword(comment, 'edit');
return;
} else {
//
@ -527,6 +528,13 @@
});
};
//
const closeAllPasswordAreas = () => {
currentPasswordCommentId.value = null; //
password.value = '';
passwordCommentAlert.value = '';
};
//
const deleteComment = async comment => {
const isMyComment = comment.authorId === currentUserId.value;
@ -559,19 +567,27 @@
};
const togglePassword = button => {
// close: .
if (button === 'close') {
isPassword.value = false;
boardPasswordAlert.value = '';
return;
}
if (lastClickedButton.value === button) {
isPassword.value = !isPassword.value;
boardPasswordAlert.value = '';
} else {
isPassword.value = true;
}
lastClickedButton.value = button;
};
//
const submitPassword = async () => {
if (!password.value.trim()) {
passwordAlert.value = '비밀번호를 입력해주세요.';
boardPasswordAlert.value = '비밀번호를 입력해주세요.';
return;
}
@ -582,7 +598,7 @@
});
if (response.data.code === 200 && response.data.data === true) {
password.value = '';
boardPasswordAlert.value = '';
isPassword.value = false;
if (lastClickedButton.value === 'edit') {
@ -592,10 +608,10 @@
}
lastClickedButton.value = null;
} else {
passwordAlert.value = '비밀번호가 일치하지 않습니다.';
boardPasswordAlert.value = '비밀번호가 일치하지 않습니다.';
}
} catch (error) {
if (error.response && error.response.status === 401) passwordAlert.value = '비밀번호가 일치하지 않습니다.';
if (error.response && error.response.status === 401) boardPasswordAlert.value = '비밀번호가 일치하지 않습니다.';
}
};
@ -677,16 +693,14 @@
if (!confirm('정말 이 댓글을 삭제하시겠습니까?')) return;
const targetComment = findCommentById(comment.commentId, comments.value);
// console.log('?',comment)
try {
const response = await axios.delete(`board/comment/${comment.commentId}`, {
data: { LOCCMTSEQ: comment.commentId },
params: { LOCCMTSEQ: comment.commentId, LOCCMTPNT: comment.parentId },
});
if (response.data.code === 200) {
await fetchComments();
closeAllPasswordAreas();
if (targetComment) {
// console.log('',targetComment)
@ -705,6 +719,7 @@
//
const handleSubmitEdit = async (comment, editedContent) => {
togglePassword();
try {
const response = await axios.put(`board/comment/${comment.commentId}`, {
LOCCMTSEQ: comment.commentId,

View File

@ -3,36 +3,37 @@
<div class="card app-calendar-wrapper">
<div class="row g-0">
<!-- Sidebar: 사이드바 영역 -->
<div class="col-3 app-calendar-sidebar border-end" id="app-calendar-sidebar">
<div class="sidebar-content">
<div class="sidebar-actions text-center my-3">
<HalfDayButtons
<div class="col-3 border-end text-center" id="app-calendar-sidebar">
<div>
<div class="card-body">
<HalfDayButtons
ref="halfDayButtonsRef"
@toggleHalfDay="toggleHalfDay"
@addVacationRequests="saveVacationChanges"
:isDisabled="!hasChanges"
:selectedDate="selectedDate"
/>
</div>
<ProfileList
/>
<ProfileList
@profileClick="handleProfileClick"
:remainingVacationData="remainingVacationData"
/>
/>
</div>
<VacationModal
v-if="isModalOpen"
:isOpen="isModalOpen"
:myVacations="filteredMyVacations"
:receivedVacations="filteredReceivedVacations"
:userColors="userColors"
@close="isModalOpen = false"
v-if="isModalOpen"
:isOpen="isModalOpen"
:myVacations="filteredMyVacations"
:receivedVacations="filteredReceivedVacations"
:userColors="userColors"
@close="isModalOpen = false"
/>
<VacationGrantModal
v-if="isGrantModalOpen"
:isOpen="isGrantModalOpen"
:targetUser="selectedUser"
:remainingQuota="remainingVacationData[selectedUser?.MEMBERSEQ] || 0"
@close="isGrantModalOpen = false"
@updateVacation="fetchRemainingVacation"
v-if="isGrantModalOpen"
:isOpen="isGrantModalOpen"
:targetUser="selectedUser"
:remainingQuota="remainingVacationData[selectedUser?.MEMBERSEQ] || 0"
@close="isGrantModalOpen = false"
@updateVacation="fetchRemainingVacation"
/>
</div>
</div>
@ -136,6 +137,7 @@ const calendarOptions = reactive({
center: "title",
right: "prev,next",
},
contentHeight:"auto",
locale: "ko",
selectable: false,
dateClick: handleDateClick,
@ -323,51 +325,66 @@ const filteredReceivedVacations = computed(() => {
//
async function saveVacationChanges() {
if (!hasChanges.value) return;
const selectedDatesArray = Array.from(selectedDates.value);
const vacationChangesByYear = selectedDatesArray.reduce((acc, [date, type]) => {
const year = date.split("-")[0]; // YYYY-MM-DD YYYY
if (!acc[year]) acc[year] = { add: [], delete: [] };
//
const vacationChanges = selectedDatesArray.reduce((acc, [date, type]) => {
if (type !== "delete") {
acc[year].add.push({ date, type });
acc.add.push({ date, type });
} else {
acc[year].delete.push(date);
acc.delete.push(date);
}
return acc;
}, {});
}, { add: [], delete: [] });
try {
for (const year of Object.keys(vacationChangesByYear)) {
const vacationsToAdd = vacationChangesByYear[year].add;
// id
const vacationsToDeleteForYear = myVacations.value
.filter(vac => {
if (!vac.date) return false;
const vacDate = vac.date.split("T")[0];
return vacationChangesByYear[year].delete.includes(vacDate);
});
const vacationIdsToDelete = vacationsToDeleteForYear.map(vac => vac.id);
if (vacationsToAdd.length > 0 || vacationIdsToDelete.length > 0) {
const response = await axios.post("vacation/batchUpdate", {
add: vacationsToAdd,
delete: vacationIdsToDelete,
});
if (response.data && response.data.status === "OK") {
toastStore.onToast(`휴가 변경 사항이 저장되었습니다.`, 's');
// : myVacations ID
myVacations.value = myVacations.value.filter(vac => !vacationIdsToDelete.includes(vac.id));
//
// ID
const allYears = new Set(vacationChanges.delete.map(date => date.split("-")[0]));
let vacationIdsToDelete = [];
for (const year of allYears) {
await fetchVacationHistory(year); //
const vacationsToDelete = myVacations.value.filter(vac => {
if (!vac.date) return false;
const vacDate = vac.date.split("T")[0];
return vacationChanges.delete.includes(vacDate) && !vac.receiverId;
});
vacationIdsToDelete.push(...vacationsToDelete.map(vac => vac.id));
}
if (vacationChanges.add.length > 0 || vacationIdsToDelete.length > 0) {
const response = await axios.post("vacation/batchUpdate", {
add: vacationChanges.add,
delete: vacationIdsToDelete,
});
if (response.data && response.data.status === "OK") {
toastStore.onToast(`휴가 변경 사항이 저장되었습니다.`, 's');
// ID `myVacations.value`
myVacations.value = myVacations.value.filter(vac => !vacationIdsToDelete.includes(vac.id));
// ( )
const yearsToUpdate = new Set(
[...vacationChanges.add.map(v => v.date.split("-")[0]),
...vacationChanges.delete.map(v => v.split("-")[0])]
);
for (const year of yearsToUpdate) {
const updatedVacations = await fetchVacationHistory(year);
if (updatedVacations) {
myVacations.value = updatedVacations; //
myVacations.value = [...myVacations.value, ...updatedVacations.filter(newVac =>
!myVacations.value.some(oldVac => oldVac.id === newVac.id)
)];
}
} else {
toastStore.onToast(`휴가 변경 중 오류가 발생했습니다.`, 'e');
}
} else {
toastStore.onToast(`휴가 변경 중 오류가 발생했습니다.`, 'e');
}
}
await fetchRemainingVacation();
selectedDates.value.clear();
updateCalendarEvents();
//
//
const currentDate = fullCalendarRef.value.getApi().getDate();
await loadCalendarData(currentDate.getFullYear(), currentDate.getMonth() + 1);
} catch (error) {
@ -375,24 +392,17 @@ async function saveVacationChanges() {
toastStore.onToast('휴가 저장 요청에 실패했습니다.', 'e');
}
}
/* 휴가 조회 */
//
async function fetchVacationHistory(year) {
try {
const response = await axios.get(`vacation/history?year=${year}`);
if (response.status === 200 && response.data) {
const newVacations = response.data.data.usedVacations || [];
const uniqueVacations = Array.from(
new Map([...myVacations.value, ...newVacations].map(v => [`${v.date}-${v.type}`, v]))
.values()
);
myVacations.value = uniqueVacations;
myVacations.value = response.data.data.usedVacations || [];
receivedVacations.value = response.data.data.receivedVacations || []
}
} catch (error) {
console.error(`🚨 ${year}휴가 데이터 불러오기 실패:`, error);
console.error(`🚨 휴가 데이터 불러오기 실패:`, error);
}
}
//
@ -403,7 +413,7 @@ async function fetchVacationData(year, month) {
const vacationList = response.data;
//
const filteredVacations = vacationList.filter(vac =>
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ]
userColors.value[vac.MEMBERSEQ] && userColors.value[vac.MEMBERSEQ] && !vac.LOCVACRMM
);
const events = filteredVacations.map(vac => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
@ -483,7 +493,6 @@ function toggleHalfDay(type) {
/* 페이지 이동 시 변경 사항 확인 */
router.beforeEach((to, from, next) => {
if (hasChanges.value) {
console.log('휴가!!!!!');
const answer = window.confirm("저장하지 않은 변경 사항이 있습니다. 이동하시겠습니까?");
if (!answer) {
return next(false);

View File

@ -34,6 +34,7 @@
<Pagination
v-if="PageData.pages"
v-bind="PageData"
:currentPage="currentPage"
@update:currentPage="handlePageChange"
/>
</div>
@ -149,7 +150,6 @@ const voteDelete =(id) =>{
}
// 1
const randomList = (data,id) =>{
isLoading.value = false;
$api.post('vote/randomList',{
randomList :data
,voteid:id
@ -158,7 +158,7 @@ const randomList = (data,id) =>{
toastStore.onToast('랜덤뽑기 진행되었습니다.', 's');
setTimeout(() => {
getvoteList();
}, 2000); // 3000ms = 3
}, 1000);
}
})
}
@ -169,9 +169,9 @@ const updateVote = (id) =>{
voteWrite();
}
//
const handlePageChange = async (page) => {
const handlePageChange = (page) => {
currentPage.value=page;
await getvoteList();
getvoteList();
};
</script>
<style></style>

View File

@ -31,7 +31,7 @@
@change="ValidHandlerendDate"
/>
<!-- 항목 입력 반복 -->
<div v-for="(item, index) in itemList" :key="index" class="d-flex align-items-start">
<div v-for="(item, index) in itemList" :key="index" class="d-flex align-items-start ">
<div class="flex-grow-1 me-2 ">
<form-input
:title="'항목 ' + (index + 1)"
@ -174,7 +174,7 @@ const saveVote = () => {
}));
$api.post('vote/insertWord',{
addvoteIs :addvoteitem.value === false ? '0' :'1'
,votemMltiIs: addvotemulti.value === false ? '0' : '1'
,votemMltiIs :addvotemulti.value === false ? '0' : '1'
,title :title.value.trim()
,endDate :endDate.value
,itemList :filteredItemList
@ -207,6 +207,6 @@ const goList = () => {
<style scoped>
.item-input {
max-width: 200px;
max-width: 200px;
}
</style>

View File

@ -9,7 +9,7 @@
<DictAlphabetFilter @update:data="handleSelectedAlphabetChange" :indexCategory="indexCategory" :selectedAl="selectedAlphabet" />
<!-- 카테고리 -->
<div v-if="cateList.length">
<CategoryBtn :lists="cateList" @update:data="handleSelectedCategoryChange" :showAll="true"/>
<CategoryBtn :lists="cateList" @update:data="handleSelectedCategoryChange" :showAll="true" :selectedCategory="selectedCategory" />
</div>
<!-- 작성 -->
<div v-if="writeStore.isItemActive(999999)" class="mt-5 card p-5">
@ -108,7 +108,7 @@
});
const refreshWordList = () => {
getwordList(searchText.value, selectedAlphabet.value, selectedCategory.value);
getwordList(searchText.value, selectedAlphabet.value, selectedCategory.value);
};
//
@ -205,6 +205,7 @@
}
getwordList();
getIndex();
selectedCategory.value = 'all';
if(res.data.data == '2'){
const newCategory = { label: data, value: category };
cateList.value = [...cateList.value,newCategory];