용어집 등록

This commit is contained in:
Dang 2025-02-10 16:04:33 +09:00
parent 8427dce4cc
commit 8fd19938ba
2 changed files with 53 additions and 37 deletions

View File

@ -1,39 +1,49 @@
<template> <template>
<div class="d-flex"> <div>
<FormSelect <div class="row">
name="cate" <div class="col-10">
title="카테고리" <FormSelect
:data="formattedDataList" name="cate"
:is-common="true" title="카테고리 선택"
@update:data="selectCategory = $event" :data="formattedDataList"
@change="onChange" :is-common="true"
/> @update:data="selectCategory = $event"
@change="onChange"
/>
</div>
<div class="col-2 btn-margin">
<PlusBtn @click="toggleInput"/>
</div>
</div>
<PlusBtn @click="toggleInput"/> <div class="row" v-if="showInput">
<div class="col-10">
<div class="d-flex" v-if="showInput"> <FormInput title="카테고리 입력" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
<FormInput :isLabel="false" title="카테고리" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/> </div>
<button class="btn btn-primary" @click="saveInput"> <div class="col-2 btn-margin">
<i class="bx bx-check"></i> <button class="btn btn-primary btn-icon" @click="saveInput">
</button> <i class="bx bx-check"></i>
</button>
</div>
</div> </div>
</div> </div>
<div> <div class="dict-w">
<FormInput <FormInput
title="용어" title="용어"
type="text" type="text"
name="word" name="word"
:is-essential="true" :is-essential="true"
:is-alert="wordTitleAlert" :is-alert="wordTitleAlert"
@update:modelValue="wordTitle = $event" @update:modelValue="wordTitle = $event"
/> />
</div> </div>
<div> <div>
<QEditor @update:data="content = $event" @update:imageUrls="imageUrls = $event" :is-alert="wordContentAlert" /> <QEditor @update:data="content = $event" @update:imageUrls="imageUrls = $event" :is-alert="wordContentAlert" />
<button class="btn btn-primary" @click="saveWord"> <div class="text-end mt-5">
<i class="bx bx-check"></i> <button class="btn btn-primary" @click="saveWord">
</button> <i class="bx bx-check"></i>
<button @click="$emit('close')">취소</button> </button>
</div>
</div> </div>
</template> </template>
@ -124,3 +134,15 @@ const saveWord = () => {
emit('addWord', wordData); emit('addWord', wordData);
}; };
</script> </script>
<style scoped>
.dict-w {
width: 83%;
}
@media (max-width: 768px) {
.btn-margin {
margin-top: 2.5rem
}
}
</style>

View File

@ -172,7 +172,7 @@
}).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 const newCategory = { CMNCODNAM: data, CMNCODVAL: newValue.toString() };
cateList.value.unshift(newCategory); cateList.value.unshift(newCategory);
selectCategory.value = newCategory.CMNCODVAL; selectCategory.value = newCategory.CMNCODVAL;
} }
@ -181,10 +181,6 @@
// //
const addWord = (wordData) => { const addWord = (wordData) => {
// console.log(' :', wordData.category); // WRDDICCAT
// console.log(' :', wordData.content); // WRDDICCON
// console.log(' :', wordData.title); // WRDDICTTL
axios.post('worddict/insertWord',{ axios.post('worddict/insertWord',{
WRDDICCAT : wordData.category, WRDDICCAT : wordData.category,
WRDDICTTL : wordData.title, WRDDICTTL : wordData.title,
@ -192,10 +188,8 @@
}).then(res => { }).then(res => {
if(res.data.data == '1'){ if(res.data.data == '1'){
toastStore.onToast('용어가 등록 되었습니다.', 's'); toastStore.onToast('용어가 등록 되었습니다.', 's');
isWriteVisible.value = false isWriteVisible.value = false;
// const newCategory = { CMNCODNAM: data, CMNCODVAL: newValue.toString() }; getwordList();
// cateList.value.unshift(newCategory);
// selectCategory.value = newCategory.CMNCODVAL;
} }
}) })
}; };