PAMapp/components/DateTimePicker.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/components/Ui/UiDatePicker.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/components/Ui/UiTimePicker.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 | |
PAMapp/pages/appointment/_appointmentId/close/index.vue | ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程 |
PAMapp/components/DateTimePicker.vue
@@ -5,12 +5,14 @@ <UiDatePicker @changeDate="changeDateTime($event, 'date')" :isPastDateDisabled="isPastDateDisabled" :isFutureDateDisabled="isFutureDateDisabled" :defaultValue="defaultValue" ></UiDatePicker> <UiTimePicker @changeTime="changeDateTime($event, 'time')" :defaultValue="defaultValue" :isPastDateDisabled="isPastDateDisabled" :isFutureDateDisabled="isFutureDateDisabled" :changeDate="changeDate" ></UiTimePicker> </div> @@ -30,6 +32,9 @@ @Prop() isPastDateDisabled!: boolean; @Prop() isFutureDateDisabled!: boolean; @Emit('changeDateTime') changeDateTime(event, type) { if (type === 'date') { PAMapp/components/Ui/UiDatePicker.vue
@@ -28,6 +28,9 @@ @Prop({default: false}) isPastDateDisabled!: boolean; @Prop({default: false}) isFutureDateDisabled!: boolean; @Emit('changeDate') changeDate() { return this.dateValue; @@ -42,16 +45,26 @@ } get pickerOptions() { const date = new Date(); const currentDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`; if (this.isPastDateDisabled) { return { disabledDate(time: Date) { const date = new Date(); const currentDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`; const pickedDate = `${time.getFullYear()}/${time.getMonth() + 1}/${time.getDate()}` const pickedDate = `${time.getFullYear()}/${time.getMonth() + 1}/${time.getDate()}`; return new Date(pickedDate).getTime() < new Date(currentDate).getTime(); } } } if (this.isFutureDateDisabled) { return { disabledDate(time: Date) { const pickedDate = `${time.getFullYear()}/${time.getMonth() + 1}/${time.getDate()}`; return new Date(pickedDate).getTime() > new Date(currentDate).getTime(); } } } } } PAMapp/components/Ui/UiTimePicker.vue
@@ -30,6 +30,9 @@ @Prop() isPastDateDisabled!: boolean; @Prop() isFutureDateDisabled!: boolean; /////////////////////////////////////////////////////////////////////// @Emit('changeTime') @@ -50,25 +53,40 @@ get pickerOptions() { let minTime = ''; let maxTime = ''; const currentDate = new Date(); if (this.isPastDateDisabled && this.changeDate && this.isPickedToday(currentDate)) { minTime = this.formatTimeString(currentDate); this.isPickedDisableTime(currentDate, minTime); if (this.changeDate && this.isPickedToday(currentDate)) { if (this.isPastDateDisabled) { minTime = this.formatTimeString(currentDate); this.isPickedDisableTime(currentDate, minTime); } if (this.isFutureDateDisabled) { maxTime = this.formatTimeString(currentDate); this.isPickedDisableTime(currentDate, maxTime); } } return { start: '09:00', step: '00:15', end: '21:00', minTime: minTime minTime: minTime, maxTime: maxTime } } private isPickedDisableTime(currentDate: Date, minTime: string) { const currentTime = this.getTimeValue(currentDate, minTime); private isPickedDisableTime(currentDate: Date, minMaxTime: string) { const currentTime = this.getTimeValue(currentDate, minMaxTime); const pickedTime = this.getTimeValue(currentDate, this.timeValue); if (pickedTime < currentTime) { if (this.isPastDateDisabled && pickedTime < currentTime) { this.timeValue = ''; this.changeTime(); } if (this.isFutureDateDisabled && currentTime < pickedTime) { this.timeValue = ''; this.changeTime(); } PAMapp/pages/appointment/_appointmentId/close/index.vue
@@ -46,6 +46,7 @@ <UiField label="進件時間" :labelSize="20" class="required"> <DateTimePicker :defaultValue="appointmentCloseInfo.policyEntryDate" :isFutureDateDisabled="true" @changeDateTime="appointmentCloseDate = $event"></DateTimePicker> </UiField> </el-row>