Merge branch 'main' into wordDict

This commit is contained in:
yoon 2025-02-20 09:20:57 +09:00
commit d6883c3a34
10 changed files with 259 additions and 154 deletions

View File

@ -37,7 +37,7 @@ $api.interceptors.response.use(
},
function (error) {
const toastStore = useToastStore();
//const currentPage = error.config.headers['X-Page-Route'];
const currentPage = error.config.headers['X-Page-Route'];
// 오류 응답 처리
if (error.response) {
switch (error.response.status) {

View File

@ -68,7 +68,7 @@
<script setup>
import { defineProps, defineEmits, ref } from 'vue';
import BoardProfile from './BoardProfile.vue';
import BoardCommentArea from './BoardComentArea.vue';
import BoardCommentArea from './BoardCommentArea.vue';
import PlusButton from '../button/PlusBtn.vue';
const props = defineProps({

View File

@ -5,7 +5,7 @@
<div class="d-flex justify-content-start align-items-top">
<!-- 프로필섹션 -->
<div class="avatar-wrapper">
<div class="avatar me-4">
<div v-if="!unknown" class="avatar me-4">
<img src="/img/avatars/11.png" alt="Avatar" class="rounded-circle">
</div>
</div>
@ -13,8 +13,9 @@
<div class="w-100">
<textarea
class="form-control"
placeholder="주제에 대한 생각을 자유롭게 댓글로 표현해 주세요. &#13;&#10;여러분의 다양한 의견을 기다립니다."
placeholder="댓글 달기"
rows="3"
v-model="comment"
></textarea>
</div>
</div>
@ -23,7 +24,7 @@
<div class="d-flex justify-content-between flex-wrap mt-4">
<div class="d-flex flex-wrap align-items-center">
<!-- 익명 체크박스 (익명게시판일 경우에만)-->
<div class="form-check form-check-inline mb-0 me-4">
<div v-if="unknown" class="form-check form-check-inline mb-0 me-4">
<input
class="form-check-input"
type="checkbox"
@ -40,15 +41,16 @@
type="password"
id="basic-default-password"
class="form-control flex-grow-1"
placeholder=""
v-model="password"
/>
</div>
</div>
<!-- 답변 쓰기 버튼 -->
<div class="ms-auto mt-3 mt-md-0">
<button class="btn btn-primary">
<i class="icon-base bx bx-check"></i>
<button class="btn btn-primary" @click="handleCommentSubmit">
<!-- <i class="icon-base bx bx-check"></i> -->
확인
</button>
</div>
</div>
@ -57,6 +59,40 @@
</template>
<script setup>
import { ref } from 'vue';
import { ref, defineEmits, defineProps, computed, watch } from 'vue';
const props = defineProps({
unknown: {
type: Boolean,
default: true,
},
parentId: {
type: Number,
default: 0
}
});
const comment = ref('');
const password = ref('');
const isCheck = ref(false);
const emit = defineEmits(['submitComment']);
watch(() => props.unknown, (newVal) => {
if (!newVal) {
isCheck.value = false;
}
});
function handleCommentSubmit() {
emit('submitComment', {
comment: comment.value,
password: password.value,
});
comment.value = '';
password.value = '';
}
</script>

View File

@ -63,7 +63,7 @@
<script setup>
import { defineProps, ref } from 'vue';
import UserList from '@c/user/UserList.vue';
import CenterModal from '../modal/CenterModal.vue';
import CenterModal from '@c/modal/CenterModal.vue';
import $api from '@api';
// Props

View File

@ -34,7 +34,7 @@
:is-label="true"
:is-common="true"
:data="allColors"
v-model="selectedProject.projctcolor"
v-model="selectedProject.PROJCTCOL"
/>
<FormInput
@ -85,19 +85,23 @@
import FormInput from '@c/input/FormInput.vue';
import FormSelect from '@c/input/FormSelect.vue';
import commonApi from '@/common/commonApi';
import ArrInput from '../input/ArrInput.vue';
import ArrInput from '@c/input/ArrInput.vue';
import { useUserInfoStore } from '@/stores/useUserInfoStore';
import { useToastStore } from '@s/toastStore';
const toastStore = useToastStore();
const projectList = ref([]);
const isModalOpen = ref(false);
let originalColor = ref('');
const userStore = useUserInfoStore();
const user = ref(null);
const nameAlert = ref(false);
const selectedProject = ref({
PROJCTSEQ:'',
PROJCTNAM: '',
projctcolor: '',
PROJCTSTR: '',
PROJCTEND: '',
PROJCTZIP: '',
@ -105,6 +109,7 @@
PROJCTDTL: '',
PROJCTDES: '',
PROJCTCOL: '',
projctcolor:'',
});
const { colorList } = commonApi({
@ -124,13 +129,14 @@
const getProjectList = () => {
$api.get('project/select').then(res => {
projectList.value = res.data.data.projectList;
console.log(projectList.value);
});
};
const openModal = (post) => {
isModalOpen.value = true;
originalColor.value = post.PROJCTCOL;
selectedProject.value = { ...post };
};
@ -156,20 +162,23 @@
};
};
console.log(projectList.PROJCTSEQ)
const handleSubmit = () => {
console.log(selectedProject.value.PROJCTCOL)
console.log(originalColor.value)
$api.patch('project/update', {
projctSeq: projectList.PROJCTSEQ,
projctSeq: selectedProject.value.PROJCTSEQ,
projctNam: selectedProject.value.PROJCTNAM,
projctCol: selectedProject.value.projctcolor,
projctCol: selectedProject.value.PROJCTCOL,
projctArr: selectedProject.value.PROJCTARR,
projctDtl: selectedProject.value.PROJCTDTL,
projctZip: selectedProject.value.PROJCTZIP,
projctStr: selectedProject.value.PROJCTSTR,
projctEnd: selectedProject.value.PROJCTEND,
projctEnd: selectedProject.value.PROJCTEND || null,
projctDes: selectedProject.value.PROJCTDES,
projctUmb: user.value.name,
originalColor: originalColor.value === selectedProject.value.PROJCTCOL ? null : originalColor.value
}).then(res => {
if (res.status === 200) {
toastStore.onToast('수정이 완료 되었습니다.', 's');

View File

@ -8,13 +8,13 @@
<p>해당 직원에게 부여할 연차 개수를 선택하세요. (남은 개수: {{ availableQuota }})</p>
<div class="vacation-control">
<button @click="decreaseCount" :disabled="grantCount <= 0" class="count-btn">-</button>
<button @click="decreaseCount" :disabled="grantCount < 2" class="count-btn">-</button>
<span class="grant-count">{{ grantCount }}</span>
<button @click="increaseCount" :disabled="grantCount >= availableQuota" class="count-btn">+</button>
</div>
<button class="gift-btn" @click="saveVacationGrant" :disabled="grantCount === 0">
<i class="bx bx-gift"></i> <!-- 선물상자 아이콘 -->
<i class="bx bx-gift"></i>
</button>
</div>
</div>
@ -26,65 +26,60 @@
import axios from "@api";
const props = defineProps({
isOpen: Boolean, //
targetUser: Object, //
isOpen: Boolean,
targetUser: Object,
});
const emit = defineEmits(["close", "updateVacation"]);
const grantCount = ref(0);
const maxQuota = 2; // 1
const sentCount = ref(0); //
const availableQuota = ref(2); //
const maxQuota = 2;
const sentCount = ref(0);
const availableQuota = ref(2);
//
const fetchSentVacationCount = async () => {
try {
const payload = { receiverId: props.targetUser.MEMBERSEQ };
const response = await axios.get(`vacation/sent`,{ params: payload });
console.log(response.data.data[0].count)
sentCount.value = response.data.data[0].count || 0; //
availableQuota.value = Math.max(maxQuota - sentCount.value, 0); // (0 )
console.log(`✅ 보낸 개수: ${sentCount.value}, 남은 개수: ${availableQuota.value}`);
const response = await axios.get("vacation/sent", { params: payload });
sentCount.value = response.data.data[0].count || 0;
availableQuota.value = Math.max(maxQuota - sentCount.value, 0);
grantCount.value = availableQuota.value; //
} catch (error) {
console.error("🚨 연차 전송 기록 조회 실패:", error);
availableQuota.value = maxQuota;
grantCount.value = maxQuota; //
}
};
//
const increaseCount = () => {
if (grantCount.value < availableQuota.value) {
grantCount.value++;
}
};
//
const decreaseCount = () => {
if (grantCount.value > 0) {
grantCount.value--;
}
};
// (saveVacations API )
const saveVacationGrant = async () => {
try {
const payload = [
{
date: new Date().toISOString().split("T")[0], //
type: "700103", //
senderId: props.targetUser.senderId, // ID
receiverId: props.targetUser.MEMBERSEQ, // ID
count: grantCount.value, //
date: new Date().toISOString().split("T")[0],
type: "700103",
senderId: props.targetUser.senderId,
receiverId: props.targetUser.MEMBERSEQ,
count: grantCount.value,
},
];
const response = await axios.post("vacation/save", payload);
const response = await axios.post("vacation", payload);
console.log(response)
if (response.data && response.data.status === "OK") {
alert("✅ 연차가 부여되었습니다.");
await fetchSentVacationCount(); //
emit("updateVacation"); //
await fetchSentVacationCount();
emit("updateVacation");
closeModal();
} else {
alert("🚨 연차 추가 중 오류가 발생했습니다.");
@ -95,36 +90,30 @@
}
};
//
const closeModal = () => {
emit("close");
};
//
watch(
() => props.isOpen,
async (newVal) => {
if (newVal && props.targetUser && props.targetUser.MEMBERSEQ) {
console.log("🟢 모달이 열렸습니다. 데이터를 로드합니다.");
grantCount.value = 0; //
await fetchSentVacationCount(); //
await fetchSentVacationCount();
}
}
);
// targetUser fetchSentVacationCount
watch(
() => props.targetUser,
async (newUser) => {
if (newUser && newUser.MEMBERSEQ) {
console.log(`🔄 새로운 대상(${newUser.name})이 선택되었습니다.`);
await fetchSentVacationCount();
}
},
{ deep: true }
);
//
onMounted(async () => {
if (props.isOpen && props.targetUser && props.targetUser.MEMBERSEQ) {
await fetchSentVacationCount();
@ -132,6 +121,7 @@
});
</script>
<style scoped>
/* 모달 본문 */

View File

@ -1,165 +1,186 @@
<template>
<div v-if="isOpen" class="modal-dialog" @click.self="closeModal">
<div class="modal-content modal-scroll">
<h5 class="modal-title">📅 연차 사용 내역</h5>
<button class="close-btn" @click="closeModal"></button>
<div v-if="isOpen" class="modal-dialog" @click.self="closeModal">
<div class="modal-content modal-scroll">
<h5 class="modal-title">📅 연차 사용 내역</h5>
<button class="close-btn" @click="closeModal"></button>
<!-- 연차 사용 받은 연차 리스트 -->
<div class="modal-body" v-if="mergedVacations.length > 0">
<ol class="vacation-list">
<li
v-for="(vacation, index) in mergedVacations"
:key="index"
class="vacation-item"
>
<span v-if="vacation.type === 'used'" class="vacation-index">
{{ totalUsedVacationCount - usedVacations.findIndex(v => v.date === vacation.date) }})
</span>
<span :class="vacation.type === 'used' ? 'minus-symbol' : 'plus-symbol'">
{{ vacation.type === 'used' ? '-' : '+' }}
</span>
<span :style="{ color: userColors[vacation.senderId || vacation.receiverId] || '#000' }"
class="vacation-date">{{ formatDate(vacation.date) }}</span>
</li>
</ol>
</div>
<!-- 연차 사용 받은 연차 리스트 -->
<div class="modal-body" v-if="mergedVacations.length > 0">
<ol class="vacation-list">
<li v-for="(vacation, index) in mergedVacations" :key="index" class="vacation-item">
<span v-if="vacation.type === 'used'" class="vacation-index">
{{ getVacationIndex(index) }})
</span>
<span :class="vacation.type === 'used' ? 'minus-symbol' : 'plus-symbol'">
{{ vacation.type === 'used' ? '-' : '+' }}
</span>
<span
:style="{ color: userColors[vacation.senderId || vacation.receiverId] || '#000' }"
class="vacation-date"
>
{{ formatDate(vacation.date) }}
</span>
</li>
</ol>
</div>
<!-- 연차 데이터 없음 -->
<p v-if="mergedVacations.length === 0" class="no-data">
🚫 사용한 연차가 없습니다.
</p>
<!-- 연차 데이터 없음 -->
<p v-if="mergedVacations.length === 0" class="no-data">
🚫 사용한 연차가 없습니다.
</p>
</div>
</div>
</div>
</template>
<script setup>
import { defineProps, defineEmits, computed } from "vue";
const props = defineProps({
isOpen: Boolean,
myVacations: {
type: Array,
default: () => [],
},
receivedVacations: {
type: Array,
default: () => [],
},
userColors: {
type: Object,
default: () => ({}),
},
isOpen: Boolean,
myVacations: {
type: Array,
default: () => [],
},
receivedVacations: {
type: Array,
default: () => [],
},
userColors: {
type: Object,
default: () => ({}),
},
});
const emit = defineEmits(["close"]);
//
const totalUsedVacationCount = computed(() => props.myVacations.length);
// +
const usedVacations = computed(() => props.myVacations.map(v => ({ ...v, type: "used" })));
const receivedVacations = computed(() => props.receivedVacations.map(v => ({ ...v, type: "received" })));
const mergedVacations = computed(() => {
return [...usedVacations.value, ...receivedVacations.value].sort(
(a, b) => new Date(b.date) - new Date(a.date)
const usedVacations = computed(() =>
props.myVacations.map(v => ({ ...v, type: "used" }))
);
const receivedVacations = computed(() =>
props.receivedVacations.map(v => ({ ...v, type: "received" }))
);
//
const mergedVacations = computed(() => {
return [...usedVacations.value, ...receivedVacations.value].sort(
(a, b) => new Date(b.date) - new Date(a.date)
);
});
// ( )
const getVacationIndex = (index) => {
let count = 0;
for (let i = 0; i <= index; i++) {
const v = mergedVacations.value[i];
count += v.used_quota; //
}
return count;
};
// (YYYY-MM-DD)
const formatDate = (dateString) => {
const date = new Date(dateString);
return date.toISOString().split("T")[0]; // YYYY-MM-DD
const date = new Date(dateString);
return date.toISOString().split("T")[0]; // YYYY-MM-DD
};
const closeModal = () => {
emit("close");
emit("close");
};
</script>
<style scoped>
/* 모달 스타일 */
.modal-dialog {
display: flex;
justify-content: center;
align-items: center;
display: flex;
justify-content: center;
align-items: center;
}
/* 스크롤 가능한 모달 */
.modal-content {
max-height: 60vh;
overflow-y: auto;
padding: 20px;
width: 75%;
background: white;
border-radius: 8px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
max-height: 60vh;
overflow-y: auto;
padding: 20px;
width: 75%;
background: white;
border-radius: 8px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}
/* 닫기 버튼 */
.close-btn {
position: absolute;
top: 10px;
right: 10px;
background: none;
border: none;
font-size: 18px;
cursor: pointer;
font-weight: bold;
position: absolute;
top: 10px;
right: 10px;
background: none;
border: none;
font-size: 18px;
cursor: pointer;
font-weight: bold;
}
/* 리스트 기본 스타일 */
.vacation-list {
list-style-type: none;
padding-left: 0;
margin-top: 15px;
list-style-type: none;
padding-left: 0;
margin-top: 15px;
}
/* 리스트 아이템 */
.vacation-item {
display: flex;
align-items: center;
font-size: 16px;
font-weight: bold;
margin-bottom: 8px;
padding: 5px 10px;
border-radius: 5px;
background: #f9f9f9;
display: flex;
align-items: center;
font-size: 16px;
font-weight: bold;
margin-bottom: 8px;
padding: 5px 10px;
border-radius: 5px;
background: #f9f9f9;
}
/* 인덱스 (연차 사용 개수) */
.vacation-index {
font-weight: bold;
font-size: 16px;
margin-right: 8px;
color: #333;
font-weight: bold;
font-size: 16px;
margin-right: 8px;
color: #333;
}
/* "-" 빨간색 */
.minus-symbol {
color: red;
font-weight: bold;
margin-right: 8px;
color: red;
font-weight: bold;
margin-right: 8px;
}
/* "+" 파란색 */
.plus-symbol {
color: blue;
font-weight: bold;
margin-right: 8px;
color: blue;
font-weight: bold;
margin-right: 8px;
}
/* 날짜 스타일 */
.vacation-date {
font-size: 16px;
color: #333;
font-size: 16px;
color: #333;
}
/* 연차 유형 스타일 */
.vacation-type {
font-size: 14px;
font-weight: normal;
color: gray;
margin-left: 5px;
}
/* 연차 데이터 없음 */
.no-data {
text-align: center;
font-size: 14px;
color: gray;
margin-top: 10px;
text-align: center;
font-size: 14px;
color: gray;
margin-top: 10px;
}
</style>

View File

@ -190,6 +190,8 @@ const fetchGeneralPosts = async (page = 1) => {
console.log(data)
const totalPosts = data.data.total; //
console.log('📌 API 응답 데이터:', data.data);
generalList.value = data.data.list.map((post, index) => ({
realId: post.id,
id: totalPosts - ((page - 1) * selectedSize.value) - index,

View File

@ -94,7 +94,11 @@
@updateReaction="handleUpdateReaction"
@submitComment="handleCommentReply"
/>
<Pagination/>
<Pagination
v-if="pagination.pages"
v-bind="pagination"
@update:currentPage="handlePageChange"
/>
</div>
</div>
</div>
@ -103,7 +107,7 @@
</template>
<script setup>
import BoardCommentArea from '@c/board/BoardComentArea.vue';
import BoardCommentArea from '@/components/board/BoardCommentArea.vue';
import BoardProfile from '@c/board/BoardProfile.vue';
import BoardCommentList from '@c/board/BoardCommentList.vue';
import BoardRecommendBtn from '@c/button/BoardRecommendBtn.vue';
@ -141,6 +145,21 @@ const passwordAlert = ref("");
const isPassword = ref(false);
const lastClickedButton = ref("");
const pagination = ref({
currentPage: 1,
pages: 1,
prePage: 0,
nextPage: 1,
isFirstPage: true,
isLastPage: false,
hasPreviousPage: false,
hasNextPage: false,
navigatePages: 10,
navigatepageNums: [1],
navigateFirstPage: 1,
navigateLastPage: 1
});
//
const fetchBoardDetails = async () => {
@ -202,10 +221,13 @@ const handleUpdateReaction = async ({ boardId, commentId, isLike, isDislike }) =
};
//
const fetchComments = async () => {
const fetchComments = async (page = 1) => {
try {
const response = await axios.get(`board/${currentBoardId.value}/comments`, {
params: { LOCBRDSEQ: currentBoardId.value }
params: {
LOCBRDSEQ: currentBoardId.value,
page
}
});
console.log("목록 API 응답 데이터:", response.data);
@ -240,6 +262,22 @@ const fetchComments = async () => {
// console.log(" comments :", comments.value);
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) {
console.error('댓글 목록 불러오기 오류:', error);
}
@ -372,6 +410,14 @@ const deletePost = async () => {
}
};
//
const handlePageChange = (page) => {
if (page !== pagination.value.currentPage) {
pagination.value.currentPage = page;
fetchComments(page);
}
};
//
const formattedDate = (dateString) => {
if (!dateString) return "날짜 없음";

View File

@ -99,6 +99,7 @@ const handleProfileClick = async (user) => {
if (user.MEMBERSEQ === userStore.user.id) {
//
const response = await axios.get(`vacation/history`);
console.log(response)
if (response.status === 200 && response.data) {
myVacations.value = response.data.data.usedVacations || [];