용어집 등록

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>
<div class="d-flex">
<FormSelect
name="cate"
title="카테고리"
:data="formattedDataList"
:is-common="true"
@update:data="selectCategory = $event"
@change="onChange"
/>
<PlusBtn @click="toggleInput"/>
<div>
<div class="row">
<div class="col-10">
<FormSelect
name="cate"
title="카테고리 선택"
:data="formattedDataList"
:is-common="true"
@update:data="selectCategory = $event"
@change="onChange"
/>
</div>
<div class="col-2 btn-margin">
<PlusBtn @click="toggleInput"/>
</div>
</div>
<div class="d-flex" v-if="showInput">
<FormInput :isLabel="false" title="카테고리" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
<button class="btn btn-primary" @click="saveInput">
<i class="bx bx-check"></i>
</button>
<div class="row" v-if="showInput">
<div class="col-10">
<FormInput title="카테고리 입력" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
</div>
<div class="col-2 btn-margin">
<button class="btn btn-primary btn-icon" @click="saveInput">
<i class="bx bx-check"></i>
</button>
</div>
</div>
</div>
<div>
<div class="dict-w">
<FormInput
title="용어"
type="text"
name="word"
:is-essential="true"
:is-alert="wordTitleAlert"
@update:modelValue="wordTitle = $event"
/>
title="용어"
type="text"
name="word"
:is-essential="true"
:is-alert="wordTitleAlert"
@update:modelValue="wordTitle = $event"
/>
</div>
<div>
<QEditor @update:data="content = $event" @update:imageUrls="imageUrls = $event" :is-alert="wordContentAlert" />
<button class="btn btn-primary" @click="saveWord">
<i class="bx bx-check"></i>
</button>
<button @click="$emit('close')">취소</button>
<div class="text-end mt-5">
<button class="btn btn-primary" @click="saveWord">
<i class="bx bx-check"></i>
</button>
</div>
</div>
</template>
@ -124,3 +134,15 @@ const saveWord = () => {
emit('addWord', wordData);
};
</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 => {
if(res.data.data == '1'){
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);
selectCategory.value = newCategory.CMNCODVAL;
}
@ -181,10 +181,6 @@
//
const addWord = (wordData) => {
// console.log(' :', wordData.category); // WRDDICCAT
// console.log(' :', wordData.content); // WRDDICCON
// console.log(' :', wordData.title); // WRDDICTTL
axios.post('worddict/insertWord',{
WRDDICCAT : wordData.category,
WRDDICTTL : wordData.title,
@ -192,10 +188,8 @@
}).then(res => {
if(res.data.data == '1'){
toastStore.onToast('용어가 등록 되었습니다.', 's');
isWriteVisible.value = false
// const newCategory = { CMNCODNAM: data, CMNCODVAL: newValue.toString() };
// cateList.value.unshift(newCategory);
// selectCategory.value = newCategory.CMNCODVAL;
isWriteVisible.value = false;
getwordList();
}
})
};