용어집 카테고리 수정

This commit is contained in:
khj0414 2025-02-06 13:26:07 +09:00
parent 67d5bede32
commit 69afdab946
2 changed files with 20 additions and 8 deletions

View File

@ -1,11 +1,14 @@
<template>
<div class="d-flex">
<FormSelect name="cate"
title="카테고리"
:data="formattedDataList"
:is-common="true"
@update:data="selectCategory = $event"
/> <button @click="toggleInput">+</button>
<FormSelect
name="cate"
title="카테고리"
:data="formattedDataList"
:is-common="true"
@update:data="selectCategory = $event"
@change="onChange"
/>
<button @click="toggleInput">+</button>
<div class="d-flex" v-if="showInput">
<FormInput :isLabel="false" title="카테고리" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
<button @click="saveInput">저장</button>
@ -83,10 +86,13 @@ const saveInput = () => {
showInput.value = false;
};
const onChange = (newValue) => {
selectCategory.value =newValue.target.value;
};
//
const saveWord = () => {
//validation emit
const wordData = {
title: wordTitle.value,
category: selectCategory.value,

View File

@ -161,11 +161,17 @@
//
const addCategory = (data) =>{
const lastCategory = cateList.value[cateList.value.length - 1];
const newValue = lastCategory ? parseInt(lastCategory.CMNCODVAL) + 1 : 600101;
axios.post('worddict/insertCategory',{
CMNCODNAM: data
}).then(res=>{
if(res.data.data == '1'){
toastStore.onToast('카테고리가 등록되었습니다.', 's');
toastStore.onToast('카테고리가 추가 등록 되었습니다.', 's');
const newCategory = { CMNCODNAM: data, CMNCODVAL: newValue.toString() }; // Assuming CMNCODVAL is the same as CMNCODNAM
cateList.value.unshift(newCategory);
selectCategory.value = newCategory.CMNCODVAL;
}
})
}