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

@ -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

@ -37,20 +37,14 @@
<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">
<i class="bx bx-edit me-2"></i>
<strong>수정 정보</strong>
</div>
<div class="ms-4 mt-2">
<p class="mb-1">{{ logData.updateDate }}</p> <p class="mb-1">{{ logData.updateDate }}</p>
<p class="mb-0 text-muted">[{{ logData.updater }}] 프로젝트 수정</p> <strong>[{{ logData.updater }}] 프로젝트 수정</strong>
</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

@ -4,28 +4,35 @@
<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"
class="vacation-item"
>
<!-- Used 항목만 인덱스 표시 -->
<span v-if="vac.category === 'used'" class="vacation-index">
{{ usedVacationIndexMap[vac._expandIndex] }})
</span> </span>
<span :class="vacation.type === 'used' ? 'minus-symbol' : 'plus-symbol'">
{{ vacation.type === 'used' ? '-' : '+' }} <span :class="vac.category === 'used' ? 'minus-symbol' : 'plus-symbol'">
{{ vac.category === 'used' ? '-' : '+' }}
</span> </span>
<span <span
:style="{ color: userColors[vacation.senderId || vacation.receiverId] || '#000' }" :style="{ color: userColors[vac.senderId || vac.receiverId] || '#000' }"
class="vacation-date" class="vacation-date"
> >
{{ formatDate(vacation.date) }} {{ formatDate(vac.date) }}
</span> </span>
</li> </li>
</ol> </ol>
</div> </div>
<!-- 연차 데이터 없음 --> <!-- 연차 데이터 없음 -->
<p v-if="mergedVacations.length === 0" class="no-data"> <p v-else class="no-data">
🚫 사용한 연차가 없습니다. 🚫 사용한 연차가 없습니다.
</p> </p>
</div> </div>
@ -53,60 +60,101 @@ const props = defineProps({
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 {
display: flex;
justify-content: center;
align-items: center;
}
/* 스크롤 가능한 모달 */
.modal-content { .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;
} }
/* 닫기 버튼 */ /* 닫기 버튼 */
@ -118,7 +166,6 @@ const closeModal = () => {
border: none; border: none;
font-size: 18px; font-size: 18px;
cursor: pointer; cursor: pointer;
font-weight: bold;
} }
/* 리스트 기본 스타일 */ /* 리스트 기본 스타일 */
@ -168,14 +215,6 @@ const closeModal = () => {
color: #333; color: #333;
} }
/* 연차 유형 스타일 */
.vacation-type {
font-size: 14px;
font-weight: normal;
color: gray;
margin-left: 5px;
}
/* 연차 데이터 없음 */ /* 연차 데이터 없음 */
.no-data { .no-data {
text-align: center; text-align: center;

View File

@ -1,9 +1,31 @@
<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"> </div>
<!-- 프로젝트 목록 -->
<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 #title> 프로젝트 등록 </template>
<template #body> <template #body>
<FormInput <FormInput
@ -56,38 +78,106 @@
/> />
</template> </template>
<template #footer> <template #footer>
<button class="btn btn-secondary" @click="closeModal">Close</button> <BackButton @click="closeCreateModal" />
<button class="btn btn-primary" @click="handleSubmit">Save</button> <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> </template>
</CenterModal> </CenterModal>
</div>
<ProjectCardList :category="selectedCategory" />
</template> </template>
<script setup> <script setup>
import { computed, inject, ref, watch, onMounted } from 'vue';
import SearchBar from '@c/search/SearchBar.vue'; import SearchBar from '@c/search/SearchBar.vue';
import ProjectCardList from '@c/list/ProjectCardList.vue'; import ProjectCard from '@c/list/ProjectCard.vue';
import CategoryBtn from '@c/category/CategoryBtn.vue'; import CategoryBtn from '@c/category/CategoryBtn.vue';
import commonApi from '@/common/commonApi';
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 today = dayjs().format('YYYY-MM-DD');
const toastStore = useToastStore(); const toastStore = useToastStore();
const userStore = useUserInfoStore(); const userStore = useUserInfoStore();
//
const user = ref(null); const user = ref(null);
const projectList = ref([]);
const filteredProjects = ref([]);
const selectedCategory = ref(null);
const searchText = ref('');
//
const isCreateModalOpen = ref(false);
const name = ref(''); const name = ref('');
const color = ref(''); const color = ref('');
const address = ref(''); const address = ref('');
@ -96,43 +186,80 @@
const startDay = ref(today); const startDay = ref(today);
const endDay = ref(''); const endDay = ref('');
const description = ref(''); const description = ref('');
const isModalOpen = ref(false);
const nameAlert = ref(false); const nameAlert = ref(false);
const addressAlert = ref(false); const addressAlert = ref(false);
const openModal = () => { //
isModalOpen.value = true; const isEditModalOpen = ref(false);
}; const originalColor = ref('');
const selectedProject = ref({
const closeModal = () => { PROJCTSEQ: '',
isModalOpen.value = false; PROJCTNAM: '',
}; PROJCTSTR: '',
PROJCTEND: '',
PROJCTZIP: '',
const selectedCategory = ref(null); PROJCTARR: '',
PROJCTDTL: '',
PROJCTDES: '',
PROJCTCOL: '',
projctcolor: '',
});
// API
const { yearCategory, colorList } = commonApi({ const { yearCategory, colorList } = commonApi({
loadColor: true, loadColor: true,
colorType: 'YNP', colorType: 'YNP',
loadYearCategory: true, loadYearCategory: true,
}); });
// //
const getProjectList = async () => {
const res = await $api.get('project/select', {
params: {
searchKeyword : searchText.value,
category : selectedYear.value,
},
});
projectList.value = res.data.data.projectList;
};
//
const search = async (searchKeyword) => {
searchText.value = searchKeyword.trim();
await getProjectList();
};
const selectedYear = computed(() => {
if (!selectedCategory.value || selectedCategory.value === 900101) {
return null;
}
// category label
return yearCategory.value.find(item => item.value === selectedCategory.value)?.label || null;
});
//
watch(selectedCategory, async () => {
await getProjectList();
});
//
const openCreateModal = () => {
isCreateModalOpen.value = true;
};
const closeCreateModal = () => {
isCreateModalOpen.value = false;
};
// ::
const handleAddressUpdate = addressData => { const handleAddressUpdate = addressData => {
address.value = addressData.address; address.value = addressData.address;
detailAddress.value = addressData.detailAddress; detailAddress.value = addressData.detailAddress;
postcode.value = addressData.postcode; postcode.value = addressData.postcode;
}; };
const handleCreate = async () => {
onMounted(async () => {
await userStore.userInfo(); //
user.value = userStore.user;
});
const handleSubmit = async () => {
nameAlert.value = name.value.trim() === ''; nameAlert.value = name.value.trim() === '';
addressAlert.value = address.value.trim() === ''; addressAlert.value = address.value.trim() === '';
@ -154,10 +281,86 @@
.then(res => { .then(res => {
if (res.status === 200) { if (res.status === 200) {
toastStore.onToast('프로젝트가 등록되었습니다.', 's'); toastStore.onToast('프로젝트가 등록되었습니다.', 's');
closeModal(); closeCreateModal();
location.reload(); location.reload();
} }
}) });
}; };
//
const openEditModal = (post) => {
isEditModalOpen.value = true;
selectedProject.value = { ...post };
originalColor.value = post.PROJCTCOL;
};
const closeEditModal = () => {
isEditModalOpen.value = false;
};
// +
const allColors = computed(() => {
const existingColor = { value: selectedProject.value.PROJCTCOL, label: selectedProject.value.projctcolor };
return [existingColor, ...colorList.value];
});
//
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) => {
@ -124,7 +141,7 @@ 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,53 +1,52 @@
<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"> <div class="container col-6 mt-12 mb-8">
<search-bar @update:data="search" /> <search-bar @update:data="search" />
</div> </div>
<!-- 글쓰기 -->
<div class="container col-2 px-12 py-2">
<router-link to="/board/write">
<WriteButton />
</router-link>
</div>
<div class="row g-3">
<!-- 셀렉트 박스 -->
<div class="col-12 col-md-auto">
<select class="form-select" v-model="selectedOrder" @change="handleSortChange">
<option value="date">최신날짜</option>
<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>
<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">
<!-- 리스트 갯수 선택 --> <!-- 리스트 갯수 선택 -->
<div class="container col-1 px-0 py-2"> <select class="form-select w-25 w-md-100" v-model="selectedSize" @change="handleSizeChange">
<select class="form-select" v-model="selectedSize" @change="handleSizeChange">
<option value="10">10개씩</option> <option value="10">10개씩</option>
<option value="20">20개씩</option> <option value="20">20개씩</option>
<option value="30">30개씩</option> <option value="30">30개씩</option>
<option value="50">50개씩</option> <option value="50">50개씩</option>
</select> </select>
<!-- 셀렉트 박스 -->
<select class="form-select w-25 w-md-100" v-model="selectedOrder" @change="handleSortChange">
<option value="date">최신날짜</option>
<option value="views">조회수</option>
</select>
<!-- 공지 접기 기능 -->
<div class="form-check mb-0 ms-2">
<input class="form-check-input" type="checkbox" v-model="showNotices" id="hideNotices" />
<label class="form-check-label" for="hideNotices">공지 숨기기</label>
</div> </div>
</div> </div>
<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>
<br>
<!-- 게시판 --> <!-- 게시판 -->
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-bordered"> <table class="datatables-users table border-top dataTable dtr-column">
<thead class="table-light"> <thead>
<tr> <tr>
<th style="width: 8%;">번호</th> <th style="width: 11%;" class="text-center">번호</th>
<th style="width: 50%;">제목</th> <th style="width: 45%;" class="text-center">제목</th>
<th style="width: 15%;">작성자</th> <th style="width: 10%;" class="text-center">작성자</th>
<th style="width: 12%;">작성일</th> <th style="width: 15%;" class="text-center">작성일</th>
<th style="width: 10%;">조회수</th> <th style="width: 9%;" class="text-center">조회수</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -57,16 +56,16 @@
:key="'notice-' + index" :key="'notice-' + index"
class="bg-label-gray" class="bg-label-gray"
@click="goDetail(notice.id)"> @click="goDetail(notice.id)">
<td>공지</td> <td class="text-center">공지</td>
<td> <td>
📌 {{ notice.title }} 📌 {{ notice.title }}
<i v-if="notice.img" class="bi bi-image me-1"></i> <i v-if="notice.img" class="bi bi-image me-1"></i>
<i v-if="notice.hasAttachment" class="bi bi-paperclip"></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> <span v-if="isNewPost(notice.date)" class="badge bg-danger text-white ms-2 fs-tiny">N</span>
</td> </td>
<td>{{ notice.author }}</td> <td class="text-center">{{ notice.author }}</td>
<td>{{ notice.date }}</td> <td class="text-center">{{ notice.date }}</td>
<td>{{ notice.views }}</td> <td class="text-center">{{ notice.views }}</td>
</tr> </tr>
</template> </template>
<!-- 일반 게시물 --> <!-- 일반 게시물 -->
@ -74,21 +73,22 @@
:key="'post-' + index" :key="'post-' + index"
class="invert-bg-white" class="invert-bg-white"
@click="goDetail(post.realId)"> @click="goDetail(post.realId)">
<td>{{ post.id }}</td> <td class="text-center">{{ post.id }}</td>
<td> <td>
{{ post.title }} {{ post.title }}
<i v-if="post.img" class="bi bi-image me-1"></i> <i v-if="post.img" class="bi bi-image me-1"></i>
<i v-if="post.hasAttachment" class="bi bi-paperclip"></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> <span v-if="isNewPost(post.date)" class="badge bg-danger text-white ms-2 fs-tiny">N</span>
</td> </td>
<td>{{ post.author }}</td> <td class="text-center">{{ post.author }}</td>
<td>{{ post.date }}</td> <td class="text-center">{{ post.date }}</td>
<td>{{ post.views }}</td> <td class="text-center">{{ post.views }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
<div class="card-footer">
<!-- 페이지네이션 --> <!-- 페이지네이션 -->
<div class="row g-3"> <div class="row g-3">
<div class="mt-8"> <div class="mt-8">
@ -100,6 +100,8 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</template> </template>
<script setup> <script setup>
@ -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)
.filter(([date, type]) => type !== "delete")
.map(([date, type]) => ({
title: getVacationType(type), title: getVacationType(type),
start: date, start: date,
backgroundColor: "rgba(0, 128, 0, 0.3)", backgroundColor: "rgb(113 212 243 / 76%)",
textColor: "#fff", //
display: "background", display: "background",
classNames: [getVacationTypeClass(type)], 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 = [...fetchedEvents.value, ...selectedEvents]; calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents];
} }
/** /**
@ -222,27 +227,43 @@ 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)) { // :
if (selectedDates.value.has(clickedDateStr)) {
selectedDates.value.delete(clickedDateStr);
updateCalendarEvents();
return; return;
} }
if (!selectedDates.value.has(clickedDateStr)) {
// ( )
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 const type = halfDayType.value
? halfDayType.value === "AM" ? (halfDayType.value === "AM" ? "700101" : "700102")
? "700101"
: "700102"
: "700103"; : "700103";
selectedDates.value.set(clickedDateStr, type); selectedDates.value.set(clickedDateStr, type);
} else {
selectedDates.value.delete(clickedDateStr);
} }
halfDayType.value = null; halfDayType.value = null;
updateCalendarEvents(); updateCalendarEvents();
} }
@ -260,18 +281,24 @@ 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;
// ( )
myVacations.value = vacationList.filter(
(vac) => vac.MEMBERSEQ === userStore.user.id
);
// saved
const events = vacationList 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);
@ -289,33 +316,50 @@ try {
/** /**
* 휴가 요청 추가 (선택된 날짜를 백엔드로 전송) * 휴가 요청 추가 (선택된 날짜를 백엔드로 전송)
*/ */
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)
)
.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 { try {
const response = await axios.post("vacation", vacationRequests); 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();
const year = currentDate.getFullYear(); await loadCalendarData(currentDate.getFullYear(), currentDate.getMonth() + 1);
const month = String(currentDate.getMonth() + 1).padStart(2, "0"); // :
loadCalendarData(year, month);
selectedDates.value.clear(); selectedDates.value.clear();
updateCalendarEvents(); 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">
@ -50,6 +50,7 @@
:item="item" :item="item"
:cateList="cateList" :cateList="cateList"
@refreshWordList="getwordList" @refreshWordList="getwordList"
@updateChecked="updateCheckedItems"
/> />
</ul> </ul>
@ -60,6 +61,10 @@
</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;