1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
| <template>
| <a-date-picker
| ref="datePicker"
| :value="innerDateValue"
| allowClear
| :format="dateFormat"
| :showTime="isDatetime"
| dropdownClassName="j-vxe-date-picker"
| style="min-width: 0;"
| v-bind="cellProps"
| @change="handleChange"
| />
| </template>
|
| <script>
| import moment from 'moment'
| import { JVXETypes } from '@/components/jeecg/JVxeTable/index'
| import JVxeCellMixins, { dispatchEvent } from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
|
| export default {
| name: 'JVxeDateCell',
| mixins: [JVxeCellMixins],
| props: {},
| data() {
| return {
| innerDateValue: null,
| }
| },
| computed: {
| isDatetime() {
| return this.$type === JVXETypes.datetime
| },
| dateFormat() {
| let format = this.originColumn.format
| return format ? format : (this.isDatetime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')
| },
| },
| watch: {
| innerValue: {
| immediate: true,
| handler(val) {
| if (val == null || val === '') {
| this.innerDateValue = null
| } else {
| this.innerDateValue = moment(val, this.dateFormat)
| }
| }
| }
| },
| methods: {
| handleChange(mom, dateStr) {
| this.handleChangeCommon(dateStr)
| }
| },
| // 【组件增强】注释详见:JVxeCellMixins.js
| enhanced: {
| aopEvents: {
| editActived(event) {
| dispatchEvent.call(this, event, 'ant-calendar-picker', el => el.children[0].dispatchEvent(event.$event))
| },
| },
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|