This commit is contained in:
@@ -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
|
||||
for example the event types and object types in notification subscription
|
||||
|
||||
|
||||
todo: does Duplicate code really duplicate the tags?
|
||||
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
|
||||
|
||||
@@ -35,6 +35,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
console.log("date-control watch value is", val);
|
||||
this.internalValue = val;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
<v-row class="my-n5">
|
||||
<v-col cols="3">
|
||||
<v-text-field
|
||||
v-if="showDays"
|
||||
:value="days"
|
||||
v-show="showDays"
|
||||
ref="daysPicker"
|
||||
:value="splitSpan.days"
|
||||
@input="handleDaysInput"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
@@ -19,7 +20,8 @@
|
||||
</v-col>
|
||||
<v-col cols="3">
|
||||
<v-text-field
|
||||
:value="hours"
|
||||
:value="splitSpan.hours"
|
||||
ref="hoursPicker"
|
||||
@input="handleHoursInput"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
@@ -30,7 +32,8 @@
|
||||
</v-col>
|
||||
<v-col cols="3">
|
||||
<v-text-field
|
||||
:value="minutes"
|
||||
:value="splitSpan.minutes"
|
||||
ref="minutesPicker"
|
||||
@input="handleMinutesInput"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
@@ -41,8 +44,9 @@
|
||||
</v-col>
|
||||
<v-col cols="3">
|
||||
<v-text-field
|
||||
v-if="showSeconds"
|
||||
:value="seconds"
|
||||
v-show="showSeconds"
|
||||
:value="splitSpan.seconds"
|
||||
ref="secondsPicker"
|
||||
@input="handleSecondsInput"
|
||||
:readonly="readonly"
|
||||
:disabled="disabled"
|
||||
@@ -69,7 +73,7 @@
|
||||
<script>
|
||||
/* Xeslint-disable */
|
||||
|
||||
/*
|
||||
/*https://alligator.io/vuejs/add-v-model-support/
|
||||
"TimeSpanDays": "days",
|
||||
"TimeSpanHours": "hours",
|
||||
"TimeSpanMinutes": "minutes",
|
||||
@@ -82,47 +86,38 @@
|
||||
//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"}}
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
internalValue: null,
|
||||
days: 0,
|
||||
hours: 0,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
//this.internalValue = 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]);
|
||||
}
|
||||
}
|
||||
},
|
||||
// created() {
|
||||
// console.log("created, value is:", this.value);
|
||||
// this.handleUpdate(this.value);
|
||||
// },
|
||||
// beforeMount() {
|
||||
// console.log("beforeMount, value is:", this.value);
|
||||
// },
|
||||
// mounted() {
|
||||
// console.log("mounted, value is:", this.value);
|
||||
// },
|
||||
// beforeUpdate() {
|
||||
// console.log("beforeUpdate, value is:", this.value);
|
||||
// },
|
||||
// updated() {
|
||||
// console.log("updated, value is:", this.value);
|
||||
// },
|
||||
// data() {
|
||||
// return {
|
||||
// internalValue: null,
|
||||
// days: 0,
|
||||
// hours: 0,
|
||||
// minutes: 0,
|
||||
// seconds: 0
|
||||
// };
|
||||
// },
|
||||
// watch: {
|
||||
// value(val) {
|
||||
// console.log("Val is ", val);
|
||||
// // this.internalValue = val;
|
||||
// this.handleUpdate(val);
|
||||
// }
|
||||
// },
|
||||
props: {
|
||||
label: String,
|
||||
rules: Array,
|
||||
@@ -138,6 +133,47 @@ export default {
|
||||
showDays: { type: Boolean, default: true },
|
||||
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: {
|
||||
allErrors() {
|
||||
let ret = "";
|
||||
@@ -157,6 +193,7 @@ export default {
|
||||
this.hour12
|
||||
);
|
||||
},
|
||||
|
||||
handleDaysInput(value) {
|
||||
this.days = Number(value);
|
||||
this.handleInput();
|
||||
@@ -207,21 +244,36 @@ export default {
|
||||
}
|
||||
ret += `${vm.hours}:${vm.minutes}:${vm.seconds}`;
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user