Merge branch 'khj'

This commit is contained in:
khj0414 2025-03-20 10:16:38 +09:00
commit c75e8a51ea
4 changed files with 38 additions and 42 deletions

View File

@ -5,35 +5,33 @@
type="button" type="button"
class="btn" class="btn"
:class="{ :class="{
'btn-outline-primary': selectedCategory !== 'all', 'btn-outline-primary': selectedCategory !== 'all',
'btn-primary': selectedCategory === 'all' 'btn-primary': selectedCategory === 'all'
}" }"
@click="selectCategory('all')" @click="selectCategory('all')"
> >
All All
</button> </button>
</li> </li>
<li v-for="category in lists" :key="category.value" class="mt-2 me-2"> <li v-for="category in lists" :key="category.value" class="mt-2 me-2">
<button <button
type="button" type="button"
class="btn" class="btn"
:class="{ :class="{
'btn-outline-primary': category.value !== selectedCategory, 'btn-outline-primary': category.value.toString() !== selectedCategory?.toString(),
'btn-primary': category.value === selectedCategory 'btn-primary': category.value.toString() === selectedCategory?.toString()
}" }"
@click="selectCategory(category.value)" @click="selectCategory(category.value)"
> >
{{ category.label }} {{ category.label }}
</button> </button>
</li> </li>
</ul> </ul>
</template> </template>
<script setup> <script setup>
import { defineProps, ref, watch } from 'vue'; import { defineProps, defineEmits, ref, watch } from 'vue';
// lists prop
const props = defineProps({ const props = defineProps({
lists: { lists: {
type: Array, type: Array,
@ -44,7 +42,7 @@ const props = defineProps({
required: false, required: false,
}, },
selectedCategory: { selectedCategory: {
type: [String, Number], type: String,
default: null, default: null,
required: false, required: false,
}, },
@ -63,4 +61,5 @@ watch(() => props.selectedCategory, (newVal) => {
selectedCategory.value = newVal; selectedCategory.value = newVal;
}); });
</script> </script>

View File

@ -9,16 +9,9 @@
:formValue="item.WRDDICCAT" :formValue="item.WRDDICCAT"
:titleValue="item.WRDDICTTL" :titleValue="item.WRDDICTTL"
:contentValue="item.WRDDICCON" :contentValue="item.WRDDICCON"
:isDisabled="userStore.user.role !== 'ROLE_ADMIN'" :isDisabled="true"
/> />
<div v-else> <div v-else>
<input
v-if="userStore.user.role == 'ROLE_ADMIN'"
type="checkbox"
class="form-check-input admin-chk"
:name="item.WRDDICSEQ"
@change="toggleCheck($event)"
>
<div class="d-flex align-ite-center"> <div class="d-flex align-ite-center">
<div class="w-100 d-flex align-items-center"> <div class="w-100 d-flex align-items-center">
<span class="btn btn-primary pe-none">{{ item.category }}</span> <span class="btn btn-primary pe-none">{{ item.category }}</span>
@ -129,7 +122,7 @@ const editWord = (data) => {
if (writeButton.value) { if (writeButton.value) {
writeButton.value.resetButton(); writeButton.value.resetButton();
} }
emit('refreshWordList'); emit('refreshWordList',data.category);
} else { } else {
console.warn('⚠️ 서버 응답이 예상과 다릅니다:', res.data); console.warn('⚠️ 서버 응답이 예상과 다릅니다:', res.data);
toastStore.onToast('용어 수정이 정상적으로 처리되지 않았습니다.', 'e'); toastStore.onToast('용어 수정이 정상적으로 처리되지 않았습니다.', 'e');

View File

@ -1,6 +1,7 @@
<template> <template>
<div> <div v-if="dataList.length > 0">
<FormSelect class="me-5" <FormSelect
class="me-5"
name="cate" name="cate"
title="카테고리" title="카테고리"
:data="dataList" :data="dataList"
@ -14,17 +15,18 @@
<PlusBtn @click="toggleInput"/> <PlusBtn @click="toggleInput"/>
</div> </div>
</div> </div>
<div v-if="dataList.length === 0 || showInput">
<div v-if="showInput"> <FormInput
<FormInput class="me-5" class="me-5"
ref="categoryInputRef" ref="categoryInputRef"
title="새 카테고리" title="새 카테고리"
name="새 카테고리" :isLabel="dataList.length === 0 ?true : false"
@update:modelValue="addCategory = $event" name="새 카테고리"
:is-cate-alert="addCategoryAlert" @update:modelValue="addCategory = $event"
@focusout="handleCategoryFocusout(addCategory)" :is-cate-alert="addCategoryAlert"
/> @focusout="handleCategoryFocusout(addCategory)"
</div> />
</div>
<FormInput class="me-5" <FormInput class="me-5"
title="용어" title="용어"
type="text" type="text"

View File

@ -112,7 +112,8 @@
writeStore.closeAll(); writeStore.closeAll();
}); });
const refreshWordList = () => { const refreshWordList = (category) => {
selectedCategory.value = category;
getwordList(searchText.value, selectedAlphabet.value, selectedCategory.value); getwordList(searchText.value, selectedAlphabet.value, selectedCategory.value);
}; };
@ -193,6 +194,7 @@
sendWordRequest(category, wordData, newCodName); sendWordRequest(category, wordData, newCodName);
}; };
const sendWordRequest = (category, wordData, data) => { const sendWordRequest = (category, wordData, data) => {
console.log(category,'category')
const payload = { const payload = {
WRDDICCAT: category, WRDDICCAT: category,
WRDDICTTL: wordData.title, WRDDICTTL: wordData.title,
@ -206,9 +208,9 @@
if (writeButton.value) { if (writeButton.value) {
writeButton.value.resetButton(); writeButton.value.resetButton();
} }
getwordList(); selectedCategory.value = category;
getwordList(searchText.value, selectedAlphabet.value, selectedCategory.value);
getIndex(); getIndex();
selectedCategory.value = 'all';
if(res.data.data == '2'){ if(res.data.data == '2'){
const newCategory = { label: data, value: category }; const newCategory = { label: data, value: category };
cateList.value = [...cateList.value,newCategory]; cateList.value = [...cateList.value,newCategory];