This commit is contained in:
2020-07-14 18:20:34 +00:00
parent 3c7f257dea
commit ae766fab32
5 changed files with 44 additions and 59 deletions

View File

@@ -4,6 +4,11 @@ export default {
get(enumKey, enumValue) {
enumKey = enumKey.toLowerCase();
if (enumKey != "authorizationroles") {
if (window.$gz.store.state.enums[enumKey] == undefined) {
throw "ERROR enums::get -> enumKey " +
enumKey +
" is missing from store";
}
return window.$gz.store.state.enums[enumKey][enumValue];
} else {
let ret = [];

View File

@@ -2,7 +2,8 @@
<div>
<v-text-field
ref="textField"
@input="handleInput"
:value="currencyValue"
@input="updateValue"
v-currency="{
currency: currencyName,
locale: languageName
@@ -26,18 +27,10 @@ import { setValue, parseCurrency } from "vue-currency-input";
export default {
data() {
return {
internalValue: null,
internalChange: false,
currencyName: window.$gz.locale.getCurrencyName(),
languageName: window.$gz.locale.getBrowserFirstLanguage()
};
},
watch: {
value(val) {
this.internalChange = true;
setValue(this.$refs.textField.$refs.input, val);
}
},
props: {
label: String,
rules: Array,
@@ -49,25 +42,20 @@ export default {
required: false
}
},
computed: {
currencyValue() {
return this.value;
}
},
methods: {
handleInput(value) {
let parsedValue = parseCurrency(value, {
updateValue() {
let val = this.$refs.textField.$refs.input.value;
let parsedValue = parseCurrency(val, {
currency: this.currencyName,
locale: this.languageName
});
if (this.internalChange) {
this.internalValue = parsedValue;
this.internalChange = false;
return;
}
if (parsedValue == this.internalValue) {
//nothing changed
return;
}
this.$emit("input", parsedValue);
this.internalValue = parsedValue;
}
}
};

View File

@@ -103,23 +103,6 @@ export default {
);
vm.$emit("input", ret);
}
// ,
// handleDateInput(value) {
// //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>

View File

@@ -3,7 +3,7 @@
<span class="v-label theme--light ">
{{ label }}
</span>
<template v-if="!readonly">
<template>
<v-row class="my-n5">
<v-col cols="3">
<v-text-field
@@ -57,14 +57,7 @@
</v-col>
</v-row>
</template>
<template v-else>
<v-text-field
:value="readonlyFormat()"
:label="label"
readonly
disabled
></v-text-field>
</template>
<p v-show="error" class="form__error v-messages theme--light error--text">
{{ error }}
</p>
@@ -153,14 +146,6 @@ export default {
}
return ret;
},
readonlyFormat() {
return window.$gz.locale.utcDateToShortDateLocalized(
this.internalValue,
this.timeZoneName,
this.languageName,
this.hour12
);
},
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

View File

@@ -96,7 +96,18 @@
</template>
<template v-else-if="c.t == 5">
<!-- INTEGER -->
{{ c.v }}
<template v-if="c.i && c.i != 0">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i)"
>
<a href="javascript:"> {{ c.v }}</a>
</div>
</template>
<template v-else>
{{ c.v }}
</template>
</template>
<template v-else-if="c.t == 6">
<!-- BOOL -->
@@ -257,7 +268,18 @@
</template>
<template v-else-if="c.t == 5">
<!-- INTEGER -->
{{ c.v }}
<template v-if="c.i && c.i != 0">
<!-- openable object with an ID -->
<div
class="subtitle-1"
@click="gridCellButtonClick(c.key, c.i)"
>
<a href="javascript:"> {{ c.v }}</a>
</div>
</template>
<template v-else>
{{ c.v }}
</template>
</template>
<template v-else-if="c.t == 6">
<!-- BOOL -->
@@ -549,10 +571,12 @@ export default {
vm.serverColumns = res.columns;
//Make sure the translation keys are fetched
await fetchTranslatedHeaderNames(res.columns); //Note can use await here because it's wrapped inside an async function call, it will wait then resume next stuff below
await fetchEnums(res.columns);
//build vm.headers here
vm.headers = buildHeaders(res.columns);
//Post process data here and then set vm.records
vm.records = buildRecords(res.data, res.columns);
@@ -790,7 +814,7 @@ async function fetchEnums(columnData) {
return;
}
let headerKeys = [];
for (let i = 1; i < columnData.length; i++) {
for (let i = 0; i < columnData.length; i++) {
let cm = columnData[i];
if (cm.et) {
await window.$gz.enums.fetchEnumList(cm.et);