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