Merge remote-tracking branch 'origin/wordDict'
This commit is contained in:
commit
692d363756
@ -122,6 +122,9 @@ const addCategory = (data) => {
|
|||||||
: null;
|
: null;
|
||||||
const newValue = lastCategory ? lastCategory.value + 1 : 600101;
|
const newValue = lastCategory ? lastCategory.value + 1 : 600101;
|
||||||
|
|
||||||
|
// console.log('lastCategory', lastCategory);
|
||||||
|
// console.log('newValue', newValue);
|
||||||
|
|
||||||
axios.post('worddict/insertCategory', {
|
axios.post('worddict/insertCategory', {
|
||||||
CMNCODNAM: data
|
CMNCODNAM: data
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@ -131,8 +134,14 @@ const addCategory = (data) => {
|
|||||||
localCateList.value = [newCategory, ...localCateList.value];
|
localCateList.value = [newCategory, ...localCateList.value];
|
||||||
selectedCategory.value = newCategory.value;
|
selectedCategory.value = newCategory.value;
|
||||||
|
|
||||||
|
// console.log('newCategory', newCategory);
|
||||||
|
// console.log('localCateList.value', localCateList.value);
|
||||||
|
// console.log('selectedCategory.value', selectedCategory.value);
|
||||||
|
|
||||||
// 부모에게 전달
|
// 부모에게 전달
|
||||||
emit('update:cateList', localCateList.value);
|
emit('update:cateList', localCateList.value);
|
||||||
|
} else if(res.data.message == '이미 존재하는 카테고리명입니다.') {
|
||||||
|
toastStore.onToast(res.data.message, 'e');
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('카테고리 추가 중 오류:', err);
|
console.error('카테고리 추가 중 오류:', err);
|
||||||
@ -145,11 +154,11 @@ const addCategory = (data) => {
|
|||||||
|
|
||||||
// 용어집 수정
|
// 용어집 수정
|
||||||
const editWord = (data) => {
|
const editWord = (data) => {
|
||||||
console.log('📌 수정할 데이터:', data);
|
// console.log('📌 수정할 데이터:', data);
|
||||||
console.log('📌 수정할 데이터:', data.id);
|
// console.log('📌 수정할 데이터:', data.id);
|
||||||
console.log('📌 수정할 데이터:', data.category);
|
// console.log('📌 수정할 데이터:', data.category);
|
||||||
console.log('📌 수정할 데이터:', data.title);
|
// console.log('📌 수정할 데이터:', data.title);
|
||||||
console.log('📌 수정할 데이터:', $common.deltaAsJson(data.content));
|
// console.log('📌 수정할 데이터:', $common.deltaAsJson(data.content));
|
||||||
|
|
||||||
if (!data.id) {
|
if (!data.id) {
|
||||||
console.error('❌ 수정할 데이터의 ID가 없습니다.');
|
console.error('❌ 수정할 데이터의 ID가 없습니다.');
|
||||||
@ -208,7 +217,6 @@ const toggleCheck = (event) => {
|
|||||||
top: 1.2rem;
|
top: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.admin-chk {
|
.admin-chk {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -0.5rem;
|
left: -0.5rem;
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
v-for="item in wordList"
|
v-for="item in wordList"
|
||||||
:key="item.WRDDICSEQ"
|
:key="item.WRDDICSEQ"
|
||||||
:item="item"
|
:item="item"
|
||||||
:cateList="cateList"
|
v-model:cateList="cateList"
|
||||||
@refreshWordList="getwordList"
|
@refreshWordList="getwordList"
|
||||||
@updateChecked="updateCheckedItems"
|
@updateChecked="updateCheckedItems"
|
||||||
/>
|
/>
|
||||||
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button v-if="isAnyChecked" class="btn btn-danger admin-del-btn">
|
<button v-if="isAnyChecked" class="btn btn-danger admin-del-btn" @click="deleteCheckedItems">
|
||||||
<i class="bx bx-trash"></i>
|
<i class="bx bx-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -209,18 +209,43 @@
|
|||||||
const updateCheckedItems = (checked, id, name) => {
|
const updateCheckedItems = (checked, id, name) => {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
checkedItems.value.push(id);
|
checkedItems.value.push(id);
|
||||||
checkedNames.value.push(name);
|
checkedNames.value.push(Number(name));
|
||||||
} else {
|
} else {
|
||||||
checkedItems.value = checkedItems.value.filter(item => item !== id);
|
checkedItems.value = checkedItems.value.filter(item => item !== id);
|
||||||
checkedNames.value = checkedNames.value.filter(item => item !== name);
|
checkedNames.value = checkedNames.value.filter(item => item !== name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 콘솔에 현재 체크된 name 값 출력
|
// 콘솔에 현재 체크된 name 값 출력
|
||||||
console.log("현재 체크된 name 값:", checkedNames.value);
|
// console.log("현재 체크된 name 값:", checkedNames.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAnyChecked = computed(() => checkedItems.value.length > 0);
|
const isAnyChecked = computed(() => checkedItems.value.length > 0);
|
||||||
|
|
||||||
|
// 용어집 삭제
|
||||||
|
const deleteCheckedItems = () => {
|
||||||
|
// console.log("현재 체크된 name 값:", Object.values(checkedNames.value));
|
||||||
|
|
||||||
|
axios.patch('worddict/deleteword', {
|
||||||
|
idList: Object.values(checkedNames.value)
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.data.status == 'OK') {
|
||||||
|
toastStore.onToast('용어 삭제가 완료되었습니다.', 's');
|
||||||
|
isWriteVisible.value = false;
|
||||||
|
getwordList();
|
||||||
|
|
||||||
|
// 삭제 후 초기화
|
||||||
|
checkedItems.value = [];
|
||||||
|
checkedNames.value = [];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('삭제 요청 중 오류 발생:', error);
|
||||||
|
toastStore.onToast('오류가 발생했습니다. 다시 시도해주세요.', 'e');
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user