Fixed decimal control and report edit
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
<div>
|
||||
<v-text-field
|
||||
ref="textField"
|
||||
@input="handleInput"
|
||||
:value="currencyValue"
|
||||
@change="updateValue"
|
||||
v-currency="{
|
||||
currency: null,
|
||||
locale: languageName
|
||||
@@ -19,26 +20,19 @@
|
||||
</template>
|
||||
<script>
|
||||
/* 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://github.com/dm4t2/vue-currency-input
|
||||
//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";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
internalValue: null,
|
||||
internalChange: false,
|
||||
// currencyName: window.$gz.locale.getCurrencyName(),
|
||||
languageName: window.$gz.locale.getBrowserFirstLanguage()
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.internalChange = true;
|
||||
setValue(this.$refs.textField.$refs.input, value);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
label: String,
|
||||
rules: Array,
|
||||
@@ -50,24 +44,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: null,
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -287,7 +287,6 @@
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
{{ obj.scale }}
|
||||
<gz-decimal
|
||||
v-model="obj.scale"
|
||||
:readonly="formState.readOnly"
|
||||
|
||||
Reference in New Issue
Block a user