From 58a70a8e2e692c77885e9f4174c42baa1b1dd586 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Wed, 2 Mar 2022 16:33:38 +0800 Subject: [PATCH] fix: update time picker --- src/components/DateCalendar.vue | 3 +++ src/components/TimePicker.vue | 6 +++--- src/views/dashboard/related/profile/components/NewTask.vue | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/DateCalendar.vue b/src/components/DateCalendar.vue index 91e56751..3e3a150f 100755 --- a/src/components/DateCalendar.vue +++ b/src/components/DateCalendar.vue @@ -553,6 +553,9 @@ const ok = (info: any) => { if (props.right && _time.getTime() / 100000 > start.value) { emit("setDates", _time, "right"); } + if (!(props.left && props.right)) { + emit("setDates", _time); + } emit("ok", info === "h"); }; onMounted(() => { diff --git a/src/components/TimePicker.vue b/src/components/TimePicker.vue index 24846c89..9d36ebeb 100755 --- a/src/components/TimePicker.vue +++ b/src/components/TimePicker.vue @@ -276,11 +276,11 @@ const ok = (leaveOpened: boolean) => { }, 1); }; const setDates = (d: Date, pos: string) => { - if (pos === "left") { - dates.value[0] = d; + if (pos === "right") { + dates.value[1] = d; return; } - dates.value[1] = d; + dates.value[0] = d; }; const dc = (e: any) => { show.value = (datepicker.value as any).contains(e.target) && !props.disabled; diff --git a/src/views/dashboard/related/profile/components/NewTask.vue b/src/views/dashboard/related/profile/components/NewTask.vue index c8f24888..81ad9091 100644 --- a/src/views/dashboard/related/profile/components/NewTask.vue +++ b/src/views/dashboard/related/profile/components/NewTask.vue @@ -118,10 +118,12 @@ function changeMaxSamplingCount(opt: any[]) { async function createTask() { emits("close"); + const date = + monitorTime.value === "0" ? appStore.durationRow.start : time.value; const params = { serviceId: selectorStore.currentService.id, endpointName: endpointName.value, - startTime: time.value.getTime(), + startTime: date.getTime(), duration: Number(monitorDuration.value), minDurationThreshold: Number(minThreshold.value), dumpPeriod: Number(dumpPeriod.value),