vxe-gantt 0.0.3 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -46
- package/es/components.js +3 -2
- package/es/gantt/src/gantt-body.js +83 -49
- package/es/gantt/src/gantt-chart.js +91 -43
- package/es/gantt/src/gantt-header.js +63 -36
- package/es/gantt/src/gantt-view.js +638 -586
- package/es/gantt/src/gantt.js +1346 -1178
- package/es/gantt/src/util.js +1 -4
- package/es/gantt/style.css +62 -28
- package/es/gantt/style.min.css +1 -1
- package/es/index.esm.js +5 -2
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +9 -3
- package/es/ui/src/comp.js +1 -2
- package/es/ui/src/log.js +3 -2
- package/es/ui/src/utils.js +17 -17
- package/es/vxe-gantt/style.css +62 -28
- package/es/vxe-gantt/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/components.js +20 -19
- package/lib/components.min.js +1 -1
- package/lib/gantt/index.js +3 -3
- package/lib/gantt/index.min.js +1 -1
- package/lib/gantt/src/gantt-body.js +109 -87
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-chart.js +109 -69
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-header.js +75 -56
- package/lib/gantt/src/gantt-header.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +684 -686
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +1630 -1559
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/gantt/src/util.js +1 -4
- package/lib/gantt/src/util.min.js +1 -1
- package/lib/gantt/style/style.css +62 -28
- package/lib/gantt/style/style.min.css +1 -1
- package/lib/index.common.js +12 -7
- package/lib/index.umd.js +10704 -5870
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +12 -16
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/comp.js +3 -2
- package/lib/ui/src/comp.min.js +1 -1
- package/lib/ui/src/dom.js +33 -33
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +4 -3
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +21 -24
- package/lib/ui/src/utils.min.js +1 -1
- package/lib/vxe-gantt/index.js +4 -2
- package/lib/vxe-gantt/index.min.js +1 -1
- package/lib/vxe-gantt/style/style.css +62 -28
- package/lib/vxe-gantt/style/style.min.css +1 -1
- package/lib/vxe-ui/index.js +4 -2
- package/lib/vxe-ui/index.min.js +1 -1
- package/package.json +13 -13
- package/packages/components.ts +8 -5
- package/packages/gantt/index.ts +2 -2
- package/packages/gantt/src/gantt-body.ts +89 -53
- package/packages/gantt/src/gantt-chart.ts +100 -49
- package/packages/gantt/src/gantt-header.ts +69 -39
- package/packages/gantt/src/gantt-view.ts +692 -624
- package/packages/gantt/src/gantt.ts +1459 -1240
- package/packages/gantt/src/util.ts +1 -4
- package/packages/index.ts +6 -2
- package/packages/ui/index.ts +9 -3
- package/packages/ui/src/comp.ts +2 -2
- package/packages/ui/src/log.ts +3 -1
- package/packages/ui/src/utils.ts +22 -21
- package/styles/components/gantt-module/gantt-chart.scss +28 -9
- package/styles/components/gantt.scss +36 -21
- package/styles/theme/base.scss +5 -1
- package/types/all.d.ts +3 -3
- package/types/index.d.ts +2 -2
- package/README.en.md +0 -72
- package/README.ja-JP.md +0 -72
- package/README.zh-TW.md +0 -73
- package/es/gantt/src/emits.js +0 -4
- package/es/gantt/src/grid-emits.js +0 -16
- package/es/gantt/src/grid-props.js +0 -7
- package/es/gantt/src/props.js +0 -2
- package/es/gantt/src/table-emits.js +0 -97
- package/es/gantt/src/table-props.js +0 -298
- package/lib/gantt/src/emits.js +0 -8
- package/lib/gantt/src/emits.min.js +0 -1
- package/lib/gantt/src/grid-emits.js +0 -8
- package/lib/gantt/src/grid-emits.min.js +0 -1
- package/lib/gantt/src/grid-props.js +0 -24
- package/lib/gantt/src/grid-props.min.js +0 -1
- package/lib/gantt/src/props.js +0 -13
- package/lib/gantt/src/props.min.js +0 -1
- package/lib/gantt/src/table-emits.js +0 -7
- package/lib/gantt/src/table-emits.min.js +0 -1
- package/lib/gantt/src/table-props.js +0 -306
- package/lib/gantt/src/table-props.min.js +0 -1
- package/packages/gantt/src/emits.ts +0 -7
- package/packages/gantt/src/grid-emits.ts +0 -19
- package/packages/gantt/src/grid-props.ts +0 -23
- package/packages/gantt/src/props.ts +0 -13
- package/packages/gantt/src/table-emits.ts +0 -109
- package/packages/gantt/src/table-props.ts +0 -304
|
@@ -1,24 +1,55 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropType, VNode, CreateElement, Component } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
|
+
import { VxeUI } from '@vxe-ui/core'
|
|
3
4
|
import XEUtils from 'xe-utils'
|
|
4
5
|
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
6
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit, addClass, removeClass } from '../../ui/src/dom'
|
|
6
|
-
import { VxeUI } from '../../ui'
|
|
7
|
-
import { ganttProps } from './props'
|
|
8
|
-
import { ganttEmits } from './emits'
|
|
9
|
-
import { tableEmits } from './table-emits'
|
|
10
|
-
import { tableProps } from './table-props'
|
|
11
7
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
12
8
|
import GanttViewComponent from './gantt-view'
|
|
9
|
+
import { VxeTable as VxeTableComponent } from 'vxe-table'
|
|
13
10
|
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
11
|
+
import type { ValueOf, VxeFormInstance, VxeFormItemProps, VxePagerInstance, VxePagerDefines, VxeComponentStyleType, VxeComponentSizeType, VxeFormDefines, VxeFormItemPropTypes } from 'vxe-pc-ui'
|
|
12
|
+
import type { VxeTableMethods, VxeToolbarPropTypes, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeToolbarInstance, TableInternalData, VxeTablePropTypes, VxeGridPropTypes } from 'vxe-table'
|
|
13
|
+
import type { VxeGanttEmits, GanttReactData, GanttInternalData, VxeGanttPropTypes, VxeGanttViewInstance, VxeGanttDefines } from '../../../types'
|
|
17
14
|
|
|
18
|
-
const { getConfig, getIcon, getI18n, commands,
|
|
15
|
+
const { getConfig, getIcon, getI18n, commands, globalMixins, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement, getSlotVNs } = VxeUI
|
|
19
16
|
|
|
20
|
-
const
|
|
21
|
-
|
|
17
|
+
const tableProps = (VxeTableComponent as any).props
|
|
18
|
+
|
|
19
|
+
const tableMethods: VxeTableMethods = {} as VxeTableMethods
|
|
20
|
+
const propKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
|
|
21
|
+
|
|
22
|
+
const defaultLayouts: VxeGanttPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']]
|
|
23
|
+
|
|
24
|
+
function getTableOns (_vm: any) {
|
|
25
|
+
const { $listeners, proxyConfig, proxyOpts } = _vm
|
|
26
|
+
const ons: any = {}
|
|
27
|
+
XEUtils.each($listeners, (cb: any, type: any) => {
|
|
28
|
+
ons[type] = (...args: any[]) => {
|
|
29
|
+
_vm.$emit(type, ...args)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
if (proxyConfig) {
|
|
33
|
+
if (proxyOpts.sort) {
|
|
34
|
+
ons['sort-change'] = _vm.sortChangeEvent
|
|
35
|
+
ons['clear-all-sort'] = _vm.clearAllSortEvent
|
|
36
|
+
}
|
|
37
|
+
if (proxyOpts.filter) {
|
|
38
|
+
ons['filter-change'] = _vm.filterChangeEvent
|
|
39
|
+
ons['clear-all-filter'] = _vm.clearAllFilterEvent
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return ons
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
XEUtils.each((VxeTableComponent as any).methods, (fn, name) => {
|
|
46
|
+
tableMethods[name as keyof VxeTableMethods] = function (this: any, ...args: any[]) {
|
|
47
|
+
const $xeGantt = this
|
|
48
|
+
const $xeTable = $xeGantt.$refs.refTable
|
|
49
|
+
|
|
50
|
+
return $xeTable && $xeTable[name](...args)
|
|
51
|
+
}
|
|
52
|
+
})
|
|
22
53
|
|
|
23
54
|
function createInternalData (): GanttInternalData {
|
|
24
55
|
return {
|
|
@@ -26,26 +57,58 @@ function createInternalData (): GanttInternalData {
|
|
|
26
57
|
}
|
|
27
58
|
}
|
|
28
59
|
|
|
29
|
-
export default defineVxeComponent({
|
|
60
|
+
export default /* define-vxe-component start */ defineVxeComponent({
|
|
30
61
|
name: 'VxeGantt',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
62
|
+
mixins: [
|
|
63
|
+
globalMixins.sizeMixin
|
|
64
|
+
],
|
|
65
|
+
props: {
|
|
66
|
+
...(tableProps as unknown as {
|
|
67
|
+
border: PropType<VxeTablePropTypes.Border>
|
|
68
|
+
round: PropType<VxeTablePropTypes.Round>
|
|
69
|
+
loading: PropType<VxeTablePropTypes.Loading>
|
|
70
|
+
height: PropType<VxeTablePropTypes.Height>
|
|
71
|
+
minHeight: PropType<VxeTablePropTypes.MinHeight>
|
|
72
|
+
maxHeight: PropType<VxeTablePropTypes.MaxHeight>
|
|
73
|
+
seqConfig: PropType<VxeTablePropTypes.SeqConfig>
|
|
74
|
+
editConfig: PropType<VxeTablePropTypes.EditConfig>
|
|
75
|
+
sortConfig: PropType<VxeTablePropTypes.SortConfig>
|
|
76
|
+
filterConfig: PropType<VxeTablePropTypes.FilterConfig>
|
|
77
|
+
validConfig: PropType<VxeTablePropTypes.ValidConfig>
|
|
78
|
+
editRules: PropType<VxeTablePropTypes.EditRules>
|
|
79
|
+
animat: PropType<VxeTablePropTypes.Animat>
|
|
80
|
+
scrollbarConfig: PropType<VxeTablePropTypes.ScrollbarConfig>
|
|
81
|
+
params: PropType<VxeTablePropTypes.Params>
|
|
82
|
+
}),
|
|
83
|
+
|
|
84
|
+
columns: Array as PropType<VxeGridPropTypes.Columns<any>>,
|
|
85
|
+
pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
|
|
86
|
+
proxyConfig: Object as PropType<VxeGridPropTypes.ProxyConfig<any>>,
|
|
87
|
+
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
88
|
+
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
89
|
+
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
90
|
+
|
|
91
|
+
layouts: Array as PropType<VxeGanttPropTypes.Layouts>,
|
|
92
|
+
taskConfig: Object as PropType<VxeGanttPropTypes.TaskConfig>,
|
|
93
|
+
taskViewConfig: Object as PropType<VxeGanttPropTypes.TaskViewConfig>,
|
|
94
|
+
taskBarConfig: Object as PropType<VxeGanttPropTypes.TaskBarConfig>,
|
|
95
|
+
taskSplitConfig: Object as PropType<VxeGanttPropTypes.TaskSplitConfig>,
|
|
96
|
+
size: {
|
|
97
|
+
type: String as PropType<VxeGridPropTypes.Size>,
|
|
98
|
+
default: () => getConfig().gantt.size || getConfig().size
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
provide () {
|
|
102
|
+
const $xeGantt = this
|
|
35
103
|
|
|
104
|
+
return {
|
|
105
|
+
$xeGantt
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
data () {
|
|
36
109
|
const xID = XEUtils.uniqueId()
|
|
37
110
|
|
|
38
|
-
|
|
39
|
-
const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
|
|
40
|
-
const VxeUIPagerComponent = VxeUI.getComponent('VxePager')
|
|
41
|
-
const VxeTableComponent = VxeUI.getComponent('VxeTable')
|
|
42
|
-
const VxeToolbarComponent = VxeUI.getComponent('VxeToolbar')
|
|
43
|
-
|
|
44
|
-
const defaultLayouts: VxeGanttPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']]
|
|
45
|
-
|
|
46
|
-
const { computeSize } = useFns.useSize(props)
|
|
47
|
-
|
|
48
|
-
const reactData = reactive<GanttReactData>({
|
|
111
|
+
const reactData: GanttReactData = {
|
|
49
112
|
tableLoading: false,
|
|
50
113
|
proxyInited: false,
|
|
51
114
|
isZMax: false,
|
|
@@ -61,131 +124,139 @@ export default defineVxeComponent({
|
|
|
61
124
|
},
|
|
62
125
|
showLeftView: true,
|
|
63
126
|
showRightView: true
|
|
64
|
-
}
|
|
127
|
+
}
|
|
65
128
|
|
|
66
129
|
const internalData = createInternalData()
|
|
67
130
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const refPager = ref<VxePagerInstance>()
|
|
73
|
-
const refGanttContainer = ref<HTMLDivElement>()
|
|
74
|
-
const refGanttView = ref<VxeGanttViewInstance>()
|
|
75
|
-
|
|
76
|
-
const refFormWrapper = ref<HTMLDivElement>()
|
|
77
|
-
const refToolbarWrapper = ref<HTMLDivElement>()
|
|
78
|
-
const refTopWrapper = ref<HTMLDivElement>()
|
|
79
|
-
const refBottomWrapper = ref<HTMLDivElement>()
|
|
80
|
-
const refPagerWrapper = ref<HTMLDivElement>()
|
|
81
|
-
const refTableWrapper = ref<HTMLDivElement>()
|
|
82
|
-
const refGanttWrapper = ref<HTMLDivElement>()
|
|
83
|
-
|
|
84
|
-
const refResizableSplitTip = ref<HTMLDivElement>()
|
|
85
|
-
|
|
86
|
-
const extendTableMethods = <T>(methodKeys: T[]) => {
|
|
87
|
-
const funcs: any = {}
|
|
88
|
-
methodKeys.forEach(name => {
|
|
89
|
-
funcs[name] = (...args: any[]) => {
|
|
90
|
-
const $xeTable: any = refTable.value
|
|
91
|
-
if ($xeTable && $xeTable[name]) {
|
|
92
|
-
return $xeTable[name](...args)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
return funcs
|
|
131
|
+
return {
|
|
132
|
+
xID,
|
|
133
|
+
reactData,
|
|
134
|
+
internalData
|
|
97
135
|
}
|
|
136
|
+
},
|
|
137
|
+
computed: {
|
|
138
|
+
...({} as {
|
|
139
|
+
computeSize(): VxeComponentSizeType
|
|
140
|
+
}),
|
|
141
|
+
computeProxyOpts () {
|
|
142
|
+
const $xeGantt = this
|
|
143
|
+
const props = $xeGantt
|
|
98
144
|
|
|
99
|
-
const ganttExtendTableMethods = extendTableMethods(tableComponentMethodKeys) as VxeTableMethods
|
|
100
|
-
|
|
101
|
-
tableComponentMethodKeys.forEach(name => {
|
|
102
|
-
ganttExtendTableMethods[name] = (...args: any[]) => {
|
|
103
|
-
const $xeTable: any = refTable.value
|
|
104
|
-
if ($xeTable && $xeTable[name]) {
|
|
105
|
-
return $xeTable && $xeTable[name](...args)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
const computeProxyOpts = computed(() => {
|
|
111
145
|
return XEUtils.merge({}, XEUtils.clone(getConfig().gantt.proxyConfig, true), props.proxyConfig)
|
|
112
|
-
}
|
|
146
|
+
},
|
|
147
|
+
computeIsRespMsg () {
|
|
148
|
+
const $xeGantt = this
|
|
113
149
|
|
|
114
|
-
|
|
115
|
-
const proxyOpts = computeProxyOpts.value
|
|
150
|
+
const proxyOpts = $xeGantt.computeProxyOpts as VxeGanttPropTypes.ProxyConfig
|
|
116
151
|
return !!(XEUtils.isBoolean(proxyOpts.message) ? proxyOpts.message : proxyOpts.showResponseMsg)
|
|
117
|
-
}
|
|
152
|
+
},
|
|
153
|
+
computeIsActiveMsg () {
|
|
154
|
+
const $xeGantt = this
|
|
118
155
|
|
|
119
|
-
|
|
120
|
-
const proxyOpts = computeProxyOpts.value
|
|
156
|
+
const proxyOpts = $xeGantt.computeProxyOpts as VxeGanttPropTypes.ProxyConfig
|
|
121
157
|
return XEUtils.isBoolean(proxyOpts.showActionMsg) ? proxyOpts.showActionMsg : !!proxyOpts.showActiveMsg
|
|
122
|
-
}
|
|
158
|
+
},
|
|
159
|
+
computePagerOpts () {
|
|
160
|
+
const $xeGantt = this
|
|
161
|
+
const props = $xeGantt
|
|
123
162
|
|
|
124
|
-
const computePagerOpts = computed(() => {
|
|
125
163
|
return Object.assign({}, getConfig().gantt.pagerConfig, props.pagerConfig)
|
|
126
|
-
}
|
|
164
|
+
},
|
|
165
|
+
computeFormOpts () {
|
|
166
|
+
const $xeGantt = this
|
|
167
|
+
const props = $xeGantt
|
|
127
168
|
|
|
128
|
-
const computeFormOpts = computed(() => {
|
|
129
169
|
return Object.assign({}, getConfig().gantt.formConfig, props.formConfig)
|
|
130
|
-
}
|
|
170
|
+
},
|
|
171
|
+
computeToolbarOpts () {
|
|
172
|
+
const $xeGantt = this
|
|
173
|
+
const props = $xeGantt
|
|
131
174
|
|
|
132
|
-
const computeToolbarOpts = computed(() => {
|
|
133
175
|
return Object.assign({}, getConfig().gantt.toolbarConfig, props.toolbarConfig)
|
|
134
|
-
}
|
|
176
|
+
},
|
|
177
|
+
computeZoomOpts () {
|
|
178
|
+
const $xeGantt = this
|
|
179
|
+
const props = $xeGantt
|
|
135
180
|
|
|
136
|
-
const computeZoomOpts = computed(() => {
|
|
137
181
|
return Object.assign({}, getConfig().gantt.zoomConfig, props.zoomConfig)
|
|
138
|
-
}
|
|
182
|
+
},
|
|
183
|
+
computeTaskOpts () {
|
|
184
|
+
const $xeGantt = this
|
|
185
|
+
const props = $xeGantt
|
|
139
186
|
|
|
140
|
-
const computeTaskOpts = computed(() => {
|
|
141
187
|
return Object.assign({}, getConfig().gantt.taskConfig, props.taskConfig)
|
|
142
|
-
}
|
|
188
|
+
},
|
|
189
|
+
computeTaskViewOpts () {
|
|
190
|
+
const $xeGantt = this
|
|
191
|
+
const props = $xeGantt
|
|
143
192
|
|
|
144
|
-
const computeTaskViewOpts = computed(() => {
|
|
145
193
|
return Object.assign({}, getConfig().gantt.taskViewConfig, props.taskViewConfig)
|
|
146
|
-
}
|
|
194
|
+
},
|
|
195
|
+
computeTaskBarOpts () {
|
|
196
|
+
const $xeGantt = this
|
|
197
|
+
const props = $xeGantt
|
|
147
198
|
|
|
148
|
-
const computeTaskBarOpts = computed(() => {
|
|
149
199
|
return Object.assign({}, getConfig().gantt.taskBarConfig, props.taskBarConfig)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
return taskOpts.titleField || 'title'
|
|
155
|
-
})
|
|
200
|
+
},
|
|
201
|
+
computeTaskSplitOpts () {
|
|
202
|
+
const $xeGantt = this
|
|
203
|
+
const props = $xeGantt
|
|
156
204
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const computeEndField = computed(() => {
|
|
163
|
-
const taskOpts = computeTaskOpts.value
|
|
164
|
-
return taskOpts.endField || 'endDate'
|
|
165
|
-
})
|
|
205
|
+
return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig)
|
|
206
|
+
},
|
|
207
|
+
computeTitleField () {
|
|
208
|
+
const $xeGantt = this
|
|
166
209
|
|
|
167
|
-
|
|
168
|
-
|
|
210
|
+
const taskOpts = $xeGantt.computeTaskOpts as VxeGanttPropTypes.TaskConfig
|
|
211
|
+
return taskOpts.titleField || 'title'
|
|
212
|
+
},
|
|
213
|
+
computeStartField () {
|
|
214
|
+
const $xeGantt = this
|
|
215
|
+
|
|
216
|
+
const taskOpts = $xeGantt.computeTaskOpts as VxeGanttPropTypes.TaskConfig
|
|
217
|
+
return taskOpts.startField || 'start'
|
|
218
|
+
},
|
|
219
|
+
computeEndField () {
|
|
220
|
+
const $xeGantt = this
|
|
221
|
+
|
|
222
|
+
const taskOpts = $xeGantt.computeTaskOpts as VxeGanttPropTypes.TaskConfig
|
|
223
|
+
return taskOpts.endField || 'end'
|
|
224
|
+
},
|
|
225
|
+
computeProgressField () {
|
|
226
|
+
const $xeGantt = this
|
|
227
|
+
|
|
228
|
+
const taskOpts = $xeGantt.computeTaskOpts as VxeGanttPropTypes.TaskConfig
|
|
169
229
|
return taskOpts.progressField || 'progress'
|
|
170
|
-
}
|
|
230
|
+
},
|
|
231
|
+
computeScrollbarOpts () {
|
|
232
|
+
const $xeGantt = this
|
|
233
|
+
const props = $xeGantt
|
|
171
234
|
|
|
172
|
-
const computeScrollbarOpts = computed(() => {
|
|
173
235
|
return Object.assign({}, getConfig().gantt.scrollbarConfig, props.scrollbarConfig)
|
|
174
|
-
}
|
|
236
|
+
},
|
|
237
|
+
computeScrollbarXToTop () {
|
|
238
|
+
const $xeGantt = this
|
|
175
239
|
|
|
176
|
-
|
|
177
|
-
const scrollbarOpts = computeScrollbarOpts.value
|
|
240
|
+
const scrollbarOpts = $xeGantt.computeScrollbarOpts as VxeTablePropTypes.ScrollbarConfig
|
|
178
241
|
return !!(scrollbarOpts.x && scrollbarOpts.x.position === 'top')
|
|
179
|
-
}
|
|
242
|
+
},
|
|
243
|
+
computeScrollbarYToLeft () {
|
|
244
|
+
const $xeGantt = this
|
|
180
245
|
|
|
181
|
-
|
|
182
|
-
const scrollbarOpts = computeScrollbarOpts.value
|
|
246
|
+
const scrollbarOpts = $xeGantt.computeScrollbarOpts as VxeTablePropTypes.ScrollbarConfig
|
|
183
247
|
return !!(scrollbarOpts.y && scrollbarOpts.y.position === 'left')
|
|
184
|
-
}
|
|
248
|
+
},
|
|
249
|
+
computeStyles () {
|
|
250
|
+
const $xeGantt = this
|
|
251
|
+
const props = $xeGantt
|
|
252
|
+
const reactData = $xeGantt.reactData
|
|
185
253
|
|
|
186
|
-
const computeStyles = computed(() => {
|
|
187
254
|
const { height, maxHeight } = props
|
|
188
255
|
const { isZMax, tZindex } = reactData
|
|
256
|
+
const taskViewOpts = $xeGantt.computeTaskViewOpts as VxeGanttPropTypes.TaskViewConfig
|
|
257
|
+
const { tableStyle } = taskViewOpts
|
|
258
|
+
const taskBarOpts = $xeGantt.computeTaskBarOpts as VxeGanttPropTypes.TaskBarConfig
|
|
259
|
+
const { barStyle } = taskBarOpts
|
|
189
260
|
const stys: VxeComponentStyleType = {}
|
|
190
261
|
if (isZMax) {
|
|
191
262
|
stys.zIndex = tZindex
|
|
@@ -197,30 +268,46 @@ export default defineVxeComponent({
|
|
|
197
268
|
stys.maxHeight = maxHeight === 'auto' || maxHeight === '100%' ? '100%' : toCssUnit(maxHeight)
|
|
198
269
|
}
|
|
199
270
|
}
|
|
271
|
+
if (barStyle) {
|
|
272
|
+
const { bgColor, completedBgColor } = barStyle
|
|
273
|
+
if (bgColor) {
|
|
274
|
+
stys['--vxe-ui-gantt-view-task-bar-background-color'] = bgColor
|
|
275
|
+
}
|
|
276
|
+
if (completedBgColor) {
|
|
277
|
+
stys['--vxe-ui-gantt-view-task-bar-completed-background-color'] = completedBgColor
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (tableStyle) {
|
|
281
|
+
const { width: defTbWidth } = tableStyle
|
|
282
|
+
if (defTbWidth) {
|
|
283
|
+
stys['--vxe-ui-gantt-view-table-default-width'] = toCssUnit(defTbWidth)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
200
286
|
return stys
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
287
|
+
},
|
|
288
|
+
computeTableExtendProps () {
|
|
289
|
+
const $xeGantt = this
|
|
290
|
+
const props = $xeGantt
|
|
291
|
+
|
|
292
|
+
const rest: any = {}
|
|
293
|
+
const gridProps: any = props
|
|
294
|
+
propKeys.forEach(key => {
|
|
295
|
+
rest[key] = gridProps[key]
|
|
207
296
|
})
|
|
208
297
|
return rest
|
|
209
|
-
}
|
|
298
|
+
},
|
|
299
|
+
computeTableProps () {
|
|
300
|
+
const $xeGantt = this
|
|
301
|
+
const props = $xeGantt
|
|
302
|
+
const reactData = $xeGantt.reactData
|
|
210
303
|
|
|
211
|
-
const computeTableProps = computed(() => {
|
|
212
304
|
const { seqConfig, pagerConfig, editConfig, proxyConfig } = props
|
|
213
305
|
const { isZMax, tablePage } = reactData
|
|
214
|
-
const tableExtendProps = computeTableExtendProps
|
|
215
|
-
const proxyOpts = computeProxyOpts
|
|
216
|
-
const pagerOpts = computePagerOpts
|
|
217
|
-
const isLoading = computeIsLoading
|
|
218
|
-
const tProps = Object.assign({}, tableExtendProps
|
|
219
|
-
showOverflow: true,
|
|
220
|
-
showHeaderOverflow: true,
|
|
221
|
-
showFooterOverflow: true,
|
|
222
|
-
showFooter: false
|
|
223
|
-
})
|
|
306
|
+
const tableExtendProps = $xeGantt.computeTableExtendProps as any
|
|
307
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
308
|
+
const pagerOpts = $xeGantt.computePagerOpts
|
|
309
|
+
const isLoading = $xeGantt.computeIsLoading
|
|
310
|
+
const tProps = Object.assign({}, tableExtendProps)
|
|
224
311
|
if (isZMax) {
|
|
225
312
|
if (tableExtendProps.maxHeight) {
|
|
226
313
|
tProps.maxHeight = '100%'
|
|
@@ -238,9 +325,16 @@ export default defineVxeComponent({
|
|
|
238
325
|
tProps.editConfig = Object.assign({}, editConfig)
|
|
239
326
|
}
|
|
240
327
|
return tProps
|
|
241
|
-
}
|
|
328
|
+
},
|
|
329
|
+
tableProps () {
|
|
330
|
+
const $xeGantt = this
|
|
331
|
+
|
|
332
|
+
return $xeGantt.computeTableProps
|
|
333
|
+
},
|
|
334
|
+
computeCurrLayoutConf () {
|
|
335
|
+
const $xeGantt = this
|
|
336
|
+
const props = $xeGantt
|
|
242
337
|
|
|
243
|
-
const computeCurrLayoutConf = computed(() => {
|
|
244
338
|
const { layouts } = props
|
|
245
339
|
let confs: VxeGanttPropTypes.Layouts = []
|
|
246
340
|
if (layouts && layouts.length) {
|
|
@@ -265,37 +359,47 @@ export default defineVxeComponent({
|
|
|
265
359
|
bodyKeys,
|
|
266
360
|
footKeys
|
|
267
361
|
}
|
|
268
|
-
}
|
|
362
|
+
},
|
|
363
|
+
computeCustomCurrentPageFlag () {
|
|
364
|
+
const $xeGantt = this
|
|
269
365
|
|
|
270
|
-
|
|
271
|
-
const pagerOpts = computePagerOpts.value
|
|
366
|
+
const pagerOpts = $xeGantt.computePagerOpts as VxeGanttPropTypes.PagerConfig
|
|
272
367
|
return pagerOpts.currentPage
|
|
273
|
-
}
|
|
368
|
+
},
|
|
369
|
+
computeCustomPageSizeFlag () {
|
|
370
|
+
const $xeGantt = this
|
|
274
371
|
|
|
275
|
-
|
|
276
|
-
const pagerOpts = computePagerOpts.value
|
|
372
|
+
const pagerOpts = $xeGantt.computePagerOpts as VxeGanttPropTypes.PagerConfig
|
|
277
373
|
return pagerOpts.pageSize
|
|
278
|
-
}
|
|
374
|
+
},
|
|
375
|
+
computeCustomTotalFlag () {
|
|
376
|
+
const $xeGantt = this
|
|
279
377
|
|
|
280
|
-
|
|
281
|
-
const pagerOpts = computePagerOpts.value
|
|
378
|
+
const pagerOpts = $xeGantt.computePagerOpts as VxeGanttPropTypes.PagerConfig
|
|
282
379
|
return pagerOpts.total
|
|
283
|
-
}
|
|
380
|
+
},
|
|
381
|
+
computePageCount () {
|
|
382
|
+
const $xeGantt = this
|
|
383
|
+
const reactData = ($xeGantt as any).reactData
|
|
284
384
|
|
|
285
|
-
const computePageCount = computed(() => {
|
|
286
385
|
const { tablePage } = reactData
|
|
287
386
|
return Math.max(Math.ceil(tablePage.total / tablePage.pageSize), 1)
|
|
288
|
-
}
|
|
387
|
+
},
|
|
388
|
+
computeIsLoading () {
|
|
389
|
+
const $xeGantt = this
|
|
390
|
+
const props = $xeGantt
|
|
391
|
+
const reactData = ($xeGantt as any).reactData
|
|
289
392
|
|
|
290
|
-
const computeIsLoading = computed(() => {
|
|
291
393
|
const { loading, proxyConfig } = props
|
|
292
394
|
const { tableLoading } = reactData
|
|
293
|
-
const proxyOpts = computeProxyOpts.
|
|
395
|
+
const proxyOpts = $xeGantt.computeProxyOpts as VxeGanttPropTypes.ProxyConfig
|
|
294
396
|
const { showLoading } = proxyOpts
|
|
295
397
|
return loading || (tableLoading && showLoading && proxyConfig && isEnableConf(proxyOpts))
|
|
296
|
-
}
|
|
398
|
+
},
|
|
399
|
+
computeTableBorder () {
|
|
400
|
+
const $xeGantt = this
|
|
401
|
+
const props = $xeGantt
|
|
297
402
|
|
|
298
|
-
const computeTableBorder = computed(() => {
|
|
299
403
|
const { border } = props
|
|
300
404
|
if (border === true) {
|
|
301
405
|
return 'full'
|
|
@@ -304,77 +408,76 @@ export default defineVxeComponent({
|
|
|
304
408
|
return border
|
|
305
409
|
}
|
|
306
410
|
return 'default'
|
|
307
|
-
})
|
|
308
|
-
|
|
309
|
-
const refMaps: GanttPrivateRef = {
|
|
310
|
-
refElem,
|
|
311
|
-
refTable,
|
|
312
|
-
refForm,
|
|
313
|
-
refToolbar,
|
|
314
|
-
refPager
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const computeMaps: VxeGanttPrivateComputed = {
|
|
318
|
-
computeProxyOpts,
|
|
319
|
-
computePagerOpts,
|
|
320
|
-
computeFormOpts,
|
|
321
|
-
computeToolbarOpts,
|
|
322
|
-
computeZoomOpts,
|
|
323
|
-
computeTaskOpts,
|
|
324
|
-
computeTaskViewOpts,
|
|
325
|
-
computeTaskBarOpts,
|
|
326
|
-
computeTitleField,
|
|
327
|
-
computeStartField,
|
|
328
|
-
computeEndField,
|
|
329
|
-
computeProgressField,
|
|
330
|
-
computeScrollbarOpts,
|
|
331
|
-
computeScrollbarXToTop,
|
|
332
|
-
computeScrollbarYToLeft
|
|
333
411
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
412
|
+
},
|
|
413
|
+
watch: {
|
|
414
|
+
columns () {
|
|
415
|
+
const $xeGantt = this
|
|
416
|
+
const props = $xeGantt
|
|
417
|
+
|
|
418
|
+
$xeGantt.$nextTick(() => $xeGantt.loadColumn(props.columns || []))
|
|
419
|
+
},
|
|
420
|
+
toolbarConfig () {
|
|
421
|
+
const $xeGantt = this
|
|
422
|
+
|
|
423
|
+
$xeGantt.initToolbar()
|
|
424
|
+
},
|
|
425
|
+
computeCustomCurrentPageFlag () {
|
|
426
|
+
const $xeGantt = this
|
|
427
|
+
|
|
428
|
+
$xeGantt.initPages('currentPage')
|
|
429
|
+
},
|
|
430
|
+
computeCustomPageSizeFlag () {
|
|
431
|
+
const $xeGantt = this
|
|
432
|
+
|
|
433
|
+
$xeGantt.initPages('pageSize')
|
|
434
|
+
},
|
|
435
|
+
computeCustomTotalFlag () {
|
|
436
|
+
const $xeGantt = this
|
|
437
|
+
|
|
438
|
+
$xeGantt.initPages('total')
|
|
439
|
+
},
|
|
440
|
+
proxyConfig () {
|
|
441
|
+
const $xeGantt = this
|
|
442
|
+
|
|
443
|
+
$xeGantt.initProxy()
|
|
356
444
|
}
|
|
445
|
+
},
|
|
446
|
+
methods: {
|
|
447
|
+
...tableMethods,
|
|
448
|
+
dispatchEvent (type: ValueOf<VxeGanttEmits>, params: Record<string, any>, evnt: Event | null) {
|
|
449
|
+
const $xeGantt = this
|
|
450
|
+
|
|
451
|
+
$xeGantt.$emit(type, createEvent(evnt, { $grid: null, $gantt: $xeGantt }, params))
|
|
452
|
+
},
|
|
453
|
+
initToolbar () {
|
|
454
|
+
const $xeGantt = this
|
|
455
|
+
|
|
456
|
+
$xeGantt.$nextTick(() => {
|
|
457
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
458
|
+
const $xeToolbar = $xeGantt.$refs.refToolbar as VxeToolbarInstance
|
|
459
|
+
if ($xeTable && $xeToolbar) {
|
|
460
|
+
$xeTable.connectToolbar($xeToolbar)
|
|
461
|
+
}
|
|
462
|
+
})
|
|
463
|
+
},
|
|
464
|
+
initGanttView () {
|
|
465
|
+
const $xeGantt = this
|
|
357
466
|
|
|
358
|
-
|
|
359
|
-
const $
|
|
360
|
-
const $ganttView = refGanttView.value
|
|
467
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
468
|
+
const $ganttView = $xeGantt.$refs.refGanttView as VxeGanttViewInstance
|
|
361
469
|
if ($xeTable && $ganttView) {
|
|
362
470
|
$xeTable.handleConnectGanttView($ganttView)
|
|
363
471
|
}
|
|
364
|
-
}
|
|
472
|
+
},
|
|
473
|
+
initPages (propKey?: 'currentPage' | 'pageSize' | 'total') {
|
|
474
|
+
const $xeGantt = this
|
|
475
|
+
const props = $xeGantt
|
|
476
|
+
const reactData = $xeGantt.reactData
|
|
365
477
|
|
|
366
|
-
const getFormData = () => {
|
|
367
|
-
const { proxyConfig } = props
|
|
368
|
-
const { formData } = reactData
|
|
369
|
-
const proxyOpts = computeProxyOpts.value
|
|
370
|
-
const formOpts = computeFormOpts.value
|
|
371
|
-
return proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
const initPages = (propKey?: 'currentPage' | 'pageSize' | 'total') => {
|
|
375
478
|
const { tablePage } = reactData
|
|
376
479
|
const { pagerConfig } = props
|
|
377
|
-
const pagerOpts = computePagerOpts
|
|
480
|
+
const pagerOpts = $xeGantt.computePagerOpts
|
|
378
481
|
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
379
482
|
if (propKey) {
|
|
380
483
|
if (pagerOpts[propKey]) {
|
|
@@ -393,16 +496,15 @@ export default defineVxeComponent({
|
|
|
393
496
|
}
|
|
394
497
|
}
|
|
395
498
|
}
|
|
396
|
-
}
|
|
499
|
+
},
|
|
500
|
+
triggerPendingEvent (code: string) {
|
|
501
|
+
const $xeGantt = this
|
|
397
502
|
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
const selectRecords = $xeTable ? $xeTable.getCheckboxRecords() : []
|
|
503
|
+
const isActiveMsg = $xeGantt.computeIsActiveMsg
|
|
504
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
505
|
+
const selectRecords = $xeTable.getCheckboxRecords()
|
|
402
506
|
if (selectRecords.length) {
|
|
403
|
-
|
|
404
|
-
$xeTable.togglePendingRow(selectRecords)
|
|
405
|
-
}
|
|
507
|
+
$xeTable.togglePendingRow(selectRecords)
|
|
406
508
|
$xeGantt.clearCheckboxRow()
|
|
407
509
|
} else {
|
|
408
510
|
if (isActiveMsg) {
|
|
@@ -411,22 +513,24 @@ export default defineVxeComponent({
|
|
|
411
513
|
}
|
|
412
514
|
}
|
|
413
515
|
}
|
|
414
|
-
}
|
|
516
|
+
},
|
|
517
|
+
getRespMsg (rest: any, defaultMsg: string) {
|
|
518
|
+
const $xeGantt = this
|
|
415
519
|
|
|
416
|
-
|
|
417
|
-
const proxyOpts = computeProxyOpts.value
|
|
520
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
418
521
|
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
419
522
|
const messageProp = resConfigs.message
|
|
420
|
-
const $xeTable = refTable
|
|
523
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
421
524
|
let msg
|
|
422
525
|
if (rest && messageProp) {
|
|
423
|
-
msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable
|
|
526
|
+
msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt }) : XEUtils.get(rest, messageProp)
|
|
424
527
|
}
|
|
425
528
|
return msg || getI18n(defaultMsg)
|
|
426
|
-
}
|
|
529
|
+
},
|
|
530
|
+
handleDeleteRow (code: string, alertKey: string, callback: () => void): Promise<void> {
|
|
531
|
+
const $xeGantt = this
|
|
427
532
|
|
|
428
|
-
|
|
429
|
-
const isActiveMsg = computeIsActiveMsg.value
|
|
533
|
+
const isActiveMsg = $xeGantt.computeIsActiveMsg
|
|
430
534
|
const selectRecords = $xeGantt.getCheckboxRecords()
|
|
431
535
|
if (isActiveMsg) {
|
|
432
536
|
if (selectRecords.length) {
|
|
@@ -448,13 +552,16 @@ export default defineVxeComponent({
|
|
|
448
552
|
}
|
|
449
553
|
}
|
|
450
554
|
return Promise.resolve()
|
|
451
|
-
}
|
|
555
|
+
},
|
|
556
|
+
pageChangeEvent (params: VxePagerDefines.PageChangeEventParams) {
|
|
557
|
+
const $xeGantt = this
|
|
558
|
+
const props = $xeGantt
|
|
559
|
+
const reactData = $xeGantt.reactData
|
|
452
560
|
|
|
453
|
-
const pageChangeEvent: VxePagerEvents.PageChange = (params) => {
|
|
454
561
|
const { proxyConfig } = props
|
|
455
562
|
const { tablePage } = reactData
|
|
456
563
|
const { $event, currentPage, pageSize } = params
|
|
457
|
-
const proxyOpts = computeProxyOpts
|
|
564
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
458
565
|
tablePage.currentPage = currentPage
|
|
459
566
|
tablePage.pageSize = pageSize
|
|
460
567
|
$xeGantt.dispatchEvent('page-change', params, $event)
|
|
@@ -463,17 +570,16 @@ export default defineVxeComponent({
|
|
|
463
570
|
$xeGantt.dispatchEvent('proxy-query', rest, $event)
|
|
464
571
|
})
|
|
465
572
|
}
|
|
466
|
-
}
|
|
573
|
+
},
|
|
574
|
+
handleSortEvent (params: VxeTableDefines.SortChangeEventParams) {
|
|
575
|
+
const $xeGantt = this
|
|
576
|
+
const props = $xeGantt
|
|
577
|
+
const reactData = $xeGantt.reactData
|
|
578
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
467
579
|
|
|
468
|
-
const handleSortEvent: VxeTableEvents.SortChange | VxeTableEvents.ClearAllSort = (params) => {
|
|
469
|
-
const $xeTable = refTable.value
|
|
470
580
|
const { proxyConfig } = props
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
const { computeSortOpts } = $xeTable.getComputeMaps()
|
|
475
|
-
const proxyOpts = computeProxyOpts.value
|
|
476
|
-
const sortOpts = computeSortOpts.value
|
|
581
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
582
|
+
const sortOpts = $xeTable.computeSortOpts
|
|
477
583
|
// 如果是服务端排序
|
|
478
584
|
if (sortOpts.remote) {
|
|
479
585
|
reactData.sortData = params.sortList
|
|
@@ -484,27 +590,28 @@ export default defineVxeComponent({
|
|
|
484
590
|
})
|
|
485
591
|
}
|
|
486
592
|
}
|
|
487
|
-
}
|
|
593
|
+
},
|
|
594
|
+
sortChangeEvent (params: VxeTableDefines.SortChangeEventParams) {
|
|
595
|
+
const $xeGantt = this
|
|
488
596
|
|
|
489
|
-
|
|
490
|
-
handleSortEvent(params)
|
|
597
|
+
$xeGantt.handleSortEvent(params)
|
|
491
598
|
$xeGantt.dispatchEvent('sort-change', params, params.$event)
|
|
492
|
-
}
|
|
599
|
+
},
|
|
600
|
+
clearAllSortEvent (params: VxeTableDefines.SortChangeEventParams) {
|
|
601
|
+
const $xeGantt = this
|
|
493
602
|
|
|
494
|
-
|
|
495
|
-
handleSortEvent(params)
|
|
603
|
+
$xeGantt.handleSortEvent(params)
|
|
496
604
|
$xeGantt.dispatchEvent('clear-all-sort', params, params.$event)
|
|
497
|
-
}
|
|
605
|
+
},
|
|
606
|
+
handleFilterEvent (params: VxeTableDefines.ClearAllFilterEventParams) {
|
|
607
|
+
const $xeGantt = this
|
|
608
|
+
const props = $xeGantt
|
|
609
|
+
const reactData = $xeGantt.reactData
|
|
610
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
498
611
|
|
|
499
|
-
const handleFilterEvent: VxeTableEvents.FilterChange | VxeTableEvents.ClearAllFilter = (params) => {
|
|
500
|
-
const $xeTable = refTable.value
|
|
501
612
|
const { proxyConfig } = props
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
const { computeFilterOpts } = $xeTable.getComputeMaps()
|
|
506
|
-
const proxyOpts = computeProxyOpts.value
|
|
507
|
-
const filterOpts = computeFilterOpts.value
|
|
613
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
614
|
+
const filterOpts = $xeTable.computeFilterOpts
|
|
508
615
|
// 如果是服务端过滤
|
|
509
616
|
if (filterOpts.remote) {
|
|
510
617
|
reactData.filterData = params.filterList
|
|
@@ -515,21 +622,26 @@ export default defineVxeComponent({
|
|
|
515
622
|
})
|
|
516
623
|
}
|
|
517
624
|
}
|
|
518
|
-
}
|
|
625
|
+
},
|
|
626
|
+
filterChangeEvent (params: VxeTableDefines.ClearAllFilterEventParams) {
|
|
627
|
+
const $xeGantt = this
|
|
519
628
|
|
|
520
|
-
|
|
521
|
-
handleFilterEvent(params)
|
|
629
|
+
$xeGantt.handleFilterEvent(params)
|
|
522
630
|
$xeGantt.dispatchEvent('filter-change', params, params.$event)
|
|
523
|
-
}
|
|
631
|
+
},
|
|
632
|
+
clearAllFilterEvent (params: VxeTableDefines.ClearAllFilterEventParams) {
|
|
633
|
+
const $xeGantt = this
|
|
524
634
|
|
|
525
|
-
|
|
526
|
-
handleFilterEvent(params)
|
|
635
|
+
$xeGantt.handleFilterEvent(params)
|
|
527
636
|
$xeGantt.dispatchEvent('clear-all-filter', params, params.$event)
|
|
528
|
-
}
|
|
637
|
+
},
|
|
638
|
+
submitFormEvent (params: VxeFormDefines.SubmitEventParams) {
|
|
639
|
+
const $xeGantt = this
|
|
640
|
+
const props = $xeGantt
|
|
641
|
+
const reactData = $xeGantt.reactData
|
|
529
642
|
|
|
530
|
-
const submitFormEvent: VxeFormEvents.Submit = (params) => {
|
|
531
643
|
const { proxyConfig } = props
|
|
532
|
-
const proxyOpts = computeProxyOpts
|
|
644
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
533
645
|
if (reactData.tableLoading) {
|
|
534
646
|
return
|
|
535
647
|
}
|
|
@@ -539,35 +651,39 @@ export default defineVxeComponent({
|
|
|
539
651
|
})
|
|
540
652
|
}
|
|
541
653
|
$xeGantt.dispatchEvent('form-submit', params, params.$event)
|
|
542
|
-
}
|
|
654
|
+
},
|
|
655
|
+
resetFormEvent (params: VxeFormDefines.ResetEventParams) {
|
|
656
|
+
const $xeGantt = this
|
|
657
|
+
const props = $xeGantt
|
|
543
658
|
|
|
544
|
-
|
|
545
|
-
const $xeTable = refTable.value
|
|
659
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
546
660
|
const { proxyConfig } = props
|
|
547
661
|
const { $event } = params
|
|
548
|
-
const proxyOpts = computeProxyOpts
|
|
662
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
549
663
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
550
|
-
|
|
551
|
-
$xeTable.clearScroll()
|
|
552
|
-
}
|
|
664
|
+
$xeTable.clearScroll()
|
|
553
665
|
$xeGantt.commitProxy('reload').then((rest) => {
|
|
554
666
|
$xeGantt.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
|
|
555
667
|
})
|
|
556
668
|
}
|
|
557
669
|
$xeGantt.dispatchEvent('form-reset', params, $event)
|
|
558
|
-
}
|
|
670
|
+
},
|
|
671
|
+
submitInvalidEvent (params: VxeFormDefines.SubmitInvalidEventParams) {
|
|
672
|
+
const $xeGantt = this
|
|
559
673
|
|
|
560
|
-
const submitInvalidEvent: VxeFormEvents.SubmitInvalid = (params) => {
|
|
561
674
|
$xeGantt.dispatchEvent('form-submit-invalid', params, params.$event)
|
|
562
|
-
}
|
|
675
|
+
},
|
|
676
|
+
collapseEvent (params: VxeFormDefines.CollapseEventParams) {
|
|
677
|
+
const $xeGantt = this
|
|
563
678
|
|
|
564
|
-
const collapseEvent: VxeFormEvents.Collapse = (params) => {
|
|
565
679
|
const { $event } = params
|
|
566
680
|
$xeGantt.dispatchEvent('form-toggle-collapse', params, $event)
|
|
567
681
|
$xeGantt.dispatchEvent('form-collapse', params, $event)
|
|
568
|
-
}
|
|
682
|
+
},
|
|
683
|
+
handleZoom (isMax?: boolean) {
|
|
684
|
+
const $xeGantt = this
|
|
685
|
+
const reactData = $xeGantt.reactData
|
|
569
686
|
|
|
570
|
-
const handleZoom = (isMax?: boolean) => {
|
|
571
687
|
const { isZMax } = reactData
|
|
572
688
|
if (isMax ? !isZMax : isZMax) {
|
|
573
689
|
reactData.isZMax = !isZMax
|
|
@@ -575,66 +691,33 @@ export default defineVxeComponent({
|
|
|
575
691
|
reactData.tZindex = nextZIndex()
|
|
576
692
|
}
|
|
577
693
|
}
|
|
578
|
-
return nextTick()
|
|
694
|
+
return $xeGantt.$nextTick()
|
|
579
695
|
.then(() => $xeGantt.recalculate(true))
|
|
580
696
|
.then(() => {
|
|
581
697
|
setTimeout(() => $xeGantt.recalculate(true), 15)
|
|
582
698
|
return reactData.isZMax
|
|
583
699
|
})
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
const funcSlot = optSlots[slotKey]
|
|
588
|
-
if (funcSlot) {
|
|
589
|
-
if (XEUtils.isString(funcSlot)) {
|
|
590
|
-
if (slots[funcSlot]) {
|
|
591
|
-
return slots[funcSlot]
|
|
592
|
-
} else {
|
|
593
|
-
errLog('vxe.error.notSlot', [funcSlot])
|
|
594
|
-
}
|
|
595
|
-
} else {
|
|
596
|
-
return funcSlot
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
return null
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
const getConfigSlot = (slotConfigs?: Record<string, any>) => {
|
|
603
|
-
const slotConf: Record<string, any> = {}
|
|
604
|
-
XEUtils.objectMap(slotConfigs, (slotFunc, slotKey) => {
|
|
605
|
-
if (slotFunc) {
|
|
606
|
-
if (XEUtils.isString(slotFunc)) {
|
|
607
|
-
if (slots[slotFunc]) {
|
|
608
|
-
slotConf[slotKey] = slots[slotFunc]
|
|
609
|
-
} else {
|
|
610
|
-
errLog('vxe.error.notSlot', [slotFunc])
|
|
611
|
-
}
|
|
612
|
-
} else {
|
|
613
|
-
slotConf[slotKey] = slotFunc
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
})
|
|
617
|
-
return slotConf
|
|
618
|
-
}
|
|
700
|
+
},
|
|
701
|
+
dragSplitEvent (evnt: MouseEvent) {
|
|
702
|
+
const $xeGantt = this
|
|
619
703
|
|
|
620
|
-
|
|
621
|
-
const el = refElem.value
|
|
704
|
+
const el = $xeGantt.$refs.refElem as HTMLDivElement
|
|
622
705
|
if (!el) {
|
|
623
706
|
return
|
|
624
707
|
}
|
|
625
|
-
const ganttContainerEl = refGanttContainer
|
|
708
|
+
const ganttContainerEl = $xeGantt.$refs.refGanttContainer as HTMLDivElement
|
|
626
709
|
if (!ganttContainerEl) {
|
|
627
710
|
return
|
|
628
711
|
}
|
|
629
|
-
const tableWrapperEl = refTableWrapper
|
|
712
|
+
const tableWrapperEl = $xeGantt.$refs.refTableWrapper as HTMLDivElement
|
|
630
713
|
if (!tableWrapperEl) {
|
|
631
714
|
return
|
|
632
715
|
}
|
|
633
|
-
const rsSplitLineEl = refResizableSplitTip
|
|
716
|
+
const rsSplitLineEl = $xeGantt.$refs.refResizableSplitTip as HTMLDivElement
|
|
634
717
|
if (!rsSplitLineEl) {
|
|
635
718
|
return
|
|
636
719
|
}
|
|
637
|
-
const taskViewOpts = computeTaskViewOpts
|
|
720
|
+
const taskViewOpts = $xeGantt.computeTaskViewOpts
|
|
638
721
|
const containerRect = ganttContainerEl.getBoundingClientRect()
|
|
639
722
|
const rsSplitTipEl = rsSplitLineEl.children[0] as HTMLDivElement
|
|
640
723
|
const disX = evnt.clientX
|
|
@@ -684,31 +767,30 @@ export default defineVxeComponent({
|
|
|
684
767
|
rsSplitLineEl.style.display = ''
|
|
685
768
|
tableWrapperEl.style.width = `${targetTableWidth}px`
|
|
686
769
|
removeClass(el, 'is--split-drag')
|
|
687
|
-
const $xeTable = refTable
|
|
770
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
688
771
|
if ($xeTable) {
|
|
689
772
|
$xeTable.recalculate(true)
|
|
690
773
|
}
|
|
691
774
|
}
|
|
692
775
|
rsSplitLineEl.style.display = 'block'
|
|
693
776
|
handleReStyle(evnt)
|
|
694
|
-
}
|
|
777
|
+
},
|
|
778
|
+
handleSplitLeftViewEvent () {
|
|
779
|
+
const $xeGantt = this
|
|
780
|
+
const reactData = $xeGantt.reactData
|
|
695
781
|
|
|
696
|
-
const handleSplitLeftViewEvent = () => {
|
|
697
782
|
reactData.showLeftView = !reactData.showLeftView
|
|
698
|
-
}
|
|
783
|
+
},
|
|
784
|
+
handleSplitRightViewEvent () {
|
|
785
|
+
const $xeGantt = this
|
|
786
|
+
const reactData = $xeGantt.reactData
|
|
699
787
|
|
|
700
|
-
const handleSplitRightViewEvent = () => {
|
|
701
788
|
reactData.showRightView = !reactData.showRightView
|
|
702
|
-
}
|
|
789
|
+
},
|
|
790
|
+
getDefaultFormData () {
|
|
791
|
+
const $xeGantt = this
|
|
703
792
|
|
|
704
|
-
|
|
705
|
-
tableEmits.forEach(name => {
|
|
706
|
-
const type = XEUtils.camelCase(`on-${name}`) as keyof VxeTableEventProps
|
|
707
|
-
tableCompEvents[type] = (...args: any[]) => emit(name, ...args)
|
|
708
|
-
})
|
|
709
|
-
|
|
710
|
-
const getDefaultFormData = () => {
|
|
711
|
-
const formOpts = computeFormOpts.value
|
|
793
|
+
const formOpts = $xeGantt.computeFormOpts
|
|
712
794
|
if (formOpts.items) {
|
|
713
795
|
const fData: any = {}
|
|
714
796
|
formOpts.items.forEach(item => {
|
|
@@ -729,772 +811,938 @@ export default defineVxeComponent({
|
|
|
729
811
|
return fData
|
|
730
812
|
}
|
|
731
813
|
return {}
|
|
732
|
-
}
|
|
814
|
+
},
|
|
815
|
+
initProxy () {
|
|
816
|
+
const $xeGantt = this
|
|
817
|
+
const props = $xeGantt
|
|
818
|
+
const reactData = $xeGantt.reactData
|
|
733
819
|
|
|
734
|
-
const initProxy = () => {
|
|
735
820
|
const { proxyConfig, formConfig } = props
|
|
736
821
|
const { proxyInited } = reactData
|
|
737
|
-
const proxyOpts = computeProxyOpts
|
|
738
|
-
const formOpts = computeFormOpts
|
|
739
|
-
if (proxyConfig
|
|
740
|
-
if (
|
|
741
|
-
reactData.formData = getDefaultFormData()
|
|
822
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
823
|
+
const formOpts = $xeGantt.computeFormOpts
|
|
824
|
+
if (proxyConfig) {
|
|
825
|
+
if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
|
|
826
|
+
reactData.formData = $xeGantt.getDefaultFormData()
|
|
742
827
|
}
|
|
743
|
-
if (!proxyInited) {
|
|
828
|
+
if (!proxyInited && proxyOpts.autoLoad !== false) {
|
|
744
829
|
reactData.proxyInited = true
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
})
|
|
749
|
-
}
|
|
830
|
+
$xeGantt.$nextTick().then(() => $xeGantt.commitProxy('initial')).then((rest) => {
|
|
831
|
+
$xeGantt.dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('initial'))
|
|
832
|
+
})
|
|
750
833
|
}
|
|
751
834
|
}
|
|
752
|
-
}
|
|
835
|
+
},
|
|
836
|
+
handleGlobalKeydownEvent (evnt: KeyboardEvent) {
|
|
837
|
+
const $xeGantt = this
|
|
838
|
+
const reactData = $xeGantt.reactData
|
|
753
839
|
|
|
754
|
-
|
|
755
|
-
const zoomOpts = computeZoomOpts.value
|
|
840
|
+
const zoomOpts = $xeGantt.computeZoomOpts
|
|
756
841
|
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
757
842
|
if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
|
|
758
843
|
$xeGantt.triggerZoomEvent(evnt)
|
|
759
844
|
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
emit(type, createEvent(evnt, { $grid: null, $gantt: $xeGantt }, params))
|
|
764
|
-
}
|
|
845
|
+
},
|
|
846
|
+
getEl () {
|
|
847
|
+
const $xeGantt = this
|
|
765
848
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return refElem.value as HTMLDivElement
|
|
770
|
-
},
|
|
771
|
-
/**
|
|
849
|
+
return $xeGantt.$refs.refElem as HTMLDivElement
|
|
850
|
+
},
|
|
851
|
+
/**
|
|
772
852
|
* 提交指令,支持 code 或 button
|
|
773
853
|
* @param {String/Object} code 字符串或对象
|
|
774
854
|
*/
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
}
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
855
|
+
commitProxy (proxyTarget: string | VxeToolbarPropTypes.ButtonConfig, ...args: any[]): Promise<any> {
|
|
856
|
+
const $xeGantt = this
|
|
857
|
+
const props = $xeGantt
|
|
858
|
+
const reactData = $xeGantt.reactData
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* 已废弃
|
|
862
|
+
* @deprecated
|
|
863
|
+
*/
|
|
864
|
+
const toolbar = (props as any).toolbar
|
|
865
|
+
|
|
866
|
+
const { proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props
|
|
867
|
+
const { tablePage } = reactData
|
|
868
|
+
const isActiveMsg = $xeGantt.computeIsActiveMsg
|
|
869
|
+
const isRespMsg = $xeGantt.computeIsRespMsg
|
|
870
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
871
|
+
const pagerOpts = $xeGantt.computePagerOpts
|
|
872
|
+
const toolbarOpts = $xeGantt.computeToolbarOpts
|
|
873
|
+
const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
|
|
874
|
+
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
875
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
876
|
+
let formData = $xeGantt.getFormData()
|
|
877
|
+
let button: VxeToolbarPropTypes.ButtonConfig | null = null
|
|
878
|
+
let code: string | null = null
|
|
879
|
+
if (XEUtils.isString(proxyTarget)) {
|
|
880
|
+
const { buttons } = toolbarOpts
|
|
881
|
+
const matchObj = (toolbarConfig || toolbar) && isEnableConf(toolbarOpts) && buttons ? XEUtils.findTree(buttons, (item) => item.code === proxyTarget, { children: 'dropdowns' }) : null
|
|
882
|
+
button = matchObj ? matchObj.item as any : null
|
|
883
|
+
code = proxyTarget
|
|
884
|
+
} else {
|
|
885
|
+
button = proxyTarget
|
|
886
|
+
code = button.code as string
|
|
887
|
+
}
|
|
888
|
+
const btnParams = button ? button.params : null
|
|
889
|
+
switch (code) {
|
|
890
|
+
case 'insert':
|
|
891
|
+
return $xeTable.insert({})
|
|
892
|
+
case 'insert_edit':
|
|
893
|
+
return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row, true))
|
|
894
|
+
|
|
895
|
+
// 已废弃
|
|
896
|
+
case 'insert_actived':
|
|
897
|
+
return $xeTable.insert({}).then(({ row }) => $xeTable.setEditRow(row, true))
|
|
898
|
+
// 已废弃
|
|
899
|
+
|
|
900
|
+
case 'mark_cancel':
|
|
901
|
+
$xeGantt.triggerPendingEvent(code)
|
|
902
|
+
break
|
|
903
|
+
case 'remove':
|
|
904
|
+
return $xeGantt.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => $xeTable.removeCheckboxRow())
|
|
905
|
+
case 'import':
|
|
906
|
+
$xeTable.importData(btnParams)
|
|
907
|
+
break
|
|
908
|
+
case 'open_import':
|
|
909
|
+
$xeTable.openImport(btnParams)
|
|
910
|
+
break
|
|
911
|
+
case 'export':
|
|
912
|
+
$xeTable.exportData(btnParams)
|
|
913
|
+
break
|
|
914
|
+
case 'open_export':
|
|
915
|
+
$xeTable.openExport(btnParams)
|
|
916
|
+
break
|
|
917
|
+
case 'reset_custom':
|
|
918
|
+
$xeTable.resetCustom(true)
|
|
919
|
+
break
|
|
920
|
+
case 'initial':
|
|
921
|
+
case 'reload':
|
|
922
|
+
case 'query': {
|
|
923
|
+
const ajaxMethods = ajax.query
|
|
924
|
+
const querySuccessMethods = ajax.querySuccess
|
|
925
|
+
const queryErrorMethods = ajax.queryError
|
|
926
|
+
if (ajaxMethods) {
|
|
927
|
+
const isInited = code === 'initial'
|
|
928
|
+
const isReload = code === 'reload'
|
|
929
|
+
if (!isInited && reactData.tableLoading) {
|
|
930
|
+
return $xeGantt.$nextTick()
|
|
931
|
+
}
|
|
932
|
+
let sortList: any[] = []
|
|
933
|
+
let filterList: VxeTableDefines.FilterCheckedParams[] = []
|
|
934
|
+
let pageParams: any = {}
|
|
935
|
+
if (pagerConfig) {
|
|
936
|
+
if (isInited || isReload) {
|
|
937
|
+
tablePage.currentPage = 1
|
|
843
938
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
let pageParams: any = {}
|
|
847
|
-
if (pagerConfig) {
|
|
848
|
-
if (isInited || isReload) {
|
|
849
|
-
// 重置分页
|
|
850
|
-
tablePage.currentPage = 1
|
|
851
|
-
}
|
|
852
|
-
if (isEnableConf(pagerOpts)) {
|
|
853
|
-
pageParams = { ...tablePage }
|
|
854
|
-
}
|
|
939
|
+
if (isEnableConf(pagerConfig)) {
|
|
940
|
+
pageParams = { ...tablePage }
|
|
855
941
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
sortList = defaultSort.map((item) => {
|
|
877
|
-
const { field, order } = item
|
|
878
|
-
const colRest = fullColumnFieldData[field]
|
|
879
|
-
if (colRest) {
|
|
880
|
-
const column = colRest.column
|
|
881
|
-
if (column) {
|
|
882
|
-
column.order = order
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
return {
|
|
886
|
-
field,
|
|
887
|
-
property: field,
|
|
888
|
-
order
|
|
889
|
-
}
|
|
890
|
-
})
|
|
942
|
+
}
|
|
943
|
+
if (isInited) {
|
|
944
|
+
// 重置代理表单数据
|
|
945
|
+
if (proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form) {
|
|
946
|
+
formData = $xeGantt.getDefaultFormData()
|
|
947
|
+
reactData.formData = formData
|
|
948
|
+
}
|
|
949
|
+
if ($xeTable) {
|
|
950
|
+
const tableInternalData = $xeTable as unknown as TableInternalData
|
|
951
|
+
const { tableFullColumn, fullColumnFieldData } = tableInternalData
|
|
952
|
+
const sortOpts = $xeTable.computeSortOpts
|
|
953
|
+
let defaultSort = sortOpts.defaultSort
|
|
954
|
+
tableFullColumn.forEach((column) => {
|
|
955
|
+
column.order = null
|
|
956
|
+
})
|
|
957
|
+
// 如果使用默认排序
|
|
958
|
+
if (defaultSort) {
|
|
959
|
+
if (!XEUtils.isArray(defaultSort)) {
|
|
960
|
+
defaultSort = [defaultSort]
|
|
891
961
|
}
|
|
962
|
+
sortList = defaultSort.map((item) => {
|
|
963
|
+
const { field, order } = item
|
|
964
|
+
const colRest = fullColumnFieldData[field]
|
|
965
|
+
if (colRest) {
|
|
966
|
+
const column = colRest.column
|
|
967
|
+
if (column) {
|
|
968
|
+
column.order = order
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return {
|
|
972
|
+
field,
|
|
973
|
+
property: field,
|
|
974
|
+
order
|
|
975
|
+
}
|
|
976
|
+
})
|
|
977
|
+
}
|
|
978
|
+
filterList = $xeTable.getCheckedFilters()
|
|
979
|
+
}
|
|
980
|
+
} else {
|
|
981
|
+
if ($xeTable) {
|
|
982
|
+
if (isReload) {
|
|
983
|
+
$xeTable.clearAll()
|
|
984
|
+
} else {
|
|
985
|
+
sortList = $xeTable.getSortColumns()
|
|
892
986
|
filterList = $xeTable.getCheckedFilters()
|
|
893
987
|
}
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
const commitParams = {
|
|
991
|
+
$table: $xeTable,
|
|
992
|
+
$grid: null,
|
|
993
|
+
$gantt: $xeGantt,
|
|
994
|
+
code,
|
|
995
|
+
button,
|
|
996
|
+
isInited,
|
|
997
|
+
isReload,
|
|
998
|
+
page: pageParams,
|
|
999
|
+
sort: sortList.length ? sortList[0] : {},
|
|
1000
|
+
sorts: sortList,
|
|
1001
|
+
filters: filterList,
|
|
1002
|
+
form: formData,
|
|
1003
|
+
options: ajaxMethods
|
|
1004
|
+
}
|
|
1005
|
+
reactData.sortData = sortList
|
|
1006
|
+
reactData.filterData = filterList
|
|
1007
|
+
reactData.tableLoading = true
|
|
1008
|
+
const applyArgs = [commitParams].concat(args)
|
|
1009
|
+
return Promise.resolve((beforeQuery || ajaxMethods)(...applyArgs))
|
|
1010
|
+
.then(rest => {
|
|
1011
|
+
let tableData: any[] = []
|
|
1012
|
+
reactData.tableLoading = false
|
|
1013
|
+
if (rest) {
|
|
1014
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1015
|
+
const totalProp = resConfigs.total
|
|
1016
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
1017
|
+
tablePage.total = XEUtils.toNumber(total)
|
|
1018
|
+
const resultProp = resConfigs.result
|
|
1019
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt }) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
1020
|
+
// 检验当前页码,不能超出当前最大页数
|
|
1021
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
|
|
1022
|
+
if (tablePage.currentPage > pageCount) {
|
|
1023
|
+
tablePage.currentPage = pageCount
|
|
1024
|
+
}
|
|
898
1025
|
} else {
|
|
899
|
-
|
|
900
|
-
|
|
1026
|
+
const listProp = resConfigs.list
|
|
1027
|
+
tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt }) : XEUtils.get(rest, listProp)) : rest) || []
|
|
901
1028
|
}
|
|
902
1029
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1030
|
+
if ($xeTable as any) {
|
|
1031
|
+
$xeTable.loadData(tableData)
|
|
1032
|
+
} else {
|
|
1033
|
+
$xeTable.$nextTick(() => {
|
|
1034
|
+
if ($xeTable) {
|
|
1035
|
+
$xeTable.loadData(tableData)
|
|
1036
|
+
}
|
|
1037
|
+
})
|
|
1038
|
+
}
|
|
1039
|
+
if (afterQuery) {
|
|
1040
|
+
afterQuery(...applyArgs)
|
|
1041
|
+
}
|
|
1042
|
+
if (querySuccessMethods) {
|
|
1043
|
+
querySuccessMethods({ ...commitParams, response: rest })
|
|
1044
|
+
}
|
|
1045
|
+
return { status: true }
|
|
1046
|
+
}).catch((rest) => {
|
|
1047
|
+
reactData.tableLoading = false
|
|
1048
|
+
if (queryErrorMethods) {
|
|
1049
|
+
queryErrorMethods({ ...commitParams, response: rest })
|
|
1050
|
+
}
|
|
1051
|
+
return { status: false }
|
|
1052
|
+
})
|
|
1053
|
+
} else {
|
|
1054
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.query'])
|
|
1055
|
+
}
|
|
1056
|
+
break
|
|
1057
|
+
}
|
|
1058
|
+
case 'delete': {
|
|
1059
|
+
const ajaxMethods = ajax.delete
|
|
1060
|
+
const deleteSuccessMethods = ajax.deleteSuccess
|
|
1061
|
+
const deleteErrorMethods = ajax.deleteError
|
|
1062
|
+
if (ajaxMethods) {
|
|
1063
|
+
const selectRecords = $xeTable.getCheckboxRecords()
|
|
1064
|
+
const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row))
|
|
1065
|
+
const body = { removeRecords }
|
|
1066
|
+
const commitParams = {
|
|
1067
|
+
$table: $xeTable,
|
|
1068
|
+
$grid: null,
|
|
1069
|
+
$gantt: $xeGantt,
|
|
1070
|
+
code,
|
|
1071
|
+
button,
|
|
1072
|
+
body,
|
|
1073
|
+
form: formData,
|
|
1074
|
+
options: ajaxMethods
|
|
1075
|
+
}
|
|
1076
|
+
const applyArgs = [commitParams].concat(args)
|
|
1077
|
+
if (selectRecords.length) {
|
|
1078
|
+
return $xeGantt.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1079
|
+
if (!removeRecords.length) {
|
|
1080
|
+
return $xeTable.remove(selectRecords)
|
|
1081
|
+
}
|
|
1082
|
+
reactData.tableLoading = true
|
|
1083
|
+
return Promise.resolve((beforeDelete || ajaxMethods)(...applyArgs))
|
|
1084
|
+
.then(rest => {
|
|
1085
|
+
reactData.tableLoading = false
|
|
1086
|
+
$xeTable.setPendingRow(removeRecords, false)
|
|
1087
|
+
if (isRespMsg) {
|
|
1088
|
+
// 检测弹窗模块
|
|
1089
|
+
if (!VxeUI.modal) {
|
|
1090
|
+
errLog('vxe.error.reqModule', ['Modal'])
|
|
937
1091
|
}
|
|
1092
|
+
VxeUI.modal.message({ content: $xeGantt.getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' })
|
|
1093
|
+
}
|
|
1094
|
+
if (afterDelete) {
|
|
1095
|
+
afterDelete(...applyArgs)
|
|
938
1096
|
} else {
|
|
939
|
-
|
|
940
|
-
tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt }) : XEUtils.get(rest, listProp)) : rest) || []
|
|
1097
|
+
$xeGantt.commitProxy('query')
|
|
941
1098
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1099
|
+
if (deleteSuccessMethods) {
|
|
1100
|
+
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
1101
|
+
}
|
|
1102
|
+
return { status: true }
|
|
1103
|
+
})
|
|
1104
|
+
.catch(rest => {
|
|
1105
|
+
reactData.tableLoading = false
|
|
1106
|
+
if (isRespMsg) {
|
|
1107
|
+
// 检测弹窗模块
|
|
1108
|
+
if (!VxeUI.modal) {
|
|
1109
|
+
errLog('vxe.error.reqModule', ['Modal'])
|
|
949
1110
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return { status: true }
|
|
959
|
-
}).catch((rest) => {
|
|
960
|
-
reactData.tableLoading = false
|
|
961
|
-
if (queryErrorMethods) {
|
|
962
|
-
queryErrorMethods({ ...commitParams, response: rest })
|
|
963
|
-
}
|
|
964
|
-
return { status: false }
|
|
965
|
-
})
|
|
1111
|
+
VxeUI.modal.message({ id: code, content: $xeGantt.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1112
|
+
}
|
|
1113
|
+
if (deleteErrorMethods) {
|
|
1114
|
+
deleteErrorMethods({ ...commitParams, response: rest })
|
|
1115
|
+
}
|
|
1116
|
+
return { status: false }
|
|
1117
|
+
})
|
|
1118
|
+
})
|
|
966
1119
|
} else {
|
|
967
|
-
|
|
1120
|
+
if (isActiveMsg) {
|
|
1121
|
+
// 检测弹窗模块
|
|
1122
|
+
if (!VxeUI.modal) {
|
|
1123
|
+
errLog('vxe.error.reqModule', ['Modal'])
|
|
1124
|
+
}
|
|
1125
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' })
|
|
1126
|
+
}
|
|
968
1127
|
}
|
|
969
|
-
|
|
1128
|
+
} else {
|
|
1129
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.delete'])
|
|
970
1130
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1131
|
+
break
|
|
1132
|
+
}
|
|
1133
|
+
case 'save': {
|
|
1134
|
+
const ajaxMethods = ajax.save
|
|
1135
|
+
const saveSuccessMethods = ajax.saveSuccess
|
|
1136
|
+
const saveErrorMethods = ajax.saveError
|
|
1137
|
+
if (ajaxMethods) {
|
|
1138
|
+
const body = $xeGantt.getRecordset()
|
|
1139
|
+
const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
|
|
1140
|
+
const commitParams = {
|
|
1141
|
+
$table: $xeTable,
|
|
1142
|
+
$grid: null,
|
|
1143
|
+
$gantt: $xeGantt,
|
|
1144
|
+
code,
|
|
1145
|
+
button,
|
|
1146
|
+
body,
|
|
1147
|
+
form: formData,
|
|
1148
|
+
options: ajaxMethods
|
|
1149
|
+
}
|
|
1150
|
+
const applyArgs = [commitParams].concat(args)
|
|
1151
|
+
// 排除掉新增且标记为删除的数据
|
|
1152
|
+
if (insertRecords.length) {
|
|
1153
|
+
body.pendingRecords = pendingRecords.filter((row) => insertRecords.indexOf(row) === -1)
|
|
1154
|
+
}
|
|
1155
|
+
// 排除已标记为删除的数据
|
|
1156
|
+
if (pendingRecords.length) {
|
|
1157
|
+
body.insertRecords = insertRecords.filter((row) => pendingRecords.indexOf(row) === -1)
|
|
1158
|
+
}
|
|
1159
|
+
let restPromise: Promise<any> = Promise.resolve()
|
|
1160
|
+
if (editRules) {
|
|
1161
|
+
// 只校验新增和修改的数据
|
|
1162
|
+
restPromise = $xeGantt[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords))
|
|
1163
|
+
}
|
|
1164
|
+
return restPromise.then((errMap: any) => {
|
|
1165
|
+
if (errMap) {
|
|
1166
|
+
// 如果校验不通过
|
|
1167
|
+
return
|
|
988
1168
|
}
|
|
989
|
-
if (
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
if (isRespMsg) {
|
|
1000
|
-
if (VxeUI.modal) {
|
|
1001
|
-
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' })
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
if (afterDelete) {
|
|
1005
|
-
afterDelete(commitParams, ...args)
|
|
1006
|
-
} else {
|
|
1007
|
-
$xeGantt.commitProxy('query')
|
|
1008
|
-
}
|
|
1009
|
-
if (deleteSuccessMethods) {
|
|
1010
|
-
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
1011
|
-
}
|
|
1012
|
-
return { status: true }
|
|
1013
|
-
})
|
|
1014
|
-
.catch(rest => {
|
|
1015
|
-
reactData.tableLoading = false
|
|
1016
|
-
if (isRespMsg) {
|
|
1017
|
-
if (VxeUI.modal) {
|
|
1018
|
-
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1019
|
-
}
|
|
1169
|
+
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1170
|
+
reactData.tableLoading = true
|
|
1171
|
+
return Promise.resolve((beforeSave || ajaxMethods)(...applyArgs))
|
|
1172
|
+
.then(rest => {
|
|
1173
|
+
reactData.tableLoading = false
|
|
1174
|
+
$xeTable.clearPendingRow()
|
|
1175
|
+
if (isRespMsg) {
|
|
1176
|
+
// 检测弹窗模块
|
|
1177
|
+
if (!VxeUI.modal) {
|
|
1178
|
+
errLog('vxe.error.reqModule', ['Modal'])
|
|
1020
1179
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1180
|
+
VxeUI.modal.message({ content: $xeGantt.getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' })
|
|
1181
|
+
}
|
|
1182
|
+
if (afterSave) {
|
|
1183
|
+
afterSave(...applyArgs)
|
|
1184
|
+
} else {
|
|
1185
|
+
$xeGantt.commitProxy('query')
|
|
1186
|
+
}
|
|
1187
|
+
if (saveSuccessMethods) {
|
|
1188
|
+
saveSuccessMethods({ ...commitParams, response: rest })
|
|
1189
|
+
}
|
|
1190
|
+
return { status: true }
|
|
1191
|
+
})
|
|
1192
|
+
.catch(rest => {
|
|
1193
|
+
reactData.tableLoading = false
|
|
1194
|
+
if (isRespMsg) {
|
|
1195
|
+
// 检测弹窗模块
|
|
1196
|
+
if (!VxeUI.modal) {
|
|
1197
|
+
errLog('vxe.error.reqModule', ['Modal'])
|
|
1023
1198
|
}
|
|
1024
|
-
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1199
|
+
VxeUI.modal.message({ id: code, content: $xeGantt.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1200
|
+
}
|
|
1201
|
+
if (saveErrorMethods) {
|
|
1202
|
+
saveErrorMethods({ ...commitParams, response: rest })
|
|
1203
|
+
}
|
|
1204
|
+
return { status: false }
|
|
1205
|
+
})
|
|
1206
|
+
} else {
|
|
1207
|
+
if (isActiveMsg) {
|
|
1208
|
+
// 检测弹窗模块
|
|
1209
|
+
if (!VxeUI.modal) {
|
|
1210
|
+
errLog('vxe.error.reqModule', ['Modal'])
|
|
1031
1211
|
}
|
|
1212
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' })
|
|
1032
1213
|
}
|
|
1033
1214
|
}
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
break
|
|
1215
|
+
})
|
|
1216
|
+
} else {
|
|
1217
|
+
errLog('vxe.error.notFunc', ['proxy-config.ajax.save'])
|
|
1038
1218
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
$table: $xeTable,
|
|
1048
|
-
$grid: null,
|
|
1049
|
-
$gantt: $xeGantt,
|
|
1050
|
-
code,
|
|
1051
|
-
button,
|
|
1052
|
-
body,
|
|
1053
|
-
form: formData,
|
|
1054
|
-
options: ajaxMethods
|
|
1055
|
-
}
|
|
1056
|
-
// 排除掉新增且标记为删除的数据
|
|
1057
|
-
if (insertRecords.length) {
|
|
1058
|
-
body.pendingRecords = pendingRecords.filter((row) => $xeTable.findRowIndexOf(insertRecords, row) === -1)
|
|
1059
|
-
}
|
|
1060
|
-
// 排除已标记为删除的数据
|
|
1061
|
-
if (pendingRecords.length) {
|
|
1062
|
-
body.insertRecords = insertRecords.filter((row) => $xeTable.findRowIndexOf(pendingRecords, row) === -1)
|
|
1063
|
-
}
|
|
1064
|
-
let restPromise: Promise<any> = Promise.resolve()
|
|
1065
|
-
if (editRules) {
|
|
1066
|
-
// 只校验新增和修改的数据
|
|
1067
|
-
restPromise = $xeTable[validConfig && validConfig.msgMode === 'full' ? 'fullValidate' : 'validate'](body.insertRecords.concat(updateRecords))
|
|
1068
|
-
}
|
|
1069
|
-
return restPromise.then((errMap) => {
|
|
1070
|
-
if (errMap) {
|
|
1071
|
-
// 如果校验不通过
|
|
1072
|
-
return
|
|
1073
|
-
}
|
|
1074
|
-
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1075
|
-
reactData.tableLoading = true
|
|
1076
|
-
return Promise.resolve((beforeSave || ajaxMethods)(commitParams, ...args))
|
|
1077
|
-
.then(rest => {
|
|
1078
|
-
reactData.tableLoading = false
|
|
1079
|
-
$xeTable.clearPendingRow()
|
|
1080
|
-
if (isRespMsg) {
|
|
1081
|
-
if (VxeUI.modal) {
|
|
1082
|
-
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' })
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
if (afterSave) {
|
|
1086
|
-
afterSave(commitParams, ...args)
|
|
1087
|
-
} else {
|
|
1088
|
-
$xeGantt.commitProxy('query')
|
|
1089
|
-
}
|
|
1090
|
-
if (saveSuccessMethods) {
|
|
1091
|
-
saveSuccessMethods({ ...commitParams, response: rest })
|
|
1092
|
-
}
|
|
1093
|
-
return { status: true }
|
|
1094
|
-
})
|
|
1095
|
-
.catch(rest => {
|
|
1096
|
-
reactData.tableLoading = false
|
|
1097
|
-
if (isRespMsg) {
|
|
1098
|
-
if (VxeUI.modal) {
|
|
1099
|
-
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
if (saveErrorMethods) {
|
|
1103
|
-
saveErrorMethods({ ...commitParams, response: rest })
|
|
1104
|
-
}
|
|
1105
|
-
return { status: false }
|
|
1106
|
-
})
|
|
1107
|
-
} else {
|
|
1108
|
-
if (isActiveMsg) {
|
|
1109
|
-
if (VxeUI.modal) {
|
|
1110
|
-
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' })
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
})
|
|
1219
|
+
break
|
|
1220
|
+
}
|
|
1221
|
+
default: {
|
|
1222
|
+
const gCommandOpts = commands.get(code)
|
|
1223
|
+
if (gCommandOpts) {
|
|
1224
|
+
const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
|
|
1225
|
+
if (tCommandMethod) {
|
|
1226
|
+
tCommandMethod({ code, button, $grid: null, $table: $xeTable, $gantt: $xeGantt }, ...args)
|
|
1115
1227
|
} else {
|
|
1116
|
-
errLog('vxe.error.
|
|
1228
|
+
errLog('vxe.error.notCommands', [code])
|
|
1117
1229
|
}
|
|
1118
|
-
break
|
|
1119
1230
|
}
|
|
1120
|
-
default: {
|
|
1121
|
-
const gCommandOpts = commands.get(code)
|
|
1122
|
-
if (gCommandOpts) {
|
|
1123
|
-
const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
|
|
1124
|
-
if (tCommandMethod) {
|
|
1125
|
-
tCommandMethod({ code, button, $table: $xeTable, $grid: null, $gantt: $xeGantt }, ...args)
|
|
1126
|
-
} else {
|
|
1127
|
-
errLog('vxe.error.notCommands', [code])
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
return nextTick()
|
|
1133
|
-
},
|
|
1134
|
-
getParams () {
|
|
1135
|
-
return props.params
|
|
1136
|
-
},
|
|
1137
|
-
zoom () {
|
|
1138
|
-
if (reactData.isZMax) {
|
|
1139
|
-
return $xeGantt.revert()
|
|
1140
|
-
}
|
|
1141
|
-
return $xeGantt.maximize()
|
|
1142
|
-
},
|
|
1143
|
-
isMaximized () {
|
|
1144
|
-
return reactData.isZMax
|
|
1145
|
-
},
|
|
1146
|
-
maximize () {
|
|
1147
|
-
return handleZoom(true)
|
|
1148
|
-
},
|
|
1149
|
-
revert () {
|
|
1150
|
-
return handleZoom()
|
|
1151
|
-
},
|
|
1152
|
-
getFormData,
|
|
1153
|
-
getFormItems (itemIndex?: number): any {
|
|
1154
|
-
const formOpts = computeFormOpts.value
|
|
1155
|
-
const { formConfig } = props
|
|
1156
|
-
const { items } = formOpts
|
|
1157
|
-
const itemList: VxeFormItemProps[] = []
|
|
1158
|
-
XEUtils.eachTree(formConfig && isEnableConf(formOpts) && items ? items : [], item => {
|
|
1159
|
-
itemList.push(item)
|
|
1160
|
-
}, { children: 'children' })
|
|
1161
|
-
return XEUtils.isUndefined(itemIndex) ? itemList : itemList[itemIndex]
|
|
1162
|
-
},
|
|
1163
|
-
resetForm () {
|
|
1164
|
-
const $form = refForm.value
|
|
1165
|
-
if ($form) {
|
|
1166
|
-
return $form.reset()
|
|
1167
|
-
}
|
|
1168
|
-
return nextTick()
|
|
1169
|
-
},
|
|
1170
|
-
validateForm () {
|
|
1171
|
-
const $form = refForm.value
|
|
1172
|
-
if ($form) {
|
|
1173
|
-
return $form.validate()
|
|
1174
|
-
}
|
|
1175
|
-
return nextTick()
|
|
1176
|
-
},
|
|
1177
|
-
validateFormField (field) {
|
|
1178
|
-
const $form = refForm.value
|
|
1179
|
-
if ($form) {
|
|
1180
|
-
return $form.validateField(field)
|
|
1181
1231
|
}
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1232
|
+
}
|
|
1233
|
+
return $xeGantt.$nextTick()
|
|
1234
|
+
},
|
|
1235
|
+
getParams () {
|
|
1236
|
+
const $xeGantt = this
|
|
1237
|
+
const props = $xeGantt
|
|
1238
|
+
|
|
1239
|
+
return props.params
|
|
1240
|
+
},
|
|
1241
|
+
zoom () {
|
|
1242
|
+
const $xeGantt = this
|
|
1243
|
+
const reactData = $xeGantt.reactData
|
|
1244
|
+
|
|
1245
|
+
if (reactData.isZMax) {
|
|
1246
|
+
return $xeGantt.revert()
|
|
1247
|
+
}
|
|
1248
|
+
return $xeGantt.maximize()
|
|
1249
|
+
},
|
|
1250
|
+
isMaximized () {
|
|
1251
|
+
const $xeGantt = this
|
|
1252
|
+
const reactData = $xeGantt.reactData
|
|
1253
|
+
|
|
1254
|
+
return reactData.isZMax
|
|
1255
|
+
},
|
|
1256
|
+
maximize () {
|
|
1257
|
+
const $xeGantt = this
|
|
1258
|
+
|
|
1259
|
+
return $xeGantt.handleZoom(true)
|
|
1260
|
+
},
|
|
1261
|
+
revert () {
|
|
1262
|
+
const $xeGantt = this
|
|
1263
|
+
|
|
1264
|
+
return $xeGantt.handleZoom()
|
|
1265
|
+
},
|
|
1266
|
+
getFormData () {
|
|
1267
|
+
const $xeGantt = this
|
|
1268
|
+
const props = $xeGantt
|
|
1269
|
+
const reactData = $xeGantt.reactData
|
|
1270
|
+
|
|
1271
|
+
const { proxyConfig } = props
|
|
1272
|
+
const { formData } = reactData
|
|
1273
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
1274
|
+
const formOpts = $xeGantt.computeFormOpts
|
|
1275
|
+
return proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
|
|
1276
|
+
},
|
|
1277
|
+
getFormItems (itemIndex?: number): any {
|
|
1278
|
+
const $xeGantt = this
|
|
1279
|
+
const props = $xeGantt
|
|
1280
|
+
|
|
1281
|
+
const formOpts = $xeGantt.computeFormOpts
|
|
1282
|
+
const { formConfig } = props
|
|
1283
|
+
const { items } = formOpts
|
|
1284
|
+
const itemList: VxeFormItemProps[] = []
|
|
1285
|
+
XEUtils.eachTree(formConfig && isEnableConf(formOpts) && items ? items : [], item => {
|
|
1286
|
+
itemList.push(item)
|
|
1287
|
+
}, { children: 'children' })
|
|
1288
|
+
return XEUtils.isUndefined(itemIndex) ? itemList : itemList[itemIndex]
|
|
1289
|
+
},
|
|
1290
|
+
resetForm () {
|
|
1291
|
+
const $xeGantt = this
|
|
1292
|
+
|
|
1293
|
+
const $form = $xeGantt.$refs.refForm as VxeFormInstance
|
|
1294
|
+
if ($form) {
|
|
1295
|
+
return $form.reset()
|
|
1296
|
+
}
|
|
1297
|
+
return $xeGantt.$nextTick()
|
|
1298
|
+
},
|
|
1299
|
+
validateForm () {
|
|
1300
|
+
const $xeGantt = this
|
|
1301
|
+
|
|
1302
|
+
const $form = $xeGantt.$refs.refForm as VxeFormInstance
|
|
1303
|
+
if ($form) {
|
|
1304
|
+
return $form.validate()
|
|
1305
|
+
}
|
|
1306
|
+
return $xeGantt.$nextTick()
|
|
1307
|
+
},
|
|
1308
|
+
validateFormField (field: VxeFormItemPropTypes.Field | VxeFormItemPropTypes.Field[] | VxeFormDefines.ItemInfo | VxeFormDefines.ItemInfo[] | null) {
|
|
1309
|
+
const $xeGantt = this
|
|
1310
|
+
|
|
1311
|
+
const $form = $xeGantt.$refs.refForm as VxeFormInstance
|
|
1312
|
+
if ($form) {
|
|
1313
|
+
return $form.validateField(field)
|
|
1314
|
+
}
|
|
1315
|
+
return $xeGantt.$nextTick()
|
|
1316
|
+
},
|
|
1317
|
+
clearFormValidate (field?: VxeFormItemPropTypes.Field | VxeFormItemPropTypes.Field[] | VxeFormDefines.ItemInfo | VxeFormDefines.ItemInfo[] | null) {
|
|
1318
|
+
const $xeGantt = this
|
|
1319
|
+
|
|
1320
|
+
const $form = $xeGantt.$refs.refForm as VxeFormInstance
|
|
1321
|
+
if ($form) {
|
|
1322
|
+
return $form.clearValidate(field)
|
|
1323
|
+
}
|
|
1324
|
+
return $xeGantt.$nextTick()
|
|
1325
|
+
},
|
|
1326
|
+
homePage () {
|
|
1327
|
+
const $xeGantt = this
|
|
1328
|
+
const reactData = $xeGantt.reactData
|
|
1329
|
+
|
|
1330
|
+
const { tablePage } = reactData
|
|
1331
|
+
tablePage.currentPage = 1
|
|
1332
|
+
return $xeGantt.$nextTick()
|
|
1333
|
+
},
|
|
1334
|
+
homePageByEvent (evnt: Event) {
|
|
1335
|
+
const $xeGantt = this
|
|
1336
|
+
|
|
1337
|
+
const $pager = $xeGantt.$refs.refPager as VxePagerInstance
|
|
1338
|
+
if ($pager) {
|
|
1339
|
+
$pager.homePageByEvent(evnt)
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
endPage () {
|
|
1343
|
+
const $xeGantt = this
|
|
1344
|
+
const reactData = $xeGantt.reactData
|
|
1345
|
+
|
|
1346
|
+
const { tablePage } = reactData
|
|
1347
|
+
const pageCount = $xeGantt.computePageCount
|
|
1348
|
+
tablePage.currentPage = pageCount
|
|
1349
|
+
return $xeGantt.$nextTick()
|
|
1350
|
+
},
|
|
1351
|
+
endPageByEvent (evnt: Event) {
|
|
1352
|
+
const $xeGantt = this
|
|
1353
|
+
|
|
1354
|
+
const $pager = $xeGantt.$refs.refPager as VxePagerInstance
|
|
1355
|
+
if ($pager) {
|
|
1356
|
+
$pager.endPageByEvent(evnt)
|
|
1357
|
+
}
|
|
1358
|
+
},
|
|
1359
|
+
setCurrentPage (currentPage: number | string | null | undefined) {
|
|
1360
|
+
const $xeGantt = this
|
|
1361
|
+
const reactData = $xeGantt.reactData
|
|
1362
|
+
|
|
1363
|
+
const { tablePage } = reactData
|
|
1364
|
+
const pageCount = $xeGantt.computePageCount
|
|
1365
|
+
tablePage.currentPage = Math.min(pageCount, Math.max(1, XEUtils.toNumber(currentPage)))
|
|
1366
|
+
return $xeGantt.$nextTick()
|
|
1367
|
+
},
|
|
1368
|
+
setCurrentPageByEvent (evnt: Event, currentPage: number | string | null | undefined) {
|
|
1369
|
+
const $xeGantt = this
|
|
1370
|
+
|
|
1371
|
+
const $pager = $xeGantt.$refs.refPager as VxePagerInstance
|
|
1372
|
+
if ($pager) {
|
|
1373
|
+
$pager.setCurrentPageByEvent(evnt, currentPage)
|
|
1374
|
+
}
|
|
1375
|
+
},
|
|
1376
|
+
setPageSize (pageSize: number | string | null | undefined) {
|
|
1377
|
+
const $xeGantt = this
|
|
1378
|
+
const reactData = $xeGantt.reactData
|
|
1379
|
+
|
|
1380
|
+
const { tablePage } = reactData
|
|
1381
|
+
tablePage.pageSize = Math.max(1, XEUtils.toNumber(pageSize))
|
|
1382
|
+
return $xeGantt.$nextTick()
|
|
1383
|
+
},
|
|
1384
|
+
setPageSizeByEvent (evnt: Event, pageSize: number | string | null | undefined) {
|
|
1385
|
+
const $xeGantt = this
|
|
1386
|
+
|
|
1387
|
+
const $pager = $xeGantt.$refs.refPager as VxePagerInstance
|
|
1388
|
+
if ($pager) {
|
|
1389
|
+
$pager.setPageSizeByEvent(evnt, pageSize)
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
getProxyInfo () {
|
|
1393
|
+
const $xeGantt = this
|
|
1394
|
+
const props = $xeGantt
|
|
1395
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
1396
|
+
const reactData = $xeGantt.reactData
|
|
1397
|
+
|
|
1398
|
+
if (props.proxyConfig) {
|
|
1399
|
+
const { sortData } = reactData
|
|
1400
|
+
return {
|
|
1401
|
+
data: $xeTable ? $xeTable.getFullData() : [],
|
|
1402
|
+
filter: reactData.filterData,
|
|
1403
|
+
form: $xeGantt.getFormData(),
|
|
1404
|
+
sort: sortData.length ? sortData[0] : {},
|
|
1405
|
+
sorts: sortData,
|
|
1406
|
+
pager: reactData.tablePage,
|
|
1407
|
+
pendingRecords: $xeTable ? $xeTable.getPendingRecords() : []
|
|
1200
1408
|
}
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1409
|
+
}
|
|
1410
|
+
return null
|
|
1411
|
+
},
|
|
1412
|
+
refreshTaskView () {
|
|
1413
|
+
const $xeGantt = this
|
|
1414
|
+
|
|
1415
|
+
const $ganttView = $xeGantt.$refs.refGanttView as VxeGanttViewInstance
|
|
1416
|
+
if ($ganttView) {
|
|
1417
|
+
return $ganttView.refreshData()
|
|
1418
|
+
}
|
|
1419
|
+
return $xeGantt.$nextTick()
|
|
1420
|
+
},
|
|
1421
|
+
callSlot (slotFunc: any, params: any, h: CreateElement, vNodes: any) {
|
|
1422
|
+
const $xeGantt = this
|
|
1423
|
+
const slots = $xeGantt.$scopedSlots
|
|
1424
|
+
|
|
1425
|
+
if (slotFunc) {
|
|
1426
|
+
if (XEUtils.isString(slotFunc)) {
|
|
1427
|
+
slotFunc = slots[slotFunc] || null
|
|
1212
1428
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
const { tablePage } = reactData
|
|
1216
|
-
const pageCount = computePageCount.value
|
|
1217
|
-
tablePage.currentPage = Math.min(pageCount, Math.max(1, XEUtils.toNumber(currentPage)))
|
|
1218
|
-
return nextTick()
|
|
1219
|
-
},
|
|
1220
|
-
setCurrentPageByEvent (evnt, currentPage) {
|
|
1221
|
-
const $pager = refPager.value
|
|
1222
|
-
if ($pager) {
|
|
1223
|
-
$pager.setCurrentPageByEvent(evnt, currentPage)
|
|
1429
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
1430
|
+
return getSlotVNs(slotFunc.call(this, params, h, vNodes))
|
|
1224
1431
|
}
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1432
|
+
}
|
|
1433
|
+
return []
|
|
1434
|
+
},
|
|
1435
|
+
/**
|
|
1436
|
+
* 获取需要排除的高度
|
|
1437
|
+
*/
|
|
1438
|
+
getExcludeHeight () {
|
|
1439
|
+
const $xeGantt = this
|
|
1440
|
+
const reactData = $xeGantt.reactData
|
|
1441
|
+
|
|
1442
|
+
const { isZMax } = reactData
|
|
1443
|
+
const el = $xeGantt.$refs.refElem as HTMLDivElement
|
|
1444
|
+
if (el) {
|
|
1445
|
+
const formWrapper = $xeGantt.$refs.refFormWrapper as HTMLDivElement
|
|
1446
|
+
const toolbarWrapper = $xeGantt.$refs.refToolbarWrapper as HTMLDivElement
|
|
1447
|
+
const topWrapper = $xeGantt.$refs.refTopWrapper as HTMLDivElement
|
|
1448
|
+
const bottomWrapper = $xeGantt.$refs.refBottomWrapper as HTMLDivElement
|
|
1449
|
+
const pagerWrapper = $xeGantt.$refs.refPagerWrapper as HTMLDivElement
|
|
1450
|
+
const parentEl = el.parentElement as HTMLElement
|
|
1451
|
+
const parentPaddingSize = isZMax ? 0 : (parentEl ? getPaddingTopBottomSize(parentEl) : 0)
|
|
1452
|
+
return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper)
|
|
1453
|
+
}
|
|
1454
|
+
return 0
|
|
1455
|
+
},
|
|
1456
|
+
getParentHeight () {
|
|
1457
|
+
const $xeGantt = this
|
|
1458
|
+
const reactData = $xeGantt.reactData
|
|
1459
|
+
|
|
1460
|
+
const el = $xeGantt.$refs.refElem as HTMLDivElement
|
|
1461
|
+
if (el) {
|
|
1462
|
+
const parentEl = el.parentElement as HTMLElement
|
|
1463
|
+
return (reactData.isZMax ? getDomNode().visibleHeight : (parentEl ? XEUtils.toNumber(getComputedStyle(parentEl).height) : 0)) - $xeGantt.getExcludeHeight()
|
|
1464
|
+
}
|
|
1465
|
+
return 0
|
|
1466
|
+
},
|
|
1467
|
+
triggerToolbarCommitEvent (params: any, evnt: any) {
|
|
1468
|
+
const $xeGantt = this
|
|
1469
|
+
|
|
1470
|
+
const { code } = params
|
|
1471
|
+
return $xeGantt.commitProxy(params, evnt).then((rest) => {
|
|
1472
|
+
if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
1473
|
+
$xeGantt.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
|
|
1235
1474
|
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1475
|
+
})
|
|
1476
|
+
},
|
|
1477
|
+
triggerToolbarBtnEvent (button: any, evnt: any) {
|
|
1478
|
+
const $xeGantt = this
|
|
1479
|
+
|
|
1480
|
+
$xeGantt.triggerToolbarCommitEvent(button, evnt)
|
|
1481
|
+
$xeGantt.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt)
|
|
1482
|
+
},
|
|
1483
|
+
triggerToolbarTolEvent (tool: any, evnt: any) {
|
|
1484
|
+
const $xeGantt = this
|
|
1485
|
+
|
|
1486
|
+
$xeGantt.triggerToolbarCommitEvent(tool, evnt)
|
|
1487
|
+
$xeGantt.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt)
|
|
1488
|
+
},
|
|
1489
|
+
triggerZoomEvent (evnt: Event) {
|
|
1490
|
+
const $xeGantt = this
|
|
1491
|
+
const reactData = $xeGantt.reactData
|
|
1492
|
+
|
|
1493
|
+
$xeGantt.zoom()
|
|
1494
|
+
$xeGantt.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
|
|
1495
|
+
},
|
|
1496
|
+
handleTaskCellClickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
|
|
1497
|
+
const $xeGantt = this
|
|
1498
|
+
|
|
1499
|
+
$xeGantt.dispatchEvent('task-cell-click', params, evnt)
|
|
1500
|
+
},
|
|
1501
|
+
handleTaskCellDblclickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
|
|
1502
|
+
const $xeGantt = this
|
|
1503
|
+
|
|
1504
|
+
$xeGantt.dispatchEvent('task-cell-dblclick', params, evnt)
|
|
1505
|
+
},
|
|
1506
|
+
handleTaskBarClickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
|
|
1507
|
+
const $xeGantt = this
|
|
1508
|
+
|
|
1509
|
+
$xeGantt.dispatchEvent('task-bar-click', params, evnt)
|
|
1510
|
+
},
|
|
1511
|
+
handleTaskBarDblclickEvent (evnt: MouseEvent, params: VxeGanttDefines.TaskCellClickParams) {
|
|
1512
|
+
const $xeGantt = this
|
|
1513
|
+
|
|
1514
|
+
$xeGantt.dispatchEvent('task-bar-dblclick', params, evnt)
|
|
1515
|
+
},
|
|
1516
|
+
loadColumn (columns: any[]) {
|
|
1517
|
+
const $xeGantt = this
|
|
1518
|
+
const slots = $xeGantt.$scopedSlots
|
|
1519
|
+
const $xeTable = $xeGantt.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
1520
|
+
|
|
1521
|
+
XEUtils.eachTree(columns, column => {
|
|
1522
|
+
if (column.slots) {
|
|
1523
|
+
XEUtils.each(column.slots, (func) => {
|
|
1524
|
+
if (!XEUtils.isFunction(func)) {
|
|
1525
|
+
if (!slots[func]) {
|
|
1526
|
+
errLog('vxe.error.notSlot', [func])
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
})
|
|
1250
1530
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
// }
|
|
1264
|
-
// }
|
|
1265
|
-
// if (proxyOpts.form && form) {
|
|
1266
|
-
// Object.assign(reactData.formData, form)
|
|
1267
|
-
// }
|
|
1268
|
-
// }
|
|
1269
|
-
// return nextTick()
|
|
1270
|
-
// }
|
|
1271
|
-
}
|
|
1531
|
+
})
|
|
1532
|
+
return $xeTable.loadColumn(columns)
|
|
1533
|
+
},
|
|
1534
|
+
reloadColumn (columns: any[]) {
|
|
1535
|
+
const $xeGantt = this
|
|
1536
|
+
|
|
1537
|
+
$xeGantt.clearAll()
|
|
1538
|
+
return $xeGantt.loadColumn(columns)
|
|
1539
|
+
},
|
|
1540
|
+
getConfigSlot (slotConfigs?: Record<string, any>) {
|
|
1541
|
+
const $xeGantt = this
|
|
1542
|
+
const slots = $xeGantt.$scopedSlots
|
|
1272
1543
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
callSlot (slotFunc, params) {
|
|
1544
|
+
const slotConf: Record<string, any> = {}
|
|
1545
|
+
XEUtils.objectMap(slotConfigs, (slotFunc, slotKey) => {
|
|
1276
1546
|
if (slotFunc) {
|
|
1277
1547
|
if (XEUtils.isString(slotFunc)) {
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1548
|
+
if (slots[slotFunc]) {
|
|
1549
|
+
slotConf[slotKey] = slots[slotFunc]
|
|
1550
|
+
} else {
|
|
1551
|
+
errLog('vxe.error.notSlot', [slotFunc])
|
|
1552
|
+
}
|
|
1553
|
+
} else {
|
|
1554
|
+
slotConf[slotKey] = slotFunc
|
|
1282
1555
|
}
|
|
1283
1556
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1557
|
+
})
|
|
1558
|
+
return slotConf
|
|
1559
|
+
},
|
|
1560
|
+
getToolbarSlots () {
|
|
1561
|
+
const $xeGantt = this
|
|
1562
|
+
const slots = $xeGantt.$scopedSlots
|
|
1563
|
+
|
|
1564
|
+
const toolbarOpts = $xeGantt.computeToolbarOpts
|
|
1565
|
+
const toolbarOptSlots = toolbarOpts.slots
|
|
1566
|
+
const toolbarSlots: {
|
|
1567
|
+
buttons?(params: any): any
|
|
1568
|
+
buttonPrefix?(params: any): any
|
|
1569
|
+
buttonSuffix?(params: any): any
|
|
1570
|
+
tools?(params: any): any
|
|
1571
|
+
toolPrefix?(params: any): any
|
|
1572
|
+
toolSuffix?(params: any): any
|
|
1573
|
+
} = {}
|
|
1574
|
+
if (slots.buttons && (!toolbarOptSlots || toolbarOptSlots.buttons !== 'buttons')) {
|
|
1575
|
+
warnLog('vxe.error.reqProp', ['toolbar-config.slots.buttons'])
|
|
1576
|
+
}
|
|
1577
|
+
if (slots.tools && (!toolbarOptSlots || toolbarOptSlots.tools !== 'tools')) {
|
|
1578
|
+
warnLog('vxe.error.reqProp', ['toolbar-config.slots.tools'])
|
|
1579
|
+
}
|
|
1580
|
+
if (toolbarOptSlots) {
|
|
1581
|
+
const buttonsSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'buttons')
|
|
1582
|
+
const buttonPrefixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'buttonPrefix')
|
|
1583
|
+
const buttonSuffixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'buttonSuffix')
|
|
1584
|
+
const toolsSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'tools')
|
|
1585
|
+
const toolPrefixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'toolPrefix')
|
|
1586
|
+
const toolSuffixSlot = $xeGantt.getFuncSlot(toolbarOptSlots, 'toolSuffix')
|
|
1587
|
+
if (buttonsSlot) {
|
|
1588
|
+
toolbarSlots.buttons = buttonsSlot
|
|
1301
1589
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1590
|
+
if (buttonPrefixSlot) {
|
|
1591
|
+
toolbarSlots.buttonPrefix = buttonPrefixSlot
|
|
1592
|
+
}
|
|
1593
|
+
if (buttonSuffixSlot) {
|
|
1594
|
+
toolbarSlots.buttonSuffix = buttonSuffixSlot
|
|
1595
|
+
}
|
|
1596
|
+
if (toolsSlot) {
|
|
1597
|
+
toolbarSlots.tools = toolsSlot
|
|
1598
|
+
}
|
|
1599
|
+
if (toolPrefixSlot) {
|
|
1600
|
+
toolbarSlots.toolPrefix = toolPrefixSlot
|
|
1601
|
+
}
|
|
1602
|
+
if (toolSuffixSlot) {
|
|
1603
|
+
toolbarSlots.toolSuffix = toolSuffixSlot
|
|
1309
1604
|
}
|
|
1310
|
-
return 0
|
|
1311
|
-
},
|
|
1312
|
-
triggerToolbarCommitEvent (params, evnt) {
|
|
1313
|
-
const { code } = params
|
|
1314
|
-
return $xeGantt.commitProxy(params, evnt).then((rest) => {
|
|
1315
|
-
if (code && rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
1316
|
-
$xeGantt.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code as 'delete' | 'save'}` : 'proxy-query', { ...rest, isReload: code === 'reload' }, evnt)
|
|
1317
|
-
}
|
|
1318
|
-
})
|
|
1319
|
-
},
|
|
1320
|
-
triggerToolbarBtnEvent (button, evnt) {
|
|
1321
|
-
$xeGantt.triggerToolbarCommitEvent(button, evnt)
|
|
1322
|
-
$xeGantt.dispatchEvent('toolbar-button-click', { code: button.code, button }, evnt)
|
|
1323
|
-
},
|
|
1324
|
-
triggerToolbarTolEvent (tool, evnt) {
|
|
1325
|
-
$xeGantt.triggerToolbarCommitEvent(tool, evnt)
|
|
1326
|
-
$xeGantt.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt)
|
|
1327
|
-
},
|
|
1328
|
-
triggerZoomEvent (evnt) {
|
|
1329
|
-
$xeGantt.zoom()
|
|
1330
|
-
$xeGantt.dispatchEvent('zoom', { type: reactData.isZMax ? 'max' : 'revert' }, evnt)
|
|
1331
1605
|
}
|
|
1332
|
-
|
|
1606
|
+
return toolbarSlots
|
|
1607
|
+
},
|
|
1608
|
+
getFuncSlot (optSlots: any, slotKey: any) {
|
|
1609
|
+
const $xeGantt = this
|
|
1610
|
+
const slots = $xeGantt.$scopedSlots
|
|
1333
1611
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
if (!XEUtils.isFunction(func)) {
|
|
1342
|
-
if (!slots[func]) {
|
|
1343
|
-
errLog('vxe.error.notSlot', [func])
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
})
|
|
1612
|
+
const funcSlot = optSlots[slotKey]
|
|
1613
|
+
if (funcSlot) {
|
|
1614
|
+
if (XEUtils.isString(funcSlot)) {
|
|
1615
|
+
if (slots[funcSlot]) {
|
|
1616
|
+
return slots[funcSlot]
|
|
1617
|
+
} else {
|
|
1618
|
+
errLog('vxe.error.notSlot', [funcSlot])
|
|
1347
1619
|
}
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
return $xeTable.loadColumn(columns)
|
|
1620
|
+
} else {
|
|
1621
|
+
return funcSlot
|
|
1351
1622
|
}
|
|
1352
|
-
return nextTick()
|
|
1353
|
-
},
|
|
1354
|
-
reloadColumn (columns: any[]) {
|
|
1355
|
-
$xeGantt.clearAll()
|
|
1356
|
-
return $xeGantt.loadColumn(columns)
|
|
1357
1623
|
}
|
|
1358
|
-
|
|
1624
|
+
return null
|
|
1625
|
+
},
|
|
1359
1626
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
const
|
|
1627
|
+
//
|
|
1628
|
+
// Render
|
|
1629
|
+
//
|
|
1630
|
+
renderDefaultForm (h: CreateElement) {
|
|
1631
|
+
const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
|
|
1632
|
+
|
|
1633
|
+
const $xeGantt = this
|
|
1634
|
+
const props = $xeGantt
|
|
1635
|
+
const slots = $xeGantt.$scopedSlots
|
|
1636
|
+
const reactData = $xeGantt.reactData
|
|
1637
|
+
|
|
1638
|
+
const { proxyConfig, formConfig } = props
|
|
1365
1639
|
const { formData } = reactData
|
|
1366
|
-
const proxyOpts = computeProxyOpts
|
|
1367
|
-
const formOpts = computeFormOpts
|
|
1368
|
-
if ((formConfig &&
|
|
1369
|
-
|
|
1370
|
-
if (
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
if (
|
|
1374
|
-
const formSlots: { [key: string]: () => VNode[] } = {}
|
|
1375
|
-
if (!(formOpts as any).inited) {
|
|
1376
|
-
(formOpts as any).inited = true
|
|
1377
|
-
const beforeItem = proxyOpts.beforeItem
|
|
1378
|
-
if (proxyOpts && beforeItem) {
|
|
1379
|
-
formOpts.items.forEach((item) => {
|
|
1380
|
-
beforeItem({ $grid: null, $gantt: $xeGantt, item })
|
|
1381
|
-
})
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
// 处理插槽
|
|
1640
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
1641
|
+
const formOpts = $xeGantt.computeFormOpts
|
|
1642
|
+
if (isEnableConf(formConfig) && formOpts.items && formOpts.items.length) {
|
|
1643
|
+
const formSlots: any = {}
|
|
1644
|
+
if (!(formOpts as any).inited) {
|
|
1645
|
+
(formOpts as any).inited = true
|
|
1646
|
+
const beforeItem = proxyOpts.beforeItem
|
|
1647
|
+
if (proxyOpts && beforeItem) {
|
|
1385
1648
|
formOpts.items.forEach((item) => {
|
|
1386
|
-
|
|
1387
|
-
if (!XEUtils.isFunction(func)) {
|
|
1388
|
-
if (slots[func]) {
|
|
1389
|
-
formSlots[func] = slots[func] as any
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
})
|
|
1649
|
+
beforeItem.call($xeGantt, { $grid: $xeGantt, $gantt: null, item })
|
|
1393
1650
|
})
|
|
1394
|
-
if (VxeUIFormComponent) {
|
|
1395
|
-
slotVNs.push(
|
|
1396
|
-
h(VxeUIFormComponent, {
|
|
1397
|
-
ref: refForm,
|
|
1398
|
-
...Object.assign({}, formOpts, {
|
|
1399
|
-
data: proxyConfig && isEnableConf(proxyOpts) && proxyOpts.form ? formData : formOpts.data
|
|
1400
|
-
}),
|
|
1401
|
-
onSubmit: submitFormEvent,
|
|
1402
|
-
onReset: resetFormEvent,
|
|
1403
|
-
onSubmitInvalid: submitInvalidEvent,
|
|
1404
|
-
onCollapse: collapseEvent
|
|
1405
|
-
}, formSlots)
|
|
1406
|
-
)
|
|
1407
|
-
}
|
|
1408
1651
|
}
|
|
1409
1652
|
}
|
|
1653
|
+
// 处理插槽
|
|
1654
|
+
formOpts.items.forEach((item) => {
|
|
1655
|
+
XEUtils.each(item.slots, (func) => {
|
|
1656
|
+
if (!XEUtils.isFunction(func)) {
|
|
1657
|
+
if (slots[func]) {
|
|
1658
|
+
formSlots[func] = slots[func]
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
})
|
|
1662
|
+
})
|
|
1663
|
+
return [
|
|
1664
|
+
VxeUIFormComponent
|
|
1665
|
+
? h(VxeUIFormComponent, {
|
|
1666
|
+
props: Object.assign({}, formOpts, {
|
|
1667
|
+
data: proxyConfig && proxyOpts.form ? formData : formOpts.data
|
|
1668
|
+
}),
|
|
1669
|
+
on: {
|
|
1670
|
+
submit: $xeGantt.submitFormEvent,
|
|
1671
|
+
reset: $xeGantt.resetFormEvent,
|
|
1672
|
+
collapse: $xeGantt.collapseEvent,
|
|
1673
|
+
'submit-invalid': $xeGantt.submitInvalidEvent
|
|
1674
|
+
},
|
|
1675
|
+
scopedSlots: formSlots
|
|
1676
|
+
})
|
|
1677
|
+
: renderEmptyElement($xeGantt)
|
|
1678
|
+
]
|
|
1679
|
+
}
|
|
1680
|
+
return []
|
|
1681
|
+
},
|
|
1682
|
+
renderForm (h: CreateElement) {
|
|
1683
|
+
const $xeGantt = this
|
|
1684
|
+
const props = $xeGantt
|
|
1685
|
+
const slots = $xeGantt.$scopedSlots
|
|
1686
|
+
|
|
1687
|
+
const { formConfig } = props
|
|
1688
|
+
const formSlot = slots.form
|
|
1689
|
+
const hasForm = !!(formSlot || isEnableConf(formConfig))
|
|
1690
|
+
|
|
1691
|
+
if (hasForm) {
|
|
1410
1692
|
return h('div', {
|
|
1411
|
-
ref: refFormWrapper,
|
|
1412
1693
|
key: 'form',
|
|
1694
|
+
ref: 'refFormWrapper',
|
|
1413
1695
|
class: 'vxe-gantt--form-wrapper'
|
|
1414
|
-
},
|
|
1696
|
+
}, formSlot ? formSlot.call($xeGantt, { $grid: null, $gantt: $xeGantt }) : $xeGantt.renderDefaultForm(h))
|
|
1415
1697
|
}
|
|
1416
1698
|
return renderEmptyElement($xeGantt)
|
|
1417
|
-
}
|
|
1699
|
+
},
|
|
1700
|
+
renderToolbar (h: CreateElement) {
|
|
1701
|
+
const VxeUIToolbarComponent = VxeUI.getComponent('VxeToolbar')
|
|
1702
|
+
|
|
1703
|
+
const $xeGantt = this
|
|
1704
|
+
const props = $xeGantt
|
|
1705
|
+
const slots = $xeGantt.$scopedSlots
|
|
1418
1706
|
|
|
1419
|
-
/**
|
|
1420
|
-
* 渲染工具栏
|
|
1421
|
-
*/
|
|
1422
|
-
const renderToolbar = () => {
|
|
1423
1707
|
const { toolbarConfig } = props
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
slotVNs = slots.toolbar({ $grid: null, $gantt: $xeGantt })
|
|
1429
|
-
} else {
|
|
1430
|
-
const toolbarOptSlots = toolbarOpts.slots
|
|
1431
|
-
const toolbarSlots: {
|
|
1432
|
-
buttons?(params: any): any
|
|
1433
|
-
buttonPrefix?(params: any): any
|
|
1434
|
-
buttonSuffix?(params: any): any
|
|
1435
|
-
tools?(params: any): any
|
|
1436
|
-
toolPrefix?(params: any): any
|
|
1437
|
-
toolSuffix?(params: any): any
|
|
1438
|
-
} = {}
|
|
1439
|
-
if (toolbarOptSlots) {
|
|
1440
|
-
const buttonsSlot = getFuncSlot(toolbarOptSlots, 'buttons')
|
|
1441
|
-
const buttonPrefixSlot = getFuncSlot(toolbarOptSlots, 'buttonPrefix')
|
|
1442
|
-
const buttonSuffixSlot = getFuncSlot(toolbarOptSlots, 'buttonSuffix')
|
|
1443
|
-
const toolsSlot = getFuncSlot(toolbarOptSlots, 'tools')
|
|
1444
|
-
const toolPrefixSlot = getFuncSlot(toolbarOptSlots, 'toolPrefix')
|
|
1445
|
-
const toolSuffixSlot = getFuncSlot(toolbarOptSlots, 'toolSuffix')
|
|
1446
|
-
if (buttonsSlot) {
|
|
1447
|
-
toolbarSlots.buttons = buttonsSlot
|
|
1448
|
-
}
|
|
1449
|
-
if (buttonPrefixSlot) {
|
|
1450
|
-
toolbarSlots.buttonPrefix = buttonPrefixSlot
|
|
1451
|
-
}
|
|
1452
|
-
if (buttonSuffixSlot) {
|
|
1453
|
-
toolbarSlots.buttonSuffix = buttonSuffixSlot
|
|
1454
|
-
}
|
|
1455
|
-
if (toolsSlot) {
|
|
1456
|
-
toolbarSlots.tools = toolsSlot
|
|
1457
|
-
}
|
|
1458
|
-
if (toolPrefixSlot) {
|
|
1459
|
-
toolbarSlots.toolPrefix = toolPrefixSlot
|
|
1460
|
-
}
|
|
1461
|
-
if (toolSuffixSlot) {
|
|
1462
|
-
toolbarSlots.toolSuffix = toolSuffixSlot
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
slotVNs.push(
|
|
1466
|
-
h(VxeToolbarComponent, {
|
|
1467
|
-
ref: refToolbar,
|
|
1468
|
-
...toolbarOpts,
|
|
1469
|
-
slots: undefined
|
|
1470
|
-
}, toolbarSlots)
|
|
1471
|
-
)
|
|
1472
|
-
}
|
|
1708
|
+
const toolbarSlot = slots.toolbar
|
|
1709
|
+
const toolbarOpts = $xeGantt.computeToolbarOpts
|
|
1710
|
+
|
|
1711
|
+
if ((toolbarConfig && isEnableConf(toolbarOpts)) || toolbarSlot) {
|
|
1473
1712
|
return h('div', {
|
|
1474
|
-
ref: refToolbarWrapper,
|
|
1475
1713
|
key: 'toolbar',
|
|
1714
|
+
ref: 'refToolbarWrapper',
|
|
1476
1715
|
class: 'vxe-gantt--toolbar-wrapper'
|
|
1477
|
-
},
|
|
1716
|
+
}, toolbarSlot
|
|
1717
|
+
? toolbarSlot.call($xeGantt, { $grid: null, $gantt: $xeGantt })
|
|
1718
|
+
: [
|
|
1719
|
+
h(VxeUIToolbarComponent, {
|
|
1720
|
+
props: Object.assign({}, toolbarOpts, { slots: undefined }),
|
|
1721
|
+
ref: 'refToolbar',
|
|
1722
|
+
scopedSlots: $xeGantt.getToolbarSlots()
|
|
1723
|
+
})
|
|
1724
|
+
]
|
|
1725
|
+
)
|
|
1478
1726
|
}
|
|
1479
1727
|
return renderEmptyElement($xeGantt)
|
|
1480
|
-
}
|
|
1728
|
+
},
|
|
1729
|
+
renderTop (h: CreateElement) {
|
|
1730
|
+
const $xeGantt = this
|
|
1731
|
+
const slots = $xeGantt.$scopedSlots
|
|
1481
1732
|
|
|
1482
|
-
/**
|
|
1483
|
-
* 渲染表格顶部区域
|
|
1484
|
-
*/
|
|
1485
|
-
const renderTop = () => {
|
|
1486
1733
|
const topSlot = slots.top
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
ref: refTopWrapper,
|
|
1734
|
+
return topSlot
|
|
1735
|
+
? h('div', {
|
|
1490
1736
|
key: 'top',
|
|
1737
|
+
ref: 'refTopWrapper',
|
|
1491
1738
|
class: 'vxe-gantt--top-wrapper'
|
|
1492
|
-
}, topSlot({ $grid: null, $gantt: $xeGantt }))
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1739
|
+
}, topSlot.call($xeGantt, { $grid: null, $gantt: $xeGantt }))
|
|
1740
|
+
: renderEmptyElement($xeGantt)
|
|
1741
|
+
},
|
|
1742
|
+
renderTableLeft (h: CreateElement) {
|
|
1743
|
+
const $xeGantt = this
|
|
1744
|
+
const slots = $xeGantt.$scopedSlots
|
|
1496
1745
|
|
|
1497
|
-
const renderTableLeft = () => {
|
|
1498
1746
|
const leftSlot = slots.left
|
|
1499
1747
|
if (leftSlot) {
|
|
1500
1748
|
return h('div', {
|
|
@@ -1502,9 +1750,11 @@ export default defineVxeComponent({
|
|
|
1502
1750
|
}, leftSlot({ $grid: null, $gantt: $xeGantt }))
|
|
1503
1751
|
}
|
|
1504
1752
|
return renderEmptyElement($xeGantt)
|
|
1505
|
-
}
|
|
1753
|
+
},
|
|
1754
|
+
renderTableRight (h: CreateElement) {
|
|
1755
|
+
const $xeGantt = this
|
|
1756
|
+
const slots = $xeGantt.$scopedSlots
|
|
1506
1757
|
|
|
1507
|
-
const renderTableRight = () => {
|
|
1508
1758
|
const rightSlot = slots.right
|
|
1509
1759
|
if (rightSlot) {
|
|
1510
1760
|
return h('div', {
|
|
@@ -1512,180 +1762,173 @@ export default defineVxeComponent({
|
|
|
1512
1762
|
}, rightSlot({ $grid: null, $gantt: $xeGantt }))
|
|
1513
1763
|
}
|
|
1514
1764
|
return renderEmptyElement($xeGantt)
|
|
1515
|
-
}
|
|
1765
|
+
},
|
|
1766
|
+
renderTable (h: CreateElement) {
|
|
1767
|
+
const $xeGantt = this
|
|
1768
|
+
const slots = $xeGantt.$scopedSlots
|
|
1516
1769
|
|
|
1517
|
-
|
|
1518
|
-
* 渲染表格
|
|
1519
|
-
*/
|
|
1520
|
-
const renderTable = () => {
|
|
1521
|
-
const { proxyConfig } = props
|
|
1522
|
-
const tableProps = computeTableProps.value
|
|
1523
|
-
const proxyOpts = computeProxyOpts.value
|
|
1524
|
-
const tableOns = Object.assign({}, tableCompEvents)
|
|
1525
|
-
const emptySlot = slots.empty
|
|
1526
|
-
const loadingSlot = slots.loading
|
|
1527
|
-
const rowDragIconSlot = slots.rowDragIcon || slots['row-drag-icon']
|
|
1528
|
-
const columnDragIconSlot = slots.columnDragIcon || slots['column-drag-icon']
|
|
1529
|
-
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
1530
|
-
if (proxyOpts.sort) {
|
|
1531
|
-
tableOns.onSortChange = sortChangeEvent
|
|
1532
|
-
tableOns.onClearAllSort = clearAllSortEvent
|
|
1533
|
-
}
|
|
1534
|
-
if (proxyOpts.filter) {
|
|
1535
|
-
tableOns.onFilterChange = filterChangeEvent
|
|
1536
|
-
tableOns.onClearAllFilter = clearAllFilterEvent
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
const slotObj: {
|
|
1540
|
-
empty?(params: any): any
|
|
1541
|
-
loading?(params: any): any
|
|
1542
|
-
rowDragIcon?(params: any): any
|
|
1543
|
-
columnDragIcon?(params: any): any
|
|
1544
|
-
} = {}
|
|
1545
|
-
if (emptySlot) {
|
|
1546
|
-
slotObj.empty = emptySlot
|
|
1547
|
-
}
|
|
1548
|
-
if (loadingSlot) {
|
|
1549
|
-
slotObj.loading = loadingSlot
|
|
1550
|
-
}
|
|
1551
|
-
if (rowDragIconSlot) {
|
|
1552
|
-
slotObj.rowDragIcon = rowDragIconSlot
|
|
1553
|
-
}
|
|
1554
|
-
if (columnDragIconSlot) {
|
|
1555
|
-
slotObj.columnDragIcon = columnDragIconSlot
|
|
1556
|
-
}
|
|
1770
|
+
const tableProps = $xeGantt.computeTableProps
|
|
1557
1771
|
return h('div', {
|
|
1558
|
-
ref: refTableWrapper,
|
|
1559
1772
|
class: 'vxe-gantt--table-wrapper'
|
|
1560
1773
|
}, [
|
|
1561
|
-
h(VxeTableComponent, {
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1774
|
+
h(VxeTableComponent as Component, {
|
|
1775
|
+
key: 'table',
|
|
1776
|
+
props: tableProps,
|
|
1777
|
+
on: getTableOns($xeGantt),
|
|
1778
|
+
scopedSlots: slots,
|
|
1779
|
+
ref: 'refTable'
|
|
1780
|
+
})
|
|
1566
1781
|
])
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
ref: refBottomWrapper,
|
|
1782
|
+
},
|
|
1783
|
+
renderBottom (h: CreateElement) {
|
|
1784
|
+
const $xeGantt = this
|
|
1785
|
+
const slots = $xeGantt.$scopedSlots
|
|
1786
|
+
|
|
1787
|
+
const bottomSlot = slots.bottom
|
|
1788
|
+
return bottomSlot
|
|
1789
|
+
? h('div', {
|
|
1576
1790
|
key: 'bottom',
|
|
1791
|
+
ref: 'refBottomWrapper',
|
|
1577
1792
|
class: 'vxe-gantt--bottom-wrapper'
|
|
1578
|
-
},
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1793
|
+
}, bottomSlot.call($xeGantt, { $grid: null, $gantt: $xeGantt }))
|
|
1794
|
+
: renderEmptyElement($xeGantt)
|
|
1795
|
+
},
|
|
1796
|
+
renderPager (h: CreateElement) {
|
|
1797
|
+
const VxeUIPagerComponent = VxeUI.getComponent('VxePager')
|
|
1798
|
+
|
|
1799
|
+
const $xeGantt = this
|
|
1800
|
+
const props = $xeGantt
|
|
1801
|
+
const slots = $xeGantt.$scopedSlots
|
|
1802
|
+
const reactData = $xeGantt.reactData
|
|
1582
1803
|
|
|
1583
|
-
/**
|
|
1584
|
-
* 渲染分页
|
|
1585
|
-
*/
|
|
1586
|
-
const renderPager = () => {
|
|
1587
1804
|
const { proxyConfig, pagerConfig } = props
|
|
1588
|
-
const proxyOpts = computeProxyOpts
|
|
1589
|
-
const pagerOpts = computePagerOpts
|
|
1805
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
1806
|
+
const pagerOpts = $xeGantt.computePagerOpts
|
|
1590
1807
|
const pagerSlot = slots.pager
|
|
1591
1808
|
if ((pagerConfig && isEnableConf(pagerOpts)) || slots.pager) {
|
|
1592
1809
|
return h('div', {
|
|
1593
|
-
ref: refPagerWrapper,
|
|
1810
|
+
ref: 'refPagerWrapper',
|
|
1594
1811
|
key: 'pager',
|
|
1595
1812
|
class: 'vxe-gantt--pager-wrapper'
|
|
1596
1813
|
}, pagerSlot
|
|
1597
|
-
? pagerSlot({ $grid: null, $gantt: $xeGantt })
|
|
1814
|
+
? pagerSlot.call($xeGantt, { $grid: null, $gantt: $xeGantt })
|
|
1598
1815
|
: [
|
|
1599
1816
|
VxeUIPagerComponent
|
|
1600
1817
|
? h(VxeUIPagerComponent, {
|
|
1601
|
-
ref: refPager,
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1818
|
+
ref: 'refPager',
|
|
1819
|
+
props: {
|
|
1820
|
+
...pagerOpts,
|
|
1821
|
+
...(proxyConfig && isEnableConf(proxyOpts) ? reactData.tablePage : {})
|
|
1822
|
+
},
|
|
1823
|
+
on: {
|
|
1824
|
+
'page-change': $xeGantt.pageChangeEvent
|
|
1825
|
+
},
|
|
1826
|
+
scopedSlots: $xeGantt.getConfigSlot(pagerOpts.slots)
|
|
1827
|
+
})
|
|
1606
1828
|
: renderEmptyElement($xeGantt)
|
|
1607
1829
|
])
|
|
1608
1830
|
}
|
|
1609
1831
|
return renderEmptyElement($xeGantt)
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1832
|
+
},
|
|
1612
1833
|
/**
|
|
1613
1834
|
* 渲染任务视图
|
|
1614
1835
|
*/
|
|
1615
|
-
|
|
1836
|
+
renderTaskView (h: CreateElement) {
|
|
1616
1837
|
return h('div', {
|
|
1617
|
-
ref: refGanttWrapper,
|
|
1838
|
+
ref: 'refGanttWrapper',
|
|
1618
1839
|
class: 'vxe-gantt--view-wrapper'
|
|
1619
1840
|
}, [
|
|
1620
1841
|
h(GanttViewComponent, {
|
|
1621
|
-
ref: refGanttView
|
|
1842
|
+
ref: 'refGanttView'
|
|
1622
1843
|
})
|
|
1623
1844
|
])
|
|
1624
|
-
}
|
|
1845
|
+
},
|
|
1846
|
+
renderSplitBar (h: CreateElement) {
|
|
1847
|
+
const $xeGantt = this
|
|
1848
|
+
const reactData = $xeGantt.reactData
|
|
1625
1849
|
|
|
1626
|
-
const renderSplitBar = () => {
|
|
1627
1850
|
const { showLeftView, showRightView } = reactData
|
|
1851
|
+
const taskSplitOpts = $xeGantt.computeTaskSplitOpts
|
|
1852
|
+
const { enabled, resize, showCollapseTableButton, showCollapseTaskButton } = taskSplitOpts
|
|
1853
|
+
if (!enabled) {
|
|
1854
|
+
return renderEmptyElement($xeGantt)
|
|
1855
|
+
}
|
|
1856
|
+
const ons: {
|
|
1857
|
+
mousedown?: any
|
|
1858
|
+
} = {}
|
|
1859
|
+
if (resize) {
|
|
1860
|
+
ons.mousedown = $xeGantt.dragSplitEvent
|
|
1861
|
+
}
|
|
1628
1862
|
return h('div', {
|
|
1629
|
-
class: 'vxe-gantt--view-split-bar'
|
|
1863
|
+
class: ['vxe-gantt--view-split-bar', {
|
|
1864
|
+
'is--resize': resize,
|
|
1865
|
+
on: ons
|
|
1866
|
+
}]
|
|
1630
1867
|
}, [
|
|
1631
1868
|
h('div', {
|
|
1632
|
-
class: 'vxe-gantt--view-split-bar-handle'
|
|
1633
|
-
onMousedown: dragSplitEvent
|
|
1869
|
+
class: 'vxe-gantt--view-split-bar-handle'
|
|
1634
1870
|
}),
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1871
|
+
showCollapseTableButton || showCollapseTaskButton
|
|
1872
|
+
? h('div', {
|
|
1873
|
+
class: 'vxe-gantt--view-split-bar-btn-wrapper'
|
|
1874
|
+
}, [
|
|
1875
|
+
showCollapseTableButton && showRightView
|
|
1876
|
+
? h('div', {
|
|
1877
|
+
class: 'vxe-gantt--view-split-bar-left-btn',
|
|
1878
|
+
on: {
|
|
1879
|
+
click: $xeGantt.handleSplitLeftViewEvent
|
|
1880
|
+
}
|
|
1881
|
+
}, [
|
|
1882
|
+
h('i', {
|
|
1883
|
+
class: showLeftView ? getIcon().GANTT_VIEW_LEFT_OPEN : getIcon().GANTT_VIEW_LEFT_CLOSE
|
|
1884
|
+
})
|
|
1885
|
+
])
|
|
1886
|
+
: renderEmptyElement($xeGantt),
|
|
1887
|
+
showCollapseTaskButton && showLeftView
|
|
1888
|
+
? h('div', {
|
|
1889
|
+
class: 'vxe-gantt--view-split-bar-right-btn',
|
|
1890
|
+
on: {
|
|
1891
|
+
click: $xeGantt.handleSplitRightViewEvent
|
|
1892
|
+
}
|
|
1893
|
+
}, [
|
|
1894
|
+
h('i', {
|
|
1895
|
+
class: showRightView ? getIcon().GANTT_VIEW_RIGHT_OPEN : getIcon().GANTT_VIEW_RIGHT_CLOSE
|
|
1896
|
+
})
|
|
1897
|
+
])
|
|
1898
|
+
: renderEmptyElement($xeGantt)
|
|
1899
|
+
])
|
|
1900
|
+
: renderEmptyElement($xeGantt)
|
|
1659
1901
|
])
|
|
1660
|
-
}
|
|
1902
|
+
},
|
|
1903
|
+
renderChildLayout (h: CreateElement, layoutKeys: VxeGanttDefines.LayoutKey[]) {
|
|
1904
|
+
const $xeGantt = this
|
|
1661
1905
|
|
|
1662
|
-
const renderChildLayout = (layoutKeys: VxeGanttDefines.LayoutKey[]) => {
|
|
1663
1906
|
const childVNs: VNode[] = []
|
|
1664
1907
|
layoutKeys.forEach(key => {
|
|
1665
1908
|
switch (key) {
|
|
1666
1909
|
case 'Form':
|
|
1667
|
-
childVNs.push(renderForm())
|
|
1910
|
+
childVNs.push($xeGantt.renderForm(h))
|
|
1668
1911
|
break
|
|
1669
1912
|
case 'Toolbar':
|
|
1670
|
-
childVNs.push(renderToolbar())
|
|
1913
|
+
childVNs.push($xeGantt.renderToolbar(h))
|
|
1671
1914
|
break
|
|
1672
1915
|
case 'Top':
|
|
1673
|
-
childVNs.push(renderTop())
|
|
1916
|
+
childVNs.push($xeGantt.renderTop(h))
|
|
1674
1917
|
break
|
|
1675
1918
|
case 'Gantt':
|
|
1676
1919
|
childVNs.push(
|
|
1677
1920
|
h('div', {
|
|
1678
|
-
ref: refGanttContainer,
|
|
1921
|
+
ref: 'refGanttContainer',
|
|
1679
1922
|
key: 'tv',
|
|
1680
1923
|
class: 'vxe-gantt--gantt-container'
|
|
1681
1924
|
}, [
|
|
1682
|
-
renderTableLeft(),
|
|
1683
|
-
renderTable(),
|
|
1684
|
-
renderSplitBar(),
|
|
1685
|
-
renderTaskView(),
|
|
1686
|
-
renderTableRight(),
|
|
1925
|
+
$xeGantt.renderTableLeft(h),
|
|
1926
|
+
$xeGantt.renderTable(h),
|
|
1927
|
+
$xeGantt.renderSplitBar(h),
|
|
1928
|
+
$xeGantt.renderTaskView(h),
|
|
1929
|
+
$xeGantt.renderTableRight(h),
|
|
1687
1930
|
h('div', {
|
|
1688
|
-
ref: refResizableSplitTip,
|
|
1931
|
+
ref: 'refResizableSplitTip',
|
|
1689
1932
|
class: 'vxe-gantt--resizable-split-tip'
|
|
1690
1933
|
}, [
|
|
1691
1934
|
h('div', {
|
|
@@ -1703,10 +1946,10 @@ export default defineVxeComponent({
|
|
|
1703
1946
|
)
|
|
1704
1947
|
break
|
|
1705
1948
|
case 'Bottom':
|
|
1706
|
-
childVNs.push(renderBottom())
|
|
1949
|
+
childVNs.push($xeGantt.renderBottom(h))
|
|
1707
1950
|
break
|
|
1708
1951
|
case 'Pager':
|
|
1709
|
-
childVNs.push(renderPager())
|
|
1952
|
+
childVNs.push($xeGantt.renderPager(h))
|
|
1710
1953
|
break
|
|
1711
1954
|
default:
|
|
1712
1955
|
errLog('vxe.error.notProp', [`layouts -> ${key}`])
|
|
@@ -1714,17 +1957,19 @@ export default defineVxeComponent({
|
|
|
1714
1957
|
}
|
|
1715
1958
|
})
|
|
1716
1959
|
return childVNs
|
|
1717
|
-
}
|
|
1960
|
+
},
|
|
1961
|
+
renderLayout (h: CreateElement) {
|
|
1962
|
+
const $xeGantt = this
|
|
1963
|
+
const slots = $xeGantt.$scopedSlots
|
|
1718
1964
|
|
|
1719
|
-
|
|
1720
|
-
const currLayoutConf = computeCurrLayoutConf.value
|
|
1965
|
+
const currLayoutConf = $xeGantt.computeCurrLayoutConf
|
|
1721
1966
|
const { headKeys, bodyKeys, footKeys } = currLayoutConf
|
|
1722
1967
|
const asideLeftSlot = slots.asideLeft || slots['aside-left']
|
|
1723
1968
|
const asideRightSlot = slots.asideRight || slots['aside-right']
|
|
1724
1969
|
return [
|
|
1725
1970
|
h('div', {
|
|
1726
1971
|
class: 'vxe-gantt--layout-header-wrapper'
|
|
1727
|
-
}, renderChildLayout(headKeys)),
|
|
1972
|
+
}, $xeGantt.renderChildLayout(h, headKeys)),
|
|
1728
1973
|
h('div', {
|
|
1729
1974
|
class: 'vxe-gantt--layout-body-wrapper'
|
|
1730
1975
|
}, [
|
|
@@ -1735,7 +1980,7 @@ export default defineVxeComponent({
|
|
|
1735
1980
|
: renderEmptyElement($xeGantt),
|
|
1736
1981
|
h('div', {
|
|
1737
1982
|
class: 'vxe-gantt--layout-body-content-wrapper'
|
|
1738
|
-
}, renderChildLayout(bodyKeys)),
|
|
1983
|
+
}, $xeGantt.renderChildLayout(h, bodyKeys)),
|
|
1739
1984
|
asideRightSlot
|
|
1740
1985
|
? h('div', {
|
|
1741
1986
|
class: 'vxe-gantt--layout-aside-right-wrapper'
|
|
@@ -1744,23 +1989,26 @@ export default defineVxeComponent({
|
|
|
1744
1989
|
]),
|
|
1745
1990
|
h('div', {
|
|
1746
1991
|
class: 'vxe-gantt--layout-footer-wrapper'
|
|
1747
|
-
}, renderChildLayout(footKeys)),
|
|
1992
|
+
}, $xeGantt.renderChildLayout(h, footKeys)),
|
|
1748
1993
|
h('div', {
|
|
1749
1994
|
class: 'vxe-gantt--border-line'
|
|
1750
1995
|
})
|
|
1751
1996
|
]
|
|
1752
|
-
}
|
|
1997
|
+
},
|
|
1998
|
+
renderVN (h: CreateElement): VNode {
|
|
1999
|
+
const $xeGantt = this
|
|
2000
|
+
const props = $xeGantt
|
|
2001
|
+
const reactData = $xeGantt.reactData
|
|
1753
2002
|
|
|
1754
|
-
const renderVN = () => {
|
|
1755
2003
|
const { showLeftView, showRightView } = reactData
|
|
1756
|
-
const vSize = computeSize
|
|
1757
|
-
const styles = computeStyles
|
|
1758
|
-
const isLoading = computeIsLoading
|
|
1759
|
-
const tableBorder = computeTableBorder
|
|
1760
|
-
const scrollbarXToTop = computeScrollbarXToTop
|
|
1761
|
-
const scrollbarYToLeft = computeScrollbarYToLeft
|
|
2004
|
+
const vSize = $xeGantt.computeSize
|
|
2005
|
+
const styles = $xeGantt.computeStyles
|
|
2006
|
+
const isLoading = $xeGantt.computeIsLoading
|
|
2007
|
+
const tableBorder = $xeGantt.computeTableBorder
|
|
2008
|
+
const scrollbarXToTop = $xeGantt.computeScrollbarXToTop
|
|
2009
|
+
const scrollbarYToLeft = $xeGantt.computeScrollbarYToLeft
|
|
1762
2010
|
return h('div', {
|
|
1763
|
-
ref: refElem,
|
|
2011
|
+
ref: 'refElem',
|
|
1764
2012
|
class: ['vxe-gantt', `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
1765
2013
|
[`size--${vSize}`]: vSize,
|
|
1766
2014
|
'is--round': props.round,
|
|
@@ -1770,100 +2018,71 @@ export default defineVxeComponent({
|
|
|
1770
2018
|
'show--right': showRightView
|
|
1771
2019
|
}],
|
|
1772
2020
|
style: styles
|
|
1773
|
-
}, renderLayout())
|
|
2021
|
+
}, $xeGantt.renderLayout(h))
|
|
1774
2022
|
}
|
|
2023
|
+
},
|
|
2024
|
+
created () {
|
|
2025
|
+
// 使用已安装的组件,如果未安装则不渲染
|
|
2026
|
+
const VxeUIFormComponent = VxeUI.getComponent('VxeForm')
|
|
2027
|
+
const VxeUIPagerComponent = VxeUI.getComponent('VxePager')
|
|
2028
|
+
const VxeUIToolbarComponent = VxeUI.getComponent('VxeToolbar')
|
|
1775
2029
|
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
columnFlag.value++
|
|
1779
|
-
})
|
|
1780
|
-
watch(() => props.columns, () => {
|
|
1781
|
-
columnFlag.value++
|
|
1782
|
-
})
|
|
1783
|
-
watch(columnFlag, () => {
|
|
1784
|
-
nextTick(() => $xeGantt.loadColumn(props.columns || []))
|
|
1785
|
-
})
|
|
1786
|
-
|
|
1787
|
-
watch(() => props.toolbarConfig, () => {
|
|
1788
|
-
initToolbar()
|
|
1789
|
-
})
|
|
1790
|
-
|
|
1791
|
-
watch(computeCustomCurrentPageFlag, () => {
|
|
1792
|
-
initPages('currentPage')
|
|
1793
|
-
})
|
|
2030
|
+
const $xeGantt = this
|
|
2031
|
+
const props = $xeGantt
|
|
1794
2032
|
|
|
1795
|
-
|
|
1796
|
-
initPages('pageSize')
|
|
1797
|
-
})
|
|
2033
|
+
const proxyOpts = $xeGantt.computeProxyOpts
|
|
1798
2034
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2035
|
+
if ((props as any).toolbar) {
|
|
2036
|
+
errLog('vxe.error.delProp', ['grid.toolbar', 'grid.toolbar-config'])
|
|
2037
|
+
}
|
|
2038
|
+
if (props.toolbarConfig && !XEUtils.isObject(props.toolbarConfig)) {
|
|
2039
|
+
errLog('vxe.error.errProp', [`grid.toolbar-config=${props.toolbarConfig}`, 'grid.toolbar-config={}'])
|
|
2040
|
+
}
|
|
2041
|
+
if (proxyOpts.props) {
|
|
2042
|
+
warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
|
|
2043
|
+
}
|
|
1806
2044
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
if (hookRest && XEUtils.isObject(hookRest)) {
|
|
1812
|
-
Object.assign($xeGantt, hookRest)
|
|
2045
|
+
$xeGantt.$nextTick(() => {
|
|
2046
|
+
if (props.formConfig) {
|
|
2047
|
+
if (!VxeUIFormComponent) {
|
|
2048
|
+
errLog('vxe.error.reqComp', ['vxe-form'])
|
|
1813
2049
|
}
|
|
1814
2050
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
onMounted(() => {
|
|
1820
|
-
nextTick(() => {
|
|
1821
|
-
const { columns } = props
|
|
1822
|
-
const proxyOpts = computeProxyOpts.value
|
|
1823
|
-
|
|
1824
|
-
if (props.formConfig) {
|
|
1825
|
-
if (!VxeUIFormComponent) {
|
|
1826
|
-
errLog('vxe.error.reqComp', ['vxe-form'])
|
|
1827
|
-
}
|
|
2051
|
+
if (props.pagerConfig) {
|
|
2052
|
+
if (!VxeUIPagerComponent) {
|
|
2053
|
+
errLog('vxe.error.reqComp', ['vxe-pager'])
|
|
1828
2054
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
// const { data, columns, proxyConfig } = props
|
|
1836
|
-
// const formOpts = computeFormOpts.value
|
|
1837
|
-
// if (isEnableConf(proxyConfig) && (data || (proxyOpts.form && formOpts.data))) {
|
|
1838
|
-
// errLog('vxe.error.errConflicts', ['grid.data', 'grid.proxy-config'])
|
|
1839
|
-
// }
|
|
1840
|
-
|
|
1841
|
-
if (proxyOpts.props) {
|
|
1842
|
-
warnLog('vxe.error.delProp', ['proxy-config.props', 'proxy-config.response'])
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
if (columns && columns.length) {
|
|
1846
|
-
$xeGantt.loadColumn(columns)
|
|
2055
|
+
}
|
|
2056
|
+
if (props.toolbarConfig) {
|
|
2057
|
+
if (!VxeUIToolbarComponent) {
|
|
2058
|
+
errLog('vxe.error.reqComp', ['vxe-toolbar'])
|
|
1847
2059
|
}
|
|
1848
|
-
|
|
1849
|
-
initProxy()
|
|
1850
|
-
})
|
|
1851
|
-
initGanttView()
|
|
1852
|
-
globalEvents.on($xeGantt, 'keydown', handleGlobalKeydownEvent)
|
|
1853
|
-
})
|
|
1854
|
-
|
|
1855
|
-
onUnmounted(() => {
|
|
1856
|
-
globalEvents.off($xeGantt, 'keydown')
|
|
1857
|
-
XEUtils.assign(internalData, createInternalData())
|
|
2060
|
+
}
|
|
1858
2061
|
})
|
|
1859
2062
|
|
|
1860
|
-
$xeGantt.
|
|
2063
|
+
$xeGantt.initPages()
|
|
2064
|
+
},
|
|
2065
|
+
mounted () {
|
|
2066
|
+
const $xeGantt = this
|
|
2067
|
+
const props = $xeGantt
|
|
1861
2068
|
|
|
1862
|
-
|
|
2069
|
+
const { columns } = props
|
|
2070
|
+
if (columns && columns.length) {
|
|
2071
|
+
$xeGantt.loadColumn(columns)
|
|
2072
|
+
}
|
|
2073
|
+
$xeGantt.initToolbar()
|
|
2074
|
+
$xeGantt.initProxy()
|
|
2075
|
+
$xeGantt.initGanttView()
|
|
2076
|
+
globalEvents.on($xeGantt, 'keydown', $xeGantt.handleGlobalKeydownEvent)
|
|
2077
|
+
},
|
|
2078
|
+
destroyed () {
|
|
2079
|
+
const $xeGantt = this
|
|
2080
|
+
const internalData = $xeGantt.internalData
|
|
1863
2081
|
|
|
1864
|
-
|
|
2082
|
+
globalEvents.off($xeGantt, 'keydown')
|
|
2083
|
+
XEUtils.assign(internalData, createInternalData())
|
|
1865
2084
|
},
|
|
1866
|
-
render () {
|
|
1867
|
-
return this.renderVN()
|
|
2085
|
+
render (this: any, h) {
|
|
2086
|
+
return this.renderVN(h)
|
|
1868
2087
|
}
|
|
1869
|
-
})
|
|
2088
|
+
}) /* define-vxe-component end */
|