window.vapp_startTime = new Vue({
el: ‘#startTime’,
template: <DatePicker type="datetime" :class="isAdd ? 'inputbg' : ''" v-model="value"></DatePicker>
,
data() {
return {
value: moment().format(‘YYYY-MM-DD HH:mm:ss’),
item: window.vapp_fltplan.item
}
},
computed: {
change_key() {
let time = this.item.TRIPTYPE == “1” ? this.item.ARRTIME : this.item.DEPTIME;
const mtime = moment(this.item.FLTDATE + “ “ + time, “YYYY-MM-DD HH:mm”)
if (this.item.TRIPTYPE == "1") {
if (this.item.CHANNELTYPE == "1") {
return mtime.subtract(0.5, "hours");
} else {
return mtime.subtract(45, "minutes");
}
}
else {
if (this.item.CHANNELTYPE == "1") {
return mtime.subtract(1.5, "hours");
} else {
return mtime.subtract(2, "hours");
}
}
},
isAdd() {
let time = this.item.TRIPTYPE == "1" ? this.item.ARRTIME : this.item.DEPTIME;
const mtime = moment(this.item.FLTDATE + " " + time, "YYYY-MM-DD HH:mm")
return moment(mtime).isAfter(moment(this.value));
}
},
created() {
this.$watchAsObservable('change_key')
//.debounceTime(1e3)
.subscribe(({ newValue, oldValue }) => {
this.value = newValue.format('YYYY-MM-DD HH:mm:ss');
});
}
})