jichoi / calendar star
박정하 박정하 5 days ago
250806 박정하 사용자 선택 모달 검색 조건 추가
@2db93e8a074d6f3cfb94cc74774433849081b151
client/resources/api/user.js
--- client/resources/api/user.js
+++ client/resources/api/user.js
@@ -15,7 +15,7 @@
 }
 
 // 스크랩 자료 수정 (PUT 메서드 사용)
-export const updateUsersProc =  (userId, formData) => {
+export const updateUsersProc = (userId, formData) => {
   return fileClient.put(`/user/${userId}/users.file`, formData);
 }
 
@@ -23,3 +23,8 @@
 export const updatePassword = (userId, updateUserPasswordDTO) => {
   return apiClient.put(`/user/${userId}/updatePassword.json`, updateUserPasswordDTO);
 }
+
+// 조회 - 목록 (모달용)
+export const findUsersForModalProc = data => {
+  return apiClient.get('/user/usersForModal.json', { params: data });
+}
(파일 끝에 줄바꿈 문자 없음)
client/views/component/Popup/HrPopup.vue
--- client/views/component/Popup/HrPopup.vue
+++ client/views/component/Popup/HrPopup.vue
@@ -51,7 +51,7 @@
 import { SearchOutlined, CloseCircleFilled } from '@ant-design/icons-vue';
 import Pagination from '../Pagination.vue';
 // API
-import { findUsersProc } from '../../../resources/api/user';
+import { findUsersForModalProc } from '../../../resources/api/user';
 
 export default {
   name: 'EmployeeSelectionModal',
@@ -72,7 +72,13 @@
     // 사용자 목록 내 유저아이디 key(혹은 column) 값
     idField: {
       type: String,
-      default: 'userId'
+      default: 'userId',
+    },
+
+    // 필터링용 날짜 정보
+    dateInfo: {
+      type: Object,
+      default: () => ({}),
     }
   },
 
@@ -85,8 +91,11 @@
       searchParams: {
         searchType: 'nm', // 검색조건 (사용자 이름으로 고정)
         searchText: null, // 검색어
-        searchSttus: 1,   // 회원상태 (승인 고정)
-        searchUseAt: 'Y', // 사용여부 (사용으로 고정)
+
+        bgnde: null,       // 시작 일 (YYYY-MM-DD)
+        beginHour: null,   // 시작 시
+        endde: null,       // 종료 일 (YYYY-MM-DD)
+        endHour: null,     // 종료 시
       },
     }
   },
@@ -97,21 +106,41 @@
     }
   },
 
+  watch: {
+    dateInfo: {
+      handler(newDateInfo) {
+        this.applyDateInfo(); // dateInfo 검색 조건에 적용
+      },
+      deep: true,
+      immediate: true
+    }
+  },
+
   mounted() {
     this.fetchEmployeeList();
   },
 
   methods: {
+    // dateInfo 검색 조건에 적용
+    applyDateInfo() {
+      if (this.dateInfo && Object.keys(this.dateInfo).length > 0) {
+        this.searchParams.bgnde = this.dateInfo.bgnde || null;
+        this.searchParams.beginHour = this.dateInfo.beginHour || null;
+        this.searchParams.endde = this.dateInfo.endde || null;
+        this.searchParams.endHour = this.dateInfo.endHour || null;
+      }
+    },
+
     // 직원 목록 조회
     async fetchEmployeeList() {
       try {
-        const response = await findUsersProc(this.searchParams);
+        const response = await findUsersForModalProc(this.searchParams);
         const result = response.data.data;
 
         this.employeeList = result.users;
         this.searchParams = result.search;
       } catch (error) {
-        const message = error.response.data.message;
+        const message = error.response?.data?.message || '데이터 조회에 실패했습니다.';
         alert(message);
         console.error(error);
       }
Add a comment
List