|
|
@ -1,4 +1,5 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
|
|
|
|
<div> |
|
|
|
<v-datetime-picker |
|
|
|
<v-datetime-picker |
|
|
|
ref="picker" |
|
|
|
ref="picker" |
|
|
|
v-model="localState" |
|
|
|
v-model="localState" |
|
|
@ -15,6 +16,7 @@ |
|
|
|
}" |
|
|
|
}" |
|
|
|
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 |
|
|
|