- Finish to fix IOperators

- Fixit Date not change correctly
This commit is contained in:
Paolo Arena
2019-11-01 15:52:58 +01:00
parent 2c62c27e64
commit cdfc32c620
23 changed files with 365 additions and 135 deletions

View File

@@ -15,7 +15,8 @@ import MixinBase from '../../mixins/mixin-base'
export default class CDateTime extends Vue {
public $q
public $t
@Prop() public value!: Date
@Prop({ required: false, default: null }) public value: Date
@Prop({ required: false, default: null }) public valueDate: Date
@Prop({ required: true, default: 'Val:' }) public label: string
@Prop({ required: false, default: '' }) public data_class!: string
@Prop({ required: false, default: true }) public canEdit!: boolean
@@ -33,22 +34,36 @@ export default class CDateTime extends Vue {
return 'calendar_comp ' + this.data_class
}
@Watch('showDateTimeScroller')
// @Watch('showDateTimeScroller')
public Opening() {
if (this.showDateTimeScroller) {
this.saveit = false
this.valueprec = this.myvalue
this.$emit('show')
} else {
if (!this.saveit) {
if (this.myvalue !== this.valueprec) {
this.myvalue = this.valueprec
tools.showNeutralNotif(this.$q, this.$t('db.reccanceled'))
}
// console.log('Opening', 'myvalue', this.myvalue, 'value', this.value)
this.saveit = false
this.valueprec = this.myvalue
this.$emit('show')
}
public Closing() {
// console.log('Closing')
if (!this.saveit) {
if (this.myvalue !== this.valueprec) {
this.myvalue = this.valueprec
tools.showNeutralNotif(this.$q, this.$t('db.reccanceled'))
}
}
}
@Watch('valueDate')
public changevalueDate() {
this.myvalue = tools.getstrYYMMDDDateTime(this.valueDate)
// console.log('changevalueDate myvalue', this.myvalue)
}
@Watch('value')
public changevalue() {
this.myvalue = this.value
// console.log('changevalue myvalue', this.myvalue)
}
public savetoclose() {
this.saveit = true
this.showDateTimeScroller = false
@@ -74,13 +89,17 @@ export default class CDateTime extends Vue {
return CalendarStore.state.locale
}
public mounted() {
this.myvalue = this.value
console.log('myvalue', this.myvalue)
public created() {
if (this.value !== null)
this.myvalue = this.value
else
this.myvalue = tools.getstrYYMMDDDateTime(this.valueDate)
// console.log('myvalue', this.myvalue)
}
public changeval(newval) {
// console.log('changeval', newval)
// console.log('changeval', newval, 'value=', this.value, 'myvalue=', this.myvalue)
this.$emit('update:value', newval)
}

View File

@@ -37,11 +37,11 @@
</template>
<template v-slot:append>
<q-icon v-if="canEdit" name="event" class="cursor-pointer">
<q-popup-proxy v-model="showDateTimeScroller">
<q-popup-proxy v-model="showDateTimeScroller" @before-show="Opening" @before-hide="Closing">
<q-date-time-scroller
v-model="myvalue"
:locale="locale"
:locale="toolsext.getLocale()"
:hour24-format="true"
:rounded-borders="true"
border-color="#2196f3"