Merge remote-tracking branch 'origin/main' into board-comment

This commit is contained in:
kimdaae328 2025-02-21 09:55:47 +09:00
commit c46bda283f
18 changed files with 904 additions and 685 deletions

View File

@ -118,6 +118,22 @@ const toggleComment = () => {
isComment.value = !isComment.value; isComment.value = !isComment.value;
}; };
// &
const password = ref('');
const passwordAlert = ref('');
const isPassword = ref(false);
const isEditTextarea = ref(false);
const lastClickedButton = ref("");
const toggleEdit = (status) => {
if (props.unknown) {
isPassword.value = status; //
lastClickedButton.value = "edit";
} else {
isEditTextarea.value = status; //
}
};
// //
const submitComment = (newComment) => { const submitComment = (newComment) => {
emit('submitComment', { parentId: props.comment.commentId, ...newComment }); emit('submitComment', { parentId: props.comment.commentId, ...newComment });

View File

@ -22,21 +22,21 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { defineEmits, ref } from "vue"; import { defineEmits, ref } from "vue";
const emit = defineEmits(["toggleHalfDay", "addVacationRequests"]); const emit = defineEmits(["toggleHalfDay", "addVacationRequests"]);
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);
}; };
const addVacationRequests = () => { const addVacationRequests = () => {
emit("addVacationRequests"); emit("addVacationRequests");
}; };
</script> </script>
<style scoped> <style scoped>

View File

@ -12,6 +12,7 @@
v-model="inputValue" v-model="inputValue"
:maxLength="maxlength" :maxLength="maxlength"
:placeholder="title" :placeholder="title"
:disabled="disabled"
/> />
<div class="invalid-feedback" :class="isAlert ? 'display-block' : ''"> <div class="invalid-feedback" :class="isAlert ? 'display-block' : ''">
{{ title }} 확인해주세요. {{ title }} 확인해주세요.
@ -60,6 +61,10 @@ const props = defineProps({
default: true, default: true,
required: false, required: false,
}, },
disabled: {
type: Boolean,
default: false,
}
}); });
// Emits // Emits

View File

@ -5,7 +5,7 @@
<span :class="isEssential ? 'link-danger' : 'none'">*</span> <span :class="isEssential ? 'link-danger' : 'none'">*</span>
</label> </label>
<div :class="isRow ? 'col-md-10' : 'col-md-12'"> <div :class="isRow ? 'col-md-10' : 'col-md-12'">
<select class="form-select" :id="name" v-model="selectData"> <select class="form-select" :id="name" v-model="selectData" :disabled="disabled">
<option v-for="(item, i) in data" :key="i" :value="isCommon ? item.value : i"> <option v-for="(item, i) in data" :key="i" :value="isCommon ? item.value : i">
{{ isCommon ? item.label : item }} {{ isCommon ? item.label : item }}
</option> </option>
@ -63,6 +63,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
required: false, required: false,
},
disabled: {
type: Boolean,
default: false
} }
}); });

View File

@ -34,23 +34,17 @@
</div> </div>
</div> </div>
</div> </div>
<CenterModal :display="isModalOpen" @close="closeModal"> <CenterModal :display="isModalOpen" @close="closeModal" >
<template #title> Log </template> <template #title> Log </template>
<template #body> <template #body>
<div class="ms-4 mt-2" v-if="logData"> <div class="border border-3 rounded p-5 ms-4 mt-2" v-if="logData">
<p class="mb-1">{{ logData.createDate }}</p> <p class="mb-1">{{ logData.createDate }}</p>
<strong class="">[{{ logData.creator }}] 프로젝트 등록</strong> <strong class="">[{{ logData.creator }}] 프로젝트 등록</strong>
</div> </div>
<div class="log-item" v-if="logData?.updateDate"> <div class="border border-3 rounded p-5 ms-4 mt-2" v-if="logData?.updateDate">
<div class="d-flex align-items-center"> <p class="mb-1">{{ logData.updateDate }}</p>
<i class="bx bx-edit me-2"></i> <strong>[{{ logData.updater }}] 프로젝트 수정</strong>
<strong>수정 정보</strong>
</div>
<div class="ms-4 mt-2">
<p class="mb-1">{{ logData.updateDate }}</p>
<p class="mb-0 text-muted">[{{ logData.updater }}] 프로젝트 수정</p>
</div>
</div> </div>
</template> </template>

View File

@ -1,190 +0,0 @@
<template>
<div class="mt-4">
<div v-if="projectList.length === 0" class="text-center">
<p class="text-muted mt-4">게시물이 없습니다.</p>
</div>
<div v-for="post in projectList" :key="post.PROJCTSEQ" @click="openModal(post)" class="cursor-pointer">
<ProjectCard
:title="post.PROJCTNAM"
:description="post.PROJCTDES"
:strdate="post.PROJCTSTR"
:enddate="post.PROJCTEND"
:address="post.PROJCTARR + ' ' + post.PROJCTDTL"
:projctSeq="post.PROJCTSEQ"
:projctCol="post.projctcolor"
/>
</div>
<CenterModal :display="isModalOpen" @close="closeModal">
<template #title> 프로젝트 수정 </template>
<template #body>
<FormInput
title="이름"
name="name"
:is-essential="true"
:is-alert="nameAlert"
v-model="selectedProject.PROJCTNAM"
/>
<FormSelect
title="컬러"
name="color"
:is-essential="true"
:is-label="true"
:is-common="true"
:data="allColors"
v-model="selectedProject.PROJCTCOL"
/>
<FormInput
title="시작일"
type="date"
name="startDay"
v-model="selectedProject.PROJCTSTR"
:is-essential="true"
/>
<FormInput
title="종료일"
type="date"
name="endDay"
v-model="selectedProject.PROJCTEND"
/>
<FormInput
title="설명"
name="description"
v-model="selectedProject.PROJCTDES"
/>
<ArrInput
title="주소"
name="address"
:is-essential="true"
:is-row="true"
v-model="selectedProject"
@update:data="updateAddress"
/>
</template>
<template #footer>
<button class="btn btn-secondary" @click="closeModal">Close</button>
<button class="btn btn-primary" @click="handleSubmit">Save</button>
</template>
</CenterModal>
</div>
</template>
<script setup>
import { computed, ref } from 'vue';
import ProjectCard from './ProjectCard.vue';
import { onMounted } from 'vue';
import $api from '@api';
import CenterModal from '@c/modal/CenterModal.vue';
import FormInput from '@c/input/FormInput.vue';
import FormSelect from '@c/input/FormSelect.vue';
import commonApi from '@/common/commonApi';
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: '',
PROJCTSTR: '',
PROJCTEND: '',
PROJCTZIP: '',
PROJCTARR: '',
PROJCTDTL: '',
PROJCTDES: '',
PROJCTCOL: '',
projctcolor:'',
});
const { colorList } = commonApi({
loadColor: true,
colorType: 'YNP',
});
onMounted(async () => {
getProjectList();
await userStore.userInfo(); //
user.value = userStore.user;
});
//
const getProjectList = () => {
$api.get('project/select').then(res => {
projectList.value = res.data.data.projectList;
});
};
const openModal = (post) => {
isModalOpen.value = true;
originalColor.value = post.PROJCTCOL;
selectedProject.value = { ...post };
};
const closeModal = () => {
isModalOpen.value = false;
};
// +
const allColors = computed(() => {
//
const existingColor = { value: selectedProject.value.PROJCTCOL, label: selectedProject.value.projctcolor };
// colorList
return [existingColor, ...colorList.value];
});
const updateAddress = (addressData) => {
selectedProject.value = {
...selectedProject.value,
PROJCTZIP: addressData.postcode,
PROJCTARR: addressData.address,
PROJCTDTL: addressData.detailAddress
};
};
const handleSubmit = () => {
console.log(selectedProject.value.PROJCTCOL)
console.log(originalColor.value)
$api.patch('project/update', {
projctSeq: selectedProject.value.PROJCTSEQ,
projctNam: selectedProject.value.PROJCTNAM,
projctCol: selectedProject.value.PROJCTCOL,
projctArr: selectedProject.value.PROJCTARR,
projctDtl: selectedProject.value.PROJCTDTL,
projctZip: selectedProject.value.PROJCTZIP,
projctStr: selectedProject.value.PROJCTSTR,
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');
closeModal();
location.reload();
}
})
};
</script>

View File

@ -68,12 +68,12 @@
{ {
date: new Date().toISOString().split("T")[0], date: new Date().toISOString().split("T")[0],
type: "700103", type: "700103",
senderId: props.targetUser.senderId,
receiverId: props.targetUser.MEMBERSEQ, receiverId: props.targetUser.MEMBERSEQ,
count: grantCount.value, count: grantCount.value,
}, },
]; ];
console.log(props.targetUser)
console.log(payload)
const response = await axios.post("vacation", payload); const response = await axios.post("vacation", payload);
console.log(response) console.log(response)
if (response.data && response.data.status === "OK") { if (response.data && response.data.status === "OK") {

View File

@ -1,116 +1,164 @@
<template> <template>
<div v-if="isOpen" class="modal-dialog" @click.self="closeModal"> <div v-if="isOpen" class="modal-dialog" @click.self="closeModal">
<div class="modal-content modal-scroll"> <div class="modal-content modal-scroll">
<h5 class="modal-title">📅 연차 사용 내역</h5> <h5 class="modal-title">📅 연차 사용 내역</h5>
<button class="close-btn" @click="closeModal"></button> <button class="close-btn" @click="closeModal"></button>
<!-- 연차 사용 받은 연차 리스트 --> <!-- 연차 목록 -->
<div class="modal-body" v-if="mergedVacations.length > 0"> <div class="modal-body" v-if="mergedVacations.length > 0">
<ol class="vacation-list"> <ol class="vacation-list">
<li v-for="(vacation, index) in mergedVacations" :key="index" class="vacation-item"> <li
<span v-if="vacation.type === 'used'" class="vacation-index"> v-for="(vac, index) in mergedVacations"
{{ getVacationIndex(index) }}) :key="vac._expandIndex"
</span> class="vacation-item"
<span :class="vacation.type === 'used' ? 'minus-symbol' : 'plus-symbol'"> >
{{ vacation.type === 'used' ? '-' : '+' }} <!-- Used 항목만 인덱스 표시 -->
</span> <span v-if="vac.category === 'used'" class="vacation-index">
<span {{ usedVacationIndexMap[vac._expandIndex] }})
:style="{ color: userColors[vacation.senderId || vacation.receiverId] || '#000' }" </span>
class="vacation-date"
>
{{ formatDate(vacation.date) }}
</span>
</li>
</ol>
</div>
<!-- 연차 데이터 없음 --> <span :class="vac.category === 'used' ? 'minus-symbol' : 'plus-symbol'">
<p v-if="mergedVacations.length === 0" class="no-data"> {{ vac.category === 'used' ? '-' : '+' }}
🚫 사용한 연차가 없습니다. </span>
</p>
<span
:style="{ color: userColors[vac.senderId || vac.receiverId] || '#000' }"
class="vacation-date"
>
{{ formatDate(vac.date) }}
</span>
</li>
</ol>
</div> </div>
<!-- 연차 데이터 없음 -->
<p v-else class="no-data">
🚫 사용한 연차가 없습니다.
</p>
</div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits, computed } from "vue"; import { defineProps, defineEmits, computed } from "vue";
const props = defineProps({ const props = defineProps({
isOpen: Boolean, isOpen: Boolean,
myVacations: { myVacations: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
receivedVacations: { receivedVacations: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
userColors: { userColors: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
}); });
const emit = defineEmits(["close"]); const emit = defineEmits(["close"]);
// + /**
const usedVacations = computed(() => * 1) Used 휴가를 used_quota만큼 펼치기
props.myVacations.map(v => ({ ...v, type: "used" })) * - category: "used"
); * - code: 휴가 코드(: LOCVACTYP)
* - _expandIndex: 항목마다 고유한 확장 인덱스 (누적 인덱스 매핑에 사용)
const receivedVacations = computed(() => */
props.receivedVacations.map(v => ({ ...v, type: "received" })) let globalCounter = 0; //
); const usedVacations = computed(() => {
const result = [];
// props.myVacations.forEach((v) => {
const mergedVacations = computed(() => { const count = v.used_quota || 1;
return [...usedVacations.value, ...receivedVacations.value].sort( for (let i = 0; i < count; i++) {
(a, b) => new Date(b.date) - new Date(a.date) result.push({
); ...v,
category: "used",
code: v.LOCVACTYP, // (700103 )
_expandIndex: globalCounter++,
});
}
});
return result;
}); });
// ( ) /**
const getVacationIndex = (index) => { * 2) Received 휴가: category: "received"
let count = 0; */
for (let i = 0; i <= index; i++) { const receivedVacations = computed(() =>
const v = mergedVacations.value[i]; props.receivedVacations.map((v) => ({
count += v.used_quota; // ...v,
} category: "received",
return count; }))
}; );
// (YYYY-MM-DD) /**
* 3) Used 휴가만 날짜 오름차순 정렬 누적 인덱스 계산
* - type === "700103"이면 +1
* - 외이면 +0.5
*/
const sortedUsedVacationsAsc = computed(() => {
return [...usedVacations.value].sort((a, b) => {
return new Date(a.date) - new Date(b.date) || (a._expandIndex - b._expandIndex);
});
});
const usedVacationIndexMap = computed(() => {
let cumulative = 0;
const map = {};
sortedUsedVacationsAsc.value.forEach((item) => {
const increment = item.type === "700103" ? 1 : 0.5;
cumulative += increment;
map[item._expandIndex] = cumulative;
});
return map;
});
/**
* 4) 최종 표시할 merged 리스트 (Used + Received)
* - 날짜 내림차순 정렬 (최신 과거)
*/
const mergedVacations = computed(() => {
const all = [...usedVacations.value, ...receivedVacations.value];
// +
all.sort((a, b) => {
const dateDiff = new Date(b.date) - new Date(a.date);
if (dateDiff !== 0) return dateDiff;
return b._expandIndex - a._expandIndex;
});
return all;
});
/** 날짜 포맷 (YYYY-MM-DD) */
const formatDate = (dateString) => { const formatDate = (dateString) => {
const date = new Date(dateString); if (!dateString) return "";
return date.toISOString().split("T")[0]; // YYYY-MM-DD // dateString "YYYY-MM-DD"
// "YYYY-MM-DD..." 10
return dateString.substring(0, 10);
}; };
/** 모달 닫기 */
const closeModal = () => { const closeModal = () => {
emit("close"); emit("close");
}; };
</script> </script>
<style scoped> <style scoped>
/* 모달 스타일 */ /* 모달 본문 */
.modal-dialog { .modal-content {
display: flex;
justify-content: center;
align-items: center;
}
/* 스크롤 가능한 모달 */
.modal-content {
max-height: 60vh;
overflow-y: auto;
padding: 20px;
width: 75%;
background: white; background: white;
border-radius: 8px; padding: 20px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); border-radius: 12px;
} width: 400px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
text-align: center;
position: relative;
}
/* 닫기 버튼 */ /* 닫기 버튼 */
.close-btn { .close-btn {
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 10px; right: 10px;
@ -118,18 +166,17 @@ const closeModal = () => {
border: none; border: none;
font-size: 18px; font-size: 18px;
cursor: pointer; cursor: pointer;
font-weight: bold; }
}
/* 리스트 기본 스타일 */ /* 리스트 기본 스타일 */
.vacation-list { .vacation-list {
list-style-type: none; list-style-type: none;
padding-left: 0; padding-left: 0;
margin-top: 15px; margin-top: 15px;
} }
/* 리스트 아이템 */ /* 리스트 아이템 */
.vacation-item { .vacation-item {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 16px; font-size: 16px;
@ -138,49 +185,41 @@ const closeModal = () => {
padding: 5px 10px; padding: 5px 10px;
border-radius: 5px; border-radius: 5px;
background: #f9f9f9; background: #f9f9f9;
} }
/* 인덱스 (연차 사용 개수) */ /* 인덱스 (연차 사용 개수) */
.vacation-index { .vacation-index {
font-weight: bold; font-weight: bold;
font-size: 16px; font-size: 16px;
margin-right: 8px; margin-right: 8px;
color: #333; color: #333;
} }
/* "-" 빨간색 */ /* "-" 빨간색 */
.minus-symbol { .minus-symbol {
color: red; color: red;
font-weight: bold; font-weight: bold;
margin-right: 8px; margin-right: 8px;
} }
/* "+" 파란색 */ /* "+" 파란색 */
.plus-symbol { .plus-symbol {
color: blue; color: blue;
font-weight: bold; font-weight: bold;
margin-right: 8px; margin-right: 8px;
} }
/* 날짜 스타일 */ /* 날짜 스타일 */
.vacation-date { .vacation-date {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
} }
/* 연차 유형 스타일 */ /* 연차 데이터 없음 */
.vacation-type { .no-data {
font-size: 14px;
font-weight: normal;
color: gray;
margin-left: 5px;
}
/* 연차 데이터 없음 */
.no-data {
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
color: gray; color: gray;
margin-top: 10px; margin-top: 10px;
} }
</style> </style>

View File

@ -1,163 +1,366 @@
<template> <template>
<SearchBar /> <SearchBar @update:data="search"/>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<CategoryBtn :lists="yearCategory" v-model:selectedCategory="selectedCategory" /> <CategoryBtn :lists="yearCategory" @update:data="selectedCategory = $event" />
<WriteBtn class="mt-2 ms-auto" @click="openModal" /> <WriteBtn class="mt-2 ms-auto" @click="openCreateModal" />
<CenterModal :display="isModalOpen" @close="closeModal">
<template #title> 프로젝트 등록 </template>
<template #body>
<FormInput
title="이름"
name="name"
:is-essential="true"
:is-alert="nameAlert"
@update:modelValue="name = $event"
/>
<FormSelect
title="컬러"
name="color"
:is-essential="true"
:is-label="true"
:is-common="true"
:data="colorList"
@update:data="color = $event"
/>
<FormInput
title="시작 일"
type="date"
name="startDay"
v-model="startDay"
:is-essential="true"
/>
<FormInput
title="종료 일"
name="endDay"
:type="'date'"
@update:modelValue="endDay = $event"
/>
<FormInput
title="설명"
name="description"
@update:modelValue="description = $event"
/>
<ArrInput
title="주소"
name="address"
:isEssential="true"
:is-row="true"
:is-alert="addressAlert"
@update:data="handleAddressUpdate"
@update:alert="addressAlert = $event"
/>
</template>
<template #footer>
<button class="btn btn-secondary" @click="closeModal">Close</button>
<button class="btn btn-primary" @click="handleSubmit">Save</button>
</template>
</CenterModal>
</div> </div>
<ProjectCardList :category="selectedCategory" />
<!-- 프로젝트 목록 -->
<div class="mt-4">
<div v-if="projectList.length === 0" class="text-center">
<p class="text-muted mt-4">게시물이 없습니다.</p>
</div>
<div v-for="post in projectList" :key="post.PROJCTSEQ" @click="openEditModal(post)" class="cursor-pointer">
<ProjectCard
:title="post.PROJCTNAM"
:description="post.PROJCTDES"
:strdate="post.PROJCTSTR"
:enddate="post.PROJCTEND"
:address="post.PROJCTARR + ' ' + post.PROJCTDTL"
:projctSeq="post.PROJCTSEQ"
:projctCol="post.projctcolor"
/>
</div>
</div>
<!-- 등록 모달 -->
<CenterModal :display="isCreateModalOpen" @close="closeCreateModal">
<template #title> 프로젝트 등록 </template>
<template #body>
<FormInput
title="이름"
name="name"
:is-essential="true"
:is-alert="nameAlert"
@update:modelValue="name = $event"
/>
<FormSelect
title="컬러"
name="color"
:is-essential="true"
:is-label="true"
:is-common="true"
:data="colorList"
@update:data="color = $event"
/>
<FormInput
title="시작 일"
type="date"
name="startDay"
v-model="startDay"
:is-essential="true"
/>
<FormInput
title="종료 일"
name="endDay"
:type="'date'"
@update:modelValue="endDay = $event"
/>
<FormInput
title="설명"
name="description"
@update:modelValue="description = $event"
/>
<ArrInput
title="주소"
name="address"
:isEssential="true"
:is-row="true"
:is-alert="addressAlert"
@update:data="handleAddressUpdate"
@update:alert="addressAlert = $event"
/>
</template>
<template #footer>
<BackButton @click="closeCreateModal" />
<SaveButton @click="handleCreate" />
</template>
</CenterModal>
<!-- 수정 모달 -->
<CenterModal :display="isEditModalOpen" @close="closeEditModal">
<template #title> 프로젝트 수정 </template>
<template #body>
<FormInput
title="이름"
name="name"
:is-essential="true"
:is-alert="nameAlert"
:modelValue="selectedProject.PROJCTNAM"
@update:modelValue="selectedProject.PROJCTNAM = $event"
/>
<FormSelect
title="컬러"
name="color"
:is-essential="true"
:is-label="true"
:is-common="true"
:data="allColors"
:value="selectedProject.PROJCTCOL"
@update:data="selectedProject.PROJCTCOL = $event"
/>
<FormInput
title="시작일"
type="date"
name="startDay"
:is-essential="true"
:modelValue="selectedProject.PROJCTSTR"
@update:modelValue="selectedProject.PROJCTSTR = $event"
/>
<FormInput
title="종료일"
type="date"
name="endDay"
:modelValue="selectedProject.PROJCTEND"
@update:modelValue="selectedProject.PROJCTEND = $event"
/>
<FormInput
title="설명"
name="description"
:modelValue="selectedProject.PROJCTDES"
@update:modelValue="selectedProject.PROJCTDES = $event"
/>
<ArrInput
title="주소"
name="address"
:is-essential="true"
:is-row="true"
:modelValue="selectedProject"
@update:data="updateAddress"
/>
</template>
<template #footer>
<BackButton @click="closeEditModal" />
<SaveButton @click="handleUpdate" />
</template>
</CenterModal>
</template> </template>
<script setup> <script setup>
import SearchBar from '@c/search/SearchBar.vue'; import { computed, inject, ref, watch, onMounted } from 'vue';
import ProjectCardList from '@c/list/ProjectCardList.vue'; import SearchBar from '@c/search/SearchBar.vue';
import CategoryBtn from '@c/category/CategoryBtn.vue'; import ProjectCard from '@c/list/ProjectCard.vue';
import commonApi from '@/common/commonApi'; import CategoryBtn from '@c/category/CategoryBtn.vue';
import { inject, onMounted, ref } from 'vue'; import WriteBtn from '@c/button/WriteBtn.vue';
import WriteBtn from '@c/button/WriteBtn.vue'; import CenterModal from '@c/modal/CenterModal.vue';
import CenterModal from '@c/modal/CenterModal.vue'; import FormSelect from '@c/input/FormSelect.vue';
import FormSelect from '@c/input/FormSelect.vue'; import FormInput from '@c/input/FormInput.vue';
import FormInput from '@c/input/FormInput.vue'; import ArrInput from '@c/input/ArrInput.vue';
import ArrInput from '@c/input/ArrInput.vue'; import commonApi from '@/common/commonApi';
import { useToastStore } from '@s/toastStore'; import { useToastStore } from '@s/toastStore';
import $api from '@api'; import { useUserInfoStore } from '@/stores/useUserInfoStore';
import { useUserInfoStore } from '@/stores/useUserInfoStore'; import $api from '@api';
import SaveButton from '@c/button/SaveBtn.vue';
import BackButton from '@c/button/BackBtn.vue'
const dayjs = inject('dayjs'); const dayjs = inject('dayjs');
const today = dayjs().format('YYYY-MM-DD');
const toastStore = useToastStore();
const userStore = useUserInfoStore();
const today = dayjs().format('YYYY-MM-DD'); //
const user = ref(null);
const projectList = ref([]);
const filteredProjects = ref([]);
const selectedCategory = ref(null);
const searchText = ref('');
const toastStore = useToastStore(); //
const userStore = useUserInfoStore(); const isCreateModalOpen = ref(false);
const name = ref('');
const color = ref('');
const address = ref('');
const detailAddress = ref('');
const postcode = ref('');
const startDay = ref(today);
const endDay = ref('');
const description = ref('');
const nameAlert = ref(false);
const addressAlert = ref(false);
const user = ref(null); //
const isEditModalOpen = ref(false);
const originalColor = ref('');
const selectedProject = ref({
PROJCTSEQ: '',
PROJCTNAM: '',
PROJCTSTR: '',
PROJCTEND: '',
PROJCTZIP: '',
PROJCTARR: '',
PROJCTDTL: '',
PROJCTDES: '',
PROJCTCOL: '',
projctcolor: '',
});
const name = ref(''); // API
const color = ref(''); const { yearCategory, colorList } = commonApi({
const address = ref(''); loadColor: true,
const detailAddress = ref(''); colorType: 'YNP',
const postcode = ref(''); loadYearCategory: true,
const startDay = ref(today); });
const endDay = ref('');
const description = ref('');
const isModalOpen = ref(false); //
const nameAlert = ref(false); const getProjectList = async () => {
const addressAlert = ref(false); const res = await $api.get('project/select', {
params: {
const openModal = () => { searchKeyword : searchText.value,
isModalOpen.value = true; category : selectedYear.value,
}; },
const closeModal = () => {
isModalOpen.value = false;
};
const selectedCategory = ref(null);
const { yearCategory, colorList } = commonApi({
loadColor: true,
colorType: 'YNP',
loadYearCategory: true,
}); });
projectList.value = res.data.data.projectList;
};
// //
const handleAddressUpdate = addressData => { const search = async (searchKeyword) => {
address.value = addressData.address; searchText.value = searchKeyword.trim();
detailAddress.value = addressData.detailAddress; await getProjectList();
postcode.value = addressData.postcode; };
};
const selectedYear = computed(() => {
if (!selectedCategory.value || selectedCategory.value === 900101) {
return null;
}
// category label
return yearCategory.value.find(item => item.value === selectedCategory.value)?.label || null;
});
onMounted(async () => { //
await userStore.userInfo(); // watch(selectedCategory, async () => {
user.value = userStore.user; await getProjectList();
}); });
const handleSubmit = async () => { //
const openCreateModal = () => {
isCreateModalOpen.value = true;
};
nameAlert.value = name.value.trim() === ''; const closeCreateModal = () => {
addressAlert.value = address.value.trim() === ''; isCreateModalOpen.value = false;
};
if (nameAlert.value || addressAlert.value ) { // ::
return; const handleAddressUpdate = addressData => {
address.value = addressData.address;
detailAddress.value = addressData.detailAddress;
postcode.value = addressData.postcode;
};
const handleCreate = async () => {
nameAlert.value = name.value.trim() === '';
addressAlert.value = address.value.trim() === '';
if (nameAlert.value || addressAlert.value) {
return;
}
$api.post('project/insert', {
projctNam: name.value,
projctCol: color.value,
projctStr: startDay.value,
projctEnd: endDay.value || null,
projctDes: description.value || null,
projctArr: address.value,
projctDtl: detailAddress.value,
projctZip: postcode.value,
projctCmb: user.value.name,
})
.then(res => {
if (res.status === 200) {
toastStore.onToast('프로젝트가 등록되었습니다.', 's');
closeCreateModal();
location.reload();
} }
});
};
$api.post('project/insert', { //
projctNam: name.value, const openEditModal = (post) => {
projctCol: color.value, isEditModalOpen.value = true;
projctStr: startDay.value, selectedProject.value = { ...post };
projctEnd: endDay.value || null, originalColor.value = post.PROJCTCOL;
projctDes: description.value || null, };
projctArr: address.value,
projctDtl: detailAddress.value, const closeEditModal = () => {
projctZip: postcode.value, isEditModalOpen.value = false;
projctCmb: user.value.name, };
})
.then(res => { // +
if (res.status === 200) { const allColors = computed(() => {
toastStore.onToast('프로젝트가 등록되었습니다.', 's'); const existingColor = { value: selectedProject.value.PROJCTCOL, label: selectedProject.value.projctcolor };
closeModal(); return [existingColor, ...colorList.value];
location.reload(); });
}
}) //
const hasChanges = computed(() => {
const original = projectList.value.find(p => p.PROJCTSEQ === selectedProject.value.PROJCTSEQ);
if (!original) return false;
return (
original.PROJCTNAM !== selectedProject.value.PROJCTNAM ||
original.PROJCTCOL !== selectedProject.value.PROJCTCOL ||
original.PROJCTARR !== selectedProject.value.PROJCTARR ||
original.PROJCTDTL !== selectedProject.value.PROJCTDTL ||
original.PROJCTZIP !== selectedProject.value.PROJCTZIP ||
original.PROJCTSTR !== selectedProject.value.PROJCTSTR ||
original.PROJCTEND !== selectedProject.value.PROJCTEND ||
original.PROJCTDES !== selectedProject.value.PROJCTDES
);
});
// ::
const updateAddress = (addressData) => {
selectedProject.value = {
...selectedProject.value,
PROJCTZIP: addressData.postcode,
PROJCTARR: addressData.address,
PROJCTDTL: addressData.detailAddress
}; };
};
const handleUpdate = () => {
if (!hasChanges.value) {
toastStore.onToast('변경된 내용이 없습니다.', 'e');
return;
}
$api.patch('project/update', {
projctSeq: selectedProject.value.PROJCTSEQ,
projctNam: selectedProject.value.PROJCTNAM,
projctCol: selectedProject.value.PROJCTCOL,
projctArr: selectedProject.value.PROJCTARR,
projctDtl: selectedProject.value.PROJCTDTL,
projctZip: selectedProject.value.PROJCTZIP,
projctStr: selectedProject.value.PROJCTSTR,
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');
closeEditModal();
location.reload();
}
});
};
onMounted(async () => {
await getProjectList();
await userStore.userInfo();
user.value = userStore.user;
});
</script> </script>

View File

@ -5,7 +5,7 @@
:key="index" :key="index"
class="avatar pull-up" class="avatar pull-up"
:class="{ 'opacity-100': isUserDisabled(user) }" :class="{ 'opacity-100': isUserDisabled(user) }"
@click="toggleDisable(index)" @click.stop="toggleDisable(index)"
data-bs-toggle="tooltip" data-bs-toggle="tooltip"
data-popup="tooltip-custom" data-popup="tooltip-custom"
data-bs-placement="top" data-bs-placement="top"

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="card-body d-flex justify-content-center"> <div class="card-body d-flex justify-content-center">
<ul class="list-unstyled d-flex align-items-center gap-3 mb-0 mt-2"> <ul class="list-unstyled d-flex align-items-center gap-5 mb-0 mt-2">
<li <li
v-for="(user, index) in sortedUserList" v-for="(user, index) in sortedUserList"
:key="index" :key="index"
@ -10,7 +10,7 @@
:aria-label="user.MEMBERSEQ" :aria-label="user.MEMBERSEQ"
> >
<img <img
class="rounded-circle user-avatar " class="rounded-circle"
:src="getUserProfileImage(user.MEMBERPRF)" :src="getUserProfileImage(user.MEMBERPRF)"
alt="user" alt="user"
:style="getDynamicStyle(user)" :style="getDynamicStyle(user)"
@ -96,10 +96,10 @@
const profileSize = computed(() => { const profileSize = computed(() => {
const totalUsers = userList.value.length; const totalUsers = userList.value.length;
if (totalUsers <= 7) return "120px"; // 7 if (totalUsers <= 7) return "100px"; // 7
if (totalUsers <= 10) return "100px"; // ~10 if (totalUsers <= 10) return "80px"; // ~10
if (totalUsers <= 20) return "80px"; // ~20 if (totalUsers <= 20) return "60px"; // ~20
return "60px"; // 20 return "40px"; // 20
}); });
// //

View File

@ -43,6 +43,9 @@ const selectAlphabet = (alphabet) => {
</script> </script>
<style scoped> <style scoped>
.btn {
min-width: 56px;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.alphabet-list { .alphabet-list {

View File

@ -13,7 +13,15 @@
/> />
<div v-else> <div v-else>
<div class="d-flex align-items-center"> <input
v-if="userStore.user.role == 'ROLE_ADMIN'"
type="checkbox"
class="form-check-input admin-chk"
:name="item.WRDDICSEQ"
id=""
@change="toggleCheck($event)"
>
<div class="d-flex align-ite-center">
<div class="w-100 d-flex align-items-center"> <div class="w-100 d-flex align-items-center">
<span class="btn btn-primary pe-none">{{ item.category }}</span> <span class="btn btn-primary pe-none">{{ item.category }}</span>
<strong class="mx-2 w-75">{{ item.WRDDICTTL }}</strong> <strong class="mx-2 w-75">{{ item.WRDDICTTL }}</strong>
@ -34,7 +42,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="d-flex justify-content-between flex-wrap gap-2 mb-2"> <div
v-if="item.author.createdAt !== item.lastEditor.updatedAt"
class="d-flex justify-content-between flex-wrap gap-2 mb-2"
>
<div class="d-flex flex-wrap align-items-center mb-50"> <div class="d-flex flex-wrap align-items-center mb-50">
<div class="avatar avatar-sm me-2"> <div class="avatar avatar-sm me-2">
<img <img
@ -64,6 +75,11 @@ import EditBtn from '@/components/button/EditBtn.vue';
import $api from '@api'; import $api from '@api';
import DictWrite from './DictWrite.vue'; import DictWrite from './DictWrite.vue';
import { useUserInfoStore } from '@s/useUserInfoStore';
//
const userStore = useUserInfoStore();
const toastStore = useToastStore(); const toastStore = useToastStore();
const { appContext } = getCurrentInstance(); const { appContext } = getCurrentInstance();
@ -87,7 +103,7 @@ const localCateList = ref([...props.cateList]);
const selectedCategory = ref(''); const selectedCategory = ref('');
// cateList emit // cateList emit
const emit = defineEmits(['update:cateList','refreshWordList']); const emit = defineEmits(['update:cateList','refreshWordList', 'updateChecked']);
// //
const isWriteVisible = ref(false); const isWriteVisible = ref(false);
@ -171,6 +187,12 @@ const formatDate = (dateString) => new Date(dateString).toLocaleString();
// //
const getProfileImage = (imagePath) => const getProfileImage = (imagePath) =>
imagePath ? `${baseUrl}upload/img/profile/${imagePath}` : '/img/avatars/default-Profile.jpg'; imagePath ? `${baseUrl}upload/img/profile/${imagePath}` : '/img/avatars/default-Profile.jpg';
//
const toggleCheck = (event) => {
emit('updateChecked', event.target.checked, props.item.WRDDICSEQ, event.target.name);
};
</script> </script>
<style scoped> <style scoped>
@ -185,4 +207,12 @@ const getProfileImage = (imagePath) =>
right: 0.7rem; right: 0.7rem;
top: 1.2rem; top: 1.2rem;
} }
.admin-chk {
position: absolute;
left: -0.5rem;
top: -0.5rem;
--bs-form-check-bg: #fff;
}
</style> </style>

View File

@ -10,10 +10,11 @@
@update:data="selectCategory = $event" @update:data="selectCategory = $event"
@change="onChange" @change="onChange"
:value="formValue" :value="formValue"
:disabled="isDisabled"
/> />
</div> </div>
<div class="col-2 btn-margin"> <div class="col-2 btn-margin">
<PlusBtn @click="toggleInput"/> <PlusBtn v-if="userStore.user.role == 'ROLE_ADMIN'" @click="toggleInput"/>
</div> </div>
</div> </div>
@ -37,6 +38,7 @@
:is-alert="wordTitleAlert" :is-alert="wordTitleAlert"
:modelValue="titleValue" :modelValue="titleValue"
@update:modelValue="wordTitle = $event" @update:modelValue="wordTitle = $event"
:disabled="isDisabled"
/> />
</div> </div>
<div> <div>
@ -56,6 +58,13 @@ import QEditor from '@/components/editor/QEditor.vue';
import FormInput from '@/components/input/FormInput.vue'; import FormInput from '@/components/input/FormInput.vue';
import FormSelect from '@/components/input/FormSelect.vue'; import FormSelect from '@/components/input/FormSelect.vue';
import PlusBtn from '../button/PlusBtn.vue'; import PlusBtn from '../button/PlusBtn.vue';
import { useUserInfoStore } from '@s/useUserInfoStore';
//
const userStore = useUserInfoStore();
// disabled
const isDisabled = computed(() => userStore.user.role !== 'ROLE_ADMIN');
const emit = defineEmits(['close','addCategory','addWord']); const emit = defineEmits(['close','addCategory','addWord']);
@ -73,6 +82,11 @@ const addCategoryAlert = ref(false);
// //
const selectCategory = ref(''); const selectCategory = ref('');
//
const computedTitle = computed(() =>
wordTitle.value === '' ? props.titleValue : wordTitle.value
);
// //
const selectedCategory = computed(() => const selectedCategory = computed(() =>
selectCategory.value === '' ? props.formValue : selectCategory.value selectCategory.value === '' ? props.formValue : selectCategory.value
@ -104,15 +118,18 @@ const toggleInput = () => {
showInput.value = !showInput.value; showInput.value = !showInput.value;
}; };
// //
const saveInput = () => { const saveInput = () => {
if(addCategory.value == ''){ if(addCategory.value == ''){
addCategoryAlert.value = true; addCategoryAlert.value = true;
return; return;
}else {
addCategoryAlert.value = false;
} }
// console.log(' !',addCategory.value); // console.log(' !',addCategory.value);
emit('addCategory', addCategory.value); emit('addCategory', addCategory.value);
showInput.value = false; // showInput.value = false;
}; };
const onChange = (newValue) => { const onChange = (newValue) => {
@ -122,9 +139,9 @@ const onChange = (newValue) => {
// //
const saveWord = () => { const saveWord = () => {
//validation //validation
// //
if(wordTitle.value == ''){ if(computedTitle.value == '' || computedTitle.length == 0){
wordTitleAlert.value = true; wordTitleAlert.value = true;
return; return;
} }
@ -137,7 +154,7 @@ const saveWord = () => {
const wordData = { const wordData = {
id: props.NumValue || null, id: props.NumValue || null,
title: wordTitle.value, title: computedTitle.value,
category: selectedCategory.value, category: selectedCategory.value,
content: content.value, content: content.value,
}; };

View File

@ -1,102 +1,104 @@
<template> <template>
<div class="container flex-grow-1 container-p-y"> <div class="container flex-grow-1 container-p-y">
<div class="row mb-4"> <div class="card">
<!-- 검색창 --> <div class="card-header">
<div class="container col-8 px-3"> <!-- 검색창 -->
<search-bar @update:data="search" /> <div class="container col-6 mt-12 mb-8">
</div> <search-bar @update:data="search" />
<!-- 글쓰기 --> </div>
<div class="container col-2 px-12 py-2">
<router-link to="/board/write">
<WriteButton />
</router-link>
</div> </div>
<div class="card-datatable">
<div class="row mx-6 my-6 justify-content-between g-3 align-items-center">
<div class="col-md-6 d-flex flex-column flex-md-row align-items-md-center gap-2 mt-0">
<!-- 리스트 갯수 선택 -->
<select class="form-select w-25 w-md-100" v-model="selectedSize" @change="handleSizeChange">
<option value="10">10개씩</option>
<option value="20">20개씩</option>
<option value="30">30개씩</option>
<option value="50">50개씩</option>
</select>
<div class="row g-3"> <!-- 셀렉트 박스 -->
<!-- 셀렉트 박스 --> <select class="form-select w-25 w-md-100" v-model="selectedOrder" @change="handleSortChange">
<div class="col-12 col-md-auto"> <option value="date">최신날짜</option>
<select class="form-select" v-model="selectedOrder" @change="handleSortChange"> <option value="views">조회수</option>
<option value="date">최신날짜</option> </select>
<option value="views">조회수</option>
</select>
</div>
<!-- 공지 접기 기능 -->
<div class="container col-1 px-0 py-2">
<label>
<input type="checkbox" v-model="showNotices" /> 공지 숨기기
</label>
</div>
<!-- 리스트 갯수 선택 -->
<div class="container col-1 px-0 py-2">
<select class="form-select" v-model="selectedSize" @change="handleSizeChange">
<option value="10">10개씩</option>
<option value="20">20개씩</option>
<option value="30">30개씩</option>
<option value="50">50개씩</option>
</select>
</div>
</div>
</div>
<br>
<!-- 게시판 -->
<div class="table-responsive">
<table class="table table-bordered">
<thead class="table-light">
<tr>
<th style="width: 8%;">번호</th>
<th style="width: 50%;">제목</th>
<th style="width: 15%;">작성자</th>
<th style="width: 12%;">작성일</th>
<th style="width: 10%;">조회수</th>
</tr>
</thead>
<tbody>
<!-- 공지사항 -->
<template v-if="pagination.currentPage === 1 && !showNotices">
<tr v-for="(notice, index) in noticeList"
:key="'notice-' + index"
class="bg-label-gray"
@click="goDetail(notice.id)">
<td>공지</td>
<td>
📌 {{ notice.title }}
<i v-if="notice.img" class="bi bi-image me-1"></i>
<i v-if="notice.hasAttachment" class="bi bi-paperclip"></i>
<span v-if="isNewPost(notice.date)" class="badge bg-danger text-white ms-2 fs-tiny">N</span>
</td>
<td>{{ notice.author }}</td>
<td>{{ notice.date }}</td>
<td>{{ notice.views }}</td>
</tr>
</template>
<!-- 일반 게시물 -->
<tr v-for="(post, index) in generalList"
:key="'post-' + index"
class="invert-bg-white"
@click="goDetail(post.realId)">
<td>{{ post.id }}</td>
<td>
{{ post.title }}
<i v-if="post.img" class="bi bi-image me-1"></i>
<i v-if="post.hasAttachment" class="bi bi-paperclip"></i>
<span v-if="isNewPost(post.date)" class="badge bg-danger text-white ms-2 fs-tiny">N</span>
</td>
<td>{{ post.author }}</td>
<td>{{ post.date }}</td>
<td>{{ post.views }}</td>
</tr>
</tbody>
</table>
</div>
<!-- 페이지네이션 --> <!-- 공지 접기 기능 -->
<div class="row g-3"> <div class="form-check mb-0 ms-2">
<div class="mt-8"> <input class="form-check-input" type="checkbox" v-model="showNotices" id="hideNotices" />
<Pagination <label class="form-check-label" for="hideNotices">공지 숨기기</label>
v-if="pagination.pages" </div>
v-bind="pagination" </div>
@update:currentPage="handlePageChange" <div class="col-md-6 d-flex flex-column flex-md-row align-items-md-center justify-content-md-end gap-2">
/> <!-- 글쓰기 -->
<router-link to="/board/write" class="ms-2">
<WriteButton class="btn add-new btn-primary"/>
</router-link>
</div>
</div>
<!-- 게시판 -->
<div class="table-responsive">
<table class="datatables-users table border-top dataTable dtr-column">
<thead>
<tr>
<th style="width: 11%;" class="text-center">번호</th>
<th style="width: 45%;" class="text-center">제목</th>
<th style="width: 10%;" class="text-center">작성자</th>
<th style="width: 15%;" class="text-center">작성일</th>
<th style="width: 9%;" class="text-center">조회수</th>
</tr>
</thead>
<tbody>
<!-- 공지사항 -->
<template v-if="pagination.currentPage === 1 && !showNotices">
<tr v-for="(notice, index) in noticeList"
:key="'notice-' + index"
class="bg-label-gray"
@click="goDetail(notice.id)">
<td class="text-center">공지</td>
<td>
📌 {{ notice.title }}
<i v-if="notice.img" class="bi bi-image me-1"></i>
<i v-if="notice.hasAttachment" class="bi bi-paperclip"></i>
<span v-if="isNewPost(notice.date)" class="badge bg-danger text-white ms-2 fs-tiny">N</span>
</td>
<td class="text-center">{{ notice.author }}</td>
<td class="text-center">{{ notice.date }}</td>
<td class="text-center">{{ notice.views }}</td>
</tr>
</template>
<!-- 일반 게시물 -->
<tr v-for="(post, index) in generalList"
:key="'post-' + index"
class="invert-bg-white"
@click="goDetail(post.realId)">
<td class="text-center">{{ post.id }}</td>
<td>
{{ post.title }}
<i v-if="post.img" class="bi bi-image me-1"></i>
<i v-if="post.hasAttachment" class="bi bi-paperclip"></i>
<span v-if="isNewPost(post.date)" class="badge bg-danger text-white ms-2 fs-tiny">N</span>
</td>
<td class="text-center">{{ post.author }}</td>
<td class="text-center">{{ post.date }}</td>
<td class="text-center">{{ post.views }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<!-- 페이지네이션 -->
<div class="row g-3">
<div class="mt-8">
<Pagination
v-if="pagination.pages"
v-bind="pagination"
@update:currentPage="handlePageChange"
/>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -262,4 +264,9 @@ onMounted(() => {
</script> </script>
<style scoped> <style scoped>
@media (max-width: 768px) {
.w-md-100 {
width: 100% !important;
}
}
</style> </style>

View File

@ -98,6 +98,7 @@
<BoardCommentList <BoardCommentList
:unknown="unknown" :unknown="unknown"
:comments="comments" :comments="comments"
<<<<<<< HEAD
:isCommentPassword="isCommentPassword" :isCommentPassword="isCommentPassword"
:isEditTextarea="isEditTextarea" :isEditTextarea="isEditTextarea"
:passwordAlert="passwordAlert" :passwordAlert="passwordAlert"
@ -109,6 +110,11 @@
@commentDeleted="handleCommentDeleted" @commentDeleted="handleCommentDeleted"
@cancelEdit="handleCancelEdit" @cancelEdit="handleCancelEdit"
@submitEdit="handleSubmitEdit" @submitEdit="handleSubmitEdit"
=======
@updateReaction="handleCommentReaction"
@submitComment="handleCommentReply"
@commentDeleted="handleCommentDeleted"
>>>>>>> origin/main
/> />
<Pagination <Pagination
v-if="pagination.pages" v-if="pagination.pages"
@ -516,7 +522,7 @@ const submitPassword = async () => {
} }
lastClickedButton.value = null; lastClickedButton.value = null;
} else { } else {
passwordAlert.value = "비밀번호가 일치하지 않습니다."; passwordAlert.value = "비밀번호가 일치하지 않습니다.????";
} }
} catch (error) { } catch (error) {
// console.log("📌 :", error); // console.log("📌 :", error);

View File

@ -9,16 +9,16 @@
@profileClick="handleProfileClick" @profileClick="handleProfileClick"
:remainingVacationData="remainingVacationData" :remainingVacationData="remainingVacationData"
/> />
<div class="card-body"> <div class="card-body w-75 p-3 align-self-center">
<VacationModal <VacationModal
v-if="isModalOpen" v-if="isModalOpen"
:isOpen="isModalOpen" :isOpen="isModalOpen"
:myVacations="myVacations" :myVacations="myVacations"
:receivedVacations="receivedVacations" :receivedVacations="receivedVacations"
:userColors="userColors" :userColors="userColors"
@click="handleProfileClick(user)"
@close="isModalOpen = false" @close="isModalOpen = false"
/> />
<VacationGrantModal <VacationGrantModal
v-if="isGrantModalOpen" v-if="isGrantModalOpen"
:isOpen="isGrantModalOpen" :isOpen="isGrantModalOpen"
@ -34,7 +34,7 @@
/> />
<HalfDayButtons <HalfDayButtons
@toggleHalfDay="toggleHalfDay" @toggleHalfDay="toggleHalfDay"
@addVacationRequests="addVacationRequests" @addVacationRequests="saveVacationChanges"
/> />
</div> </div>
</div> </div>
@ -99,7 +99,6 @@ const handleProfileClick = async (user) => {
if (user.MEMBERSEQ === userStore.user.id) { if (user.MEMBERSEQ === userStore.user.id) {
// //
const response = await axios.get(`vacation/history`); const response = await axios.get(`vacation/history`);
console.log(response)
if (response.status === 200 && response.data) { if (response.status === 200 && response.data) {
myVacations.value = response.data.data.usedVacations || []; myVacations.value = response.data.data.usedVacations || [];
@ -188,23 +187,29 @@ const getVacationType = (typeCode) => {
return vacationCodeMap.value[typeCode] || "기타"; return vacationCodeMap.value[typeCode] || "기타";
}; };
/**
* API 이벤트(fetchedEvents) 사용자가 선택한 날짜(selectedDates) 병합하여
* calendarEvents를 업데이트하는 함수
* - 선택 이벤트는 display: "background" 옵션을 사용하여 배경으로 표시
* - 선택된 타입에 따라 클래스(selected-am, selected-pm, selected-full) 부여함
*/
function updateCalendarEvents() { function updateCalendarEvents() {
const selectedEvents = Array.from(selectedDates.value).map(([date, type]) => { // ( ): type "delete"
return { const selectedEvents = Array.from(selectedDates.value)
title: getVacationType(type), .filter(([date, type]) => type !== "delete")
start: date, .map(([date, type]) => ({
backgroundColor: "rgba(0, 128, 0, 0.3)", title: getVacationType(type),
display: "background", start: date,
classNames: [getVacationTypeClass(type)], backgroundColor: "rgb(113 212 243 / 76%)",
}; textColor: "#fff", //
}); display: "background",
calendarEvents.value = [...fetchedEvents.value, ...selectedEvents]; classNames: [getVacationTypeClass(type), "selected-event"]
}));
// ,
//
const filteredFetchedEvents = fetchedEvents.value.filter(event => {
if (event.saved) { // saved
return selectedDates.value.get(event.start) !== "delete";
}
return true;
});
calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents];
} }
/** /**
@ -221,30 +226,46 @@ calendarEvents.value = [...fetchedEvents.value, ...selectedEvents];
* - 주말(, ) 공휴일은 클릭되지 않음 * - 주말(, ) 공휴일은 클릭되지 않음
* - 클릭 해당 날짜를 selectedDates에 추가 또는 제거한 updateCalendarEvents() 호출 * - 클릭 해당 날짜를 selectedDates에 추가 또는 제거한 updateCalendarEvents() 호출
*/ */
function handleDateClick(info) { function handleDateClick(info) {
const clickedDateStr = info.dateStr; const clickedDateStr = info.dateStr; // "YYYY-MM-DD"
const clickedDate = info.date; const clickedDate = info.date;
const todayStr = new Date().toISOString().split("T")[0];
// (:6, :0) // , ,
if (clickedDate.getDay() === 0 || clickedDate.getDay() === 6) { if (
clickedDate.getDay() === 0 ||
clickedDate.getDay() === 6 ||
holidayDates.value.has(clickedDateStr) ||
clickedDateStr < todayStr
) {
return; return;
} }
//
if (holidayDates.value.has(clickedDateStr)) { // :
return; if (selectedDates.value.has(clickedDateStr)) {
}
if (!selectedDates.value.has(clickedDateStr)) {
const type = halfDayType.value
? halfDayType.value === "AM"
? "700101"
: "700102"
: "700103";
selectedDates.value.set(clickedDateStr, type);
} else {
selectedDates.value.delete(clickedDateStr); selectedDates.value.delete(clickedDateStr);
} updateCalendarEvents();
halfDayType.value = null; return;
updateCalendarEvents(); }
// ( )
const unsentVacation = myVacations.value.find(
(vac) => vac.LOCVACUDT && vac.LOCVACUDT.startsWith(clickedDateStr) && !vac.LOCVACRMM
);
if (unsentVacation) {
// , "delete" (, )
selectedDates.value.set(clickedDateStr, "delete");
} else {
// : halfDayType
const type = halfDayType.value
? (halfDayType.value === "AM" ? "700101" : "700102")
: "700103";
selectedDates.value.set(clickedDateStr, type);
}
halfDayType.value = null;
updateCalendarEvents();
} }
/** /**
@ -257,66 +278,89 @@ halfDayType.value = halfDayType.value === type ? null : type;
/** /**
* 백엔드에서 휴가 데이터를 가져와 이벤트로 변환 * 백엔드에서 휴가 데이터를 가져와 이벤트로 변환
*/ */
async function fetchVacationData(year, month) { async function fetchVacationData(year, month) {
try { try {
const response = await axios.get(`vacation/list/${year}/${month}`); const response = await axios.get(`vacation/list/${year}/${month}`);
if (response.status == 200) { if (response.status === 200) {
const vacationList = response.data; const vacationList = response.data;
const events = vacationList // ( )
myVacations.value = vacationList.filter(
(vac) => vac.MEMBERSEQ === userStore.user.id
);
// saved
const events = vacationList
.filter((vac) => !vac.LOCVACRMM) // ()
.map((vac) => { .map((vac) => {
let dateStr = vac.LOCVACUDT.split("T")[0]; let dateStr = vac.LOCVACUDT.split("T")[0];
let className = "fc-daygrid-event"; let backgroundColor = userColors.value[vac.MEMBERSEQ] || "#FFFFFF";
let backgroundColor = userColors.value[vac.MEMBERSEQ] || "#FFFFFF"; return {
return {
title: getVacationType(vac.LOCVACTYP), title: getVacationType(vac.LOCVACTYP),
start: dateStr, start: dateStr,
backgroundColor, backgroundColor,
classNames: [getVacationTypeClass(vac.LOCVACTYP)], classNames: [getVacationTypeClass(vac.LOCVACTYP)],
}; saved: true, // saved
};
}) })
.filter((event) => event !== null); .filter((event) => event !== null);
return events; return events;
} else { } else {
console.warn("📌 휴가 데이터를 불러오지 못함"); console.warn("📌 휴가 데이터를 불러오지 못함");
return []; return [];
} }
} catch (error) { } catch (error) {
console.error("Error fetching vacation data:", error); console.error("Error fetching vacation data:", error);
return []; return [];
} }
} }
/** /**
* 휴가 요청 추가 (선택된 날짜를 백엔드로 전송) * 휴가 요청 추가 (선택된 날짜를 백엔드로 전송)
*/ */
async function addVacationRequests() { async function saveVacationChanges() {
if (selectedDates.value.size === 0) { // : selectedDates type "delete"
alert("휴가를 선택해주세요."); const selectedDatesArray = Array.from(selectedDates.value);
return; const vacationsToAdd = selectedDatesArray
} .filter(([date, type]) => type !== "delete")
const vacationRequests = Array.from(selectedDates.value).map(([date, type]) => ({ .filter(([date, type]) =>
date, // , (LOCVACRMM)
type, !myVacations.value.some(vac => vac.LOCVACUDT.startsWith(date)) ||
})); myVacations.value.some(vac => vac.LOCVACUDT.startsWith(date) && vac.LOCVACRMM)
try { )
const response = await axios.post("vacation", vacationRequests); .map(([date, type]) => ({ date, type }));
// : ,
// "delete"
const vacationsToDelete = myVacations.value
.filter(vac => {
const date = vac.LOCVACUDT.split("T")[0];
// "delete"
return selectedDates.value.get(date) === "delete" && !vac.LOCVACRMM;
})
.map(vac => {
const id = vac.LOCVACSEQ ;
return typeof id === "number" ? Number(id) : id;
});
try {
const response = await axios.post("vacation/batchUpdate", {
add: vacationsToAdd,
delete: vacationsToDelete
});
if (response.data && response.data.status === "OK") { if (response.data && response.data.status === "OK") {
alert("휴가가 저장되었습니다."); alert("✅ 휴가 변경 사항이 저장되었습니다.");
await fetchRemainingVacation(); await fetchRemainingVacation();
// const currentDate = fullCalendarRef.value.getApi().getDate();
const currentDate = fullCalendarRef.value.getApi().getDate(); await loadCalendarData(currentDate.getFullYear(), currentDate.getMonth() + 1);
const year = currentDate.getFullYear(); // :
const month = String(currentDate.getMonth() + 1).padStart(2, "0"); selectedDates.value.clear();
loadCalendarData(year, month); updateCalendarEvents();
selectedDates.value.clear();
updateCalendarEvents();
} else { } else {
alert("휴가 저장 중 오류가 발생했습니다."); alert("❌ 휴가 저장 중 오류가 발생했습니다.");
} }
} catch (error) { } catch (error) {
console.error(error); console.error("🚨 휴가 변경 저장 실패:", error);
alert("휴가 저장에 실패했습니다."); alert("휴가 저장 요청에 실패했습니다.");
} }
} }
/** /**
@ -377,5 +421,7 @@ await loadCalendarData(year, month);
</script> </script>
<style> <style>
.fc-bg-event{
}
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="container-xxl flex-grow-1 container-p-y"> <div class="container-xxl flex-grow-1 container-p-y">
<!-- {{ userStore.user.role == 'ROLE_ADMIN' ? '관리자' : '일반인'}} -->
<div class="card p-5"> <div class="card p-5">
<!-- 타이틀, 검색 --> <!-- 타이틀, 검색 -->
<div class="row"> <div class="row">
@ -34,32 +34,37 @@
</div> </div>
</div> </div>
<!-- 용어 리스트 --> <!-- 용어 리스트 -->
<div class="mt-10"> <div class="mt-10">
<!-- 로딩 중일 --> <!-- 로딩 중일 -->
<div v-if="loading">로딩 중...</div> <div v-if="loading">로딩 중...</div>
<!-- 에러 메시지 --> <!-- 에러 메시지 -->
<div v-if="error" class="error">{{ error }}</div> <div v-if="error" class="error">{{ error }}</div>
<!-- 단어 목록 --> <!-- 단어 목록 -->
<ul v-if="total > 0" class="px-0 list-unstyled"> <ul v-if="total > 0" class="px-0 list-unstyled">
<DictCard <DictCard
v-for="item in wordList" v-for="item in wordList"
:key="item.WRDDICSEQ" :key="item.WRDDICSEQ"
:item="item" :item="item"
:cateList="cateList" :cateList="cateList"
@refreshWordList="getwordList" @refreshWordList="getwordList"
/> @updateChecked="updateCheckedItems"
</ul> />
</ul>
<!-- 데이터가 없을 --> <!-- 데이터가 없을 -->
<div v-else-if="!loading && !error" class="card p-5 text-center">용어집의 용어가 없습니다.</div> <div v-else-if="!loading && !error" class="card p-5 text-center">용어집의 용어가 없습니다.</div>
</div> </div>
</div> </div>
<button v-if="isAnyChecked" class="btn btn-danger admin-del-btn">
<i class="bx bx-trash"></i>
</button>
</template> </template>
<script setup> <script setup>
@ -73,6 +78,10 @@
import DictAlphabetFilter from '@/components/wordDict/DictAlphabetFilter.vue'; import DictAlphabetFilter from '@/components/wordDict/DictAlphabetFilter.vue';
import commonApi from '@/common/commonApi'; import commonApi from '@/common/commonApi';
import { useToastStore } from '@s/toastStore'; import { useToastStore } from '@s/toastStore';
import { useUserInfoStore } from '@s/useUserInfoStore';
//
const userStore = useUserInfoStore();
const { appContext } = getCurrentInstance(); const { appContext } = getCurrentInstance();
const $common = appContext.config.globalProperties.$common; const $common = appContext.config.globalProperties.$common;
@ -97,6 +106,11 @@
const selectedCategory = ref(''); const selectedCategory = ref('');
const selectCategory = ref(''); const selectCategory = ref('');
//
const checkedItems = ref([]);
// name
const checkedNames = ref([]);
// //
const selectedAlphabet = ref(''); const selectedAlphabet = ref('');
@ -163,7 +177,6 @@
const addCategory = (data) =>{ const addCategory = (data) =>{
const lastCategory = cateList.value[cateList.value.length - 1]; const lastCategory = cateList.value[cateList.value.length - 1];
const newValue = lastCategory ? lastCategory.value + 1 : 600101; const newValue = lastCategory ? lastCategory.value + 1 : 600101;
axios.post('worddict/insertCategory',{ axios.post('worddict/insertCategory',{
CMNCODNAM: data CMNCODNAM: data
}).then(res => { }).then(res => {
@ -172,6 +185,8 @@
const newCategory = { label: data, value: newValue }; const newCategory = { label: data, value: newValue };
cateList.value = [newCategory, ...cateList.value]; cateList.value = [newCategory, ...cateList.value];
selectedCategory.value = newCategory.value; selectedCategory.value = newCategory.value;
} else if(res.data.message == '이미 존재하는 카테고리명입니다.') {
toastStore.onToast(res.data.message, 'e');
} }
}) })
} }
@ -190,10 +205,34 @@
}) })
}; };
//
const updateCheckedItems = (checked, id, name) => {
if (checked) {
checkedItems.value.push(id);
checkedNames.value.push(name);
} else {
checkedItems.value = checkedItems.value.filter(item => item !== id);
checkedNames.value = checkedNames.value.filter(item => item !== name);
}
// name
console.log("현재 체크된 name 값:", checkedNames.value);
};
const isAnyChecked = computed(() => checkedItems.value.length > 0);
</script> </script>
<style scoped> <style scoped>
.admin-del-btn {
position: fixed;
right: 1.5rem;
bottom: 1.5rem;
width: 3rem;
height: 3rem;
}
.error { .error {
color: red; color: red;
font-weight: bold; font-weight: bold;