Stormen123 2023-06-26
20230626 김성훈 사용자 상세조회,수정,삭제 추가
@6204bb43d2a0c6252d6b79ee586b345cd8df82bc
client/views/pages/SystemManagement/UserAddForm.vue
--- client/views/pages/SystemManagement/UserAddForm.vue
+++ client/views/pages/SystemManagement/UserAddForm.vue
@@ -3,10 +3,10 @@
     <div class="tab-wrap">
       <ul>
         <li>
-          <a href="" class="tab active">사용자 관리</a>
+          <button class="tab active">사용자 관리</button>
         </li>
         <li>
-          <a href="" class="tab">접속기록 조회</a>
+          <button @click="accessLogPage()" class="tab">접속기록 조회</button>
         </li>
       </ul>
     </div>
@@ -23,21 +23,19 @@
         </div>
         <div class="flex m-b">
           <span>비밀번호 : </span>
-          <input type="password" placeholder="Password" v-model="user.user_pw" @change="passwordSyncCheck()">
+          <input type="password" placeholder="Password" v-model="user.user_pw">
         </div>
         <div class="flex m-b">
           <span>비밀번호 확인 : </span>
-          <input type="password" placeholder="Confirm Password" v-model="passwordCheck" @change="passwordSyncCheck()">
+          <input type="password" placeholder="Confirm Password" v-model="passwordCheck">
         </div>
-        <div v-if="passwordCheckFlag === true" style="color:chartreuse">비밀번호 일치</div>
-        <div v-else-if="passwordCheckFlag === false" style="color:red">비밀번호 불일치</div>
         <div class="flex m-b">
           <span>이름 : </span>
           <input type="text" placeholder="Name" v-model="user.user_nm">
         </div>
         <div class="flex m-b">
           <span>전화번호 : </span>
-          <input type="text" placeholder=" '-' 을 제외하고 입력해주세요." maxlength="13" v-model="telno" @change="phoneCheck" @keyup="getPhoneMask(telno)">
+          <input type="text" placeholder=" '-' 을 제외하고 입력해주세요." maxlength="13" v-model="user.user_telno" @change="phoneCheck" @keyup="getPhoneMask(user.user_telno)">
           <p style="color:red" v-if="telno_boolean === false">&nbsp;전화번호 9~11자리를 입력해주세요.</p>
         </div>
         <div class="flex m-b">
@@ -47,7 +45,7 @@
         </div>
         <div class="flex m-b">
           <span>관리구역 : </span>
-          <select name="" id="">
+          <select v-model="searchCip_rvnCode">
             <option value="">시/도</option>
           </select>
           <select name="" id="">
@@ -75,9 +73,7 @@
 
         <div class="btn-wrap">
           <button type="button" class="green-btn" @click="userInsertCheck">등록</button>
-          <router-link to="/UserManagement.page">
-            <span class="btn-2 gray-btn">취소</span>
-          </router-link>
+            <span class="btn-2 gray-btn" @click="userSelectListPage()">취소</span>
         </div>
       </div>
     </div>
@@ -123,6 +119,7 @@
     };
   },
   methods: {
+
     //ID 중복 검사
     idChcek: function() {
       const vm = this;
@@ -150,36 +147,25 @@
         vm.idChcek_boolean = false;
       });
     },
-  
-    //비밀번호 일치 여부 검사
-    passwordSyncCheck: function () {
-      if (this.user.user_pw != this.passwordCheck && this.user.user_pw != "" && this.passwordCheck != "" &&
-          this.user.user_pw != null && this.passwordCheck != null) {
-        this.passwordCheckFlag = false;
-      } else if (this.user.user_pw === this.passwordCheck && this.user.user_pw != "" && this.passwordCheck != ""&&
-                 this.user.user_pw != null && this.passwordCheck != null) {
-        this.passwordCheckFlag = true;
-      } else if (this.user.user_pw === "" || this.passwordCheck === "") {
-        this.passwordCheckFlag = null;
-      }
-    },
 
     //전화번호 입력 시 자동 '-' 삽입
     getPhoneMask: function(telNumber) {
       var res = COMMON_UTIL.getMask(telNumber)
-      this.telno = res
-      //서버 전송 값에는 '-' 를 제외하고 숫자만 저장
-      this.user.user_telno = this.telno.replace(/[^0-9]/g, '')
+      this.user.user_telno = res
     },
     
     emailCheck: function() {
       this.email_boolean = true;
-      if (COMMON_UTIL.checkEmail(this.user.user_eml) === false) this.email_boolean = false;
+
+      if (COMMON_UTIL.checkEmail(this.user.user_eml) === false) 
+      this.email_boolean = false;
     },
 
     phoneCheck: function() {
       this.telno_boolean = true;
-      if (COMMON_UTIL.checkPhone(this.user.user_telno) === false) this.telno_boolean = false;
+
+      if (COMMON_UTIL.checkPhone(this.user.user_telno) === false) 
+      this.telno_boolean = false;
     },
 
     // 등록버튼 클릭 시 빈칸 검사
@@ -199,7 +185,7 @@
         return false;
       }
 
-      if (this.passwordCheckFlag === false || this.passwordCheckFlag === null) {
+      if (COMMON_UTIL.checkPassword(this.user.user_pw, this.passwordCheck) === false) {
         alert('비밀번호가 일치하지 않습니다.');
         return false;
       }
@@ -244,6 +230,9 @@
     // 사용자 등록
     userInsert: function() {
       const vm = this;
+      //서버 전송 값에는 '-' 를 제외하고 숫자만 저장
+      vm.user.user_telno = vm.user.user_telno.replace(/[^0-9]/g, '');
+
       axios({
         url: '/user/userInsert.json',
         method: 'post',
@@ -259,17 +248,23 @@
           vm.userSelectListPage();
         } else {
           alert("등록 실패, 관리자에게 문의해주세요.");
-          vm.modal_1 = false;
+          vm.modal_insert = false;
         }
       }).catch(function (error) {
         console.log("userInsert - error : ", error);
         alert("사용자 등록 오류, 관리자에게 문의해주세요.");
-        vm.modal_1 = false;
+        vm.modal_insert = false;
       })
     },
-
+    
+    //사용자 목록 페이지 이동
     userSelectListPage: function () {
-      this.$router.push({ path : '/UserManagement.page'});
+      this.$router.push({ path: '/UserManagement.page'});
+    },
+
+    //접속기록조회 페이지 이동
+    accessLogPage: function () {
+      this.$router.push({ path: '/AccessRecord.page'});
     },
   },
   watch: {},
client/views/pages/SystemManagement/UserManagement.vue
--- client/views/pages/SystemManagement/UserManagement.vue
+++ client/views/pages/SystemManagement/UserManagement.vue
@@ -3,22 +3,22 @@
     <div class="tab-wrap">
       <ul>
         <li>
-          <button @click="userSelectListPage" class="tab active">사용자 관리</button>
+          <button class="tab active">사용자 관리</button>
         </li>
         <li>
-          <button @click="accessLogPage" class="tab">접속기록 조회</button>
+          <button @click="accessLogPage()" class="tab">접속기록 조회</button>
         </li>
       </ul>
     </div>
     <div class="board-wrap">
       <div>
-        <h2 class="page-title">사용자 등록</h2>
+        <h2 class="page-title">사용자 관리</h2>
       </div>
       <hr class="margin">
       <div class="search-wrap clear-fix">
         <div class="float-left">
           <select v-model="userListSearch.authorFilter" @change="userSelectList">
-            <option value="">권한필터</option>
+            <option value="null">권한필터</option>
             <option value="시청관리자">시청관리자</option>
             <option value="지자체관리자">지자체관리자</option>
           </select>
@@ -26,10 +26,10 @@
         <div class="float-right flex gap">
           <label>등록일자</label>
           <input type="date" value-format="yyyyMMdd" v-model="userListSearch.startDate"/>
-          <span>~</span>
+          <span> ~ </span>
           <input type="date" value-format="yyyyMMdd" v-model="userListSearch.endDate"/>
           <select v-model="userListSearch.searchType">
-            <option value="">검색조건</option>
+            <option value="null">검색조건</option>
             <option value="user_id">ID</option>
             <option value="user_nm">이름</option>
             <option value="dong_cd">관리구역</option>
@@ -139,11 +139,6 @@
     //날짜 시,분,초 자르기
     yyyymmdd: function (date) {
       return COMMON_UTIL.yyyymmdd(date);
-    },
-
-    //사용자 목록 페이지 이동
-    userSelectListPage: function () {
-      this.$router.push({ path: '/UserManagement.page'});
     },
 
     //접속기록조회 페이지 이동
client/views/pages/SystemManagement/UserModifyForm.vue
--- client/views/pages/SystemManagement/UserModifyForm.vue
+++ client/views/pages/SystemManagement/UserModifyForm.vue
@@ -3,10 +3,10 @@
     <div class="tab-wrap">
       <ul>
         <li>
-          <a href="" class="tab active">사용자 관리</a>
+          <button class="tab active">사용자 관리</button>
         </li>
         <li>
-          <a href="" class="tab">접속기록 조회</a>
+          <button @click="accessLogPage()" class="tab">접속기록 조회</button>
         </li>
       </ul>
     </div>
@@ -18,25 +18,23 @@
       <div class="form-wrap">
         <div class="flex m-b">
           <span>아이디 : </span>
-          <span>admin </span>
+          <span>{{ user.user_id }} </span>
         </div>
         <div class="flex m-b">
           <span>비밀번호 : </span>
-          <input type="password" placeholder="Password" v-model="user.user_pw" @change="passwordSyncCheck()">
+          <input type="password" placeholder="Password" v-model="user.user_pw">
         </div>
         <div class="flex m-b">
           <span>비밀번호 확인 : </span>
-          <input type="password" placeholder="Confirm Password" v-model="passwordCheck" @change="passwordSyncCheck()">
+          <input type="password" placeholder="Confirm Password" v-model="passwordCheck">
         </div>
-        <div v-if="passwordCheckFlag === true" style="color:chartreuse">비밀번호 일치</div>
-        <div v-else-if="passwordCheckFlag === false" style="color:red">비밀번호 불일치</div>
         <div class="flex m-b">
           <span>이름 : </span>
           <input type="text" placeholder="Name" v-model="user.user_nm">
         </div>
         <div class="flex m-b">
           <span>전화번호 : </span>
-          <input type="text" placeholder=" '-' 을 제외하고 입력해주세요." maxlength="13" v-model="telno" @change="phoneCheck" @keyup="getPhoneMask(telno)">
+          <input type="text" placeholder=" '-' 을 제외하고 입력해주세요." maxlength="13" v-model="user.user_telno" @change="phoneCheck" @keyup="getPhoneMask(user.user_telno)">
           <p style="color:red" v-if="telno_boolean === false">&nbsp;전화번호 9~11자리를 입력해주세요.</p>
         </div>
         <div class="flex m-b">
@@ -73,24 +71,38 @@
         </div>
 
         <div class="btn-wrap">
-          <button type="button" class="green-btn" @click="userInsertCheck">수정</button>
-          <button type="button" class="green-btn" @click="DeleteCheck">삭제</button>
-          <router-link to="/UserManagement.page">
-            <span class="btn-2 gray-btn">취소</span>
-          </router-link>
+          <button type="button" class="green-btn" @click="userUpdateCheck">수정</button>
+          <button type="button" class="green-btn" @click="modal_delete = true">삭제</button>
+            <span class="btn-2 gray-btn" @click="userSelectListPage()">취소</span>
         </div>
       </div>
     </div>
   </div>
 
-  <div class="modal-wrap" v-if="modal_insert == true">
+  <div class="modal-wrap" v-if="modal_update == true">
     <div class="modal-bg">
     </div>
     <div class="modal">
-      <p>사용자를 <span class="txt-point">등록</span>하시겠습니까?</p>
+      <p>수정하신 정보를 <span class="txt-point">저장</span>하시겠습니까?</p>
       <div class="btn-wrap">
-        <button type="button" class="green-btn" @click="userInsert">확인</button>
-        <button type="button" class="gray-btn" @click="modal_insert = false">취소</button>
+        <button type="button" class="green-btn" @click="userUpdate">확인</button>
+        <button type="button" class="gray-btn" @click="modal_update = false">취소</button>
+      </div>
+    </div>
+  </div>
+
+  <div class="modal-wrap"  v-if="modal_delete == true">
+    <div class="modal-bg">
+    </div>
+    <div class="modal">
+      <p>
+        해당 기능은 데이터 <span class="txt-point-red">삭제</span>기능입니다.<br>
+        데이터 <span class="txt-point-red">삭제</span> 후, 조회에서 해당 데이터를 확인할 수 없습니다.<br>
+        <span class="txt-point-red">삭제</span>를 원하시면 아래 삭제 버튼을 눌러주세요.
+      </p>
+      <div class="btn-wrap">
+        <button type="button" class="green-btn" @click="userDelete">삭제</button>
+        <button type="button" class="gray-btn" @click="modal_delete = false">취소</button>
       </div>
     </div>
   </div>
@@ -99,6 +111,7 @@
 <script>
 import axios from 'axios';
 import COMMON_UTIL from '../../../resources/js/commonUtil.ts';
+import { useRoute } from 'vue-router';
 
 export default {
   data: () => {
@@ -112,64 +125,48 @@
         user_author: null,
         rm: null
       },
+      route: useRoute(),
+
       passwordCheck: null,
-      passwordCheckFlag: null,
+      
       telno_boolean: true,
       email_boolean: true,
-      idChcek_boolean: false,
-      telno: null,
-      modal_insert: false
+      modal_update: false,
+      modal_delete: false
 
     };
   },
   methods: {
-    //ID 중복 검사
-    idChcek: function() {
+
+    //사용자 상세조회
+    userSelectOne: function() {
       const vm = this;
       axios({
         url: '/user/userSelectOne.json',
         method: 'post',
-        herders: {
-          'Content-Type': "application/json; charset=UTF-8",
+        headers: {
+          "Content-Type": "application/json; charset=UTF-8"
         },
-        data: vm.user
-      }).then( function (response) {
-        console.log("idCheck - response : ", response.data);
-        if(response.data != null) {
-          alert("중복된 ID 입니다.");
-          vm.idChcek_boolean = false;
-          return false;
-        } else {
-          alert("사용가능한 ID 입니다.");
-          vm.idChcek_boolean = true;
-          return true;
-        }
-      }).catch( function (error) {
-        console.log("idCheck - error : ", error);
-        alert("중복검사 오류, 다시 시도해주세요.");
-        vm.idChcek_boolean = false;
+        data: vm.route.query
+      }).then(function (response) {
+        console.log("userSelectOne - response : ", response.data);
+        vm.user = response.data;
+        vm.user.user_telno = vm.HyphenMinus(response.data.user_telno);
+      }).catch(function(error) {
+        console.log("userSelectOne - error : ", error)
       });
     },
-  
-    //비밀번호 일치 여부 검사
-    passwordSyncCheck: function () {
-      if (this.user.user_pw != this.passwordCheck && this.user.user_pw != "" && this.passwordCheck != "" &&
-          this.user.user_pw != null && this.passwordCheck != null) {
-        this.passwordCheckFlag = false;
-      } else if (this.user.user_pw === this.passwordCheck && this.user.user_pw != "" && this.passwordCheck != ""&&
-                 this.user.user_pw != null && this.passwordCheck != null) {
-        this.passwordCheckFlag = true;
-      } else if (this.user.user_pw === "" || this.passwordCheck === "") {
-        this.passwordCheckFlag = null;
-      }
+
+     // 전화번호 '-' 추가 후 출력
+     HyphenMinus: function (telno) {
+      return COMMON_UTIL.HyphenMinus(telno);
     },
 
     //전화번호 입력 시 자동 '-' 삽입
     getPhoneMask: function(telNumber) {
       var res = COMMON_UTIL.getMask(telNumber)
-      this.telno = res
-      //서버 전송 값에는 '-' 를 제외하고 숫자만 저장
-      this.user.user_telno = this.telno.replace(/[^0-9]/g, '')
+      this.user.user_telno = res
+      // this.user.user_telno = this.user_telno.replace(/[^0-9]/g, '')
     },
     
     emailCheck: function() {
@@ -182,24 +179,15 @@
       if (COMMON_UTIL.checkPhone(this.user.user_telno) === false) this.telno_boolean = false;
     },
 
-    // 등록버튼 클릭 시 빈칸 검사
-    userInsertCheck: function() {
-      if (COMMON_UTIL.isEmpty(this.user.user_id) === false) {
-        alert('수정하신 정보를 저장하시겠습니까?');
-        return false;
-      }
-
-      if (this.idChcek_boolean === false) {
-        alert("ID중복검사를 완료해주세요.")
-        return false;
-      }
-
+    // 수정버튼 클릭 시 빈칸 검사
+    userUpdateCheck: function() {
+   
       if (COMMON_UTIL.isEmpty(this.user.user_pw) === false) {
         alert('비밀번호를 입력해주세요.');
         return false;
       }
 
-      if (this.passwordCheckFlag === false || this.passwordCheckFlag === null) {
+      if (COMMON_UTIL.checkPassword(this.user.user_pw, this.passwordCheck) === false) {
         alert('비밀번호가 일치하지 않습니다.');
         return false;
       }
@@ -238,44 +226,80 @@
         alert('권한을 선택해주세요.');
         return false;
       }
-      this.modal_insert = true
+      this.modal_update = true
     },
 
-    // 사용자 삭제
-    DeleteCheck: function() {
+    userUpdate: function() {
       const vm = this;
+      //서버 전송 값에는 '-' 를 제외하고 숫자만 저장
+      vm.user.user_telno = vm.user.user_telno.replace(/[^0-9]/g, '');
+
       axios({
-        url: '/user/userInsert.json',
+        url: '/user/userUpdate.json',
         method: 'post',
-        herders: {
+        headers: {
           'Content-Type': "application/json; charset=UTF-8",
         },
         data: vm.user
-      }).then(function (response) {
-        console.log("userInsert - response : ", response);
+      }).then(function(response) {
+        console.log("userUpdate - response : ",response.data);
         let result = response.data;
-        if (result > 0) {
-          alert("해당 기능은 데이터 삭제 기능입니다. 데이터 삭제 후, 조회에서 해당 데이터를 확인할 수 없습니다.삭제를 원하시면 아래 삭제 버튼을 눌러 주세요.");
+        if(result > 0) {
+          alert("사용자 정보 수정을 완료 하였습니다.");
           vm.userSelectListPage();
         } else {
-          alert("등록 실패, 관리자에게 문의해주세요.");
-          vm.modal_1 = false;
+          alert("수정 실패, 관리자에게 문의해주세요.");
+          vm.modal_update = false;
         }
       }).catch(function (error) {
-        console.log("userInsert - error : ", error);
-        alert("해당 기능은 데이터 삭제 기능입니다. 데이터 삭제 후, 조회에서 해당 데이터를 확인할 수 없습니다.삭제를 원하시면 아래 삭제 버튼을 눌러 주세요.");
-        vm.modal_1 = false;
+        console.log("userUpdate - error : ", error);
+        alert("사용자정보 수정 오류, 관리자에게 문의해주세요.");
+        vm.modal_update = false;
       })
     },
 
+    //사용자아이디 사용여부 N
+    userDelete: function() {
+      const vm = this;
+      axios({
+        url: '/user/userDelete.json',
+        method: 'post',
+        headers: {
+          'Content-Type': "application/json; charset=UTF-8",
+        },
+        data: vm.user
+      }).then(function(response) {
+        console.log("userUpdate - response : ",response.data);
+        let result = response.data;
+        if(result > 0) {
+          alert("사용자 삭제를 완료 하였습니다.");
+          vm.userSelectListPage();
+        } else {
+          alert("삭제 실패, 관리자에게 문의해주세요.");
+          vm.modal_delete = false;
+        }
+      }).catch(function (error) {
+        console.log("userUpdate - error : ", error);
+        alert("사용자 삭제 오류, 관리자에게 문의해주세요.");
+        vm.modal_delete = false;
+      })
+    },
+
+    //사용자 목록 페이지 이동
     userSelectListPage: function () {
-      this.$router.push({ path : '/UserManagement.page'});
+      this.$router.push({ path: '/UserManagement.page'});
+    },
+
+    //접속기록조회 페이지 이동
+    accessLogPage: function () {
+      this.$router.push({ path: '/AccessRecord.page'});
     },
   },
   watch: {},
   computed: {},
   mounted() {
     console.log("Main4 mounted");
+    this.userSelectOne();
   },
 };
 </script>
@@ -407,4 +431,8 @@
 .txt-point {
   color: #13833b;
 }
+
+.txt-point-red {
+  color: red;
+}
 </style>
(No newline at end of file)
Add a comment
List