Fixed decimal control and report edit

This commit is contained in:
2020-10-02 14:58:55 +00:00
parent d30ff33a89
commit 40089a3144
2 changed files with 13 additions and 24 deletions

View File

@@ -2,7 +2,8 @@
<div> <div>
<v-text-field <v-text-field
ref="textField" ref="textField"
@input="handleInput" :value="currencyValue"
@change="updateValue"
v-currency="{ v-currency="{
currency: null, currency: null,
locale: languageName locale: languageName
@@ -19,26 +20,19 @@
</template> </template>
<script> <script>
/* Xeslint-disable */ /* Xeslint-disable */
//https://dm4t2.github.io/vue-currency-input/guide/#introduction //### NOTE: THIS IS A DUPLICATE OF CURRENCYCONTROL AND THE ONLY DIFFERENCE IS THE "currency:" VALUE IS SET TO NULL IN THE TEMPLATE AND IN THE updateValue METHOD
//https://dm4t2.github.io/vue-currency-input/guide/#introduction :value="formattedValue"
//https://codesandbox.io/s/vue-template-kd7d1?fontsize=14&module=%2Fsrc%2FApp.vue //https://codesandbox.io/s/vue-template-kd7d1?fontsize=14&module=%2Fsrc%2FApp.vue
//https://github.com/dm4t2/vue-currency-input //https://github.com/dm4t2/vue-currency-input
//https://github.com/dm4t2/vue-currency-input/releases //https://github.com/dm4t2/vue-currency-input/releases
//NON CURRENCY MODE: https://dm4t2.github.io/vue-currency-input/config/#component
import { setValue, parseCurrency } from "vue-currency-input"; import { setValue, parseCurrency } from "vue-currency-input";
export default { export default {
data() { data() {
return { return {
internalValue: null, // currencyName: window.$gz.locale.getCurrencyName(),
internalChange: false,
languageName: window.$gz.locale.getBrowserFirstLanguage() languageName: window.$gz.locale.getBrowserFirstLanguage()
}; };
}, },
watch: {
value(value) {
this.internalChange = true;
setValue(this.$refs.textField.$refs.input, value);
}
},
props: { props: {
label: String, label: String,
rules: Array, rules: Array,
@@ -50,24 +44,20 @@ export default {
required: false required: false
} }
}, },
computed: {
currencyValue() {
return this.value;
}
},
methods: { methods: {
handleInput(value) { updateValue() {
let parsedValue = parseCurrency(value, { let val = this.$refs.textField.$refs.input.value;
let parsedValue = parseCurrency(val, {
currency: null, currency: null,
locale: this.languageName 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.$emit("input", parsedValue);
this.internalValue = parsedValue;
} }
} }
}; };

View File

@@ -287,7 +287,6 @@
</v-col> </v-col>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
{{ obj.scale }}
<gz-decimal <gz-decimal
v-model="obj.scale" v-model="obj.scale"
:readonly="formState.readOnly" :readonly="formState.readOnly"