Merge branch 'main' into project-list

This commit is contained in:
yoon 2025-02-24 14:56:45 +09:00
commit 76527da74f
7 changed files with 298 additions and 197 deletions

View File

@ -4,8 +4,8 @@
'use strict' 'use strict'
let menu, animate var menu, animate;
;(function () { (function () {
// Initialize menu // Initialize menu
//----------------- //-----------------

View File

@ -5,7 +5,7 @@
<button class="close-btn" @click="closeModal"></button> <button class="close-btn" @click="closeModal"></button>
<div class="modal-body"> <div class="modal-body">
<p>해당 직원에게 부여연차 개수를 선택하세요. (남은 개수: {{ availableQuota }})</p> <p>선물연차 개수를 선택하세요.</p>
<div class="vacation-control"> <div class="vacation-control">
<button @click="decreaseCount" :disabled="grantCount < 2" class="count-btn">-</button> <button @click="decreaseCount" :disabled="grantCount < 2" class="count-btn">-</button>
@ -129,7 +129,7 @@
background: white; background: white;
padding: 20px; padding: 20px;
border-radius: 12px; border-radius: 12px;
width: 400px; width: 300px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15); box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
text-align: center; text-align: center;
position: relative; position: relative;

View File

@ -151,7 +151,7 @@ const closeModal = () => {
background: white; background: white;
padding: 20px; padding: 20px;
border-radius: 12px; border-radius: 12px;
width: 400px; width: 300px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15); box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
text-align: center; text-align: center;
position: relative; position: relative;
@ -222,4 +222,10 @@ const closeModal = () => {
color: gray; color: gray;
margin-top: 10px; margin-top: 10px;
} }
/* 모달 본문 스크롤: 높이가 300px 이상이면 스크롤바 표시 */
.modal-body {
max-height: 130px;
overflow-y: auto;
}
</style> </style>

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-5 mb-0 mt-2"> <ul class="list-unstyled d-flex flex-wrap align-items-center gap-2 mb-0 mt-2">
<li <li
v-for="(user, index) in sortedUserList" v-for="(user, index) in sortedUserList"
:key="index" :key="index"
@ -34,8 +34,8 @@
defineEmits(["profileClick"]); defineEmits(["profileClick"]);
defineProps({ defineProps({
remainingVacationData: Object, remainingVacationData: Object,
}); });
const userStore = useUserInfoStore(); const userStore = useUserInfoStore();
const userListStore = useUserStore(); const userListStore = useUserStore();
@ -47,28 +47,28 @@
const userColors = ref({}); const userColors = ref({});
onMounted(async () => { onMounted(async () => {
await userStore.userInfo(); await userStore.userInfo();
if (userStore.user) { if (userStore.user) {
employeeId.value = userStore.user.id; employeeId.value = userStore.user.id;
} else { } else {
console.error("❌ 로그인한 사용자 정보를 불러오지 못했습니다."); console.error("❌ 로그인한 사용자 정보를 불러오지 못했습니다.");
} }
await userListStore.fetchUserList(); await userListStore.fetchUserList();
userList.value = userListStore.userList; userList.value = userListStore.userList;
// //
userList.value.forEach(user => { userList.value.forEach(user => {
userColors.value[user.MEMBERSEQ] = user.usercolor || "#ccc"; userColors.value[user.MEMBERSEQ] = user.usercolor || "#ccc";
}); });
nextTick(() => { nextTick(() => {
const tooltips = document.querySelectorAll('[data-bs-toggle="tooltip"]'); const tooltips = document.querySelectorAll('[data-bs-toggle="tooltip"]');
tooltips.forEach(tooltip => { tooltips.forEach(tooltip => {
new bootstrap.Tooltip(tooltip); new bootstrap.Tooltip(tooltip);
});
}); });
}); });
});
const sortedUserList = computed(() => { const sortedUserList = computed(() => {
if (!employeeId.value) return userList.value; // if (!employeeId.value) return userList.value; //
@ -78,6 +78,7 @@
return myProfile ? [myProfile, ...otherUsers] : userList.value; return myProfile ? [myProfile, ...otherUsers] : userList.value;
}); });
// URL
const getUserProfileImage = (profilePath) => { const getUserProfileImage = (profilePath) => {
return profilePath && profilePath.trim() return profilePath && profilePath.trim()
? `${baseUrl}upload/img/profile/${profilePath}` ? `${baseUrl}upload/img/profile/${profilePath}`
@ -92,14 +93,12 @@
event.target.style.visibility = "visible"; event.target.style.visibility = "visible";
}; };
// // :
const profileSize = computed(() => { const profileSize = computed(() => {
const totalUsers = userList.value.length; const totalUsers = userList.value.length;
if (totalUsers <= 10) return "68px"; // ~10
if (totalUsers <= 7) return "100px"; // 7 if (totalUsers <= 15) return "50px"; // ~20
if (totalUsers <= 10) return "80px"; // ~10 return "30px"; // 20
if (totalUsers <= 20) return "60px"; // ~20
return "40px"; // 20
}); });
// //
@ -109,18 +108,29 @@
height: profileSize.value, height: profileSize.value,
borderWidth: "4px", borderWidth: "4px",
borderColor: user.usercolor || "#ccc", borderColor: user.usercolor || "#ccc",
borderStyle: "solid", borderStyle: "solid",
}; };
}; };
</script> </script>
<style scoped> <style scoped>
/* 남은 연차 개수 스타일 */ /* 남은 연차 개수 스타일 */
.remaining-vacation { .remaining-vacation {
display: block; display: block;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
color: #333; color: #333;
margin-top: 5px; margin-top: 5px;
} }
/* ul에 flex-wrap을 적용하여 넘치는 프로필이 다음 줄로 내려가도록 함 */
ul {
flex-wrap: wrap;
justify-content: center;
}
/* li 간 간격 조정 */
li {
margin: 5px;
}
</style> </style>

View File

@ -138,6 +138,14 @@ const onChange = (newValue) => {
// //
const saveWord = () => { const saveWord = () => {
// if(addCategory.value == ''){
// addCategoryAlert.value = true;
// return;
// }else {
// addCategoryAlert.value = false;
// }
//validation //validation
// //
@ -158,8 +166,7 @@ const saveWord = () => {
category: selectedCategory.value, category: selectedCategory.value,
content: content.value, content: content.value,
}; };
emit('addWord', wordData ,addCategory.value );
emit('addWord', wordData);
}; };
</script> </script>

View File

@ -1,43 +1,51 @@
<template> <template>
<div class="vacation-management"> <div class="container-xxl flex-grow-1 container-p-y">
<div class="container-xxl flex-grow-1 container-p-y"> <div class="card app-calendar-wrapper">
<div class="card app-calendar-wrapper"> <div class="row g-0">
<div class="row g-0"> <!-- Sidebar: 사이드바 영역 -->
<div class="col app-calendar-content"> <div class="col-3 app-calendar-sidebar border-end" id="app-calendar-sidebar">
<div class="card shadow-none border-0"> <div class="sidebar-content">
<ProfileList <!-- 사원 프로필 리스트 -->
@profileClick="handleProfileClick" <ProfileList
:remainingVacationData="remainingVacationData" @profileClick="handleProfileClick"
/> :remainingVacationData="remainingVacationData"
<div class="card-body w-75 p-3 align-self-center"> />
<!-- 모달에 필터링된 연차 목록 전달 --> <!-- 모달들은 화면 오버레이로 동작하므로 사이드바 내부에 두어도 무방 -->
<VacationModal <VacationModal
v-if="isModalOpen" v-if="isModalOpen"
:isOpen="isModalOpen" :isOpen="isModalOpen"
:myVacations="filteredMyVacations" :myVacations="filteredMyVacations"
:receivedVacations="filteredReceivedVacations" :receivedVacations="filteredReceivedVacations"
:userColors="userColors" :userColors="userColors"
@close="isModalOpen = false" @close="isModalOpen = false"
/> />
<VacationGrantModal
v-if="isGrantModalOpen"
:isOpen="isGrantModalOpen"
:targetUser="selectedUser"
:remainingQuota="remainingVacationData[selectedUser?.MEMBERSEQ] || 0"
@close="isGrantModalOpen = false"
@updateVacation="fetchRemainingVacation"
/>
</div>
<div class="sidebar-actions text-center my-3">
<!-- 액션 버튼 -->
<HalfDayButtons
@toggleHalfDay="toggleHalfDay"
@addVacationRequests="saveVacationChanges"
/>
</div>
</div>
<VacationGrantModal <!-- Main Content: 캘린더 영역 -->
v-if="isGrantModalOpen" <div class="col app-calendar-content">
:isOpen="isGrantModalOpen" <div class="card shadow-none border-0">
:targetUser="selectedUser" <div class="card-body pb-0">
:remainingQuota="remainingVacationData[selectedUser?.MEMBERSEQ] || 0" <full-calendar
@close="isGrantModalOpen = false" ref="fullCalendarRef"
@updateVacation="fetchRemainingVacation" :options="calendarOptions"
/> class="flatpickr-calendar-only"
<full-calendar />
ref="fullCalendarRef"
:options="calendarOptions"
class="flatpickr-calendar-only"
/>
<HalfDayButtons
@toggleHalfDay="toggleHalfDay"
@addVacationRequests="saveVacationChanges"
/>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -47,7 +55,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, ref, onMounted, nextTick, computed } from "vue"; import { reactive, ref, onMounted, nextTick, computed, watch } from "vue";
import axios from "@api"; import axios from "@api";
import FullCalendar from "@fullcalendar/vue3"; import FullCalendar from "@fullcalendar/vue3";
import dayGridPlugin from "@fullcalendar/daygrid"; import dayGridPlugin from "@fullcalendar/daygrid";
@ -67,15 +75,13 @@
const userListStore = useUserStore(); const userListStore = useUserStore();
const userList = ref([]); const userList = ref([]);
const userColors = ref({}); const userColors = ref({});
const myVacations = ref([]); // " " const myVacations = ref([]); // " " ( )
const receivedVacations = ref([]); // " " const receivedVacations = ref([]); // " "
const isModalOpen = ref(false); const isModalOpen = ref(false);
const remainingVacationData = ref({}); const remainingVacationData = ref({});
// ( )
const modalYear = ref(new Date().getFullYear()); const modalYear = ref(new Date().getFullYear());
const modalMonth = ref(String(new Date().getMonth() + 1).padStart(2, "0"));
const lastRemainingYear = ref(new Date().getFullYear()); const lastRemainingYear = ref(new Date().getFullYear());
const lastRemainingMonth = ref(String(new Date().getMonth() + 1).padStart(2, "0"));
const isGrantModalOpen = ref(false); const isGrantModalOpen = ref(false);
const selectedUser = ref(null); const selectedUser = ref(null);
@ -88,6 +94,9 @@
const holidayDates = ref(new Set()); const holidayDates = ref(new Set());
const fetchedEvents = ref([]); const fetchedEvents = ref([]);
// : ( )
const toggledDates = ref(new Set());
const calendarOptions = reactive({ const calendarOptions = reactive({
plugins: [dayGridPlugin, interactionPlugin], plugins: [dayGridPlugin, interactionPlugin],
initialView: "dayGridMonth", initialView: "dayGridMonth",
@ -106,6 +115,31 @@
onMounted(async () => { onMounted(async () => {
await userStore.userInfo(); await userStore.userInfo();
await fetchRemainingVacation(); await fetchRemainingVacation();
// vacation history
const currentYear = new Date().getFullYear();
await fetchVacationHistory(currentYear);
});
// API ( )
async function fetchVacationHistory(year) {
try {
const response = await axios.get(`vacation/history?year=${year}`);
if (response.status === 200 && response.data) {
myVacations.value = response.data.data.usedVacations || [];
receivedVacations.value = response.data.data.receivedVacations || [];
} else {
console.warn("❌ 연차 내역을 불러오지 못했습니다.");
myVacations.value = [];
receivedVacations.value = [];
}
} catch (error) {
console.error("🚨 연차 데이터 불러오기 실패:", error);
}
}
// lastRemainingYear
watch(lastRemainingYear, async (newYear, oldYear) => {
await fetchVacationHistory(newYear);
}); });
const fetchRemainingVacation = async () => { const fetchRemainingVacation = async () => {
@ -123,32 +157,31 @@
}; };
// //
// const handleProfileClick = async (user) => {
const handleProfileClick = async (user) => { try {
try { if (isModalOpen.value) {
if (user.MEMBERSEQ === userStore.user.id) { isModalOpen.value = false;
const year = new Date().getFullYear(); // return;
// }
const response = await axios.get(`vacation/history?year=${year}`); if (isGrantModalOpen.value) {
if (response.status === 200 && response.data) { isGrantModalOpen.value = false;
myVacations.value = response.data.data.usedVacations || []; return;
receivedVacations.value = response.data.data.receivedVacations || []; }
if (user.MEMBERSEQ === userStore.user.id) {
const year = new Date().getFullYear();
await fetchVacationHistory(year);
isModalOpen.value = true; isModalOpen.value = true;
// lastRemainingYear.value = year;
modalYear.value = year;
isGrantModalOpen.value = false; isGrantModalOpen.value = false;
} else { } else {
console.warn("❌ 연차 내역을 불러오지 못했습니다."); selectedUser.value = user;
isGrantModalOpen.value = true;
isModalOpen.value = false;
} }
} else { } catch (error) {
selectedUser.value = user; console.error("🚨 연차 데이터 불러오기 실패:", error);
isGrantModalOpen.value = true;
isModalOpen.value = false;
} }
} catch (error) { };
console.error("🚨 연차 데이터 불러오기 실패:", error);
}
};
const fetchUserList = async () => { const fetchUserList = async () => {
try { try {
@ -187,30 +220,29 @@ const handleProfileClick = async (user) => {
return vacationCodeMap.value[typeCode] || "기타"; return vacationCodeMap.value[typeCode] || "기타";
}; };
// computed: modalYear // computed: lastRemainingYear
const filteredMyVacations = computed(() => { const filteredMyVacations = computed(() => {
const filtered = myVacations.value.filter(vac => { const filtered = myVacations.value.filter(vac => {
// vac.date vac.LOCVACUDT const dateStr = vac.date || vac.LOCVACUDT;
const dateStr = vac.date || vac.LOCVACUDT; const year = dateStr ? dateStr.split("T")[0].substring(0, 4) : null;
const year = dateStr ? dateStr.split("T")[0].substring(0, 4) : null; console.log("vacation year:", year, "lastRemainingYear:", lastRemainingYear.value);
console.log("vacation year:", year, "modalYear:", modalYear.value); return year === String(lastRemainingYear.value);
return year === String(modalYear.value); });
console.log("filteredMyVacations:", filtered);
return filtered;
}); });
console.log("filteredMyVacations:", filtered);
return filtered;
});
const filteredReceivedVacations = computed(() => { const filteredReceivedVacations = computed(() => {
return receivedVacations.value.filter(vac => { return receivedVacations.value.filter(vac => {
const dateStr = vac.date || vac.LOCVACUDT; const dateStr = vac.date || vac.LOCVACUDT;
const year = dateStr ? dateStr.split("T")[0].substring(0, 4) : null; const year = dateStr ? dateStr.split("T")[0].substring(0, 4) : null;
console.log("vacation year:", year, "modalYear:", modalYear.value); console.log("vacation year:", year, "lastRemainingYear:", lastRemainingYear.value);
return dateStr && year === String(modalYear.value); return dateStr && year === String(lastRemainingYear.value);
});
}); });
});
function updateCalendarEvents() { function updateCalendarEvents() {
// selectedDates "delete"
const selectedEvents = Array.from(selectedDates.value) const selectedEvents = Array.from(selectedDates.value)
.filter(([date, type]) => type !== "delete") .filter(([date, type]) => type !== "delete")
.map(([date, type]) => ({ .map(([date, type]) => ({
@ -221,12 +253,18 @@ const filteredReceivedVacations = computed(() => {
display: "background", display: "background",
classNames: [getVacationTypeClass(type), "selected-event"] classNames: [getVacationTypeClass(type), "selected-event"]
})); }));
// fetchedEvents, "delete"
// () , .
const filteredFetchedEvents = fetchedEvents.value.filter(event => { const filteredFetchedEvents = fetchedEvents.value.filter(event => {
if (event.saved) { if (event.saved && selectedDates.value.get(event.start) === "delete") {
return selectedDates.value.get(event.start) !== "delete"; if (event.memberSeq === userStore.user.id) {
return false;
}
} }
return true; return true;
}); });
calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents]; calendarEvents.value = [...filteredFetchedEvents, ...selectedEvents];
} }
@ -240,6 +278,7 @@ const filteredReceivedVacations = computed(() => {
const clickedDateStr = info.dateStr; const clickedDateStr = info.dateStr;
const clickedDate = info.date; const clickedDate = info.date;
const todayStr = new Date().toISOString().split("T")[0]; const todayStr = new Date().toISOString().split("T")[0];
if ( if (
clickedDate.getDay() === 0 || clickedDate.getDay() === 0 ||
clickedDate.getDay() === 6 || clickedDate.getDay() === 6 ||
@ -248,22 +287,36 @@ const filteredReceivedVacations = computed(() => {
) { ) {
return; return;
} }
// : LOCVACUDT 10 clickedDateStr , LOCVACRMM
const isMyVacation = myVacations.value.some(vac => {
const vacDate = vac.date ? String(vac.date).substring(0, 10) : "";
return vacDate === clickedDateStr &&
(!vac.LOCVACRMM || String(vac.LOCVACRMM).trim() === "");
});
if (isMyVacation) {
// : selectedDates "delete" ( )
if (selectedDates.value.get(clickedDateStr) === "delete") {
selectedDates.value.delete(clickedDateStr);
} else {
selectedDates.value.set(clickedDateStr, "delete");
}
updateCalendarEvents();
return;
}
// : /
if (selectedDates.value.has(clickedDateStr)) { if (selectedDates.value.has(clickedDateStr)) {
console.log("일반 날짜 토글 off: 기존 선택 해제");
selectedDates.value.delete(clickedDateStr); selectedDates.value.delete(clickedDateStr);
updateCalendarEvents(); updateCalendarEvents();
return; return;
} }
const unsentVacation = myVacations.value.find( const type = halfDayType.value
(vac) => vac.LOCVACUDT && vac.LOCVACUDT.startsWith(clickedDateStr) && !vac.LOCVACRMM ? (halfDayType.value === "AM" ? "700101" : "700102")
); : "700103";
if (unsentVacation) { console.log("일반 날짜 토글 on: 선택 및 타입", type);
selectedDates.value.set(clickedDateStr, "delete"); selectedDates.value.set(clickedDateStr, type);
} else {
const type = halfDayType.value
? (halfDayType.value === "AM" ? "700101" : "700102")
: "700103";
selectedDates.value.set(clickedDateStr, type);
}
halfDayType.value = null; halfDayType.value = null;
updateCalendarEvents(); updateCalendarEvents();
} }
@ -273,43 +326,42 @@ const filteredReceivedVacations = computed(() => {
} }
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;
// modalYear if (lastRemainingYear.value !== year) {
if (modalYear.value !== year) { //
myVacations.value = vacationList.filter( myVacations.value = vacationList.filter(
(vac) => vac.MEMBERSEQ === userStore.user.id (vac) => vac.MEMBERSEQ === userStore.user.id
); );
modalYear.value = year; lastRemainingYear.value = year;
// modalMonth ( ) }
const events = vacationList
.filter((vac) => !vac.LOCVACRMM)
.map((vac) => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
let backgroundColor = userColors.value[vac.MEMBERSEQ] || "#FFFFFF";
return {
title: getVacationType(vac.LOCVACTYP),
start: dateStr,
backgroundColor,
classNames: [getVacationTypeClass(vac.LOCVACTYP)],
saved: true,
memberSeq: vac.MEMBERSEQ, //
};
})
.filter((event) => event.start);
return events;
} else {
console.warn("📌 휴가 데이터를 불러오지 못함");
return [];
} }
// } catch (error) {
const events = vacationList console.error("Error fetching vacation data:", error);
.filter((vac) => !vac.LOCVACRMM)
.map((vac) => {
let dateStr = vac.LOCVACUDT ? vac.LOCVACUDT.split("T")[0] : "";
let backgroundColor = userColors.value[vac.MEMBERSEQ] || "#FFFFFF";
return {
title: getVacationType(vac.LOCVACTYP),
start: dateStr,
backgroundColor,
classNames: [getVacationTypeClass(vac.LOCVACTYP)],
saved: true,
};
})
.filter((event) => event.start);
return events;
} else {
console.warn("📌 휴가 데이터를 불러오지 못함");
return []; return [];
} }
} catch (error) {
console.error("Error fetching vacation data:", error);
return [];
} }
}
async function saveVacationChanges() { async function saveVacationChanges() {
const selectedDatesArray = Array.from(selectedDates.value); const selectedDatesArray = Array.from(selectedDates.value);
@ -359,9 +411,10 @@ const filteredReceivedVacations = computed(() => {
} }
async function loadCalendarData(year, month) { async function loadCalendarData(year, month) {
if (lastRemainingYear.value !== year) { if (lastRemainingYear.value !== year || lastRemainingMonth.value !== month) {
await fetchRemainingVacation(); await fetchRemainingVacation();
lastRemainingYear.value = year; lastRemainingYear.value = year;
lastRemainingMonth.value = month;
} }
fetchedEvents.value = []; fetchedEvents.value = [];
const [vacationEvents, holidayEvents] = await Promise.all([ const [vacationEvents, holidayEvents] = await Promise.all([
@ -381,6 +434,7 @@ const filteredReceivedVacations = computed(() => {
const today = new Date(); const today = new Date();
const year = today.getFullYear(); const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, "0"); const month = String(today.getMonth() + 1).padStart(2, "0");
await fetchVacationData(year, month);
await loadCalendarData(year, month); await loadCalendarData(year, month);
}); });
</script> </script>

View File

@ -177,34 +177,58 @@
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',{ const newCategory = { label: data, value: newValue };
CMNCODNAM: data
}).then(res => {
if(res.data.data == '1'){
toastStore.onToast('카테고리가 추가 등록 되었습니다.', 's');
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 == '이미 존재하는 카테고리명입니다.') { // axios.post('worddict/insertCategory',{
toastStore.onToast(res.data.message, 'e'); // CMNCODNAM: data
} // }).then(res => {
}) // if(res.data.data == '1'){
// toastStore.onToast(' .', 's');
// const newCategory = { label: data, value: newValue };
// cateList.value = [newCategory, ...cateList.value];
// selectedCategory.value = newCategory.value;
// } else if(res.data.message == ' .') {
// toastStore.onToast(res.data.message, 'e');
// }
// })
} }
// const addWord = (wordData, data) => {
const addWord = (wordData) => { let category = null;
axios.post('worddict/insertWord',{ //
WRDDICCAT : wordData.category, const existingCategory = cateList.value.find(item => item.label === data);
WRDDICTTL : wordData.title, if (existingCategory) {
WRDDICCON : $common.deltaAsJson(wordData.content), //
}).then(res => { category = existingCategory.label == '' ? wordData.category : existingCategory.value;
if(res.data.data == '1'){ } else {
//
console.log('카테고리 없음');
const lastCategory = cateList.value[cateList.value.length - 1];
category = lastCategory ? lastCategory.value + 1 : 600101;
}
sendWordRequest(category, wordData, data, !existingCategory);
};
const sendWordRequest = (category, wordData, data, isNewCategory) => {
const payload = {
WRDDICCAT: category,
WRDDICTTL: wordData.title,
WRDDICCON: $common.deltaAsJson(wordData.content),
};
if (isNewCategory) {
payload.CMNCODNAM = data; //
}
axios.post('worddict/insertWord', payload).then(res => {
if (res.data.status === 'OK') {
toastStore.onToast('용어가 등록 되었습니다.', 's'); toastStore.onToast('용어가 등록 되었습니다.', 's');
isWriteVisible.value = false; isWriteVisible.value = false;
getwordList(); getwordList();
//
} }
}) });
}; };
// //
const updateCheckedItems = (checked, id, name) => { const updateCheckedItems = (checked, id, name) => {
if (checked) { if (checked) {