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/DateTimePicker.vue | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/PAMapp/components/DateTimePicker.vue b/PAMapp/components/DateTimePicker.vue index 7916c77..de34a14 100644 --- a/PAMapp/components/DateTimePicker.vue +++ b/PAMapp/components/DateTimePicker.vue @@ -4,25 +4,40 @@ <div class="dateTime"> <UiDatePicker @changeDate="changeDateTime($event, 'date')" + :disabledBeforeSpecificDate="disabledBeforeSpecificDate" + :isPastDateDisabled="isPastDateDisabled" + :isFutureDateDisabled="isFutureDateDisabled" :defaultValue="defaultValue" ></UiDatePicker> <UiTimePicker @changeTime="changeDateTime($event, 'time')" :defaultValue="defaultValue" + :isPastDateDisabled="isPastDateDisabled" + :isFutureDateDisabled="isFutureDateDisabled" + :changeDate="changeDate" ></UiTimePicker> </div> </template> <script lang="ts"> -import { Component, Emit, Prop, Vue } from "nuxt-property-decorator"; +import { Component, Emit, Prop, Vue, Watch } from "nuxt-property-decorator"; @Component export default class DateTimePicker extends Vue { - changeDate!: Date; + changeDate: Date | string = ''; changeTime!: string; @Prop() defaultValue!: string; + + @Prop() + isPastDateDisabled!: boolean; + + @Prop() + isFutureDateDisabled!: boolean; + + @Prop() + disabledBeforeSpecificDate?: string; @Emit('changeDateTime') changeDateTime(event, type) { @@ -33,12 +48,14 @@ this.changeTime = event; } if (this.changeDate && this.changeTime) { - const timeArray = this.changeTime.split(':'); - const interViewTime = this.changeDate.setHours(+timeArray[0], +timeArray[1]); + const hour = this.changeTime.split(':')[0]; + const minute = this.changeTime.split(':')[1]; + const interViewTime = new Date(this.changeDate).setHours(+hour, +minute); return new Date(interViewTime); } return ''; } + } </script> @@ -49,4 +66,4 @@ justify-content: space-between; font-size: 20px; } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0