용어집 카테고리 수정
This commit is contained in:
parent
67d5bede32
commit
69afdab946
@ -1,11 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<FormSelect name="cate"
|
<FormSelect
|
||||||
title="카테고리"
|
name="cate"
|
||||||
:data="formattedDataList"
|
title="카테고리"
|
||||||
:is-common="true"
|
:data="formattedDataList"
|
||||||
@update:data="selectCategory = $event"
|
:is-common="true"
|
||||||
/> <button @click="toggleInput">+</button>
|
@update:data="selectCategory = $event"
|
||||||
|
@change="onChange"
|
||||||
|
/>
|
||||||
|
<button @click="toggleInput">+</button>
|
||||||
<div class="d-flex" v-if="showInput">
|
<div class="d-flex" v-if="showInput">
|
||||||
<FormInput :isLabel="false" title="카테고리" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
|
<FormInput :isLabel="false" title="카테고리" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
|
||||||
<button @click="saveInput">저장</button>
|
<button @click="saveInput">저장</button>
|
||||||
@ -83,10 +86,13 @@ const saveInput = () => {
|
|||||||
showInput.value = false;
|
showInput.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onChange = (newValue) => {
|
||||||
|
selectCategory.value =newValue.target.value;
|
||||||
|
};
|
||||||
|
|
||||||
//용어 등록
|
//용어 등록
|
||||||
const saveWord = () => {
|
const saveWord = () => {
|
||||||
//validation 체크후 emit전송 수정해야함
|
//validation 체크후 emit전송 수정해야함
|
||||||
|
|
||||||
const wordData = {
|
const wordData = {
|
||||||
title: wordTitle.value,
|
title: wordTitle.value,
|
||||||
category: selectCategory.value,
|
category: selectCategory.value,
|
||||||
|
|||||||
@ -161,11 +161,17 @@
|
|||||||
|
|
||||||
//카테고리 등록
|
//카테고리 등록
|
||||||
const addCategory = (data) =>{
|
const addCategory = (data) =>{
|
||||||
|
const lastCategory = cateList.value[cateList.value.length - 1];
|
||||||
|
const newValue = lastCategory ? parseInt(lastCategory.CMNCODVAL) + 1 : 600101;
|
||||||
|
|
||||||
axios.post('worddict/insertCategory',{
|
axios.post('worddict/insertCategory',{
|
||||||
CMNCODNAM: data
|
CMNCODNAM: data
|
||||||
}).then(res=>{
|
}).then(res=>{
|
||||||
if(res.data.data == '1'){
|
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