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