용어집 카테고리 수정
This commit is contained in:
parent
67d5bede32
commit
69afdab946
@ -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,
|
||||
|
||||
@ -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;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user