From 85c39644533f93559ccf51cc4c8dfa7388d36cd4 Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期三, 27 四月 2022 14:46:55 +0800 Subject: [PATCH] fix#137058: 顧問管理流程 - 約訪記錄填寫日期需要卡控 --- PAMapp/components/Interview/InterviewAdd.vue | 2 ++ PAMapp/components/Ui/UiDatePicker.vue | 15 ++++++++++++++- PAMapp/components/DateTimePicker.vue | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/PAMapp/components/DateTimePicker.vue b/PAMapp/components/DateTimePicker.vue index 584df86..de34a14 100644 --- a/PAMapp/components/DateTimePicker.vue +++ b/PAMapp/components/DateTimePicker.vue @@ -4,6 +4,7 @@ <div class="dateTime"> <UiDatePicker @changeDate="changeDateTime($event, 'date')" + :disabledBeforeSpecificDate="disabledBeforeSpecificDate" :isPastDateDisabled="isPastDateDisabled" :isFutureDateDisabled="isFutureDateDisabled" :defaultValue="defaultValue" @@ -35,6 +36,9 @@ @Prop() isFutureDateDisabled!: boolean; + @Prop() + disabledBeforeSpecificDate?: string; + @Emit('changeDateTime') changeDateTime(event, type) { if (type === 'date') { @@ -62,4 +66,4 @@ justify-content: space-between; font-size: 20px; } -</style> \ No newline at end of file +</style> diff --git a/PAMapp/components/Interview/InterviewAdd.vue b/PAMapp/components/Interview/InterviewAdd.vue index 231053d..5064c77 100644 --- a/PAMapp/components/Interview/InterviewAdd.vue +++ b/PAMapp/components/Interview/InterviewAdd.vue @@ -21,8 +21,10 @@ ><i class="icon-edit"></i></span> </el-col> </el-row> + <template v-if="!interviewId || isEdit"> <DateTimePicker + :disabledBeforeSpecificDate="appointmentDetail.appointmentDate" @changeDateTime="interviewTime = $event" :defaultValue="defaultValue" ></DateTimePicker> diff --git a/PAMapp/components/Ui/UiDatePicker.vue b/PAMapp/components/Ui/UiDatePicker.vue index 025594a..890c5ec 100644 --- a/PAMapp/components/Ui/UiDatePicker.vue +++ b/PAMapp/components/Ui/UiDatePicker.vue @@ -31,6 +31,9 @@ @Prop({default: false}) isFutureDateDisabled!: boolean; + @Prop() + disabledBeforeSpecificDate?: string; + @Emit('changeDate') changeDate() { return this.dateValue; @@ -47,6 +50,16 @@ get pickerOptions() { const date = new Date(); const currentDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`; + + if (!!this.disabledBeforeSpecificDate) { + const compareDate = new Date(this.disabledBeforeSpecificDate); + return { + disabledDate(time: Date) { + const pickedDate = `${time.getFullYear()}/${time.getMonth() + 1}/${time.getDate()}`; + return new Date(pickedDate).getTime() < compareDate.getTime(); + } + } + } if (this.isPastDateDisabled) { return { @@ -68,4 +81,4 @@ } } -</script> \ No newline at end of file +</script> -- Gitblit v1.8.0