vxe-gantt 4.0.23 → 4.0.25
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/es/gantt/src/gantt-body.js +29 -10
- package/es/gantt/src/gantt-view.js +94 -4
- package/es/gantt/src/gantt.js +155 -37
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/utils.js +3 -0
- package/lib/gantt/src/gantt-body.js +34 -6
- package/lib/gantt/src/gantt-body.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +98 -4
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +171 -48
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +310 -60
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +4 -0
- package/lib/ui/src/utils.min.js +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/gantt-body.ts +38 -17
- package/packages/gantt/src/gantt-view.ts +95 -4
- package/packages/gantt/src/gantt.ts +187 -70
- package/packages/ui/src/utils.ts +4 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { h, inject, ref, onMounted, onUnmounted } from 'vue';
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
3
3
|
import { getCellRestHeight } from './util';
|
|
4
|
+
import { getClass } from '../../ui/src/utils';
|
|
5
|
+
import XEUtils from 'xe-utils';
|
|
4
6
|
import GanttViewChartComponent from './gantt-chart';
|
|
5
7
|
const sourceType = 'gantt';
|
|
6
8
|
const viewType = 'body';
|
|
@@ -30,9 +32,10 @@ export default defineVxeComponent({
|
|
|
30
32
|
const { headerGroups } = reactData;
|
|
31
33
|
const { todayDateMaps } = internalData;
|
|
32
34
|
const taskViewOpts = computeTaskViewOpts.value;
|
|
33
|
-
const { showNowLine } = taskViewOpts;
|
|
35
|
+
const { showNowLine, viewStyle } = taskViewOpts;
|
|
34
36
|
const { scaleItem } = headerGroups[headerGroups.length - 1] || {};
|
|
35
|
-
const { field } = column;
|
|
37
|
+
const { field, dateObj } = column;
|
|
38
|
+
const { cellClassName, cellStyle } = viewStyle || {};
|
|
36
39
|
const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null;
|
|
37
40
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
38
41
|
const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
|
|
@@ -71,16 +74,24 @@ export default defineVxeComponent({
|
|
|
71
74
|
onDblclick: (evnt) => $xeTable.handleRowResizeDblclickEvent(evnt, cellParams)
|
|
72
75
|
}));
|
|
73
76
|
}
|
|
74
|
-
const ctParams = { source: sourceType, type: viewType, row, column, $rowIndex, rowIndex, _rowIndex };
|
|
77
|
+
const ctParams = { source: sourceType, type: viewType, dateObj, row, column, $rowIndex, rowIndex, _rowIndex };
|
|
75
78
|
return h('td', {
|
|
76
79
|
key: $columnIndex,
|
|
77
|
-
class: [
|
|
80
|
+
class: [
|
|
81
|
+
'vxe-gantt-view--body-column',
|
|
82
|
+
{
|
|
78
83
|
'is--now': showNowLine && todayValue === field,
|
|
79
84
|
'col--rs-height': isRsHeight
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
},
|
|
86
|
+
getClass(cellClassName, ctParams)
|
|
87
|
+
],
|
|
88
|
+
style: cellStyle
|
|
89
|
+
? Object.assign({}, XEUtils.isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
|
|
90
|
+
height: `${cellHeight}px`
|
|
91
|
+
})
|
|
92
|
+
: {
|
|
93
|
+
height: `${cellHeight}px`
|
|
94
|
+
},
|
|
84
95
|
onClick(evnt) {
|
|
85
96
|
$xeGantt.handleTaskCellClickEvent(evnt, { row, column });
|
|
86
97
|
},
|
|
@@ -106,6 +117,9 @@ export default defineVxeComponent({
|
|
|
106
117
|
const treeOpts = computeTreeOpts.value;
|
|
107
118
|
const { transform } = treeOpts;
|
|
108
119
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
120
|
+
const taskViewOpts = computeTaskViewOpts.value;
|
|
121
|
+
const { viewStyle } = taskViewOpts;
|
|
122
|
+
const { rowClassName, rowStyle } = viewStyle || {};
|
|
109
123
|
const { tableColumn, scrollYLoad } = reactData;
|
|
110
124
|
const trVNs = [];
|
|
111
125
|
tableData.forEach((row, $rowIndex) => {
|
|
@@ -138,13 +152,18 @@ export default defineVxeComponent({
|
|
|
138
152
|
trOns.onDragend = $xeTable.handleRowDragDragendEvent;
|
|
139
153
|
trOns.onDragover = $xeTable.handleRowDragDragoverEvent;
|
|
140
154
|
}
|
|
141
|
-
|
|
155
|
+
const rowParams = { source: sourceType, type: viewType, row, rowIndex, $rowIndex, _rowIndex };
|
|
156
|
+
trVNs.push(h('tr', Object.assign({ key: treeConfig ? rowid : $rowIndex, class: [
|
|
157
|
+
'vxe-gantt-view--body-row',
|
|
158
|
+
{
|
|
142
159
|
'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
|
|
143
160
|
'is--new': isNewRow,
|
|
144
161
|
'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
|
|
145
162
|
'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
|
|
146
163
|
'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
|
|
147
|
-
}
|
|
164
|
+
},
|
|
165
|
+
getClass(rowClassName, rowParams)
|
|
166
|
+
], rowid, style: rowStyle ? XEUtils.isFunction(rowStyle) ? rowStyle(rowParams) : rowStyle : undefined }, trOns), tableColumn.map((column, $columnIndex) => renderColumn($xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex))));
|
|
148
167
|
let isExpandTree = false;
|
|
149
168
|
let rowChildren = [];
|
|
150
169
|
if (treeConfig && !scrollYLoad && !transform) {
|
|
@@ -8,6 +8,7 @@ import GanttViewHeaderComponent from './gantt-header';
|
|
|
8
8
|
import GanttViewBodyComponent from './gantt-body';
|
|
9
9
|
import GanttViewFooterComponent from './gantt-footer';
|
|
10
10
|
const { globalEvents } = VxeUI;
|
|
11
|
+
const sourceType = 'gantt';
|
|
11
12
|
function createInternalData() {
|
|
12
13
|
return {
|
|
13
14
|
xeTable: null,
|
|
@@ -781,8 +782,7 @@ export default defineVxeComponent({
|
|
|
781
782
|
reactData.lazScrollLoading = false;
|
|
782
783
|
}, 200);
|
|
783
784
|
};
|
|
784
|
-
|
|
785
|
-
const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
785
|
+
const handleScrollData = (isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
786
786
|
if (isRollX) {
|
|
787
787
|
internalData.lastScrollLeft = scrollLeft;
|
|
788
788
|
}
|
|
@@ -792,6 +792,91 @@ export default defineVxeComponent({
|
|
|
792
792
|
reactData.lastScrollTime = Date.now();
|
|
793
793
|
checkLastSyncScroll(isRollX, isRollY);
|
|
794
794
|
};
|
|
795
|
+
const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
|
|
796
|
+
const $xeTable = internalData.xeTable;
|
|
797
|
+
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
798
|
+
const xHandleEl = refScrollXHandleElem.value;
|
|
799
|
+
const yHandleEl = refScrollYHandleElem.value;
|
|
800
|
+
if (!xHandleEl || !yHandleEl) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
if (!$xeTable) {
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
const { computeScrollXThreshold, computeScrollYThreshold } = $xeTable.getComputeMaps();
|
|
807
|
+
const bodyHeight = yHandleEl.clientHeight;
|
|
808
|
+
const bodyWidth = xHandleEl.clientWidth;
|
|
809
|
+
const scrollHeight = yHandleEl.scrollHeight;
|
|
810
|
+
const scrollWidth = xHandleEl.scrollWidth;
|
|
811
|
+
let isTop = false;
|
|
812
|
+
let isBottom = false;
|
|
813
|
+
let isLeft = false;
|
|
814
|
+
let isRight = false;
|
|
815
|
+
let direction = '';
|
|
816
|
+
let isTopBoundary = false;
|
|
817
|
+
let isBottomBoundary = false;
|
|
818
|
+
let isLeftBoundary = false;
|
|
819
|
+
let isRightBoundary = false;
|
|
820
|
+
if (isRollX) {
|
|
821
|
+
const xThreshold = computeScrollXThreshold.value;
|
|
822
|
+
isLeft = scrollLeft <= 0;
|
|
823
|
+
if (!isLeft) {
|
|
824
|
+
isRight = scrollLeft + bodyWidth >= scrollWidth - 1;
|
|
825
|
+
}
|
|
826
|
+
if (scrollLeft > lastScrollLeft) {
|
|
827
|
+
direction = 'right';
|
|
828
|
+
if (scrollLeft + bodyWidth >= scrollWidth - xThreshold) {
|
|
829
|
+
isRightBoundary = true;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
direction = 'left';
|
|
834
|
+
if (scrollLeft <= xThreshold) {
|
|
835
|
+
isLeftBoundary = true;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (isRollY) {
|
|
840
|
+
const yThreshold = computeScrollYThreshold.value;
|
|
841
|
+
isTop = scrollTop <= 0;
|
|
842
|
+
if (!isTop) {
|
|
843
|
+
isBottom = scrollTop + bodyHeight >= scrollHeight - 1;
|
|
844
|
+
}
|
|
845
|
+
if (scrollTop > lastScrollTop) {
|
|
846
|
+
direction = 'bottom';
|
|
847
|
+
if (scrollTop + bodyHeight >= scrollHeight - yThreshold) {
|
|
848
|
+
isBottomBoundary = true;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
else {
|
|
852
|
+
direction = 'top';
|
|
853
|
+
if (scrollTop <= yThreshold) {
|
|
854
|
+
isTopBoundary = true;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
handleScrollData(isRollY, isRollX, scrollTop, scrollLeft);
|
|
859
|
+
const evntParams = {
|
|
860
|
+
source: sourceType,
|
|
861
|
+
scrollTop,
|
|
862
|
+
scrollLeft,
|
|
863
|
+
bodyHeight,
|
|
864
|
+
bodyWidth,
|
|
865
|
+
scrollHeight,
|
|
866
|
+
scrollWidth,
|
|
867
|
+
isX: isRollX,
|
|
868
|
+
isY: isRollY,
|
|
869
|
+
isTop,
|
|
870
|
+
isBottom,
|
|
871
|
+
isLeft,
|
|
872
|
+
isRight,
|
|
873
|
+
direction
|
|
874
|
+
};
|
|
875
|
+
if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
|
|
876
|
+
$xeGantt.dispatchEvent('scroll-boundary', evntParams, evnt);
|
|
877
|
+
}
|
|
878
|
+
$xeGantt.dispatchEvent('scroll', evntParams, evnt);
|
|
879
|
+
};
|
|
795
880
|
const ganttViewMethods = {
|
|
796
881
|
refreshData() {
|
|
797
882
|
handleUpdateData();
|
|
@@ -911,7 +996,12 @@ export default defineVxeComponent({
|
|
|
911
996
|
triggerScrollXEvent();
|
|
912
997
|
}
|
|
913
998
|
}
|
|
914
|
-
|
|
999
|
+
if (isRollY) {
|
|
1000
|
+
handleScrollData(isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
|
|
1001
|
+
}
|
|
1002
|
+
if (isRollX) {
|
|
1003
|
+
handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
|
|
1004
|
+
}
|
|
915
1005
|
},
|
|
916
1006
|
// triggerFooterScrollEvent (evnt) {
|
|
917
1007
|
// const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
|
|
@@ -965,7 +1055,7 @@ export default defineVxeComponent({
|
|
|
965
1055
|
internalData.inVirtualScroll = true;
|
|
966
1056
|
setScrollTop(bodyScrollElem, currTopNum);
|
|
967
1057
|
syncTableScrollTop(currTopNum);
|
|
968
|
-
|
|
1058
|
+
handleScrollData(isRollY, isRollX, currTopNum, wrapperEl.scrollLeft);
|
|
969
1059
|
}
|
|
970
1060
|
},
|
|
971
1061
|
handleUpdateSXSpace() {
|
package/es/gantt/src/gantt.js
CHANGED
|
@@ -17,6 +17,7 @@ const tableComponentMethodKeys = ['clearAll', 'syncData', 'updateData', 'loadDat
|
|
|
17
17
|
const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Gantt', 'Bottom', 'Pager']];
|
|
18
18
|
function createInternalData() {
|
|
19
19
|
return {
|
|
20
|
+
uFoot: false,
|
|
20
21
|
resizeTableWidth: 0
|
|
21
22
|
};
|
|
22
23
|
}
|
|
@@ -60,6 +61,7 @@ export default defineVxeComponent({
|
|
|
60
61
|
filterData: [],
|
|
61
62
|
formData: {},
|
|
62
63
|
sortData: [],
|
|
64
|
+
footerData: [],
|
|
63
65
|
tZindex: 0,
|
|
64
66
|
tablePage: {
|
|
65
67
|
total: 0,
|
|
@@ -217,14 +219,17 @@ export default defineVxeComponent({
|
|
|
217
219
|
});
|
|
218
220
|
const computeTableExtendProps = computed(() => {
|
|
219
221
|
const rest = {};
|
|
222
|
+
const ganttProps = props;
|
|
220
223
|
tableComponentPropKeys.forEach((key) => {
|
|
221
|
-
|
|
224
|
+
if (ganttProps[key] !== undefined) {
|
|
225
|
+
rest[key] = ganttProps[key];
|
|
226
|
+
}
|
|
222
227
|
});
|
|
223
228
|
return rest;
|
|
224
229
|
});
|
|
225
230
|
const computeTableProps = computed(() => {
|
|
226
|
-
const { seqConfig, pagerConfig, editConfig, proxyConfig } = props;
|
|
227
|
-
const { isZMax, tablePage } = reactData;
|
|
231
|
+
const { showFooter, seqConfig, pagerConfig, editConfig, proxyConfig } = props;
|
|
232
|
+
const { isZMax, tablePage, footerData } = reactData;
|
|
228
233
|
const taskViewOpts = computeTaskViewOpts.value;
|
|
229
234
|
const { tableStyle } = taskViewOpts;
|
|
230
235
|
const tableExtendProps = computeTableExtendProps.value;
|
|
@@ -243,8 +248,16 @@ export default defineVxeComponent({
|
|
|
243
248
|
tProps.border = border;
|
|
244
249
|
}
|
|
245
250
|
}
|
|
251
|
+
if (showFooter && !tProps.footerData) {
|
|
252
|
+
// 如果未设置自己的标位数据,则使用代理的
|
|
253
|
+
tProps.footerData = footerData;
|
|
254
|
+
}
|
|
255
|
+
else if (proxyOpts.footer && footerData.length) {
|
|
256
|
+
// 如果代理标为数据,且未请求到数据,则用自己的
|
|
257
|
+
tProps.footerData = footerData;
|
|
258
|
+
}
|
|
246
259
|
if (isZMax) {
|
|
247
|
-
if (
|
|
260
|
+
if (tProps.maxHeight) {
|
|
248
261
|
tProps.maxHeight = '100%';
|
|
249
262
|
}
|
|
250
263
|
else {
|
|
@@ -558,9 +571,12 @@ export default defineVxeComponent({
|
|
|
558
571
|
reactData.filterData = params.filterList;
|
|
559
572
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
560
573
|
reactData.tablePage.currentPage = 1;
|
|
574
|
+
internalData.uFoot = true;
|
|
561
575
|
$xeGantt.commitProxy('query').then((rest) => {
|
|
562
576
|
$xeGantt.dispatchEvent('proxy-query', rest, params.$event);
|
|
563
577
|
});
|
|
578
|
+
internalData.uFoot = false;
|
|
579
|
+
updateQueryFooter();
|
|
564
580
|
}
|
|
565
581
|
}
|
|
566
582
|
};
|
|
@@ -579,9 +595,12 @@ export default defineVxeComponent({
|
|
|
579
595
|
return;
|
|
580
596
|
}
|
|
581
597
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
598
|
+
internalData.uFoot = true;
|
|
582
599
|
$xeGantt.commitProxy('reload').then((rest) => {
|
|
583
600
|
$xeGantt.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isReload: true }), params.$event);
|
|
584
601
|
});
|
|
602
|
+
internalData.uFoot = false;
|
|
603
|
+
updateQueryFooter();
|
|
585
604
|
}
|
|
586
605
|
$xeGantt.dispatchEvent('form-submit', params, params.$event);
|
|
587
606
|
};
|
|
@@ -594,9 +613,12 @@ export default defineVxeComponent({
|
|
|
594
613
|
if ($xeTable) {
|
|
595
614
|
$xeTable.clearScroll();
|
|
596
615
|
}
|
|
616
|
+
internalData.uFoot = true;
|
|
597
617
|
$xeGantt.commitProxy('reload').then((rest) => {
|
|
598
618
|
$xeGantt.dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isReload: true }), $event);
|
|
599
619
|
});
|
|
620
|
+
internalData.uFoot = false;
|
|
621
|
+
updateQueryFooter();
|
|
600
622
|
}
|
|
601
623
|
$xeGantt.dispatchEvent('form-reset', params, $event);
|
|
602
624
|
};
|
|
@@ -754,13 +776,17 @@ export default defineVxeComponent({
|
|
|
754
776
|
if (field) {
|
|
755
777
|
let itemValue = null;
|
|
756
778
|
if (itemRender) {
|
|
757
|
-
const { defaultValue } = itemRender;
|
|
779
|
+
const { startField, endField, defaultValue } = itemRender;
|
|
758
780
|
if (XEUtils.isFunction(defaultValue)) {
|
|
759
781
|
itemValue = defaultValue({ item });
|
|
760
782
|
}
|
|
761
783
|
else if (!XEUtils.isUndefined(defaultValue)) {
|
|
762
784
|
itemValue = defaultValue;
|
|
763
785
|
}
|
|
786
|
+
if (startField && endField) {
|
|
787
|
+
XEUtils.set(fData, startField, null);
|
|
788
|
+
XEUtils.set(fData, endField, null);
|
|
789
|
+
}
|
|
764
790
|
}
|
|
765
791
|
fData[field] = itemValue;
|
|
766
792
|
}
|
|
@@ -781,13 +807,26 @@ export default defineVxeComponent({
|
|
|
781
807
|
if (!proxyInited) {
|
|
782
808
|
reactData.proxyInited = true;
|
|
783
809
|
if (proxyOpts.autoLoad !== false) {
|
|
784
|
-
nextTick().then(() =>
|
|
810
|
+
nextTick().then(() => {
|
|
811
|
+
internalData.uFoot = true;
|
|
812
|
+
const rest = $xeGantt.commitProxy('initial');
|
|
813
|
+
internalData.uFoot = false;
|
|
814
|
+
updateQueryFooter();
|
|
815
|
+
return rest;
|
|
816
|
+
}).then((rest) => {
|
|
785
817
|
dispatchEvent('proxy-query', Object.assign(Object.assign({}, rest), { isInited: true }), new Event('initial'));
|
|
786
818
|
});
|
|
787
819
|
}
|
|
788
820
|
}
|
|
789
821
|
}
|
|
790
822
|
};
|
|
823
|
+
const updateQueryFooter = () => {
|
|
824
|
+
const proxyOpts = computeProxyOpts.value;
|
|
825
|
+
const { ajax } = proxyOpts;
|
|
826
|
+
if (ajax && ajax.queryFooter) {
|
|
827
|
+
return $xeGantt.commitProxy('queryFooter');
|
|
828
|
+
}
|
|
829
|
+
};
|
|
791
830
|
const handleGlobalKeydownEvent = (evnt) => {
|
|
792
831
|
const zoomOpts = computeZoomOpts.value;
|
|
793
832
|
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
|
|
@@ -808,15 +847,15 @@ export default defineVxeComponent({
|
|
|
808
847
|
* @param {String/Object} code 字符串或对象
|
|
809
848
|
*/
|
|
810
849
|
commitProxy(proxyTarget, ...args) {
|
|
811
|
-
const { proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props;
|
|
850
|
+
const { showFooter, proxyConfig, toolbarConfig, pagerConfig, editRules, validConfig } = props;
|
|
812
851
|
const { tablePage } = reactData;
|
|
813
852
|
const isActiveMsg = computeIsActiveMsg.value;
|
|
814
853
|
const isRespMsg = computeIsRespMsg.value;
|
|
815
854
|
const proxyOpts = computeProxyOpts.value;
|
|
816
855
|
const pagerOpts = computePagerOpts.value;
|
|
817
856
|
const toolbarOpts = computeToolbarOpts.value;
|
|
818
|
-
const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
|
|
819
|
-
const resConfigs = proxyOpts.response || proxyOpts.props || {};
|
|
857
|
+
const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
|
|
858
|
+
const resConfigs = (proxyOpts.response || proxyOpts.props || {});
|
|
820
859
|
const $xeTable = refTable.value;
|
|
821
860
|
if (!$xeTable) {
|
|
822
861
|
return nextTick();
|
|
@@ -866,15 +905,16 @@ export default defineVxeComponent({
|
|
|
866
905
|
case 'initial':
|
|
867
906
|
case 'reload':
|
|
868
907
|
case 'query': {
|
|
869
|
-
const
|
|
870
|
-
const
|
|
871
|
-
const
|
|
872
|
-
if (
|
|
908
|
+
const qMethods = ajax.query;
|
|
909
|
+
const qsMethods = ajax.querySuccess;
|
|
910
|
+
const qeMethods = ajax.queryError;
|
|
911
|
+
if (qMethods) {
|
|
873
912
|
const isInited = code === 'initial';
|
|
874
913
|
const isReload = code === 'reload';
|
|
875
914
|
if (!isInited && reactData.tableLoading) {
|
|
876
915
|
return nextTick();
|
|
877
916
|
}
|
|
917
|
+
let operPromise = null;
|
|
878
918
|
let sortList = [];
|
|
879
919
|
let filterList = [];
|
|
880
920
|
let pageParams = {};
|
|
@@ -929,7 +969,7 @@ export default defineVxeComponent({
|
|
|
929
969
|
else {
|
|
930
970
|
if ($xeTable) {
|
|
931
971
|
if (isReload) {
|
|
932
|
-
$xeTable.clearAll();
|
|
972
|
+
operPromise = $xeTable.clearAll();
|
|
933
973
|
}
|
|
934
974
|
else {
|
|
935
975
|
sortList = $xeTable.getSortColumns();
|
|
@@ -950,22 +990,25 @@ export default defineVxeComponent({
|
|
|
950
990
|
sorts: sortList,
|
|
951
991
|
filters: filterList,
|
|
952
992
|
form: formData,
|
|
953
|
-
options:
|
|
993
|
+
options: qMethods
|
|
954
994
|
};
|
|
955
995
|
reactData.sortData = sortList;
|
|
956
996
|
reactData.filterData = filterList;
|
|
957
997
|
reactData.tableLoading = true;
|
|
958
|
-
return Promise.
|
|
959
|
-
.
|
|
998
|
+
return Promise.all([
|
|
999
|
+
Promise.resolve((beforeQuery || qMethods)(commitParams, ...args)),
|
|
1000
|
+
operPromise
|
|
1001
|
+
]).then(([rest]) => {
|
|
960
1002
|
let tableData = [];
|
|
961
1003
|
reactData.tableLoading = false;
|
|
962
1004
|
if (rest) {
|
|
1005
|
+
const reParams = { data: rest, $table: $xeTable, $grid: null, $gantt: $xeGantt };
|
|
963
1006
|
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
964
1007
|
const totalProp = resConfigs.total;
|
|
965
|
-
const total = (XEUtils.isFunction(totalProp) ? totalProp(
|
|
1008
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
|
|
966
1009
|
tablePage.total = XEUtils.toNumber(total);
|
|
967
1010
|
const resultProp = resConfigs.result;
|
|
968
|
-
tableData = (XEUtils.isFunction(resultProp) ? resultProp(
|
|
1011
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
|
|
969
1012
|
// 检验当前页码,不能超出当前最大页数
|
|
970
1013
|
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
971
1014
|
if (tablePage.currentPage > pageCount) {
|
|
@@ -974,7 +1017,19 @@ export default defineVxeComponent({
|
|
|
974
1017
|
}
|
|
975
1018
|
else {
|
|
976
1019
|
const listProp = resConfigs.list;
|
|
977
|
-
|
|
1020
|
+
if (XEUtils.isArray(rest)) {
|
|
1021
|
+
tableData = rest;
|
|
1022
|
+
}
|
|
1023
|
+
else if (listProp) {
|
|
1024
|
+
tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || [];
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (showFooter) {
|
|
1028
|
+
const fdProp = resConfigs.footerData;
|
|
1029
|
+
const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : [];
|
|
1030
|
+
if (XEUtils.isArray(footerList)) {
|
|
1031
|
+
reactData.footerData = footerList;
|
|
1032
|
+
}
|
|
978
1033
|
}
|
|
979
1034
|
}
|
|
980
1035
|
if ($xeTable) {
|
|
@@ -982,6 +1037,7 @@ export default defineVxeComponent({
|
|
|
982
1037
|
}
|
|
983
1038
|
else {
|
|
984
1039
|
nextTick(() => {
|
|
1040
|
+
const $xeTable = refTable.value;
|
|
985
1041
|
if ($xeTable) {
|
|
986
1042
|
$xeTable.loadData(tableData);
|
|
987
1043
|
}
|
|
@@ -990,28 +1046,68 @@ export default defineVxeComponent({
|
|
|
990
1046
|
if (afterQuery) {
|
|
991
1047
|
afterQuery(commitParams, ...args);
|
|
992
1048
|
}
|
|
993
|
-
if (
|
|
994
|
-
|
|
1049
|
+
if (qsMethods) {
|
|
1050
|
+
qsMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
995
1051
|
}
|
|
996
1052
|
return { status: true };
|
|
997
1053
|
}).catch((rest) => {
|
|
998
1054
|
reactData.tableLoading = false;
|
|
999
|
-
if (
|
|
1000
|
-
|
|
1055
|
+
if (qeMethods) {
|
|
1056
|
+
qeMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1001
1057
|
}
|
|
1002
1058
|
return { status: false };
|
|
1003
1059
|
});
|
|
1004
1060
|
}
|
|
1005
1061
|
else {
|
|
1006
|
-
errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
|
|
1062
|
+
errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.query']);
|
|
1063
|
+
}
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
1066
|
+
case 'queryFooter': {
|
|
1067
|
+
const qfMethods = ajax.queryFooter;
|
|
1068
|
+
const qfSuccessMethods = ajax.queryFooterSuccess;
|
|
1069
|
+
const qfErrorMethods = ajax.queryFooterError;
|
|
1070
|
+
if (qfMethods) {
|
|
1071
|
+
let filterList = [];
|
|
1072
|
+
if ($xeTable) {
|
|
1073
|
+
filterList = $xeTable.getCheckedFilters();
|
|
1074
|
+
}
|
|
1075
|
+
const commitParams = {
|
|
1076
|
+
$table: $xeTable,
|
|
1077
|
+
$grid: null,
|
|
1078
|
+
$gantt: $xeGantt,
|
|
1079
|
+
code,
|
|
1080
|
+
button,
|
|
1081
|
+
filters: filterList,
|
|
1082
|
+
form: formData,
|
|
1083
|
+
options: qfMethods
|
|
1084
|
+
};
|
|
1085
|
+
return Promise.resolve((beforeQueryFooter || qfMethods)(commitParams, ...args)).then(rest => {
|
|
1086
|
+
reactData.footerData = XEUtils.isArray(rest) ? rest : [];
|
|
1087
|
+
if (afterQueryFooter) {
|
|
1088
|
+
afterQueryFooter(commitParams, ...args);
|
|
1089
|
+
}
|
|
1090
|
+
if (qfSuccessMethods) {
|
|
1091
|
+
qfSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1092
|
+
}
|
|
1093
|
+
return { status: true };
|
|
1094
|
+
}).catch((rest) => {
|
|
1095
|
+
if (qfErrorMethods) {
|
|
1096
|
+
qfErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1097
|
+
}
|
|
1098
|
+
return { status: false };
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.queryFooter']);
|
|
1007
1103
|
}
|
|
1008
1104
|
break;
|
|
1009
1105
|
}
|
|
1010
1106
|
case 'delete': {
|
|
1011
|
-
const
|
|
1107
|
+
const dMethods = ajax.delete;
|
|
1012
1108
|
const deleteSuccessMethods = ajax.deleteSuccess;
|
|
1013
1109
|
const deleteErrorMethods = ajax.deleteError;
|
|
1014
|
-
if (
|
|
1110
|
+
if (dMethods) {
|
|
1015
1111
|
const selectRecords = $xeGantt.getCheckboxRecords();
|
|
1016
1112
|
const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
|
|
1017
1113
|
const body = { removeRecords };
|
|
@@ -1023,7 +1119,7 @@ export default defineVxeComponent({
|
|
|
1023
1119
|
button,
|
|
1024
1120
|
body,
|
|
1025
1121
|
form: formData,
|
|
1026
|
-
options:
|
|
1122
|
+
options: dMethods
|
|
1027
1123
|
};
|
|
1028
1124
|
if (selectRecords.length) {
|
|
1029
1125
|
return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
@@ -1031,7 +1127,7 @@ export default defineVxeComponent({
|
|
|
1031
1127
|
return $xeTable.remove(selectRecords);
|
|
1032
1128
|
}
|
|
1033
1129
|
reactData.tableLoading = true;
|
|
1034
|
-
return Promise.resolve((beforeDelete ||
|
|
1130
|
+
return Promise.resolve((beforeDelete || dMethods)(commitParams, ...args))
|
|
1035
1131
|
.then(rest => {
|
|
1036
1132
|
reactData.tableLoading = false;
|
|
1037
1133
|
$xeTable.setPendingRow(removeRecords, false);
|
|
@@ -1044,7 +1140,10 @@ export default defineVxeComponent({
|
|
|
1044
1140
|
afterDelete(commitParams, ...args);
|
|
1045
1141
|
}
|
|
1046
1142
|
else {
|
|
1143
|
+
internalData.uFoot = true;
|
|
1047
1144
|
$xeGantt.commitProxy('query');
|
|
1145
|
+
internalData.uFoot = false;
|
|
1146
|
+
updateQueryFooter();
|
|
1048
1147
|
}
|
|
1049
1148
|
if (deleteSuccessMethods) {
|
|
1050
1149
|
deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
@@ -1074,7 +1173,7 @@ export default defineVxeComponent({
|
|
|
1074
1173
|
}
|
|
1075
1174
|
}
|
|
1076
1175
|
else {
|
|
1077
|
-
errLog('vxe.error.notFunc', ['proxy-config.ajax.delete']);
|
|
1176
|
+
errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.delete']);
|
|
1078
1177
|
}
|
|
1079
1178
|
break;
|
|
1080
1179
|
}
|
|
@@ -1128,7 +1227,10 @@ export default defineVxeComponent({
|
|
|
1128
1227
|
afterSave(commitParams, ...args);
|
|
1129
1228
|
}
|
|
1130
1229
|
else {
|
|
1230
|
+
internalData.uFoot = true;
|
|
1131
1231
|
$xeGantt.commitProxy('query');
|
|
1232
|
+
internalData.uFoot = false;
|
|
1233
|
+
updateQueryFooter();
|
|
1132
1234
|
}
|
|
1133
1235
|
if (saveSuccessMethods) {
|
|
1134
1236
|
saveSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
@@ -1158,7 +1260,7 @@ export default defineVxeComponent({
|
|
|
1158
1260
|
});
|
|
1159
1261
|
}
|
|
1160
1262
|
else {
|
|
1161
|
-
errLog('vxe.error.notFunc', ['proxy-config.ajax.save']);
|
|
1263
|
+
errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.save']);
|
|
1162
1264
|
}
|
|
1163
1265
|
break;
|
|
1164
1266
|
}
|
|
@@ -1170,7 +1272,7 @@ export default defineVxeComponent({
|
|
|
1170
1272
|
tCommandMethod({ code, button, $table: $xeTable, $grid: null, $gantt: $xeGantt }, ...args);
|
|
1171
1273
|
}
|
|
1172
1274
|
else {
|
|
1173
|
-
errLog('vxe.error.notCommands', [code]);
|
|
1275
|
+
errLog('vxe.error.notCommands', [`[grid] ${code}`]);
|
|
1174
1276
|
}
|
|
1175
1277
|
}
|
|
1176
1278
|
}
|
|
@@ -1369,6 +1471,7 @@ export default defineVxeComponent({
|
|
|
1369
1471
|
* 获取需要排除的高度
|
|
1370
1472
|
*/
|
|
1371
1473
|
getExcludeHeight() {
|
|
1474
|
+
const { height } = props;
|
|
1372
1475
|
const { isZMax } = reactData;
|
|
1373
1476
|
const el = refElem.value;
|
|
1374
1477
|
if (el) {
|
|
@@ -1378,7 +1481,10 @@ export default defineVxeComponent({
|
|
|
1378
1481
|
const bottomWrapper = refBottomWrapper.value;
|
|
1379
1482
|
const pagerWrapper = refPagerWrapper.value;
|
|
1380
1483
|
const parentEl = el.parentElement;
|
|
1381
|
-
|
|
1484
|
+
let parentPaddingSize = 0;
|
|
1485
|
+
if (parentEl && (height === '100%' || height === 'auto')) {
|
|
1486
|
+
parentPaddingSize = isZMax ? 0 : getPaddingTopBottomSize(parentEl);
|
|
1487
|
+
}
|
|
1382
1488
|
return parentPaddingSize + getPaddingTopBottomSize(el) + getOffsetHeight(formWrapper) + getOffsetHeight(toolbarWrapper) + getOffsetHeight(topWrapper) + getOffsetHeight(bottomWrapper) + getOffsetHeight(pagerWrapper);
|
|
1383
1489
|
}
|
|
1384
1490
|
return 0;
|
|
@@ -1393,11 +1499,23 @@ export default defineVxeComponent({
|
|
|
1393
1499
|
},
|
|
1394
1500
|
triggerToolbarCommitEvent(params, evnt) {
|
|
1395
1501
|
const { code } = params;
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1502
|
+
if (code) {
|
|
1503
|
+
const isUf = ['reload', 'delete', 'save'].includes(code);
|
|
1504
|
+
if (isUf) {
|
|
1505
|
+
internalData.uFoot = true;
|
|
1399
1506
|
}
|
|
1400
|
-
|
|
1507
|
+
const rest = $xeGantt.commitProxy(params, evnt).then((rest) => {
|
|
1508
|
+
if (rest && rest.status && ['query', 'reload', 'delete', 'save'].includes(code)) {
|
|
1509
|
+
$xeGantt.dispatchEvent(code === 'delete' || code === 'save' ? `proxy-${code}` : 'proxy-query', Object.assign(Object.assign({}, rest), { isReload: code === 'reload' }), evnt);
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
internalData.uFoot = false;
|
|
1513
|
+
if (isUf) {
|
|
1514
|
+
updateQueryFooter();
|
|
1515
|
+
}
|
|
1516
|
+
return rest;
|
|
1517
|
+
}
|
|
1518
|
+
return nextTick();
|
|
1401
1519
|
},
|
|
1402
1520
|
triggerToolbarBtnEvent(button, evnt) {
|
|
1403
1521
|
$xeGantt.triggerToolbarCommitEvent(button, evnt);
|
package/es/ui/index.js
CHANGED