|
|
@ -1,20 +1,22 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<v-datetime-picker |
|
|
|
<div> |
|
|
|
ref="picker" |
|
|
|
<v-datetime-picker |
|
|
|
v-model="localState" |
|
|
|
ref="picker" |
|
|
|
class="caption xc-date-time-picker" |
|
|
|
v-model="localState" |
|
|
|
:text-field-props="{ |
|
|
|
class="caption xc-date-time-picker" |
|
|
|
class:'caption mt-0 pt-0', |
|
|
|
:text-field-props="{ |
|
|
|
flat:true, |
|
|
|
class:'caption mt-0 pt-0', |
|
|
|
solo:true, |
|
|
|
flat:true, |
|
|
|
dense:true, |
|
|
|
solo:true, |
|
|
|
hideDetails:true |
|
|
|
dense:true, |
|
|
|
}" |
|
|
|
hideDetails:true |
|
|
|
:time-picker-props="{ |
|
|
|
}" |
|
|
|
format:'24hr' |
|
|
|
:time-picker-props="{ |
|
|
|
}" |
|
|
|
format:'24hr' |
|
|
|
v-on="parentListeners" |
|
|
|
}" |
|
|
|
/> |
|
|
|
v-on="parentListeners" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
@ -25,14 +27,16 @@ dayjs.extend(utc) |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'DateTimePickerCell', |
|
|
|
name: 'DateTimePickerCell', |
|
|
|
props: ['value', 'ignoreFocus'], |
|
|
|
props: { |
|
|
|
|
|
|
|
value: [String, Date, Number], ignoreFocus: Boolean |
|
|
|
|
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
localState: { |
|
|
|
localState: { |
|
|
|
get() { |
|
|
|
get() { |
|
|
|
if (!this.value) { return this.value } |
|
|
|
if (!this.value) { return this.value } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(this.value, dayjs(this.value).utc().format('YYYY-MM-DD HH:mm')) |
|
|
|
return dayjs(this.value).format('YYYY-MM-DD HH:mm') |
|
|
|
return dayjs(this.value).format('YYYY-MM-DD HH:mm') |
|
|
|
|
|
|
|
|
|
|
|
// todo : time value correction |
|
|
|
// todo : time value correction |
|
|
|
// |
|
|
|
// |
|
|
|
// if (/^\d{6,}$/.test(this.value)) { |
|
|
|
// if (/^\d{6,}$/.test(this.value)) { |
|
|
@ -44,14 +48,16 @@ export default { |
|
|
|
set(val) { |
|
|
|
set(val) { |
|
|
|
// console.log('dayjs=====', dayjs.utc(val).toString()) |
|
|
|
// console.log('dayjs=====', dayjs.utc(val).toString()) |
|
|
|
// const uVal = val && new Date(val).toISOString().slice(0, 19).replace('T', ' ').replace(/(\d{1,2}:\d{1,2}):\d{1,2}$/, '$1') |
|
|
|
// const uVal = val && new Date(val).toISOString().slice(0, 19).replace('T', ' ').replace(/(\d{1,2}:\d{1,2}):\d{1,2}$/, '$1') |
|
|
|
this.$emit('input', val && dayjs(val).format('YYYY-MM-DD HH:mm')) |
|
|
|
// console.log(uVal) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$emit('input', val && dayjs(val).format('YYYY-MM-DD HH:mm:ssZ')) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
parentListeners() { |
|
|
|
parentListeners() { |
|
|
|
const $listeners = {} |
|
|
|
const $listeners = {} |
|
|
|
|
|
|
|
|
|
|
|
if (this.$listeners.blur) { |
|
|
|
if (this.$listeners.blur) { |
|
|
|
$listeners.blur = this.$listeners.blur |
|
|
|
// $listeners.blur = this.$listeners.blur |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.$listeners.focus) { |
|
|
|
if (this.$listeners.focus) { |
|
|
|
$listeners.focus = this.$listeners.focus |
|
|
|
$listeners.focus = this.$listeners.focus |
|
|
|