하석형 하석형 05-16
250516 하석형 권한 삭제 시 사용 중인 부서가 있을 경우 삭제 불가, 팝업 위치 정중앙 설정
@cf5ef583b9a492274a9da4ddac18aa1b4cfef149
client/resources/api/dept.js
--- client/resources/api/dept.js
+++ client/resources/api/dept.js
@@ -34,4 +34,8 @@
 
 export const deptMbrSaveProc = params => {
     return apiClient.post(`/admin/dept/deptMbrSaveProc.json`, params);
+}
+
+export const findDeptAuthrtByAuthrtCd = params => {
+    return apiClient.post(`/admin/dept/findDeptAuthrtByAuthrtCd.json`, params);
 }
(파일 끝에 줄바꿈 문자 없음)
client/views/pages/adm/authority/authority/AuthoritySelectList.vue
--- client/views/pages/adm/authority/authority/AuthoritySelectList.vue
+++ client/views/pages/adm/authority/authority/AuthoritySelectList.vue
@@ -66,6 +66,7 @@
 import ListTable from "../../../../component/table/ListTable.vue";
 import PaginationButton from "../../../../component/pagination/PaginationButton.vue";
 import { findAll, del } from "../../../../../resources/api/authrt";
+import { findDeptAuthrtByAuthrtCd } from "../../../../../resources/api/dept";
 import queryParams from "../../../../../resources/js/queryParams";
 import { toRaw } from "vue";
 import { defaultSearchParams } from "../../../../../resources/js/defaultSearchParams";
@@ -131,16 +132,24 @@
     },
     // 삭제
     async fnDel(row, idx) {
-      if (this.list[idx].sysPvsnYn == 0) {
+      const item = this.list[idx];
+      if (item.sysPvsnYn == 0) {
         alert("시스템에서 제공하는 정보는 삭제할 수 없습니다.");
         return;
       }
+      
+      const isUsed = await this.fnDeptAuthrt({authrtCd: item.authrtCd});
+      if (isUsed) {
+        alert("권한을 사용 중인 부서가 있어 삭제할 수 없습니다.");
+        return;
+      }
+
       if (!confirm("삭제하시겠습니까?")) {
         return;
       }
       try {
-        this.list[idx].useYn = "N";
-        const res = await del(this.list[idx]);
+        item.useYn = "N";
+        const res = await del(item);
         alert(res.data.message);
         if (res.status == 200) {
           this.findAll();
@@ -154,6 +163,24 @@
         }
       }
     },
+    // 부서 권한 목록 조회
+    async fnDeptAuthrt(authrtCd) {
+      try {
+        const res = await findDeptAuthrtByAuthrtCd(authrtCd);
+        if (res.status == 200) {
+          return res.data.data?.length > 0;
+        }
+        return false;
+      } catch (error) {
+        const errorData = error.response.data;
+        if (errorData.message != null && errorData.message != "") {
+          alert(error.response.data.message);
+        } else {
+          alert("에러가 발생했습니다.\n관리자에게 문의해주세요.");
+        }
+        return false;
+      }
+    },
     // tbody 생성
     makeTbody() {
       this.tbody = []; // 초기화
client/views/pages/adm/departmentManagement/DepartmentManagement.vue
--- client/views/pages/adm/departmentManagement/DepartmentManagement.vue
+++ client/views/pages/adm/departmentManagement/DepartmentManagement.vue
@@ -306,13 +306,13 @@
     },
     // 저장
     async fnSave() {
+      // 유효성 검사
+      if (this.validation() == false) {
+        return false;
+      }
       // 변경전 코드와 비교
       if(_.isEqual(this.viewDept, this.originDept)) {
         alert("변경할 내용이 없습니다.");
-        return false;
-      }
-      // 유효성 검사
-      if (this.validation() == false) {
         return false;
       }
       // 신규 등록 및 수정 설정
client/views/pages/adm/main/Main.vue
--- client/views/pages/adm/main/Main.vue
+++ client/views/pages/adm/main/Main.vue
@@ -326,16 +326,28 @@
           }
         }
         if (!count) {
+            const width = popup.wdthLen;
+            const height = popup.vrtcLen;
+
+            const screenX = window.screenX ?? window.screenLeft;
+            const screenY = window.screenY ?? window.screenTop;
+            const outerWidth = window.outerWidth ?? document.documentElement.clientWidth;
+            const outerHeight = window.outerHeight ?? document.documentElement.clientHeight;
+
+            const left = screenX + (outerWidth - width) / 2;
+            const top = screenY + (outerHeight - height) / 2;
+
+            const specs = `width=${width},height=${height},left=${left},top=${top},scrollbars=no,resizable=no,toolbars=no,menubar=no`;
           let size = "width=" + popup.wdthLen + ", height=" + popup.vrtcLen;
           window.open(
             "/cmmn/popup.page?popupId=" + popup.popupId,
             "_blank",
-            size + ", scrollbars=no, resizable=no, toolbars=no, menubar=no"
+            specs
+            // size + ", scrollbars=no, resizable=no, toolbars=no, menubar=no"
           );
         }
       }
     },
-
   },
 };
 
client/views/pages/adm/popup/PopupManagementInsert.vue
--- client/views/pages/adm/popup/PopupManagementInsert.vue
+++ client/views/pages/adm/popup/PopupManagementInsert.vue
@@ -191,7 +191,7 @@
             <div  class="layout">
               <label class="form-title"><span>*</span>순서</label>
               <select class="form-select sm " v-model="popup['sn']" ref="sn">
-                <option value="">순서를 선택하세요.</option>
+                <option value="0">순서를 선택하세요.</option>
                 <option value="1">1</option>
                 <option value="2">2</option>
                 <option value="3">3</option>
Add a comment
List