하관우 하관우 04-04
2025-04-04 하관우 카테고리 회원 수정정
@0d1c5b9c2aa2098a481798582a0e8c3df0c74d78
client/views/pages/ctgry/CategoryManagement.vue
--- client/views/pages/ctgry/CategoryManagement.vue
+++ client/views/pages/ctgry/CategoryManagement.vue
@@ -29,6 +29,9 @@
                         </tr>
                     </thead>
                     <tbody>
+                        <tr v-if="selectedCategories.length === 0">
+                            <td colspan="3" style="text-align: center;">등록된 카테고리리가 없습니다.</td>
+                        </tr>
                         <tr v-for="item in selectedCategories" :key="item.ctgryId"
                             :class="{ 'delete-member': item.useAt === 'N' }" @click="selectCategory(item)">
                             <!-- Category 칼럼 -->
@@ -45,13 +48,13 @@
                         class="button green-line" @click="updateByUseAtCategory">복구</div>
                     <div v-if="copySelectedCategory.useAt === 'Y' && isNewInsert && ctgryId != null"
                         class="button red-line" @click="updateByUseAtCategory">삭제</div>
-                    <div class="button pink-line-bg flex align-center" @click="resetCategory"><img :src="check_pink"
-                            alt="">
+                    <div v-if="newInsertCheck" class="button pink-line-bg flex align-center" @click="resetCategory"><img
+                            :src="check_pink" alt="">
                         <p>신규등록</p>
                     </div>
                     <div class="button blue-line-bg flex align-center" @click="insertByUpdateCategory"><img
                             :src="check_blue" alt="">
-                        <p>등록</p>
+                        {{ newInsertCheck ? "수정" : "등록" }}
                     </div>
                     <div class="button gray-bg" @click="cancelCategory">취소</div>
                 </div>
@@ -67,7 +70,8 @@
                             <label for="use" class="require">사용여부</label>
                             <div class="switch">
                                 <input type="checkbox" id="switch" :checked="selectedCategory.useAt === 'Y'"
-                                    @change="toggleUseAt" :disabled="!isNewInsert"/>
+                                    @change="toggleUseAt"
+                                    :disabled="!isNewInsert || (this.ctgryId !== null || this.ctgryId !== '')" />
                                 <label for="switch">Toggle</label>
                             </div>
 
@@ -107,12 +111,13 @@
             check_pink: 'client/resources/images/checkbox_pink.png',
             check_blue: 'client/resources/images/checkbox_blue.png',
             searchicon: 'client/resources/images/icon/search.png',
+            newInsertCheck: false,
             selectedCategories: [],
             ctgryId: null,
             // 선택된 카테고리 정보를 저장할 객체
             selectedCategory: {
                 ctgryNm: null,
-                useAt: null,
+                useAt: "Y",
                 dc: null
             },
             // 선택된 카테고리 정보를 저장할 객체 copy
@@ -120,7 +125,7 @@
                 oldCtgryNm: null,
                 ctgryId: null,
                 ctgryNm: null,
-                useAt: null,
+                useAt: "Y",
                 dc: null
             },
             searchReqDTO: {
@@ -149,13 +154,14 @@
         },
         // 클릭한 카테고리의 정보를 오른쪽에 표시
         selectCategory(item) {
-            this.isNewInsert = true;
+            this.newInsertCheck = true,
+                this.isNewInsert = true;
             this.ctgryId = item.ctgryId,
-            this.selectedCategory = {
-                ctgryNm: item.ctgryNm,
-                useAt: item.useAt,
-                dc: item.dc
-            };
+                this.selectedCategory = {
+                    ctgryNm: item.ctgryNm,
+                    useAt: item.useAt,
+                    dc: item.dc
+                };
             this.copySelectedCategory = {
                 oldCtgryNm: item.ctgryNm,
                 ctgryId: item.ctgryId,
@@ -169,9 +175,10 @@
         // 삭제 또는 복구 로직
         async updateByUseAtCategory() {
             if (this.selectedCategory.useAt === 'Y') {
-                this.selectedCategory.useAt = 'N'
                 if (confirm("선택한 카테고리를 삭제 하시겠습니까?")) {
                     try {
+                        this.selectedCategory.useAt = 'N'
+                        this.copySelectedCategory.useAt ='N'
                         const response = await updateCategory(this.ctgryId, this.selectedCategory);
                         if (response.status === 200) {
                             alert("삭제되었습니다..");
@@ -184,9 +191,10 @@
                     }
                 }
             } else {
-                this.selectedCategory.useAt = 'Y'
                 if (confirm("선택한 카테고리를 복구 하시겠습니까?")) {
                     try {
+                        this.selectedCategory.useAt = 'Y'
+                        this.copySelectedCategory.useAt ='Y'
                         const response = await updateCategory(this.ctgryId, this.selectedCategory);
                         if (response.status === 200) {
                             alert("복구되었습니다..");
@@ -202,7 +210,8 @@
         },
         // 신규 등록
         resetCategory() {
-            this.isNewInsert = false
+            this.newInsertCheck = false;
+            this.isNewInsert = false;
             this.ctgryId = null;
             this.selectedCategory = {
                 ctgryNm: null,
@@ -273,22 +282,31 @@
         },
         //취소소
         cancelCategory() {
-            this.ctgryId = this.copySelectedCategory.ctgryId,
-            this.selectedCategory = {
-                ctgryNm: this.copySelectedCategory.ctgryNm,
-                useAt: this.copySelectedCategory.useAt,
-                dc: this.copySelectedCategory.dc,
-            };
+            if (confirm("초기값으로 변경하시겠습니까?")) {
+                if (this.ctgryId === null || this.ctgryId === "") {
+                    this.selectedCategory = {
+                        ctgryNm: null,
+                        useAt: "Y",
+                        dc: null,
+                    };
+                } else {
+                    this.selectedCategory = {
+                        ctgryNm: this.copySelectedCategory.ctgryNm,
+                        useAt: this.copySelectedCategory.useAt,
+                        dc: this.copySelectedCategory.dc,
+                    };
+                }
+            }
         },
         //카테고리 벨류데이션 체크
         isValidationCategory() {
             return this.selectedCategory.ctgryNm == null || this.selectedCategory.ctgryNm == '';
         },
         //수정 함수
-        updateCategory(){
+        updateCategory() {
             this.copySelectedCategory.ctgryNm = this.selectedCategory.ctgryNm;
             this.copySelectedCategory.useAt = this.selectedCategory.useAt;
-            this.copySelectedCategory.dc =  this.selectedCategory.dc;
+            this.copySelectedCategory.dc = this.selectedCategory.dc;
         }
 
     },
client/views/pages/member/MemberManagement.vue
--- client/views/pages/member/MemberManagement.vue
+++ client/views/pages/member/MemberManagement.vue
@@ -31,20 +31,26 @@
                         </button>
                     </div>
                 </div>
-                <table class="mb-10">
+                <table class="mb-10" style="width: 100%;">
                     <thead>
                         <tr>
-                            <th>아이디</th>
-                            <th>이름</th>
-                            <th>권한</th>
+                            <th style="width: 30%">아이디</th>
+                            <th style="width: 40%">이름</th>
+                            <th style="width: 30%">권한</th>
                         </tr>
                     </thead>
                     <tbody>
+                        <tr v-if="selectedUsers.length === 0">
+                            <td colspan="3" style="text-align: center;">등록된 사용자가 없습니다.</td>
+                        </tr>
                         <tr v-for="(item, index) in selectedUsers" :key="index"
                             :class="{ 'delete-member': item.useAt === 'N' }" @click="selectUser(item)">
                             <td>{{ item.loginId }}</td>
                             <td>{{ item.userNm }}</td>
-                            <td>{{ item.authorList[0].authorNm }}</td>
+                            <td>
+                                <span v-if="item.authorList.length > 0">{{ item.authorList[0].authorNm }}</span>
+                                <span v-else>없음</span>
+                            </td>
                         </tr>
                     </tbody>
                 </table>
@@ -63,7 +69,7 @@
                             :src="check_blue" alt="">
                         <p>등록</p>
                     </div>
-                    <div class="button gray-bg">취소</div>
+                    <div class="button gray-bg" @click="cancelUser">취소</div>
                 </div>
                 <form action="" class="insert-form mb-50">
                     <dl>
@@ -111,7 +117,7 @@
                             <label for="use" class="require">사용여부</label>
                             <div class="switch">
                                 <input type="checkbox" id="switch" :checked="selectedUser.useAt === 'Y'"
-                                    @change="toggleUseAt" :disabled="!isNewInsert" /> 
+                                    @change="toggleUseAt" :disabled="!isNewInsert || (this.userId !== null || this.userId !== '')" />
                                 <label for="switch">Toggle</label>
                             </div>
                         </dd>
@@ -195,6 +201,26 @@
         };
     },
     methods: {
+        cancelUser() {
+            if (this.userId === null || this.userId === "") {
+                this.loginId = null;
+                this.password = null;
+                this.passwordCheck = null;
+                this.selectedUser = {
+                    userNm: null,
+                    useAt: "Y",
+                    authorUpdateCheck: false,
+                    authorList: [{ authorCode: "ROLE_ADMIN" }]
+                };
+            } else {
+                this.selectedUser = {
+                    userNm: this.copySelectedUser.userNm,
+                    useAt: this.copySelectedUser.useAt,
+                    authorUpdateCheck: false,
+                    authorList: [{ authorCode: this.copySelectedUser.authorList[0].authorCode }] // 배열 형태로 설정
+                };
+            }
+        },
         //등록 함수
         updateUser() {
             this.joinDTO.loginId = this.loginId;
Add a comment
List