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