+
-
-
-
+
로딩 중...
-
{{ error }}
@@ -51,10 +40,8 @@
@updateChecked="updateCheckedItems"
/>
-
-
용어집의 용어가 없습니다.
-
+
✏️ 용어를 선택/작성해 주세요 ✏️
@@ -116,9 +103,13 @@
// 검색
const searchText = ref('');
+ //검색 정렬
+ const indexCategory = ref([]);
+
// 데이터 로드
onMounted(() => {
- getwordList();
+ //getwordList();
+ getIndex();
});
//용어 목록
@@ -144,6 +135,14 @@
loading.value = false;
});
};
+ //정렬 목록
+ const getIndex = () => {
+ axios.get('worddict/getIndexCategory').then(res=>{
+ if(res.data.status ="OK"){
+ indexCategory.value = res.data.data;
+ }
+ })
+ }
// 검색
const search = (e) => {
@@ -162,33 +161,29 @@
selectedCategory.value = category;
getwordList(searchText.value, selectedAlphabet.value, selectedCategory.value);
}
-
+
// 용어집 등록
const addWord = (wordData, data) => {
let category = null;
+ let newCodName = '';
// 카테고리 체크
- const existingCategory = cateList.value.find(item => item.label === data.trim());
-
- if (existingCategory) {
- //카테고리 있을시 그냥 저장
- category = existingCategory.label == '' ? wordData.category : existingCategory.value;
- } else {
- //카테고리 없을시 카테고리 와 용어 둘다 저장
+ console.log('data',data)
+ if(typeof(data) == 'number'){
+ category = data;
+ newCodName = '';
+ }else{
const lastCategory = cateList.value[cateList.value.length - 1];
category = lastCategory ? lastCategory.value + 1 : 600101;
-
+ newCodName = data;
}
- sendWordRequest(category, wordData, data, !existingCategory);
+ sendWordRequest(category, wordData, newCodName);
};
-
- const sendWordRequest = (category, wordData, data, isNewCategory) => {
+ const sendWordRequest = (category, wordData, data) => {
const payload = {
WRDDICCAT: category,
WRDDICTTL: wordData.title,
WRDDICCON: $common.deltaAsJson(wordData.content),
};
-
- if (isNewCategory) {
payload.CMNCODNAM = data;
axios.post('worddict/insertWord', payload).then(res => {
if (res.data.status === 'OK') {
@@ -198,22 +193,14 @@
writeButton.value.resetButton();
}
getwordList();
- const newCategory = { label: data, value: category };
- cateList.value = [newCategory, ...cateList.value];
- }
- });
- } else {
- axios.post('worddict/insertWord', payload).then(res => {
- if (res.data.status === 'OK') {
- toastStore.onToast('용어가 등록 되었습니다.', 's');
- writeStore.closeAll();
- if (writeButton.value) {
- writeButton.value.resetButton();
+ getIndex();
+ if(res.data.data == '2'){
+ const newCategory = { label: data, value: category };
+ cateList.value = [...cateList.value,newCategory];
}
- getwordList();
+ selectedAlphabet.value = '';
}
});
- }
};