From 8b56ce4e428659a2805c1b0074623a8bccab8564 Mon Sep 17 00:00:00 2001 From: Dang Date: Tue, 18 Feb 2025 14:26:24 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=91=EC=97=85=20=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EC=84=A4=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/wordDict/DictCard.vue | 13 +++++++------ src/components/wordDict/DictWrite.vue | 7 ++++++- src/views/wordDict/wordDict.vue | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/wordDict/DictCard.vue b/src/components/wordDict/DictCard.vue index 8004a55..36825f5 100644 --- a/src/components/wordDict/DictCard.vue +++ b/src/components/wordDict/DictCard.vue @@ -87,7 +87,7 @@ const localCateList = ref([...props.cateList]); const selectedCategory = ref(''); // cateList emit -const emit = defineEmits(['update:cateList']); +const emit = defineEmits(['update:cateList','refreshWordList']); // 글 수정 상태 const isWriteVisible = ref(false); @@ -126,6 +126,7 @@ const addCategory = (data) => { } } + // 용어집 수정 const editWord = (data) => { console.log('📌 수정할 데이터:', data); @@ -142,15 +143,15 @@ const editWord = (data) => { axios.patch('worddict/updateWord', { WRDDICSEQ: data.id, - WRDDICCAT: 600104, + WRDDICCAT: data.category, WRDDICTTL: data.title, - WRDDICRIK: $common.deltaAsJson(data.content), + WRDDICCON: $common.deltaAsJson(data.content), }) .then((res) => { - if (res.data.data === '1') { + if (res.data.data === 1) { toastStore.onToast('✅ 용어가 수정되었습니다.', 's'); - isWriteVisible.value = false; // 성공 시에만 닫기 - // getwordList(); // 목록 갱신 + isWriteVisible.value = false; + emit('refreshWordList'); } else { console.warn('⚠️ 서버 응답이 예상과 다릅니다:', res.data); toastStore.onToast('용어 수정이 정상적으로 처리되지 않았습니다.', 'e'); diff --git a/src/components/wordDict/DictWrite.vue b/src/components/wordDict/DictWrite.vue index b6dd169..65bdceb 100644 --- a/src/components/wordDict/DictWrite.vue +++ b/src/components/wordDict/DictWrite.vue @@ -73,6 +73,11 @@ const addCategoryAlert = ref(false); //선택 카테고리 const selectCategory = ref(''); +// 카테고리 상태 +const selectedCategory = computed(() => + selectCategory.value === '' ? props.formValue : selectCategory.value +); + const props = defineProps({ dataList: { type: Array, @@ -133,7 +138,7 @@ const saveWord = () => { const wordData = { id: props.NumValue || null, title: wordTitle.value, - category: selectCategory.value, + category: selectedCategory.value, content: content.value, }; diff --git a/src/views/wordDict/wordDict.vue b/src/views/wordDict/wordDict.vue index 9e083fe..68a060b 100644 --- a/src/views/wordDict/wordDict.vue +++ b/src/views/wordDict/wordDict.vue @@ -49,6 +49,7 @@ :key="item.WRDDICSEQ" :item="item" :cateList="cateList" + @refreshWordList="getwordList" />