류윤주 류윤주 04-01
250401 류윤주 input date 공통화
@d2bc760d27574aecaad80dbc69fb5742e3615d39
client/resources/js/defaultDateParams.js
--- client/resources/js/defaultDateParams.js
+++ client/resources/js/defaultDateParams.js
@@ -36,26 +36,67 @@
     },
 
     // 조회기간 유효성 검사
+    // validateDate(event, cate) {
+    //   const val = event.target.value; // 변경된 날짜 값
+    //   // 시작일 변경 시
+    //   if (cate === "startDt") {
+    //     if (this.searchDate.endDt !== null && this.searchDate.endDt < val) {
+    //       alert("시작일은 종료일보다 클 수 없습니다.");
+    //       this.searchDate.startDt = null; // 유효하지 않은 경우, 시작일을 초기화
+    //     } else {
+    //       this.searchDate.startDt = val;
+    //     }
+    //   }
+    //   // 종료일 변경 시
+    //   else if (cate === "endDt") {
+    //     if (this.searchDate.startDt !== null && this.searchDate.startDt > val) {
+    //       alert("종료일은 시작일보다 작을 수 없습니다.");
+    //       this.searchDate.endDt = null; // 유효하지 않은 경우, 종료일을 초기화
+    //     } else {
+    //       this.searchDate.endDt = val;
+    //     }
+    //   }
+    // },
+
     validateDate(event, cate) {
-      const val = event.target.value; // 변경된 날짜 값
-      // 시작일 변경 시
+      let val;
+
+      // 값이 Date 객체인지 확인
+      if (event instanceof Date) {
+        const year = event.getFullYear();
+        const month = ('00' + (event.getMonth() + 1)).slice(-2);
+        const day = ('00' + event.getDate()).slice(-2);
+
+        val = `${year}-${month}-${day}`;
+      }
+      // 값이 Event 객체인지 확인
+      else if (event instanceof Event) {
+        val = event.target.value; // input에서 직접 입력된 값
+      }
+      // 그 외의 경우 처리 불필요 (예외 처리)
+      else {
+        console.error("Invalid date input:", event);
+        return;
+      }
+
+      // 시작일 검증
       if (cate === "startDt") {
-        if (this.searchDate.endDt !== null && this.searchDate.endDt < val) {
+        if (this.searchDate.endDt && this.searchDate.endDt < val) {
           alert("시작일은 종료일보다 클 수 없습니다.");
-          this.searchDate.startDt = null; // 유효하지 않은 경우, 시작일을 초기화
+          this.searchDate.startDt = null;
         } else {
           this.searchDate.startDt = val;
         }
       }
-      // 종료일 변경 시
+      // 종료일 검증
       else if (cate === "endDt") {
-        if (this.searchDate.startDt !== null && this.searchDate.startDt > val) {
+        if (this.searchDate.startDt && this.searchDate.startDt > val) {
           alert("종료일은 시작일보다 작을 수 없습니다.");
-          this.searchDate.endDt = null; // 유효하지 않은 경우, 종료일을 초기화
+          this.searchDate.endDt = null;
         } else {
           this.searchDate.endDt = val;
         }
       }
-    },
+    }
   }
 }
(파일 끝에 줄바꿈 문자 없음)
client/resources/scss/admin/content.scss
--- client/resources/scss/admin/content.scss
+++ client/resources/scss/admin/content.scss
@@ -371,3 +371,32 @@
 .mb30{
     margin-bottom: 3rem;
 }
+
+.dp__main{
+    height: 100%;
+    >div:first-child{
+        height: 100%;
+        *{
+            height: 100%;
+        }
+        .dp__input{
+            width: 100%;
+            border: none;
+            background-color: transparent;
+            transition: none;
+            line-height: 100%;
+            padding: 0;
+            font-size: 1.5rem;
+        }
+        .dp__icon{
+            display: none;
+        }
+       
+    }
+
+    .dp__menu,
+    .dp__selection_preview,
+    .dp__action_button{
+        font-size: 1.5rem;
+    }
+}
(파일 끝에 줄바꿈 문자 없음)
client/views/pages/adm/log/LoginLog.vue
--- client/views/pages/adm/log/LoginLog.vue
+++ client/views/pages/adm/log/LoginLog.vue
@@ -9,19 +9,27 @@
 
         </div>
         <div class="search-bar">
-          <VueDatePicker
-            time-picker-inline
-            placeholder="시작일"
-            locale="ko"
-            v-model="search['startDt']"
-          />
-        <div class="pd10">-</div>
-          <VueDatePicker
-            time-picker-inline
-            placeholder="종료일"
-            locale="ko"
-            v-model="search['endDt']"
-          />
+          <div class="form-control sm cal">
+            <VueDatePicker
+              InlineOptions
+              placeholder="시작일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="search['startDt']"
+            />
+          </div>
+          <div class="mark">-</div>
+          <div class="form-control sm cal">
+              <VueDatePicker
+              InlineOptions
+              placeholder="종료일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="search['endDt']"
+            />
+          </div>
           <select
             name="selectType"
             id="selectType"
@@ -164,6 +172,15 @@
       }
     },
     //─────axios─────┘
+
+    // 날짜포맷
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = ('00' + (date.getMonth() + 1)).slice(-2);
+      const day = ('00' + date.getDate()).slice(-2);
+      return `${year}-${month}-${day}`;
+    }
+
   },
 };
 </script>
client/views/pages/adm/log/PersonalDataLog.vue
--- client/views/pages/adm/log/PersonalDataLog.vue
+++ client/views/pages/adm/log/PersonalDataLog.vue
@@ -4,19 +4,27 @@
       <p>개인정보 조회 이력</p>
     </div>
     <div class="search-bar">
-            <VueDatePicker
-              time-picker-inline
-              placeholder="시작일"
-              locale="ko"
-              v-model="search['startDt']"
+      <div class="form-control sm cal">
+        <VueDatePicker
+          InlineOptions   
+          placeholder="시작일"
+          locale="ko"
+          :enable-time-picker="false"
+          :format="formatDate"
+          v-model="search['startDt']"
             />
-          <div>-</div>
-            <VueDatePicker
-              time-picker-inline
-              placeholder="종료일"
-              locale="ko"
-              v-model="search['endDt']"
-            />
+      </div>  
+      <div class="mark">-</div>
+      <div  class="form-control sm cal">
+        <VueDatePicker
+          InlineOptions
+          placeholder="종료일"
+          locale="ko"
+          :enable-time-picker="false"
+          :format="formatDate"
+          v-model="search['endDt']"
+        />
+      </div>
             <select
               name="selectType"
               id="selectType"
@@ -198,6 +206,23 @@
       }
     },
     //─────axios─────┘},
+    // 날짜포맷
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = date.getMonth() + 1;
+      const day = date.getDate();
+
+      // 날짜 앞에 0을 붙여야 하는 경우
+      if (month || day < 10) {
+        const zeroDay = ('00' + day).slice(-2);
+        const zeroMonth = ('00' + month).slice(-2);
+
+        return `${year}-${zeroMonth}-${zeroDay}`;
+      } else {
+
+        return `${year}-${month}-${day}`;
+      }
+    }
   },
 };
 </script>
client/views/pages/adm/statistics/BbsStatistics.vue
--- client/views/pages/adm/statistics/BbsStatistics.vue
+++ client/views/pages/adm/statistics/BbsStatistics.vue
@@ -8,20 +8,42 @@
           </div>
 
         </div>
-        <div class="input-group mb30">
-            <input
+        <div class="search-bar mb30">
+          <div class="form-control sm cal">
+            <VueDatePicker
+              InlineOptions
+              placeholder="시작일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="searchDate.startDt"
+              @update:model-value="validateDate($event, 'startDt')"
+            />
+          </div>
+            <!-- <input
               type="date"
               class="form-control sm datepicker"
               v-model="searchDate.startDt"
               @change="validateDate($event, 'startDt')"
-            />
+            /> -->
             <div class="mark">-</div>
-            <input
+            <div class="form-control sm cal">
+              <VueDatePicker
+              InlineOptions
+              placeholder="종료일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="searchDate.endDt"
+              @update:model-value="validateDate($event, 'endDt')"
+            />
+          </div>
+            <!-- <input
               type="date"
               class="form-control sm datepicker"
               v-model="searchDate.endDt"
               @change="validateDate($event, 'endDt')"
-            />
+            /> -->
             <button class="btn sm primary" @click="axiosSelectList">
               조회
             </button>
@@ -225,6 +247,14 @@
           });
       });
     },
+
+    // 날짜포맷
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = ('00' + (date.getMonth() + 1)).slice(-2);
+      const day = ('00' + date.getDate()).slice(-2);
+      return `${year}-${month}-${day}`;
+    }
   },
 };
 </script>
(파일 끝에 줄바꿈 문자 없음)
client/views/pages/adm/statistics/MenuStatistics.vue
--- client/views/pages/adm/statistics/MenuStatistics.vue
+++ client/views/pages/adm/statistics/MenuStatistics.vue
@@ -8,20 +8,42 @@
           </div>
 
         </div>
-        <div class="input-group mb30">
-            <input
+        <div class="search-bar mb30">
+          <div class="form-control sm cal">
+            <VueDatePicker
+              InlineOptions
+              placeholder="시작일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="searchDate.startDt"
+               @update:model-value="validateDate($event, 'startDt')"
+            />
+          </div>
+            <!-- <input
               type="date"
               class="form-control sm"
               v-model="searchDate.startDt"
               @change="validateDate($event, 'startDt')"
-            />
+            /> -->
             <div>-</div>
-            <input
+            <div class="form-control sm cal">
+              <VueDatePicker
+              InlineOptions
+              placeholder="종료일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="searchDate.endDt"
+              @update:model-value="validateDate($event, 'endDt')"
+            />
+          </div>
+            <!-- <input
               type="date"
               class="form-control sm"
               v-model="searchDate.endDt"
               @change="validateDate($event, 'endDt')"
-            />      
+            />       -->
             <button class="btn sm primary" @click="axiosSelectList">
               조회
             </button>
@@ -224,6 +246,13 @@
           });
       });
     },
+    // 날짜포맷
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = ('00' + (date.getMonth() + 1)).slice(-2);
+      const day = ('00' + date.getDate()).slice(-2);
+      return `${year}-${month}-${day}`;
+    }
   },
 };
 </script>
(파일 끝에 줄바꿈 문자 없음)
client/views/pages/adm/statistics/UserStatistics.vue
--- client/views/pages/adm/statistics/UserStatistics.vue
+++ client/views/pages/adm/statistics/UserStatistics.vue
@@ -8,21 +8,42 @@
           </div>
 
         </div>
-        <div class="input-group mb30">
-          <input
+        <div class="search-bar mb30">
+          <div class="form-control sm cal">
+              <VueDatePicker
+              InlineOptions
+              placeholder="종료일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="searchDate.startDt"
+              @update:model-value="validateDate($event, 'startDt')"
+            />
+          </div>
+          <!-- <input
             type="date"
             class="form-control sm"
             v-model="searchDate.startDt"
             @change="validateDate($event, 'startDt')"
-          />
+          /> -->
           <div class="mark">-</div>
-
-          <input
+          <div class="form-control sm cal">
+              <VueDatePicker
+              InlineOptions
+              placeholder="종료일"
+              locale="ko"
+              :enable-time-picker="false"
+              :format="formatDate"
+              v-model="searchDate.endDt"
+              @update:model-value="validateDate($event, 'endDt')"
+            />
+          </div>
+          <!-- <input
             type="date"
             class="form-control sm"
             v-model="searchDate.endDt"
             @change="validateDate($event, 'endDt')"
-          />
+          /> -->
 
 
           <button class="btn sm primary" @click="axiosSelectList">
@@ -214,6 +235,13 @@
           });
       });
     },
+    // 날짜포맷
+    formatDate(date) {
+      const year = date.getFullYear();
+      const month = ('00' + (date.getMonth() + 1)).slice(-2);
+      const day = ('00' + date.getDate()).slice(-2);
+      return `${year}-${month}-${day}`;
+    }
   },
 };
 </script>
(파일 끝에 줄바꿈 문자 없음)
Add a comment
List