From 9efed6a3b7dc1b2c599bb4cbd70dbc4f6b02ef64 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 14 Jul 2020 00:26:47 +0000 Subject: [PATCH] --- ayanova/src/components/duration-control.vue | 92 ++++----------------- 1 file changed, 15 insertions(+), 77 deletions(-) diff --git a/ayanova/src/components/duration-control.vue b/ayanova/src/components/duration-control.vue index 0e842eeb..9dd88d8d 100644 --- a/ayanova/src/components/duration-control.vue +++ b/ayanova/src/components/duration-control.vue @@ -10,7 +10,7 @@ v-show="showDays" ref="daysPicker" :value="splitSpan.days" - @input="handleDaysInput" + @input="updateSpan()" :readonly="readonly" :disabled="disabled" :label="$ay.t('TimeSpanDays')" @@ -22,7 +22,7 @@ 24) { - this.hours = 24; - } else { - this.hours = Number(value); - } - this.handleInput(); - //oninput="if(Number(this.value) > Number(this.max)) this.value = this.max;" - }, - handleMinutesInput(value) { - if (Number(value) > 60) { - this.minutes = 60; - } else { - this.minutes = Number(value); - } - this.handleInput(); - }, - handleSecondsInput(value) { - if (Number(value) > 60) { - this.seconds = 60; - } else { - this.seconds = Number(value); - } - this.handleInput(); - }, - handleInput() { + updateSpan() { //{"data":{"testTSDaysWMS":"22.10:15:22.0330000","testTSHMS":"05:16:33","testTS_DHMS":"5.10:15:33","testTS_MS":"00:15:33","testTS_S":"00:00:33","testTS_D":"22.00:00:00"}} // DD.HH:MM:SS.ms let ret = ""; let vm = this; - if (vm.days && vm.days > 0) { - ret = `${vm.days}.`; + //this.$refs.daysPicker.$refs.input.value + let daysValue = this.$refs.daysPicker.$refs.input.value || 0; + let hoursValue = this.$refs.hoursPicker.$refs.input.value || 0; + let minutesValue = this.$refs.minutesPicker.$refs.input.value || 0; + let secondsValue = this.$refs.secondsPicker.$refs.input.value || 0; + + if (daysValue > 0) { + ret = `${daysValue}.`; } - if (!vm.hours) { - vm.hours = 0; - } - if (!vm.minutes) { - vm.minutes = 0; - } - - if (!vm.seconds) { - vm.seconds = 0; - } - ret += `${vm.hours}:${vm.minutes}:${vm.seconds}`; + ret += `${hoursValue}:${minutesValue}:${secondsValue}`; + console.log("updateSpan, ret is ", ret); this.$emit("input", ret); - }, - handleUpdate(val) { - if (val == null) { - this.days = 0; - this.hours = 0; - this.minutes = 0; - this.seconds = 0; - return; - } - let work = val.split(":"); - //has days? - if (work[0].includes(".")) { - let dh = work[0].split("."); - this.days = Number(dh[0]); - this.hours = Number(dh[1]); - } else { - this.days = 0; - this.hours = Number(work[0]); - } - - this.minutes = Number(work[1]); - - //has milliseconds? (ignore them) - if (work[2].includes(".")) { - let dh = work[2].split("."); - this.seconds = Number(dh[0]); - } else { - this.seconds = Number(work[2]); - } } } };