From 5767fe896bec25e85393e5bbd7f76c5ff6dc2ae5 Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Wed, 19 Oct 2022 17:19:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=A5=E5=91=8ABox?= =?UTF-8?q?=E4=BE=A7=E6=BB=91Time=20limit=20=E4=B8=BA=20customize=EF=BC=8C?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=99=90=E5=88=B6=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/rightBox/report/ReportBox.vue | 38 +++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/components/rightBox/report/ReportBox.vue b/src/components/rightBox/report/ReportBox.vue index 1b1e3abc..df508ae8 100644 --- a/src/components/rightBox/report/ReportBox.vue +++ b/src/components/rightBox/report/ReportBox.vue @@ -74,8 +74,9 @@ size="small" :format="dateFormat" :disabled="!!editObject.id" - :disabled-date="disabledDate" + :disabled-date="startDisabledDate" @change="startTimeChang" + @focus="startFocus" prefix-icon="cn-icon cn-icon-shijian" type="datetime" placeholder=" " @@ -93,8 +94,9 @@ size="small" :format="dateFormat" :disabled="!!editObject.id" - :disabled-date="disabledDate" + :disabled-date="endDisabledDate" @change="endTimeChange" + @focus="endFocus" prefix-icon="cn-icon cn-icon-shijian" type="datetime" placeholder=" " @@ -313,27 +315,53 @@ export default { setup () { const startTime = ref('') const endTime = ref('') + const focus = ref('') + const focusDate = ref('') function endTimeChange (val) { endTime.value = val } function startTimeChang (val) { startTime.value = val } - const disabledDate = (time) => { + function startFocus (val) { + focus.value = val.target.value + } + function endFocus (val) { + focusDate.value = val.target.value + } + const endDisabledDate = (time) => { if (time.getTime() > new Date()) { return true } if (startTime.value != '' && startTime.value > time) { return true } + if (focusDate.value != '' && endTime.value > time) { + return false + } else if (endTime.value != '' && endTime.value < time) { + return true + } + } + const startDisabledDate = (time) => { + if (time.getTime() > new Date()) { + return true + } + if (focus.value != '' && startTime.value > time) { + return false + } else if (startTime.value != '' && startTime.value > time) { + return true + } if (endTime.value != '' && endTime.value < time) { return true } } return { - disabledDate, + endDisabledDate, + startDisabledDate, startTimeChang, - endTimeChange + endTimeChange, + startFocus, + endFocus } }, data () {