용여집 수정정
This commit is contained in:
parent
c95a2ae80b
commit
67d5bede32
@ -1,18 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<FormSelect :isLabel="false" :data="formattedDataList" :isCommon="true" name="용어집 카테고리" title="용어집 카테고리"/>
|
<FormSelect name="cate"
|
||||||
<button @click="toggleInput">+</button>
|
title="카테고리"
|
||||||
|
:data="formattedDataList"
|
||||||
|
:is-common="true"
|
||||||
|
@update:data="selectCategory = $event"
|
||||||
|
/> <button @click="toggleInput">+</button>
|
||||||
<div class="d-flex" v-if="showInput">
|
<div class="d-flex" v-if="showInput">
|
||||||
<FormInput :isLabel="false" title="용어집 입력" name="용어집 입력"/>
|
<FormInput :isLabel="false" title="카테고리" name="카테고리" @update:modelValue="addCategory = $event" :is-alert="addCategoryAlert"/>
|
||||||
<button @click="saveInput">저장</button>
|
<button @click="saveInput">저장</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<FormInput title="내용" name="용어집 내용 입력"/>
|
<FormInput
|
||||||
</div>
|
title="용어"
|
||||||
|
type="text"
|
||||||
|
name="word"
|
||||||
|
:is-essential="true"
|
||||||
|
:is-alert="wordTitleAlert"
|
||||||
|
@update:modelValue="wordTitle = $event"
|
||||||
|
/> </div>
|
||||||
<div>
|
<div>
|
||||||
<QEditor/>
|
<QEditor @update:data="content = $event" @update:imageUrls="imageUrls = $event" :is-alert="true" />
|
||||||
<button>저장</button>
|
<button @click="saveWord">저장</button>
|
||||||
<button @click="$emit('close')">취소</button>
|
<button @click="$emit('close')">취소</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -24,7 +34,20 @@ import QEditor from '@/components/editor/QEditor.vue';
|
|||||||
import FormInput from '@/components/input/FormInput.vue';
|
import FormInput from '@/components/input/FormInput.vue';
|
||||||
import FormSelect from '@/components/input/FormSelect.vue';
|
import FormSelect from '@/components/input/FormSelect.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close','addCategory','addWord']);
|
||||||
|
|
||||||
|
//용어제목
|
||||||
|
const wordTitle =ref('');
|
||||||
|
const addCategory =ref('');
|
||||||
|
const content = ref('');
|
||||||
|
const imageUrls = ref([]);
|
||||||
|
|
||||||
|
//용어 Vaildation용
|
||||||
|
const wordTitleAlert = ref(false);
|
||||||
|
const addcateAlert =ref(false);
|
||||||
|
const addCategoryAlert = ref(false);
|
||||||
|
//선택 카테고리
|
||||||
|
const selectCategory = ref('');
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataList: {
|
dataList: {
|
||||||
@ -46,12 +69,29 @@ const showInput = ref(false);
|
|||||||
|
|
||||||
// 카테고리 입력 토글
|
// 카테고리 입력 토글
|
||||||
const toggleInput = () => {
|
const toggleInput = () => {
|
||||||
howInput.value = !showInput.value;
|
showInput.value = !showInput.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 카테고리 저장
|
// 카테고리 저장
|
||||||
const saveInput = () => {
|
const saveInput = () => {
|
||||||
console.log('입력값 저장됨!');
|
if( addCategory.value == ''){
|
||||||
|
addCategoryAlert.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('입력값 저장됨!',addCategory.value);
|
||||||
|
emit('addCategory', addCategory.value);
|
||||||
showInput.value = false;
|
showInput.value = false;
|
||||||
};
|
};
|
||||||
</script>
|
|
||||||
|
//용어 등록
|
||||||
|
const saveWord = () => {
|
||||||
|
//validation 체크후 emit전송 수정해야함
|
||||||
|
|
||||||
|
const wordData = {
|
||||||
|
title: wordTitle.value,
|
||||||
|
category: selectCategory.value,
|
||||||
|
content: content.value,
|
||||||
|
};
|
||||||
|
emit('addWord', wordData);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<!-- 작성 -->
|
<!-- 작성 -->
|
||||||
<div v-if="isWriteVisible" class="mt-5">
|
<div v-if="isWriteVisible" class="mt-5">
|
||||||
<DictWrite @close="isWriteVisible = false" :dataList="cateList"/>
|
<DictWrite @close="isWriteVisible = false" :dataList="cateList" @addCategory="addCategory"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -69,7 +69,9 @@
|
|||||||
import DictCard from '@/components/wordDict/DictCard.vue';
|
import DictCard from '@/components/wordDict/DictCard.vue';
|
||||||
import DictWrite from '@/components/wordDict/DictWrite.vue';
|
import DictWrite from '@/components/wordDict/DictWrite.vue';
|
||||||
import DictAlphabetFilter from '@/components/wordDict/DictAlphabetFilter.vue';
|
import DictAlphabetFilter from '@/components/wordDict/DictAlphabetFilter.vue';
|
||||||
|
import { useToastStore } from '@s/toastStore';
|
||||||
|
|
||||||
|
const toastStore = useToastStore();
|
||||||
|
|
||||||
// 공통
|
// 공통
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@ -87,7 +89,7 @@
|
|||||||
|
|
||||||
//선택된 알파벳
|
//선택된 알파벳
|
||||||
const selectedAlphabet = ref('');
|
const selectedAlphabet = ref('');
|
||||||
|
|
||||||
// 검색
|
// 검색
|
||||||
const searchText = ref('');
|
const searchText = ref('');
|
||||||
|
|
||||||
@ -99,12 +101,12 @@
|
|||||||
getwordList();
|
getwordList();
|
||||||
getwordCategory();
|
getwordCategory();
|
||||||
});
|
});
|
||||||
|
|
||||||
//용어 목록
|
//용어 목록
|
||||||
const getwordList = (searchKeyword='', indexKeyword='', category='') => {
|
const getwordList = (searchKeyword='', indexKeyword='', category='') => {
|
||||||
axios.get('worddict/getWordList',{
|
axios.get('worddict/getWordList',{
|
||||||
//목록조회시 파라미터 전달
|
//목록조회시 파라미터 전달
|
||||||
params: {
|
params: {
|
||||||
searchKeyword : searchKeyword,
|
searchKeyword : searchKeyword,
|
||||||
indexKeyword :indexKeyword,
|
indexKeyword :indexKeyword,
|
||||||
category : category
|
category : category
|
||||||
@ -157,6 +159,17 @@
|
|||||||
isWriteVisible.value = !isWriteVisible.value;
|
isWriteVisible.value = !isWriteVisible.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//카테고리 등록
|
||||||
|
const addCategory = (data) =>{
|
||||||
|
axios.post('worddict/insertCategory',{
|
||||||
|
CMNCODNAM: data
|
||||||
|
}).then(res=>{
|
||||||
|
if(res.data.data == '1'){
|
||||||
|
toastStore.onToast('카테고리가 등록되었습니다.', 's');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//용어 등록
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -172,4 +185,4 @@
|
|||||||
margin-bottom: 0.5rem !important;
|
margin-bottom: 0.5rem !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user