This commit is contained in:
2020-07-14 00:13:40 +00:00
parent ef25048f1e
commit 6fd1fef16e
3 changed files with 120 additions and 64 deletions

View File

@@ -45,11 +45,14 @@ todo: Test server down while polling in release mode, does it recover when serve
todo: all custom controls are fucked (mostly)
wont' start with initial value, WTF????????
this just started as an issue, def wasn't before
includes custom form date and time etc
todo: pick lists in forms should be sortable alphabetically todo: pick lists in forms should be sortable alphabetically
for example the event types and object types in notification subscription for example the event types and object types in notification subscription
todo: does Duplicate code really duplicate the tags? todo: does Duplicate code really duplicate the tags?
i.e. duplicate a widget with tags, do the tags come over? i.e. duplicate a widget with tags, do the tags come over?
if not then need to modify the copy object code to handle tags as well if not then need to modify the copy object code to handle tags as well

View File

@@ -35,6 +35,7 @@ export default {
}, },
watch: { watch: {
value(val) { value(val) {
console.log("date-control watch value is", val);
this.internalValue = val; this.internalValue = val;
} }
}, },

View File

@@ -7,8 +7,9 @@
<v-row class="my-n5"> <v-row class="my-n5">
<v-col cols="3"> <v-col cols="3">
<v-text-field <v-text-field
v-if="showDays" v-show="showDays"
:value="days" ref="daysPicker"
:value="splitSpan.days"
@input="handleDaysInput" @input="handleDaysInput"
:readonly="readonly" :readonly="readonly"
:disabled="disabled" :disabled="disabled"
@@ -19,7 +20,8 @@
</v-col> </v-col>
<v-col cols="3"> <v-col cols="3">
<v-text-field <v-text-field
:value="hours" :value="splitSpan.hours"
ref="hoursPicker"
@input="handleHoursInput" @input="handleHoursInput"
:readonly="readonly" :readonly="readonly"
:disabled="disabled" :disabled="disabled"
@@ -30,7 +32,8 @@
</v-col> </v-col>
<v-col cols="3"> <v-col cols="3">
<v-text-field <v-text-field
:value="minutes" :value="splitSpan.minutes"
ref="minutesPicker"
@input="handleMinutesInput" @input="handleMinutesInput"
:readonly="readonly" :readonly="readonly"
:disabled="disabled" :disabled="disabled"
@@ -41,8 +44,9 @@
</v-col> </v-col>
<v-col cols="3"> <v-col cols="3">
<v-text-field <v-text-field
v-if="showSeconds" v-show="showSeconds"
:value="seconds" :value="splitSpan.seconds"
ref="secondsPicker"
@input="handleSecondsInput" @input="handleSecondsInput"
:readonly="readonly" :readonly="readonly"
:disabled="disabled" :disabled="disabled"
@@ -69,7 +73,7 @@
<script> <script>
/* Xeslint-disable */ /* Xeslint-disable */
/* /*https://alligator.io/vuejs/add-v-model-support/
"TimeSpanDays": "days", "TimeSpanDays": "days",
"TimeSpanHours": "hours", "TimeSpanHours": "hours",
"TimeSpanMinutes": "minutes", "TimeSpanMinutes": "minutes",
@@ -82,47 +86,38 @@
//maybe split by colon first then subsplit first and last elements into days and MS //maybe split by colon first then subsplit first and last elements into days and MS
//{"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"}} //{"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"}}
export default { export default {
data() { // created() {
return { // console.log("created, value is:", this.value);
internalValue: null, // this.handleUpdate(this.value);
days: 0, // },
hours: 0, // beforeMount() {
minutes: 0, // console.log("beforeMount, value is:", this.value);
seconds: 0 // },
}; // mounted() {
}, // console.log("mounted, value is:", this.value);
watch: { // },
value(val) { // beforeUpdate() {
//this.internalValue = val; // console.log("beforeUpdate, value is:", this.value);
if (val == null) { // },
this.days = 0; // updated() {
this.hours = 0; // console.log("updated, value is:", this.value);
this.minutes = 0; // },
this.seconds = 0; // data() {
return; // return {
} // internalValue: null,
let work = val.split(":"); // days: 0,
//has days? // hours: 0,
if (work[0].includes(".")) { // minutes: 0,
let dh = work[0].split("."); // seconds: 0
this.days = Number(dh[0]); // };
this.hours = Number(dh[1]); // },
} else { // watch: {
this.days = 0; // value(val) {
this.hours = Number(work[0]); // console.log("Val is ", val);
} // // this.internalValue = val;
// this.handleUpdate(val);
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]);
}
}
},
props: { props: {
label: String, label: String,
rules: Array, rules: Array,
@@ -138,6 +133,47 @@ export default {
showDays: { type: Boolean, default: true }, showDays: { type: Boolean, default: true },
testId: String testId: String
}, },
computed: {
splitSpan() {
let vm = this;
let theDays = 0;
let theHours = 0;
let theMinutes = 0;
let theSeconds = 0;
if (vm.value == null) {
theDays = 0;
theHours = 0;
theMinutes = 0;
theSeconds = 0;
} else {
let work = vm.value.split(":");
//has days?
if (work[0].includes(".")) {
let dh = work[0].split(".");
theDays = Number(dh[0]);
theHours = Number(dh[1]);
} else {
theHours = Number(work[0]);
}
theMinutes = Number(work[1]);
//has milliseconds? (ignore them)
if (work[2].includes(".")) {
let dh = work[2].split(".");
theSeconds = Number(dh[0]);
} else {
theSeconds = Number(work[2]);
}
}
return {
days: theDays,
hours: theHours,
minutes: theMinutes,
seconds: theSeconds
};
}
},
methods: { methods: {
allErrors() { allErrors() {
let ret = ""; let ret = "";
@@ -157,6 +193,7 @@ export default {
this.hour12 this.hour12
); );
}, },
handleDaysInput(value) { handleDaysInput(value) {
this.days = Number(value); this.days = Number(value);
this.handleInput(); this.handleInput();
@@ -207,21 +244,36 @@ export default {
} }
ret += `${vm.hours}:${vm.minutes}:${vm.seconds}`; ret += `${vm.hours}:${vm.minutes}:${vm.seconds}`;
this.$emit("input", 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]);
}
} }
//combine these into the proper timespan string
// //combine the time and dates into a consolidated value
// let TimePortion = window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
// this.internalValue,
// this.timeZoneName
// );
// if (!TimePortion) {
// TimePortion = "00:00:00";
// }
// let newValue = window.$gz.locale.localTimeDateStringToUTC8601String(
// value + "T" + TimePortion,
// this.timeZoneName
// );
// this.$emit("input", newValue);
} }
}; };
</script> </script>