하석형 하석형 04-11
250411 하석형 공통코드관리 데이터 변경 시 검증
@a537010d43fb839636915a3a678477a2f61de5b0
client/views/pages/adm/preferences/commonCodeManagement/CommonCodeManagement.vue
--- client/views/pages/adm/preferences/commonCodeManagement/CommonCodeManagement.vue
+++ client/views/pages/adm/preferences/commonCodeManagement/CommonCodeManagement.vue
@@ -206,15 +206,26 @@
     },
     // 최상위 신규 객체 생성
     topAdd() {
+      if (this.selectedCd != null) {
+        if (!confirm("작성 중인 공통코드정보는 저장되지 않습니다.\n계속 하시겠습니까?")) {
+          return;
+        }
+      }
+      this.selectedCd = null; // 선택된 코드 초기화
       this.viewCode = JSON.parse(JSON.stringify(this.newCode));
       this.originCode = this.viewCode.cd;
       this.submitStts = true;
     },
     // 하위 신규 객체 생성
     subAdd() {
-      if (Object.keys(this.viewCode).length === 0) {
+      // if (Object.keys(this.viewCode).length === 0) {
+      if (this.selectedCd == null) {
         alert("상위 코드를 지정해주세요.");
         return;
+      } else {
+        if (!confirm("작성 중인 공통코드정보는 저장되지 않습니다.\n계속 하시겠습니까?")) {
+          return;
+        }
       }
       const upCd = this.viewCode.cd;
       const upCdNm = this.viewCode.cdNm;
@@ -253,10 +264,14 @@
     // axios: 목록 수정
     async fnListUpdate() {
       try {
+        if (!confirm("공통코드 목록을 저장하시겠습니까?\n 작성 중인 공통코드정보는 저장되지 않습니다.")) {
+          return;
+        }
         const res = await updateListProc(this.codeList);
         alert(res.data.message);
         if (res.status == 200) {
           this.findAll();
+          this.findByCd();
         }
       } catch (error) {
         alert(error.res.data.message);
Add a comment
List