tplus-components-touch 3.43.1 → 3.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/billSearch/index.js +17 -40
- package/dist/components/billSearch/index.js.map +1 -1
- package/dist/components/deliverySearch/index.js +5 -1
- package/dist/components/deliverySearch/index.js.map +1 -1
- package/dist/components/hotKey/localConfig.js +13 -0
- package/dist/components/hotKey/localConfig.js.map +1 -1
- package/dist/components/inventorySearch/tab.js +6 -1
- package/dist/components/inventorySearch/tab.js.map +1 -1
- package/dist/components/loading/loadingContent.js +5 -2
- package/dist/components/loading/loadingContent.js.map +1 -1
- package/dist/components/message/index.js +4 -6
- package/dist/components/message/index.js.map +1 -1
- package/dist/components/modalWraper/index.js +16 -1
- package/dist/components/modalWraper/index.js.map +1 -1
- package/dist/components/modalWraper/style.less +6 -0
- package/dist/components/notification/index.js +11 -12
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/progressState/EmptyAndErrorView.js +5 -7
- package/dist/components/progressState/EmptyAndErrorView.js.map +1 -1
- package/dist/components/settlement/asyncModal.js +4 -1
- package/dist/components/settlement/asyncModal.js.map +1 -1
- package/dist/components/settlement/settlement.js +352 -291
- package/dist/components/settlement/settlement.js.map +1 -1
- package/dist/components/settlement/settlement.less +4 -1
- package/dist/components/settlement/settlementApi.js +512 -0
- package/dist/components/settlement/settlementApi.js.map +1 -0
- package/dist/components/ticon/iconfont/demo.css +539 -539
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/commonForm/addressPicker/index.js +0 -241
- package/dist/components/commonForm/addressPicker/index.js.map +0 -1
- package/dist/components/commonForm/autoComplete/index.js +0 -260
- package/dist/components/commonForm/autoComplete/index.js.map +0 -1
- package/dist/components/commonForm/datePicker/index.js +0 -92
- package/dist/components/commonForm/datePicker/index.js.map +0 -1
- package/dist/components/commonForm/formControl/index.js +0 -144
- package/dist/components/commonForm/formControl/index.js.map +0 -1
- package/dist/components/commonForm/inputNumber/index.js +0 -272
- package/dist/components/commonForm/inputNumber/index.js.map +0 -1
- package/dist/components/commonForm/radio/index.js +0 -132
- package/dist/components/commonForm/radio/index.js.map +0 -1
- package/dist/components/input/tplusInput/index.js +0 -81
- package/dist/components/input/tplusInput/index.js.map +0 -1
- package/dist/components/input/tplusInput/inputContent.js +0 -128
- package/dist/components/input/tplusInput/inputContent.js.map +0 -1
- package/dist/components/input/tplusInput/inputs.js +0 -151
- package/dist/components/input/tplusInput/inputs.js.map +0 -1
- package/dist/components/input/utils/index.js +0 -26
- package/dist/components/input/utils/index.js.map +0 -1
- package/dist/components/settlement/moreCzkTable/index.js +0 -156
- package/dist/components/settlement/moreCzkTable/index.js.map +0 -1
- package/dist/components/settlement/prototypeTable/index.js +0 -353
- package/dist/components/settlement/prototypeTable/index.js.map +0 -1
- package/dist/components/settlement/prototypeTable/utils.js +0 -14
- package/dist/components/settlement/prototypeTable/utils.js.map +0 -1
- package/dist/components/settlement/settlementStore.js +0 -2869
- package/dist/components/settlement/settlementStore.js.map +0 -1
- package/dist/components/settlement/utils.js +0 -249
- package/dist/components/settlement/utils.js.map +0 -1
- package/dist/components/socket/index.js +0 -221
- package/dist/components/socket/index.js.map +0 -1
- package/dist/components/spin/index.js +0 -95
- package/dist/components/spin/index.js.map +0 -1
- package/dist/components/test/index.js +0 -330
- package/dist/components/test/index.js.map +0 -1
- package/dist/components/ticon/iconfont/iconfont.js +0 -35
- package/dist/components/ticon/iconfont/iconfont.js.map +0 -1
- package/dist/components/ticon/index.js +0 -60
- package/dist/components/ticon/index.js.map +0 -1
- package/dist/components/touchScroll/index.js +0 -186
- package/dist/components/touchScroll/index.js.map +0 -1
- package/dist/components/touchTable/AuthProcess.js +0 -42
- package/dist/components/touchTable/AuthProcess.js.map +0 -1
- package/dist/components/touchTable/generateWater.js +0 -59
- package/dist/components/touchTable/generateWater.js.map +0 -1
- package/dist/components/touchTable/index.js +0 -1133
- package/dist/components/touchTable/index.js.map +0 -1
- package/dist/components/touchTable/utils.js +0 -14
- package/dist/components/touchTable/utils.js.map +0 -1
@@ -1,1133 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = exports.InputNumberCell = undefined;
|
7
|
-
|
8
|
-
var _table = require('antd/es/table');
|
9
|
-
|
10
|
-
var _table2 = _interopRequireDefault(_table);
|
11
|
-
|
12
|
-
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
13
|
-
|
14
|
-
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
15
|
-
|
16
|
-
var _regenerator = require('babel-runtime/regenerator');
|
17
|
-
|
18
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
19
|
-
|
20
|
-
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
21
|
-
|
22
|
-
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
23
|
-
|
24
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
25
|
-
|
26
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
27
|
-
|
28
|
-
var _typeof2 = require('babel-runtime/helpers/typeof');
|
29
|
-
|
30
|
-
var _typeof3 = _interopRequireDefault(_typeof2);
|
31
|
-
|
32
|
-
var _checkbox = require('antd/es/checkbox');
|
33
|
-
|
34
|
-
var _checkbox2 = _interopRequireDefault(_checkbox);
|
35
|
-
|
36
|
-
var _set = require('babel-runtime/core-js/set');
|
37
|
-
|
38
|
-
var _set2 = _interopRequireDefault(_set);
|
39
|
-
|
40
|
-
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
41
|
-
|
42
|
-
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
43
|
-
|
44
|
-
var _getIterator2 = require('babel-runtime/core-js/get-iterator');
|
45
|
-
|
46
|
-
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
47
|
-
|
48
|
-
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
49
|
-
|
50
|
-
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
51
|
-
|
52
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
53
|
-
|
54
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
55
|
-
|
56
|
-
var _createClass2 = require('babel-runtime/helpers/createClass');
|
57
|
-
|
58
|
-
var _createClass3 = _interopRequireDefault(_createClass2);
|
59
|
-
|
60
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
61
|
-
|
62
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
63
|
-
|
64
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
65
|
-
|
66
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
67
|
-
|
68
|
-
var _class, _temp; /**
|
69
|
-
*
|
70
|
-
* waterMark 水印文字内容
|
71
|
-
* waterMarkOption 水印参数 Object类型 (width, height, font, color,rotate)
|
72
|
-
*
|
73
|
-
* badge Boolean 徽章 在dataSource(data) 属性中每一行的数据定义badge字段会自动生成,不需要定义对应的columns
|
74
|
-
* dataSource: [{badge: {text: '赠', position: 'leftTop', className: ''}}]
|
75
|
-
* badge: text 文字内容 | position 徽章位置(leftTop/rightTop/leftBottom/rightBottom) | className
|
76
|
-
*
|
77
|
-
*/
|
78
|
-
|
79
|
-
|
80
|
-
require('antd/es/table/style');
|
81
|
-
|
82
|
-
require('antd/es/checkbox/style');
|
83
|
-
|
84
|
-
var _react = require('react');
|
85
|
-
|
86
|
-
var _react2 = _interopRequireDefault(_react);
|
87
|
-
|
88
|
-
var _propTypes = require('prop-types');
|
89
|
-
|
90
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
91
|
-
|
92
|
-
var _index = require('../../index');
|
93
|
-
|
94
|
-
var _generateWater = require('./generateWater.js');
|
95
|
-
|
96
|
-
var _utils = require('./utils');
|
97
|
-
|
98
|
-
var _tools = require('../../util/tools.js');
|
99
|
-
|
100
|
-
var _tools2 = _interopRequireDefault(_tools);
|
101
|
-
|
102
|
-
require('./index.less');
|
103
|
-
|
104
|
-
var _get2 = require('lodash/get');
|
105
|
-
|
106
|
-
var _get3 = _interopRequireDefault(_get2);
|
107
|
-
|
108
|
-
var _mobx = require('mobx');
|
109
|
-
|
110
|
-
var _mobx2 = _interopRequireDefault(_mobx);
|
111
|
-
|
112
|
-
var _beeTable = require('bee-table');
|
113
|
-
|
114
|
-
var _beeTable2 = _interopRequireDefault(_beeTable);
|
115
|
-
|
116
|
-
require('bee-table/build/Table.css');
|
117
|
-
|
118
|
-
var _message = require('../message');
|
119
|
-
|
120
|
-
var _message2 = _interopRequireDefault(_message);
|
121
|
-
|
122
|
-
var _AuthProcess = require('./AuthProcess');
|
123
|
-
|
124
|
-
var _mutantsAppfx = require('mutants-appfx');
|
125
|
-
|
126
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
127
|
-
|
128
|
-
var emptyTabImage = 'https://newretail.static.chanjet.com/empty.png';
|
129
|
-
|
130
|
-
var InputNumberCell = exports.InputNumberCell = function (_Component) {
|
131
|
-
(0, _inherits3.default)(InputNumberCell, _Component);
|
132
|
-
|
133
|
-
function InputNumberCell() {
|
134
|
-
(0, _classCallCheck3.default)(this, InputNumberCell);
|
135
|
-
return (0, _possibleConstructorReturn3.default)(this, (InputNumberCell.__proto__ || (0, _getPrototypeOf2.default)(InputNumberCell)).apply(this, arguments));
|
136
|
-
}
|
137
|
-
|
138
|
-
(0, _createClass3.default)(InputNumberCell, [{
|
139
|
-
key: 'render',
|
140
|
-
value: function render() {
|
141
|
-
var _props = this.props,
|
142
|
-
val = _props.val,
|
143
|
-
text = _props.text,
|
144
|
-
record = _props.record,
|
145
|
-
index = _props.index,
|
146
|
-
selectedRowKeys = _props.selectedRowKeys,
|
147
|
-
rowItem = _props.rowItem,
|
148
|
-
_props$rowHeight = _props.rowHeight,
|
149
|
-
rowHeight = _props$rowHeight === undefined ? 50 : _props$rowHeight,
|
150
|
-
handleClick = _props.handleClick,
|
151
|
-
mergeQuantityUnit = _props.mergeQuantityUnit;
|
152
|
-
|
153
|
-
var _ref = record || {},
|
154
|
-
Unit = _ref.Unit;
|
155
|
-
|
156
|
-
var unitname = Unit && Unit.Name;
|
157
|
-
var fileName = rowItem.FieldName ? rowItem.FieldName : rowItem.key;
|
158
|
-
val = !!mergeQuantityUnit && fileName == 'Quantity' ? val + unitname || '' : val;
|
159
|
-
if (selectedRowKeys && selectedRowKeys.length > 0) {
|
160
|
-
var _iteratorNormalCompletion = true;
|
161
|
-
var _didIteratorError = false;
|
162
|
-
var _iteratorError = undefined;
|
163
|
-
|
164
|
-
try {
|
165
|
-
for (var _iterator = (0, _getIterator3.default)(selectedRowKeys), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
166
|
-
var item = _step.value;
|
167
|
-
|
168
|
-
if (index === parseInt(item) && rowItem.readOnly === false) {
|
169
|
-
return _react2.default.createElement(
|
170
|
-
'div',
|
171
|
-
{ className: '' + (rowItem.quick == true ? 'selectedCell' : 'unSelectedCell') },
|
172
|
-
rowItem.quick == true && _react2.default.createElement(_index.Ticon, { type: 'jianqu', className: 'iconKey primary-color', style: { height: rowHeight + 'px', lineHeight: rowHeight + 'px' }, onClick: function onClick(e) {
|
173
|
-
return handleClick(e, 'minus', text, record, index, rowItem);
|
174
|
-
} }),
|
175
|
-
_react2.default.createElement(
|
176
|
-
'span',
|
177
|
-
{ onClick: function onClick(e) {
|
178
|
-
return handleClick(e, 'modal', text, record, index, rowItem);
|
179
|
-
}, className: 'iconText row-cell-div row-cell-pad mouse hot-key-' + (rowItem.FieldName ? rowItem.FieldName : rowItem.key) },
|
180
|
-
val
|
181
|
-
),
|
182
|
-
_react2.default.createElement('span', { className: 'editorLine' }),
|
183
|
-
rowItem.quick == true && _react2.default.createElement(_index.Ticon, { type: 'zengjia', className: 'iconKey primary-color', style: { height: rowHeight + 'px', lineHeight: rowHeight + 'px' }, onClick: function onClick(e) {
|
184
|
-
return handleClick(e, 'plus', text, record, index, rowItem);
|
185
|
-
} })
|
186
|
-
);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
} catch (err) {
|
190
|
-
_didIteratorError = true;
|
191
|
-
_iteratorError = err;
|
192
|
-
} finally {
|
193
|
-
try {
|
194
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
195
|
-
_iterator.return();
|
196
|
-
}
|
197
|
-
} finally {
|
198
|
-
if (_didIteratorError) {
|
199
|
-
throw _iteratorError;
|
200
|
-
}
|
201
|
-
}
|
202
|
-
}
|
203
|
-
}
|
204
|
-
return _react2.default.createElement(
|
205
|
-
'div',
|
206
|
-
{ className: 'unSelectedCell' },
|
207
|
-
_react2.default.createElement(
|
208
|
-
'span',
|
209
|
-
{ className: 'iconText row-cell-div row-cell-pad' },
|
210
|
-
val
|
211
|
-
)
|
212
|
-
);
|
213
|
-
}
|
214
|
-
}]);
|
215
|
-
return InputNumberCell;
|
216
|
-
}(_react.Component);
|
217
|
-
|
218
|
-
var TouchTable = (_temp = _class = function (_Component2) {
|
219
|
-
(0, _inherits3.default)(TouchTable, _Component2);
|
220
|
-
|
221
|
-
function TouchTable(props) {
|
222
|
-
var _this3 = this;
|
223
|
-
|
224
|
-
(0, _classCallCheck3.default)(this, TouchTable);
|
225
|
-
|
226
|
-
var _this2 = (0, _possibleConstructorReturn3.default)(this, (TouchTable.__proto__ || (0, _getPrototypeOf2.default)(TouchTable)).call(this, props));
|
227
|
-
|
228
|
-
_this2.renderCheckbox = function (text, record, index) {
|
229
|
-
Array.prototype.remove = function (val) {
|
230
|
-
var index = this.indexOf(val);
|
231
|
-
if (index > -1) {
|
232
|
-
this.splice(index, 1);
|
233
|
-
}
|
234
|
-
};
|
235
|
-
var _onChange = function _onChange(checked, index) {
|
236
|
-
var arr = _this2.state.selectedRowKeys;
|
237
|
-
if (checked === true) {
|
238
|
-
arr.push(index);
|
239
|
-
} else if (checked === false) {
|
240
|
-
arr.remove(index);
|
241
|
-
}
|
242
|
-
_this2.setSelectedRowKeys([].concat((0, _toConsumableArray3.default)(new _set2.default(arr))));
|
243
|
-
var fn = _this2.props.cboxClick;
|
244
|
-
if (typeof fn == 'function') {
|
245
|
-
fn(checked, index);
|
246
|
-
}
|
247
|
-
};
|
248
|
-
var status = _this2.findSelectedRowKeys(index);
|
249
|
-
return _react2.default.createElement(
|
250
|
-
'div',
|
251
|
-
{ style: { margin: 'auto', width: '20px' } },
|
252
|
-
_react2.default.createElement(_checkbox2.default, { className: 'test', checked: status, onChange: function onChange(event) {
|
253
|
-
return _onChange(event, index);
|
254
|
-
} })
|
255
|
-
);
|
256
|
-
};
|
257
|
-
|
258
|
-
_this2.renderLineNum = function (text, record, index) {
|
259
|
-
return index + 1;
|
260
|
-
//return this.prefixZero(index + 1, 2);
|
261
|
-
};
|
262
|
-
|
263
|
-
_this2.renderNumber = function (text, record, index, item) {
|
264
|
-
var mergeQuantityUnit = _this2.props.mergeQuantityUnit;
|
265
|
-
|
266
|
-
var precision = parseInt(item.precision);
|
267
|
-
var isPercent = 'Format' in item && item.Format == 'Percent';
|
268
|
-
text = isPercent ? _this2.changeDecimalMul(text, 100) : text;
|
269
|
-
var val = _this2.changeDecimalBuZero(text, precision);
|
270
|
-
val = isPercent ? val + "%" : val;
|
271
|
-
var rowIndexs = _this2.state.selectedRowKeys;
|
272
|
-
return _react2.default.createElement(InputNumberCell, {
|
273
|
-
val: val,
|
274
|
-
text: text,
|
275
|
-
record: record,
|
276
|
-
index: index,
|
277
|
-
selectedRowKeys: rowIndexs,
|
278
|
-
rowItem: item,
|
279
|
-
mergeQuantityUnit: mergeQuantityUnit,
|
280
|
-
handleClick: _this2.handleClick });
|
281
|
-
};
|
282
|
-
|
283
|
-
_this2.renderAction = function (text, record, index) {
|
284
|
-
var status = _this2.findSelectedRowKeys(index);
|
285
|
-
if (status == true) {
|
286
|
-
return _react2.default.createElement(
|
287
|
-
'span',
|
288
|
-
{ className: 'spanDel', onClick: function onClick(e) {
|
289
|
-
return _this2.handleClick(e, 'del', index, record);
|
290
|
-
} },
|
291
|
-
_react2.default.createElement(_index.Ticon, { type: 'shanchu', className: 'iconDel primary-color' })
|
292
|
-
);
|
293
|
-
} else {
|
294
|
-
return '';
|
295
|
-
}
|
296
|
-
};
|
297
|
-
|
298
|
-
_this2.renderOther = function (showText, record, index, item) {
|
299
|
-
var _this2$props = _this2.props,
|
300
|
-
badge = _this2$props.badge,
|
301
|
-
_this2$props$height = _this2$props.height,
|
302
|
-
height = _this2$props$height === undefined ? 50 : _this2$props$height,
|
303
|
-
type = _this2$props.type;
|
304
|
-
//针对存货为赠品属性的处理逻辑。
|
305
|
-
|
306
|
-
if (item && item.Name == 'Inventory' && badge && record.badge) {
|
307
|
-
var _record$badge = record.badge;
|
308
|
-
_record$badge = _record$badge === undefined ? {} : _record$badge;
|
309
|
-
var text = _record$badge.text,
|
310
|
-
_record$badge$positio = _record$badge.position,
|
311
|
-
position = _record$badge$positio === undefined ? 'leftTop' : _record$badge$positio,
|
312
|
-
_record$badge$classNa = _record$badge.className,
|
313
|
-
className = _record$badge$classNa === undefined ? '' : _record$badge$classNa;
|
314
|
-
|
315
|
-
var badgeClassName = _utils.badgeClassNames[position];
|
316
|
-
var baseNum = position.includes('Bottom') ? 25 : 0;
|
317
|
-
var style = {};
|
318
|
-
if (type === 'bee') {
|
319
|
-
style = {
|
320
|
-
top: baseNum
|
321
|
-
};
|
322
|
-
}
|
323
|
-
return _react2.default.createElement(
|
324
|
-
'div',
|
325
|
-
{ className: 'tplus-table-badge' },
|
326
|
-
_react2.default.createElement(
|
327
|
-
'div',
|
328
|
-
{ className: 'badge-item ' + className + ' ' + badgeClassName, style: style },
|
329
|
-
_react2.default.createElement(
|
330
|
-
'span',
|
331
|
-
null,
|
332
|
-
text
|
333
|
-
)
|
334
|
-
),
|
335
|
-
_react2.default.createElement(
|
336
|
-
'div',
|
337
|
-
{ className: 'row-cell-div row-cell-pad' },
|
338
|
-
showText
|
339
|
-
)
|
340
|
-
);
|
341
|
-
}
|
342
|
-
//增加宽度是为了控制超出之后显示省略号。
|
343
|
-
return _react2.default.createElement(
|
344
|
-
'div',
|
345
|
-
{ className: 'row-cell-div row-cell-pad' },
|
346
|
-
showText
|
347
|
-
);
|
348
|
-
};
|
349
|
-
|
350
|
-
_this2.renderUserDefined = function (text, record, index, item) {
|
351
|
-
var fn = item.callbackFunc;
|
352
|
-
if (typeof fn == 'function') {
|
353
|
-
return fn();
|
354
|
-
} else {
|
355
|
-
return '';
|
356
|
-
}
|
357
|
-
};
|
358
|
-
|
359
|
-
_this2.getRowClassName = function (record, index) {
|
360
|
-
var status = _this2.findSelectedRowKeys(index);
|
361
|
-
if (status == true) {
|
362
|
-
return 'row-selected';
|
363
|
-
} else {
|
364
|
-
return '';
|
365
|
-
}
|
366
|
-
};
|
367
|
-
|
368
|
-
_this2.renderIntegralExchangeItem = function (text, record, index, item, exchangeIntegralValue) {
|
369
|
-
return _react2.default.createElement(
|
370
|
-
'div',
|
371
|
-
{ onClick: function onClick(e) {
|
372
|
-
return _this2.handleClick(e, 'modal', text, record, index, item);
|
373
|
-
}, className: 'Integral-exchange-item hot-key-' + (item.FieldName ? item.FieldName : item.key) },
|
374
|
-
_react2.default.createElement(
|
375
|
-
'span',
|
376
|
-
{ className: 'money iconText row-cell-div mouse' },
|
377
|
-
exchangeIntegralValue + "积分"
|
378
|
-
),
|
379
|
-
_react2.default.createElement(
|
380
|
-
'span',
|
381
|
-
{ className: 'value iconText row-cell-div mouse' },
|
382
|
-
'¥' + text
|
383
|
-
)
|
384
|
-
);
|
385
|
-
};
|
386
|
-
|
387
|
-
_this2.getRenderColumns = function (cols, dataSource) {
|
388
|
-
var _this2$props2 = _this2.props,
|
389
|
-
badge = _this2$props2.badge,
|
390
|
-
_this2$props2$height = _this2$props2.height,
|
391
|
-
height = _this2$props2$height === undefined ? 50 : _this2$props2$height,
|
392
|
-
mergeQuantityUnit = _this2$props2.mergeQuantityUnit,
|
393
|
-
type = _this2$props2.type;
|
394
|
-
|
395
|
-
var arr = [];
|
396
|
-
var check = typeof _this2.props.checkbox == 'boolean' ? _this2.props.checkbox : false;
|
397
|
-
if (check === true) {
|
398
|
-
arr.push({
|
399
|
-
key: 'checkbox',
|
400
|
-
dataIndex: 'checkbox',
|
401
|
-
title: '',
|
402
|
-
width: 25,
|
403
|
-
textAlign: 'center',
|
404
|
-
readOnly: true,
|
405
|
-
render: function render(text, record, index) {
|
406
|
-
return _this2.renderCheckbox(text, record, index);
|
407
|
-
}
|
408
|
-
});
|
409
|
-
}
|
410
|
-
var lineType = typeof _this2.props.lineNum == 'boolean' ? _this2.props.lineNum : false;
|
411
|
-
if (lineType === true) {
|
412
|
-
arr.push({
|
413
|
-
key: 'rowNum',
|
414
|
-
dataIndex: 'rowNum',
|
415
|
-
title: '行号',
|
416
|
-
width: 50,
|
417
|
-
textAlign: 'center',
|
418
|
-
readOnly: true,
|
419
|
-
fixed: 'left',
|
420
|
-
render: function render(text, record, index) {
|
421
|
-
return _this2.renderLineNum(text, record, index);
|
422
|
-
}
|
423
|
-
});
|
424
|
-
}
|
425
|
-
if (cols && cols.length > 0) {
|
426
|
-
var _loop = function _loop(_item) {
|
427
|
-
if (_item.controlType === 'NumTextBox') {
|
428
|
-
_item.render = function (text, record, index) {
|
429
|
-
// 增加积分抵现特殊显示方式
|
430
|
-
var dsItem = dataSource && dataSource[index];
|
431
|
-
if (dsItem && dsItem.IsIntegralExchange && (_item.FieldName == "TaxPrice" || _item.FieldName == "TaxAmount")) {
|
432
|
-
var singleExchangeIntegral = dataSource[index].ExchangeIntegral;
|
433
|
-
var exchangeIntegralValue = _item.FieldName == "TaxPrice" ? singleExchangeIntegral : singleExchangeIntegral * dataSource[index].Quantity;
|
434
|
-
if (exchangeIntegralValue > 0) {
|
435
|
-
exchangeIntegralValue = Math.ceil(exchangeIntegralValue);
|
436
|
-
} else {
|
437
|
-
exchangeIntegralValue = Math.floor(exchangeIntegralValue);
|
438
|
-
}
|
439
|
-
return _this2.renderIntegralExchangeItem(text, record, index, _item, exchangeIntegralValue);
|
440
|
-
}
|
441
|
-
return _this2.renderNumber(text, record, index, _item);
|
442
|
-
};
|
443
|
-
} else if (_item.controlType === 'Userdefined') {
|
444
|
-
_item.render = function (text, record, index) {
|
445
|
-
return _this2.renderUserDefined(text, record, index, _item);
|
446
|
-
};
|
447
|
-
} else if (_item.controlType === 'DatePicker' || _item.controlType === 'DateDropDown') {
|
448
|
-
_item.render = function (text, record, index) {
|
449
|
-
var renderText = _tools2.default.dateFormat(text, _item.Format);
|
450
|
-
return _react2.default.createElement(
|
451
|
-
'span',
|
452
|
-
null,
|
453
|
-
renderText
|
454
|
-
);
|
455
|
-
};
|
456
|
-
} else {
|
457
|
-
_item.render = function (text, record, index) {
|
458
|
-
if (text && (typeof text === 'undefined' ? 'undefined' : (0, _typeof3.default)(text)) == 'object') {
|
459
|
-
text = (0, _get3.default)(record, _item.FieldName);
|
460
|
-
}
|
461
|
-
if (text && (typeof text === 'undefined' ? 'undefined' : (0, _typeof3.default)(text)) == 'object' && 'Name' in text) {
|
462
|
-
text = text['Name'];
|
463
|
-
}
|
464
|
-
return _this2.renderOther(text, record, index, _item);
|
465
|
-
};
|
466
|
-
}
|
467
|
-
if (type !== 'bee') {
|
468
|
-
if (_item.dataIndex.lastIndexOf(".") > 0) {
|
469
|
-
_item.dataIndex = _item.dataIndex.split('.');
|
470
|
-
}
|
471
|
-
_item.align = _item.textAlign;
|
472
|
-
}
|
473
|
-
if (mergeQuantityUnit && _item.FieldName == 'Quantity') {
|
474
|
-
_item = (0, _extends3.default)({}, _item, { title: '数量/单位' });
|
475
|
-
}
|
476
|
-
arr.push(_item);
|
477
|
-
item = _item;
|
478
|
-
};
|
479
|
-
|
480
|
-
var _iteratorNormalCompletion2 = true;
|
481
|
-
var _didIteratorError2 = false;
|
482
|
-
var _iteratorError2 = undefined;
|
483
|
-
|
484
|
-
try {
|
485
|
-
for (var _iterator2 = (0, _getIterator3.default)(cols), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
486
|
-
var item = _step2.value;
|
487
|
-
|
488
|
-
_loop(item);
|
489
|
-
}
|
490
|
-
} catch (err) {
|
491
|
-
_didIteratorError2 = true;
|
492
|
-
_iteratorError2 = err;
|
493
|
-
} finally {
|
494
|
-
try {
|
495
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
496
|
-
_iterator2.return();
|
497
|
-
}
|
498
|
-
} finally {
|
499
|
-
if (_didIteratorError2) {
|
500
|
-
throw _iteratorError2;
|
501
|
-
}
|
502
|
-
}
|
503
|
-
}
|
504
|
-
}
|
505
|
-
//最后一列留白,解决最后一列自适应宽度的问题
|
506
|
-
var lastColumnResize = typeof _this2.props.lastColumnResize == 'boolean' ? _this2.props.lastColumnResize : false;
|
507
|
-
if (lastColumnResize == true) {
|
508
|
-
arr.push({
|
509
|
-
key: 'resize',
|
510
|
-
dataIndex: 'resize',
|
511
|
-
title: '',
|
512
|
-
width: 10,
|
513
|
-
textAlign: 'center',
|
514
|
-
readOnly: true
|
515
|
-
});
|
516
|
-
}
|
517
|
-
var delType = typeof _this2.props.delRow == 'boolean' ? _this2.props.delRow : true;
|
518
|
-
var dynamics = typeof _this2.props.isFixDelColumn == 'boolean' && _this2.props.isFixDelColumn == true ? { fixed: 'right', width: 50 } : { width: 28 };
|
519
|
-
if (delType === true) {
|
520
|
-
arr.push((0, _extends3.default)({
|
521
|
-
key: 'del'
|
522
|
-
}, dynamics, {
|
523
|
-
dataIndex: 'del',
|
524
|
-
title: '',
|
525
|
-
className: 'shanchu',
|
526
|
-
textAlign: 'center', //beeTable居中
|
527
|
-
align: 'center', //antTable居中
|
528
|
-
render: function render(text, record, index) {
|
529
|
-
return _this2.renderAction(text, record, index);
|
530
|
-
}
|
531
|
-
}));
|
532
|
-
}
|
533
|
-
return arr;
|
534
|
-
};
|
535
|
-
|
536
|
-
_this2.stopPropagation = function (_event) {
|
537
|
-
if (_event && _event.stopPropagation) {
|
538
|
-
_event.stopPropagation();
|
539
|
-
}
|
540
|
-
};
|
541
|
-
|
542
|
-
_this2.handleClick = function (_event, type) {
|
543
|
-
for (var _len = arguments.length, rest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
544
|
-
rest[_key - 2] = arguments[_key];
|
545
|
-
}
|
546
|
-
|
547
|
-
_this2.isHitRow = true;
|
548
|
-
var lists = _this2.props.dataSource;
|
549
|
-
switch (type) {
|
550
|
-
case 'rowClick':
|
551
|
-
_this2.rowClick.apply(_this2, rest);
|
552
|
-
break;
|
553
|
-
case 'del':
|
554
|
-
_this2.delClick.apply(_this2, [lists].concat(rest));
|
555
|
-
_this2.stopPropagation(_event);
|
556
|
-
break;
|
557
|
-
case 'minus':
|
558
|
-
_this2.minusClick.apply(_this2, [lists].concat(rest));
|
559
|
-
_this2.stopPropagation(_event);
|
560
|
-
break;
|
561
|
-
case 'plus':
|
562
|
-
_this2.plusClick.apply(_this2, [lists].concat(rest));
|
563
|
-
_this2.stopPropagation(_event);
|
564
|
-
break;
|
565
|
-
case 'modal':
|
566
|
-
_this2.modalClick.apply(_this2, rest);
|
567
|
-
break;
|
568
|
-
}
|
569
|
-
};
|
570
|
-
|
571
|
-
_this2.controllerEvent = function (methodName, methodArgs) {
|
572
|
-
_this2.context.onEvent({ 'controllerEvent': _mutantsAppfx.Action.fromJS(_this2.context.viewModel, methodName) }, 'controllerEvent', methodArgs);
|
573
|
-
};
|
574
|
-
|
575
|
-
_this2.selfHandleClick = function () {
|
576
|
-
var _this2$props$rowIndex = _this2.props.rowIndex,
|
577
|
-
rowIndex = _this2$props$rowIndex === undefined ? undefined : _this2$props$rowIndex;
|
578
|
-
|
579
|
-
if (rowIndex == undefined) {
|
580
|
-
return true;
|
581
|
-
}
|
582
|
-
return false;
|
583
|
-
};
|
584
|
-
|
585
|
-
_this2.rowClick = function (record, index, fn) {
|
586
|
-
if (_this2.selfHandleClick()) {
|
587
|
-
//当不设置行点击事件时,组件内部处理。
|
588
|
-
if (_this2.state.selectedRowKeys.indexOf(index) > -1) return;
|
589
|
-
_this2.setSelectedRowKeys(index, true);
|
590
|
-
} else {
|
591
|
-
//当设置点击事件,组件外处理
|
592
|
-
_this2.outerCallback(_this2.type.click, record, index);
|
593
|
-
}
|
594
|
-
};
|
595
|
-
|
596
|
-
_this2.delClick = function () {
|
597
|
-
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(lists, index, record) {
|
598
|
-
var status;
|
599
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
600
|
-
while (1) {
|
601
|
-
switch (_context.prev = _context.next) {
|
602
|
-
case 0:
|
603
|
-
status = _AuthProcess.AuthProcess.execute('ReverseOperation');
|
604
|
-
|
605
|
-
if (!status) {
|
606
|
-
_this2.props.authorityValidate && _this2.props.authorityValidate({ callback: function callback(result) {
|
607
|
-
if (result) {
|
608
|
-
if (_this2.selfHandleClick()) {
|
609
|
-
lists.splice(index, 1);
|
610
|
-
_this2.clearSelectedRows();
|
611
|
-
} else {
|
612
|
-
_this2.outerCallback(_this2.type.delete, record, index);
|
613
|
-
AddLogProcessor.execute("删除行", record.Code, '删除行成功');
|
614
|
-
}
|
615
|
-
}
|
616
|
-
} });
|
617
|
-
} else {
|
618
|
-
if (_this2.selfHandleClick()) {
|
619
|
-
lists.splice(index, 1);
|
620
|
-
_this2.clearSelectedRows();
|
621
|
-
} else {
|
622
|
-
_this2.outerCallback(_this2.type.delete, record, index);
|
623
|
-
}
|
624
|
-
}
|
625
|
-
_this2.controllerEvent('setInventoryFocus');
|
626
|
-
|
627
|
-
case 3:
|
628
|
-
case 'end':
|
629
|
-
return _context.stop();
|
630
|
-
}
|
631
|
-
}
|
632
|
-
}, _callee, _this3);
|
633
|
-
}));
|
634
|
-
|
635
|
-
return function (_x, _x2, _x3) {
|
636
|
-
return _ref2.apply(this, arguments);
|
637
|
-
};
|
638
|
-
}();
|
639
|
-
|
640
|
-
_this2.minusClick = function (lists, text, record, index, rowItem) {
|
641
|
-
var val = text;
|
642
|
-
var min = rowItem.minValue;
|
643
|
-
var quantityUiState = record.uiState && record.uiState.Quantity;
|
644
|
-
//单元格状态控制
|
645
|
-
var cellMin = quantityUiState && quantityUiState.min.value;
|
646
|
-
var cellMinTip = quantityUiState && quantityUiState.min.tip;
|
647
|
-
|
648
|
-
var item = (0, _extends3.default)({}, lists[index]);
|
649
|
-
var afterValue = _this2.accSub(val, 1);
|
650
|
-
|
651
|
-
if (min !== undefined) {
|
652
|
-
if (min >= val) return;
|
653
|
-
afterValue = min >= afterValue ? min : afterValue;
|
654
|
-
}
|
655
|
-
//单元格状态控制
|
656
|
-
if (!_tools2.default.isNull(cellMin)) {
|
657
|
-
if (cellMin >= val) {
|
658
|
-
if (!_tools2.default.isNull(cellMinTip)) _message2.default.info(cellMinTip);
|
659
|
-
return;
|
660
|
-
}
|
661
|
-
afterValue = cellMin >= afterValue ? cellMin : afterValue;
|
662
|
-
}
|
663
|
-
|
664
|
-
item[rowItem.key] = afterValue;
|
665
|
-
item.operateType = 'minus';
|
666
|
-
_this2.outerCallback(_this2.type.update, item, index);
|
667
|
-
};
|
668
|
-
|
669
|
-
_this2.plusClick = function (lists, text, record, index, rowItem) {
|
670
|
-
var list1 = lists[index];
|
671
|
-
if (list1 && list1.isSerialNumber && list1.SerialNumber && list1.Quantity === 1) {
|
672
|
-
_message2.default.warn('已录入序列号后,不可增加数量');
|
673
|
-
return;
|
674
|
-
}
|
675
|
-
var val = text;
|
676
|
-
var max = rowItem.maxValue;
|
677
|
-
var quantityUiState = record.uiState && record.uiState.Quantity;
|
678
|
-
//单元格状态控制
|
679
|
-
var cellMax = quantityUiState && quantityUiState.max.value;
|
680
|
-
var cellMaxTip = quantityUiState && quantityUiState.max.tip;
|
681
|
-
|
682
|
-
var item = (0, _extends3.default)({}, lists[index]);
|
683
|
-
var afterValue = _this2.accAdd(val, 1);
|
684
|
-
if (record.WaitPickUpArr && record.WaitPickUpArr.length > 0) {
|
685
|
-
var WaitPickUpObj = record.WaitPickUpArr.find(function (o) {
|
686
|
-
return o.unitId == record.Idunit;
|
687
|
-
}) || {};
|
688
|
-
if (text > WaitPickUpObj.waitPickUpQty) {
|
689
|
-
_message2.default.warn('\u4E0D\u80FD\u8D85\u8FC7\u6700\u5927\u53EF\u53D6\u6570\u91CF' + WaitPickUpObj.waitPickUpQty);
|
690
|
-
return;
|
691
|
-
} else if (afterValue > WaitPickUpObj.waitPickUpQty && text != WaitPickUpObj.waitPickUpQty) {
|
692
|
-
afterValue = WaitPickUpObj.waitPickUpQty;
|
693
|
-
}
|
694
|
-
}
|
695
|
-
if (max !== undefined) {
|
696
|
-
if (max <= val) return;
|
697
|
-
afterValue = max <= afterValue ? max : afterValue;
|
698
|
-
}
|
699
|
-
//单元格状态控制
|
700
|
-
if (!_tools2.default.isNull(cellMax)) {
|
701
|
-
if (cellMax <= val) {
|
702
|
-
if (!_tools2.default.isNull(cellMaxTip)) _message2.default.info(cellMaxTip);
|
703
|
-
return;
|
704
|
-
}
|
705
|
-
afterValue = cellMax <= afterValue ? cellMax : afterValue;
|
706
|
-
}
|
707
|
-
item[rowItem.key] = afterValue;
|
708
|
-
_this2.outerCallback(_this2.type.update, item, index);
|
709
|
-
};
|
710
|
-
|
711
|
-
_this2.modalClick = function (text, record, index, rowItem) {
|
712
|
-
var fn = _this2.props.rowClick;
|
713
|
-
if (typeof fn == 'function') {
|
714
|
-
fn(_this2.type.updateField, index, record, rowItem.key, rowItem);
|
715
|
-
}
|
716
|
-
};
|
717
|
-
|
718
|
-
_this2.setRow = function (index) {
|
719
|
-
_this2.setSelectedRowKeys(index);
|
720
|
-
};
|
721
|
-
|
722
|
-
_this2.setSelectedRowKeys = function (params) {
|
723
|
-
var _this2$props3 = _this2.props,
|
724
|
-
rowIndex = _this2$props3.rowIndex,
|
725
|
-
isScrolling = _this2$props3.isScrolling;
|
726
|
-
|
727
|
-
var arr = new Array();
|
728
|
-
if (params instanceof Array) {
|
729
|
-
arr.push.apply(arr, (0, _toConsumableArray3.default)(params));
|
730
|
-
} else {
|
731
|
-
arr.push(params);
|
732
|
-
}
|
733
|
-
var tops = {};
|
734
|
-
var isHitRow = event && event.type == 'click' && (event.target.nodeName == 'DIV' || event.target.nodeName == 'I');
|
735
|
-
if (isScrolling && rowIndex && rowIndex > -1 && !(_this2.isHitRow === true ? true : isHitRow)) {
|
736
|
-
var scrollTop = _this2.getScrollTopValue();
|
737
|
-
tops = { scrollTop: scrollTop };
|
738
|
-
} else {
|
739
|
-
tops = { scrollTop: null };
|
740
|
-
}
|
741
|
-
_this2.setState((0, _extends3.default)({ selectedRowKeys: arr }, tops));
|
742
|
-
if (_this2.isHitRow === true) {
|
743
|
-
setTimeout(function () {
|
744
|
-
_this2.isHitRow = false;
|
745
|
-
}, 600);
|
746
|
-
}
|
747
|
-
};
|
748
|
-
|
749
|
-
_this2.findSelectedRowKeys = function (index) {
|
750
|
-
var rowIndexs = _this2.state.selectedRowKeys;
|
751
|
-
if (rowIndexs && rowIndexs.length > 0) {
|
752
|
-
for (var i = 0; i < rowIndexs.length; i++) {
|
753
|
-
var _item2 = rowIndexs[i];
|
754
|
-
if (_item2 === index) {
|
755
|
-
return true;
|
756
|
-
}
|
757
|
-
}
|
758
|
-
}
|
759
|
-
return false;
|
760
|
-
};
|
761
|
-
|
762
|
-
_this2.clearSelectedRows = function () {
|
763
|
-
_this2.setSelectedRowKeys([]);
|
764
|
-
};
|
765
|
-
|
766
|
-
_this2.outerCallback = function (type, record, index) {
|
767
|
-
var cb = _this2.props.rowClick;
|
768
|
-
if (typeof cb == 'function') cb(type, index, record);
|
769
|
-
};
|
770
|
-
|
771
|
-
_this2.changeDecimalBuZero = function (number, bitNum) {
|
772
|
-
if (bitNum == 0) return number;
|
773
|
-
var f_x = parseFloat(number);
|
774
|
-
if (isNaN(f_x)) {
|
775
|
-
return '';
|
776
|
-
}
|
777
|
-
// f_x = Math.round(number * 100) / 100;
|
778
|
-
var newBitNum = Math.pow(10, bitNum);
|
779
|
-
f_x = Math.round(number * newBitNum) / newBitNum;
|
780
|
-
var s_x = (f_x + '').toString();
|
781
|
-
var pos_decimal = s_x.indexOf('.');
|
782
|
-
if (pos_decimal < 0) {
|
783
|
-
pos_decimal = s_x.length;
|
784
|
-
s_x += '.';
|
785
|
-
}
|
786
|
-
while (s_x.length <= pos_decimal + bitNum) {
|
787
|
-
s_x += '0';
|
788
|
-
}
|
789
|
-
return s_x;
|
790
|
-
};
|
791
|
-
|
792
|
-
_this2.changeDecimalMul = function (a, b) {
|
793
|
-
var c = 0,
|
794
|
-
d = (a + '').toString(),
|
795
|
-
e = (b + '').toString();
|
796
|
-
try {
|
797
|
-
c += d.split(".")[1].length;
|
798
|
-
} catch (f) {}
|
799
|
-
try {
|
800
|
-
c += e.split(".")[1].length;
|
801
|
-
} catch (f) {}
|
802
|
-
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
|
803
|
-
};
|
804
|
-
|
805
|
-
_this2.prefixZero = function (num, n) {
|
806
|
-
return (Array(n).join(0) + num).slice(-n);
|
807
|
-
};
|
808
|
-
|
809
|
-
_this2.accAdd = function (arg1, arg2) {
|
810
|
-
var r1 = void 0,
|
811
|
-
r2 = void 0,
|
812
|
-
m = void 0,
|
813
|
-
c = void 0;
|
814
|
-
try {
|
815
|
-
r1 = (arg1 + '').toString().split(".")[1].length;
|
816
|
-
} catch (e) {
|
817
|
-
r1 = 0;
|
818
|
-
}
|
819
|
-
try {
|
820
|
-
r2 = (arg2 + '').toString().split(".")[1].length;
|
821
|
-
} catch (e) {
|
822
|
-
r2 = 0;
|
823
|
-
}
|
824
|
-
c = Math.abs(r1 - r2);
|
825
|
-
m = Math.pow(10, Math.max(r1, r2));
|
826
|
-
if (c > 0) {
|
827
|
-
var cm = Math.pow(10, c);
|
828
|
-
if (r1 > r2) {
|
829
|
-
arg1 = Number((arg1 + '').toString().replace(".", ""));
|
830
|
-
arg2 = Number((arg2 + '').toString().replace(".", "")) * cm;
|
831
|
-
} else {
|
832
|
-
arg1 = Number((arg1 + '').toString().replace(".", "")) * cm;
|
833
|
-
arg2 = Number((arg2 + '').toString().replace(".", ""));
|
834
|
-
}
|
835
|
-
} else {
|
836
|
-
arg1 = Number((arg1 + '').toString().replace(".", ""));
|
837
|
-
arg2 = Number((arg2 + '').toString().replace(".", ""));
|
838
|
-
}
|
839
|
-
return (arg1 + arg2) / m;
|
840
|
-
};
|
841
|
-
|
842
|
-
_this2.accSub = function (arg1, arg2) {
|
843
|
-
var r1 = void 0,
|
844
|
-
r2 = void 0,
|
845
|
-
m = void 0,
|
846
|
-
n = void 0;
|
847
|
-
try {
|
848
|
-
r1 = (arg1 + '').toString().split(".")[1].length;
|
849
|
-
} catch (e) {
|
850
|
-
r1 = 0;
|
851
|
-
}
|
852
|
-
try {
|
853
|
-
r2 = (arg2 + '').toString().split(".")[1].length;
|
854
|
-
} catch (e) {
|
855
|
-
r2 = 0;
|
856
|
-
}
|
857
|
-
m = Math.pow(10, Math.max(r1, r2)); //last modify by deeka //动态控制精度长度
|
858
|
-
n = r1 >= r2 ? r1 : r2;
|
859
|
-
return ((arg1 * m - arg2 * m) / m).toFixed(n);
|
860
|
-
};
|
861
|
-
|
862
|
-
_this2.emptyFunc = function (tabHeight) {
|
863
|
-
var emptyStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'txt';
|
864
|
-
|
865
|
-
var type = null;
|
866
|
-
switch (emptyStyle) {
|
867
|
-
case 'icon':
|
868
|
-
type = 1;
|
869
|
-
break;
|
870
|
-
case 'txt':
|
871
|
-
type = 2;
|
872
|
-
break;
|
873
|
-
case 'icon-txt':
|
874
|
-
type = 3;
|
875
|
-
break;
|
876
|
-
default:
|
877
|
-
type = 0;
|
878
|
-
}
|
879
|
-
return _react2.default.createElement(
|
880
|
-
'div',
|
881
|
-
{ className: 'defaultContainer', style: { height: tabHeight + 'px' } },
|
882
|
-
_react2.default.createElement(
|
883
|
-
'div',
|
884
|
-
{ style: { display: type === 0 ? 'none' : '' } },
|
885
|
-
_react2.default.createElement('img', { className: 'img', style: { display: type === 1 || type === 3 ? '' : 'none' }, src: emptyTabImage }),
|
886
|
-
_react2.default.createElement(
|
887
|
-
'div',
|
888
|
-
{ style: { display: type === 2 || type === 3 ? '' : 'none' } },
|
889
|
-
'\u6682\u65E0\u6570\u636E~~'
|
890
|
-
)
|
891
|
-
)
|
892
|
-
);
|
893
|
-
};
|
894
|
-
|
895
|
-
_this2.getScrollHeight = function () {
|
896
|
-
var _this2$props4 = _this2.props,
|
897
|
-
tableHeight = _this2$props4.tableHeight,
|
898
|
-
_this2$props4$headerH = _this2$props4.headerHeight,
|
899
|
-
headerHeight = _this2$props4$headerH === undefined ? 50 : _this2$props4$headerH,
|
900
|
-
type = _this2$props4.type;
|
901
|
-
|
902
|
-
if (typeof tableHeight == 'number') return tableHeight - headerHeight;
|
903
|
-
var tab = void 0;
|
904
|
-
if (type === 'bee') {
|
905
|
-
tab = _this2.tableElement.current;
|
906
|
-
} else {
|
907
|
-
tab = document.getElementsByClassName("antTable")[0];
|
908
|
-
}
|
909
|
-
if (tab) {
|
910
|
-
var t = type === 'bee' ? tab.contentTable.parentNode.clientHeight : tab.clientHeight;
|
911
|
-
return t - headerHeight > 0 ? t - headerHeight : headerHeight;
|
912
|
-
} else {
|
913
|
-
return 0;
|
914
|
-
}
|
915
|
-
};
|
916
|
-
|
917
|
-
_this2.initScrollHeight = function () {
|
918
|
-
var scrollHeight = _this2.getScrollHeight();
|
919
|
-
_this2.setState({ scrollY: scrollHeight });
|
920
|
-
};
|
921
|
-
|
922
|
-
_this2.getScrollTopValue = function () {
|
923
|
-
var top = 0;
|
924
|
-
var _this2$props5 = _this2.props,
|
925
|
-
_this2$props5$height = _this2$props5.height,
|
926
|
-
height = _this2$props5$height === undefined ? 50 : _this2$props5$height,
|
927
|
-
type = _this2$props5.type;
|
928
|
-
|
929
|
-
var bodyTable = void 0;
|
930
|
-
if (type === 'bee') {
|
931
|
-
var tab = _this2.tableElement.current;
|
932
|
-
bodyTable = tab && tab.bodyTable;
|
933
|
-
} else {
|
934
|
-
var parentNodeEl = document.getElementsByClassName("antTable")[0];
|
935
|
-
bodyTable = parentNodeEl.getElementsByClassName('ant-table-body')[0];
|
936
|
-
}
|
937
|
-
if (bodyTable.scrollHeight > bodyTable.clientHeight) {
|
938
|
-
var selectedRowKeys = _this2.state.selectedRowKeys;
|
939
|
-
|
940
|
-
var rowTop = 0;
|
941
|
-
if (selectedRowKeys && selectedRowKeys.length > 0) {
|
942
|
-
var index = selectedRowKeys[0];
|
943
|
-
var tabTop = bodyTable.scrollTop;
|
944
|
-
var curTop = bodyTable.lastChild.lastChild.childNodes[index].offsetTop;
|
945
|
-
rowTop = curTop - bodyTable.clientHeight + height + 10;
|
946
|
-
rowTop = Math.abs(tabTop - curTop) < 100 ? tabTop : rowTop;
|
947
|
-
}
|
948
|
-
top = rowTop > 0 ? rowTop : 0;
|
949
|
-
}
|
950
|
-
return top;
|
951
|
-
};
|
952
|
-
|
953
|
-
_this2.state = {
|
954
|
-
selectedRowKeys: [],
|
955
|
-
tabColumns: [],
|
956
|
-
scrollY: 0,
|
957
|
-
scrollTop: null
|
958
|
-
};
|
959
|
-
_this2.checkboxedList = [];
|
960
|
-
_this2.type = {
|
961
|
-
click: 'click',
|
962
|
-
update: 'update',
|
963
|
-
delete: 'delete',
|
964
|
-
updateField: 'updateField'
|
965
|
-
};
|
966
|
-
_this2.isHitRow = false;
|
967
|
-
_this2.tableElement = _react2.default.createRef();
|
968
|
-
_this2.getTableElement = _this2.getTableElement.bind(_this2);
|
969
|
-
_this2.getRowClassName = _this2.getRowClassName.bind(_this2);
|
970
|
-
return _this2;
|
971
|
-
}
|
972
|
-
|
973
|
-
(0, _createClass3.default)(TouchTable, [{
|
974
|
-
key: 'getTableElement',
|
975
|
-
value: function getTableElement() {
|
976
|
-
return this.tableElement;
|
977
|
-
}
|
978
|
-
}, {
|
979
|
-
key: 'generateWaterMark',
|
980
|
-
value: function generateWaterMark() {
|
981
|
-
var _props2 = this.props,
|
982
|
-
waterMark = _props2.waterMark,
|
983
|
-
_props2$waterMarkOpti = _props2.waterMarkOption,
|
984
|
-
waterMarkOption = _props2$waterMarkOpti === undefined ? {} : _props2$waterMarkOpti,
|
985
|
-
type = _props2.type;
|
986
|
-
|
987
|
-
var contentTable = void 0;
|
988
|
-
|
989
|
-
if (type === 'bee') {
|
990
|
-
contentTable = this.tableElement.current;
|
991
|
-
} else {
|
992
|
-
var parentNodeEl = document.getElementsByClassName("antTable")[0];
|
993
|
-
contentTable = {
|
994
|
-
contentTable: parentNodeEl.children[0]
|
995
|
-
};
|
996
|
-
}
|
997
|
-
if (waterMark != this.waterMark) {
|
998
|
-
(0, _generateWater.generateWaterMark)(contentTable, (0, _extends3.default)({ text: waterMark }, waterMarkOption));
|
999
|
-
this.waterMark = waterMark;
|
1000
|
-
}
|
1001
|
-
this.props.handleCallback && this.props.handleCallback();
|
1002
|
-
}
|
1003
|
-
//自定义列
|
1004
|
-
|
1005
|
-
|
1006
|
-
/*以下为触发事件*/
|
1007
|
-
|
1008
|
-
|
1009
|
-
/*以下为抽离公共方法*/
|
1010
|
-
|
1011
|
-
/* 浮点数做相乘处理 */
|
1012
|
-
|
1013
|
-
|
1014
|
-
//相加
|
1015
|
-
|
1016
|
-
|
1017
|
-
//相减
|
1018
|
-
|
1019
|
-
}, {
|
1020
|
-
key: 'componentDidMount',
|
1021
|
-
value: function componentDidMount() {
|
1022
|
-
var _this4 = this;
|
1023
|
-
|
1024
|
-
setTimeout(function () {
|
1025
|
-
if (_this4.props.rowIndex !== void 0) {
|
1026
|
-
_this4.setSelectedRowKeys(_this4.props.rowIndex);
|
1027
|
-
}
|
1028
|
-
_this4.initScrollHeight();
|
1029
|
-
}, 0);
|
1030
|
-
this.generateWaterMark();
|
1031
|
-
}
|
1032
|
-
}, {
|
1033
|
-
key: 'componentDidUpdate',
|
1034
|
-
value: function componentDidUpdate() {
|
1035
|
-
this.generateWaterMark();
|
1036
|
-
}
|
1037
|
-
}, {
|
1038
|
-
key: 'componentWillReceiveProps',
|
1039
|
-
value: function componentWillReceiveProps(nextProps) {
|
1040
|
-
if ('rowIndex' in nextProps) {
|
1041
|
-
this.setSelectedRowKeys(nextProps.rowIndex);
|
1042
|
-
this.initScrollHeight();
|
1043
|
-
}
|
1044
|
-
}
|
1045
|
-
}, {
|
1046
|
-
key: 'render',
|
1047
|
-
value: function render() {
|
1048
|
-
var _this5 = this;
|
1049
|
-
|
1050
|
-
var _props3 = this.props,
|
1051
|
-
autoScroll = _props3.autoScroll,
|
1052
|
-
width = _props3.width,
|
1053
|
-
tableHeight = _props3.tableHeight,
|
1054
|
-
_props3$headerHeight = _props3.headerHeight,
|
1055
|
-
headerHeight = _props3$headerHeight === undefined ? 50 : _props3$headerHeight,
|
1056
|
-
_props3$height = _props3.height,
|
1057
|
-
height = _props3$height === undefined ? 50 : _props3$height,
|
1058
|
-
pagination = _props3.pagination,
|
1059
|
-
dataSource = _props3.dataSource,
|
1060
|
-
columns = _props3.columns,
|
1061
|
-
rowClick = _props3.rowClick,
|
1062
|
-
cboxClick = _props3.cboxClick,
|
1063
|
-
_props3$className = _props3.className,
|
1064
|
-
className = _props3$className === undefined ? '' : _props3$className,
|
1065
|
-
checkbox = _props3.checkbox,
|
1066
|
-
emptyStyle = _props3.emptyStyle,
|
1067
|
-
rowIndex = _props3.rowIndex,
|
1068
|
-
type = _props3.type,
|
1069
|
-
items = (0, _objectWithoutProperties3.default)(_props3, ['autoScroll', 'width', 'tableHeight', 'headerHeight', 'height', 'pagination', 'dataSource', 'columns', 'rowClick', 'cboxClick', 'className', 'checkbox', 'emptyStyle', 'rowIndex', 'type']);
|
1070
|
-
var _state = this.state,
|
1071
|
-
scrollY = _state.scrollY,
|
1072
|
-
scrollTop = _state.scrollTop;
|
1073
|
-
// let copyColumns = columns.map(el=>{return {...el}});
|
1074
|
-
|
1075
|
-
var tabColumns = this.getRenderColumns(columns, dataSource);
|
1076
|
-
var dyItems = scrollTop != null ? { scrollTop: scrollTop } : {};
|
1077
|
-
return _react2.default.createElement(
|
1078
|
-
'div',
|
1079
|
-
{ className: (type === 'bee' ? 'touchTable' : 'antTable') + ' ' + className },
|
1080
|
-
type === 'bee' ? _react2.default.createElement(_beeTable2.default, (0, _extends3.default)({}, items, dyItems, {
|
1081
|
-
ref: this.tableElement,
|
1082
|
-
style: { width: width ? width : '100%', height: tableHeight ? tableHeight : '100%' },
|
1083
|
-
rowKey: function rowKey(row) {
|
1084
|
-
return row.Code;
|
1085
|
-
},
|
1086
|
-
headerHeight: headerHeight,
|
1087
|
-
pagination: pagination ? pagination : false,
|
1088
|
-
data: dataSource,
|
1089
|
-
columns: tabColumns,
|
1090
|
-
height: height,
|
1091
|
-
rowClassName: this.getRowClassName,
|
1092
|
-
emptyText: function emptyText() {
|
1093
|
-
return _this5.emptyFunc(tableHeight, emptyStyle);
|
1094
|
-
},
|
1095
|
-
scroll: autoScroll ? {} : { y: scrollY },
|
1096
|
-
headerScroll: false,
|
1097
|
-
onRowClick: function onRowClick(record, index) {
|
1098
|
-
_this5.handleClick(null, 'rowClick', record, index, rowClick);
|
1099
|
-
}
|
1100
|
-
})) : _react2.default.createElement(_table2.default, (0, _extends3.default)({
|
1101
|
-
id: 'ref-table'
|
1102
|
-
}, items, dyItems, {
|
1103
|
-
style: { width: width ? width : '100%', height: tableHeight ? tableHeight : '100%' },
|
1104
|
-
rowKey: function rowKey(row) {
|
1105
|
-
return row.Code;
|
1106
|
-
},
|
1107
|
-
pagination: pagination ? pagination : false,
|
1108
|
-
dataSource: dataSource,
|
1109
|
-
columns: tabColumns,
|
1110
|
-
rowClassName: this.getRowClassName,
|
1111
|
-
locale: { emptyText: this.emptyFunc(tableHeight - 60, emptyStyle) },
|
1112
|
-
scroll: autoScroll ? { y: null } : { y: tableHeight - 60 },
|
1113
|
-
onRow: function onRow(record, index) {
|
1114
|
-
return {
|
1115
|
-
onClick: function onClick() {
|
1116
|
-
return _this5.handleClick(null, 'rowClick', record, index, rowClick);
|
1117
|
-
}
|
1118
|
-
};
|
1119
|
-
}
|
1120
|
-
}))
|
1121
|
-
);
|
1122
|
-
}
|
1123
|
-
}]);
|
1124
|
-
return TouchTable;
|
1125
|
-
}(_react.Component), _class.propTypes = {
|
1126
|
-
waterMark: _propTypes2.default.string,
|
1127
|
-
waterMarkOption: _propTypes2.default.object
|
1128
|
-
}, _class.contextTypes = {
|
1129
|
-
onEvent: _propTypes2.default.func,
|
1130
|
-
viewModel: _propTypes2.default.object
|
1131
|
-
}, _temp);
|
1132
|
-
exports.default = TouchTable;
|
1133
|
-
//# sourceMappingURL=index.js.map
|