easy3wui 1.5.77 → 1.5.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/assets/card.css +14 -0
- package/assets/formPage.css +74 -0
- package/assets/gridPage.css +6 -0
- package/assets/index.css +94 -0
- package/lib/Easy3wFormPage/index.js +28 -4010
- package/lib/Easy3wFormPage/indexM.js +4258 -0
- package/lib/Easy3wFormPage/indexPC.js +4006 -0
- package/lib/Easy3wGridPage/index.js +7 -656
- package/lib/Easy3wGridPage/indexM.js +680 -0
- package/lib/Easy3wGridPage/indexPC.js +668 -0
- package/package.json +1 -1
|
@@ -2,671 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
|
|
5
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
|
6
|
-
|
|
7
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
|
8
|
-
|
|
9
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
10
|
-
|
|
11
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
12
|
-
|
|
13
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
14
|
-
|
|
15
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
16
|
-
|
|
17
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
18
|
-
|
|
19
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
20
|
-
|
|
21
|
-
var _react = require('react');
|
|
22
|
-
|
|
23
|
-
var _react2 = _interopRequireDefault(_react);
|
|
24
|
-
|
|
25
|
-
var _propTypes = require('prop-types');
|
|
26
|
-
|
|
27
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
28
|
-
|
|
29
|
-
var _table = require('antd/lib/table');
|
|
30
|
-
|
|
31
|
-
var _table2 = _interopRequireDefault(_table);
|
|
32
|
-
|
|
33
|
-
require('antd/lib/table/style');
|
|
34
|
-
|
|
35
|
-
var _tag = require('antd/lib/tag');
|
|
36
|
-
|
|
37
|
-
var _tag2 = _interopRequireDefault(_tag);
|
|
38
|
-
|
|
39
|
-
require('antd/lib/tag/style');
|
|
40
|
-
|
|
41
|
-
require('antd/lib/card/style');
|
|
42
|
-
|
|
43
|
-
var _alert = require('antd/lib/alert');
|
|
44
|
-
|
|
45
|
-
var _alert2 = _interopRequireDefault(_alert);
|
|
46
|
-
|
|
47
|
-
require('antd/lib/alert/style');
|
|
48
|
-
|
|
49
|
-
var _classnames = require('classnames');
|
|
50
|
-
|
|
51
|
-
var _classnames2 = _interopRequireDefault(_classnames);
|
|
52
|
-
|
|
53
|
-
var _tooltip = require('antd/lib/tooltip');
|
|
54
|
-
|
|
55
|
-
var _tooltip2 = _interopRequireDefault(_tooltip);
|
|
56
|
-
|
|
57
|
-
require('antd/lib/tooltip/style');
|
|
58
|
-
|
|
59
|
-
var _numeral = require('numeral');
|
|
60
|
-
|
|
61
|
-
var _numeral2 = _interopRequireDefault(_numeral);
|
|
62
|
-
|
|
63
5
|
var _dva = require('dva');
|
|
64
6
|
|
|
65
|
-
var
|
|
7
|
+
var _indexM = require('./indexM');
|
|
66
8
|
|
|
67
|
-
var
|
|
9
|
+
var _indexM2 = _interopRequireDefault(_indexM);
|
|
68
10
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var Easy3wGridPage = function (_Component) {
|
|
72
|
-
(0, _inherits3['default'])(Easy3wGridPage, _Component);
|
|
73
|
-
|
|
74
|
-
function Easy3wGridPage(props) {
|
|
75
|
-
(0, _classCallCheck3['default'])(this, Easy3wGridPage);
|
|
76
|
-
|
|
77
|
-
var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
|
78
|
-
|
|
79
|
-
_initialiseProps.call(_this);
|
|
11
|
+
var _indexPC = require('./indexPC');
|
|
80
12
|
|
|
81
|
-
|
|
82
|
-
selectedVal = _this$props.selectedVal,
|
|
83
|
-
selectedKey = _this$props.selectedKey,
|
|
84
|
-
rowKey = _this$props.rowKey,
|
|
85
|
-
rowKeyCname = _this$props.rowKeyCname;
|
|
13
|
+
var _indexPC2 = _interopRequireDefault(_indexPC);
|
|
86
14
|
|
|
87
|
-
|
|
88
|
-
if (selectedVal) {
|
|
89
|
-
selectedVal.forEach(function (obj) {
|
|
90
|
-
selRowKeysTags.push(_react2['default'].createElement(
|
|
91
|
-
_tag2['default'],
|
|
92
|
-
{ key: obj[rowKey], closable: true, afterClose: function afterClose() {
|
|
93
|
-
return _this.onCloseTag(obj[rowKey]);
|
|
94
|
-
} },
|
|
95
|
-
obj[rowKeyCname]
|
|
96
|
-
));
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
_this.state = {
|
|
100
|
-
selectedRowKeysState: selectedKey || [],
|
|
101
|
-
selectedRowsState: selectedVal || [],
|
|
102
|
-
selRowKeysTags: selRowKeysTags,
|
|
103
|
-
pagination: { offset: 1, limit: 10 }
|
|
104
|
-
};
|
|
105
|
-
_this.myRef = (0, _react.createRef)(); // 创建 ref
|
|
106
|
-
return _this;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
Easy3wGridPage.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
110
|
-
if (nextProps.cleanFlag === '1') {
|
|
111
|
-
this.delAll();
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
Easy3wGridPage.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
116
|
-
var that = this;
|
|
117
|
-
if (this.props.totalResult && this.props.totalResult !== prevProps.totalResult) {
|
|
118
|
-
that.setState({ pagination: { offset: 1, limit: 10 } });
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
Easy3wGridPage.prototype.render = function render() {
|
|
123
|
-
var _this2 = this;
|
|
124
|
-
|
|
125
|
-
var _props = this.props,
|
|
126
|
-
columns = _props.columns,
|
|
127
|
-
totalResult = _props.totalResult,
|
|
128
|
-
dataList = _props.dataList,
|
|
129
|
-
loading = _props.loading,
|
|
130
|
-
getCheckboxProps = _props.getCheckboxProps,
|
|
131
|
-
needPaginationFlag = _props.needPaginationFlag,
|
|
132
|
-
autoAddNumber = _props.autoAddNumber,
|
|
133
|
-
gridProps = _props.gridProps,
|
|
134
|
-
rowKey = _props.rowKey,
|
|
135
|
-
checkType = _props.checkType,
|
|
136
|
-
bordered = _props.bordered,
|
|
137
|
-
chooseFlag = _props.chooseFlag,
|
|
138
|
-
scroll = _props.scroll,
|
|
139
|
-
className = _props.className,
|
|
140
|
-
paginationInfo = _props.paginationInfo,
|
|
141
|
-
handleSearchNew = _props.handleSearchNew;
|
|
142
|
-
var _state = this.state,
|
|
143
|
-
selectedRowKeysState = _state.selectedRowKeysState,
|
|
144
|
-
selectedRowsState = _state.selectedRowsState,
|
|
145
|
-
selRowKeysTags = _state.selRowKeysTags;
|
|
146
|
-
|
|
147
|
-
var printArr = location.hash.split('/');
|
|
148
|
-
var printValue = this.props.printValue || 'print';
|
|
149
|
-
var printFlag = printArr[1] === printValue;
|
|
150
|
-
var hasFormParentClass = this.myRef.current && this.myRef.current.closest('.e3wFormPageWrap'); // 是否处于表单页面
|
|
151
|
-
var paginationProps = false; // 默认不分页
|
|
152
|
-
var recursion = function recursion(arr) {
|
|
153
|
-
arr.forEach(function (item) {
|
|
154
|
-
var columnsType = item.type;
|
|
155
|
-
// const { title } = item;
|
|
156
|
-
// if (!(printFlag || hasFormParentClass) && title && typeof title === 'string' && title.length > 6) {
|
|
157
|
-
// item.title = <Tooltip placement="topLeft" title={title}>{title.substring(0, 6)}...</Tooltip>;
|
|
158
|
-
// }
|
|
159
|
-
switch (columnsType) {
|
|
160
|
-
case 'shortText':
|
|
161
|
-
item.className = 'e3wGridShortText';break;
|
|
162
|
-
case 'longText':
|
|
163
|
-
item.className = 'e3wGridLongText';break;
|
|
164
|
-
case 'number':
|
|
165
|
-
item.className = 'e3wGridNumber';break;
|
|
166
|
-
case 'maxText':
|
|
167
|
-
item.className = 'e3wMaxText';break;
|
|
168
|
-
case 'numeralFormat':
|
|
169
|
-
item.className = 'e3wGridNumber';break;
|
|
170
|
-
default:
|
|
171
|
-
item.className = 'e3wGridShortText';
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
if (item.children) {
|
|
175
|
-
recursion(item.children);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
var recursionT = function recursionT(arr) {
|
|
180
|
-
arr.forEach(function (item) {
|
|
181
|
-
if (!item.render) {
|
|
182
|
-
item.render = function (text) {
|
|
183
|
-
var globalData = _this2.props.globalData;
|
|
184
|
-
|
|
185
|
-
var _ref = globalData || {},
|
|
186
|
-
dataDesensitizationEyeFlag = _ref.dataDesensitizationEyeFlag;
|
|
187
|
-
|
|
188
|
-
var strTextNew = _comonConfig.dataDesensitizationFlag ? dataDesensitizationEyeFlag ? text : (0, _easy3wui.Easy3wGetDesensitization)(text) : text;
|
|
189
|
-
if (strTextNew && strTextNew.length * 14 > 160) {
|
|
190
|
-
return _react2['default'].createElement(
|
|
191
|
-
_tooltip2['default'],
|
|
192
|
-
{ placement: 'topLeft', title: strTextNew, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
193
|
-
strTextNew
|
|
194
|
-
);
|
|
195
|
-
} else {
|
|
196
|
-
return strTextNew;
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
if (item.type === 'numeralFormat') {
|
|
200
|
-
item.render = function (text) {
|
|
201
|
-
return _react2['default'].createElement(
|
|
202
|
-
_tooltip2['default'],
|
|
203
|
-
{ placement: 'topLeft', title: _this2.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
204
|
-
_this2.numeralFormat(text)
|
|
205
|
-
);
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
}if (item.fixed) {
|
|
209
|
-
item.className = 'e3wText';
|
|
210
|
-
item.minWidth = 5;
|
|
211
|
-
}
|
|
212
|
-
if (item.children) {
|
|
213
|
-
recursionT(item.children);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
recursion(columns);
|
|
218
|
-
if (dataList) {
|
|
219
|
-
if (dataList.length > 0) {
|
|
220
|
-
recursionT(columns);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
var rowSelection = null;
|
|
224
|
-
if (checkType) {
|
|
225
|
-
// 若需选择框
|
|
226
|
-
rowSelection = {
|
|
227
|
-
hideDefaultSelections: true, // 去掉『全选』『反选』两个默认选项
|
|
228
|
-
key: rowKey,
|
|
229
|
-
type: checkType,
|
|
230
|
-
getCheckboxProps: getCheckboxProps,
|
|
231
|
-
selectedRowKeys: selectedRowKeysState,
|
|
232
|
-
selectedRows: selectedRowsState,
|
|
233
|
-
onSelect: function onSelect(record, selected) {
|
|
234
|
-
if (selected) {
|
|
235
|
-
_this2.selectedAdd([record]);
|
|
236
|
-
} else {
|
|
237
|
-
_this2.selectedRemove([record]);
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
onSelectAll: function onSelectAll(selected, selectedRows, changeRows) {
|
|
241
|
-
if (selected) {
|
|
242
|
-
_this2.selectedAdd(changeRows);
|
|
243
|
-
} else {
|
|
244
|
-
_this2.selectedRemove(changeRows);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
var myColumns = columns;
|
|
250
|
-
// 处理分页 start
|
|
251
|
-
if (needPaginationFlag || handleSearchNew) {
|
|
252
|
-
var defaultCurrent = paginationInfo ? paginationInfo.offset : 1;
|
|
253
|
-
var defaultPageSize = paginationInfo ? paginationInfo.limit : 10;
|
|
254
|
-
var current = paginationInfo ? paginationInfo.offset : this.state.pagination.offset;
|
|
255
|
-
var limit = paginationInfo ? paginationInfo.limit : this.state.pagination.limit;
|
|
256
|
-
paginationProps = {
|
|
257
|
-
total: totalResult,
|
|
258
|
-
showTotal: function showTotal(total, range) {
|
|
259
|
-
return range[0] + '-' + range[1] + ' \u5171 ' + totalResult + ' \u6761';
|
|
260
|
-
},
|
|
261
|
-
defaultCurrent: defaultCurrent,
|
|
262
|
-
defaultPageSize: defaultPageSize,
|
|
263
|
-
current: current,
|
|
264
|
-
showSizeChanger: true,
|
|
265
|
-
showQuickJumper: true,
|
|
266
|
-
pageSizeOptions: ['10', '20', '30', '40', '50', '100']
|
|
267
|
-
};
|
|
268
|
-
if (autoAddNumber) {
|
|
269
|
-
if (columns.length > 0) {
|
|
270
|
-
var fixed = columns[0].fixed;
|
|
271
|
-
|
|
272
|
-
myColumns = [{
|
|
273
|
-
title: '序号',
|
|
274
|
-
dataIndex: 'number',
|
|
275
|
-
className: 'e3wGridShortText',
|
|
276
|
-
width: 50,
|
|
277
|
-
fixed: fixed,
|
|
278
|
-
render: function render(text, record, index) {
|
|
279
|
-
return _react2['default'].createElement(
|
|
280
|
-
'div',
|
|
281
|
-
null,
|
|
282
|
-
(current - 1) * limit + index + 1,
|
|
283
|
-
' '
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
}].concat(columns);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (printFlag) {
|
|
291
|
-
myColumns.forEach(function (item) {
|
|
292
|
-
if (item.fixed) {
|
|
293
|
-
item.fixed = null;
|
|
294
|
-
}
|
|
295
|
-
item.width = null;
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
var alertRegionFlag = false;
|
|
299
|
-
if (selRowKeysTags && selRowKeysTags instanceof Array && selRowKeysTags.length) {
|
|
300
|
-
alertRegionFlag = true;
|
|
301
|
-
}
|
|
302
|
-
var alertRegion = _react2['default'].createElement(_alert2['default'], { message: _react2['default'].createElement(
|
|
303
|
-
'div',
|
|
304
|
-
{ className: (0, _classnames2['default'])(['positionRel']) },
|
|
305
|
-
selRowKeysTags,
|
|
306
|
-
_react2['default'].createElement(
|
|
307
|
-
'a',
|
|
308
|
-
{ onClick: this.delAll, className: (0, _classnames2['default'])(['positionAbs']) },
|
|
309
|
-
'\u6E05\u7A7A'
|
|
310
|
-
)
|
|
311
|
-
), type: 'info' });
|
|
312
|
-
|
|
313
|
-
// console.log('父级是否有 .e3wFormPageWrap:', hasParentClass);
|
|
314
|
-
return _react2['default'].createElement(
|
|
315
|
-
'div',
|
|
316
|
-
{ ref: this.myRef, className: gridProps || this.props.rowType ? gridProps.onRow || this.props.rowType ? 'onRow' : null : null },
|
|
317
|
-
_react2['default'].createElement(_table2['default'], (0, _extends3['default'])({
|
|
318
|
-
className: printFlag || hasFormParentClass ? 'scrollPrint' : className || 'scrollX',
|
|
319
|
-
columns: myColumns,
|
|
320
|
-
dataSource: dataList,
|
|
321
|
-
pagination: paginationProps,
|
|
322
|
-
loading: loading,
|
|
323
|
-
rowKey: rowKey,
|
|
324
|
-
rowSelection: rowSelection,
|
|
325
|
-
bordered: bordered,
|
|
326
|
-
scroll: printFlag ? {} : scroll || { x: true },
|
|
327
|
-
onChange: this.handleTableChange,
|
|
328
|
-
onRow: this.props.rowType ? function (record) {
|
|
329
|
-
return {
|
|
330
|
-
onClick: function onClick(event) {
|
|
331
|
-
return _this2.rowSelected(record, event);
|
|
332
|
-
} // 点击行
|
|
333
|
-
};
|
|
334
|
-
} : null
|
|
335
|
-
}, gridProps, {
|
|
336
|
-
locale: { emptyText: '暂无数据' }
|
|
337
|
-
})),
|
|
338
|
-
chooseFlag && alertRegionFlag ? alertRegion : ''
|
|
339
|
-
);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
return Easy3wGridPage;
|
|
343
|
-
}(_react.Component);
|
|
344
|
-
|
|
345
|
-
Easy3wGridPage.propTypes = {
|
|
346
|
-
columns: _propTypes2['default'].array.isRequired,
|
|
347
|
-
bordered: _propTypes2['default'].bool
|
|
348
|
-
};
|
|
349
|
-
Easy3wGridPage.defaultProps = {
|
|
350
|
-
bordered: true
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
var _initialiseProps = function _initialiseProps() {
|
|
354
|
-
var _this3 = this;
|
|
355
|
-
|
|
356
|
-
this.onCloseTag = function (closeKey) {
|
|
357
|
-
var _state2 = _this3.state,
|
|
358
|
-
selectedRowKeysState = _state2.selectedRowKeysState,
|
|
359
|
-
selectedRowsState = _state2.selectedRowsState;
|
|
360
|
-
var _props2 = _this3.props,
|
|
361
|
-
rowKey = _props2.rowKey,
|
|
362
|
-
rowKeyCname = _props2.rowKeyCname,
|
|
363
|
-
selectChangeCallback = _props2.selectChangeCallback,
|
|
364
|
-
chooseFlag = _props2.chooseFlag;
|
|
365
|
-
|
|
366
|
-
selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
|
|
367
|
-
return selectedRowKey === closeKey;
|
|
368
|
-
}), 1);
|
|
369
|
-
selectedRowsState.splice(selectedRowsState.findIndex(function (selectedRow) {
|
|
370
|
-
return selectedRow[rowKey] === closeKey;
|
|
371
|
-
}), 1);
|
|
372
|
-
var newSelRowKeysTags = [];
|
|
373
|
-
if (chooseFlag) {
|
|
374
|
-
selectedRowsState.forEach(function (selectedRow) {
|
|
375
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
376
|
-
_tag2['default'],
|
|
377
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
378
|
-
return _this3.onCloseTag(selectedRow[rowKey]);
|
|
379
|
-
} },
|
|
380
|
-
selectedRow[rowKeyCname]
|
|
381
|
-
));
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
_this3.setState({
|
|
385
|
-
selectedRowKeysState: selectedRowKeysState,
|
|
386
|
-
selectedRowsState: selectedRowsState,
|
|
387
|
-
selRowKeysTags: newSelRowKeysTags
|
|
388
|
-
});
|
|
389
|
-
if (selectChangeCallback) {
|
|
390
|
-
selectChangeCallback(selectedRowKeysState, selectedRowsState);
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
this.onRowSelectedClose = function (selectedKey) {
|
|
395
|
-
var _state3 = _this3.state,
|
|
396
|
-
selectedRowKeysState = _state3.selectedRowKeysState,
|
|
397
|
-
selectedRowsState = _state3.selectedRowsState;
|
|
398
|
-
|
|
399
|
-
var selectedRowKeysStateArr = selectedRowKeysState;
|
|
400
|
-
var selectedRowsStateArr = selectedRowsState;
|
|
401
|
-
var _props3 = _this3.props,
|
|
402
|
-
rowKey = _props3.rowKey,
|
|
403
|
-
rowKeyCname = _props3.rowKeyCname,
|
|
404
|
-
selectChangeCallback = _props3.selectChangeCallback,
|
|
405
|
-
chooseFlag = _props3.chooseFlag;
|
|
406
|
-
|
|
407
|
-
var newSelRowKeysTags = [];
|
|
408
|
-
selectedRowKeysStateArr.splice(selectedRowKeysStateArr.findIndex(function (selectedRowKey) {
|
|
409
|
-
return selectedRowKey === selectedKey;
|
|
410
|
-
}), 1);
|
|
411
|
-
selectedRowsStateArr.splice(selectedRowsStateArr.findIndex(function (selectedRow) {
|
|
412
|
-
return selectedRow[rowKey] === selectedKey;
|
|
413
|
-
}), 1);
|
|
414
|
-
if (chooseFlag) {
|
|
415
|
-
selectedRowsStateArr.forEach(function (selectedRow) {
|
|
416
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
417
|
-
_tag2['default'],
|
|
418
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
419
|
-
return _this3.onRowSelectedClose(selectedRow[rowKey]);
|
|
420
|
-
} },
|
|
421
|
-
selectedRow[rowKeyCname]
|
|
422
|
-
));
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
_this3.setState({
|
|
426
|
-
selectedRowKeysState: selectedRowKeysStateArr,
|
|
427
|
-
selectedRowsState: selectedRowsStateArr,
|
|
428
|
-
selRowKeysTags: newSelRowKeysTags
|
|
429
|
-
});
|
|
430
|
-
if (selectChangeCallback) {
|
|
431
|
-
selectChangeCallback(selectedRowKeysStateArr, selectedRowsStateArr);
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
this.delAll = function () {
|
|
436
|
-
var selectChangeCallback = _this3.props.selectChangeCallback;
|
|
437
|
-
|
|
438
|
-
_this3.setState({
|
|
439
|
-
selectedRowKeysState: [],
|
|
440
|
-
selectedRowsState: [],
|
|
441
|
-
selRowKeysTags: []
|
|
442
|
-
});
|
|
443
|
-
if (selectChangeCallback) {
|
|
444
|
-
selectChangeCallback([], []);
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
this.selectedAdd = function (addRows) {
|
|
449
|
-
var _state4 = _this3.state,
|
|
450
|
-
selectedRowKeysState = _state4.selectedRowKeysState,
|
|
451
|
-
selectedRowsState = _state4.selectedRowsState;
|
|
452
|
-
var _props4 = _this3.props,
|
|
453
|
-
rowKey = _props4.rowKey,
|
|
454
|
-
rowKeyCname = _props4.rowKeyCname,
|
|
455
|
-
selectChangeCallback = _props4.selectChangeCallback,
|
|
456
|
-
chooseFlag = _props4.chooseFlag,
|
|
457
|
-
checkType = _props4.checkType;
|
|
458
|
-
|
|
459
|
-
if (checkType === 'radio') {
|
|
460
|
-
selectedRowKeysState = [];
|
|
461
|
-
selectedRowsState = [];
|
|
462
|
-
}
|
|
463
|
-
addRows.forEach(function (addRow) {
|
|
464
|
-
selectedRowKeysState.push(addRow[rowKey]);
|
|
465
|
-
selectedRowsState.push(addRow);
|
|
466
|
-
});
|
|
467
|
-
var newSelRowKeysTags = [];
|
|
468
|
-
if (chooseFlag) {
|
|
469
|
-
selectedRowsState.forEach(function (selectedRow) {
|
|
470
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
471
|
-
_tag2['default'],
|
|
472
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
473
|
-
return _this3.onCloseTag(selectedRow[rowKey]);
|
|
474
|
-
} },
|
|
475
|
-
selectedRow[rowKeyCname]
|
|
476
|
-
));
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
_this3.setState({
|
|
480
|
-
selectedRowKeysState: selectedRowKeysState,
|
|
481
|
-
selectedRowsState: selectedRowsState,
|
|
482
|
-
selRowKeysTags: newSelRowKeysTags
|
|
483
|
-
});
|
|
484
|
-
if (selectChangeCallback) {
|
|
485
|
-
selectChangeCallback(selectedRowKeysState, selectedRowsState, true, addRows);
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
this.selectedRemove = function (removeRows) {
|
|
490
|
-
var _state5 = _this3.state,
|
|
491
|
-
selectedRowKeysState = _state5.selectedRowKeysState,
|
|
492
|
-
selectedRowsState = _state5.selectedRowsState;
|
|
493
|
-
var _props5 = _this3.props,
|
|
494
|
-
rowKey = _props5.rowKey,
|
|
495
|
-
rowKeyCname = _props5.rowKeyCname,
|
|
496
|
-
selectChangeCallback = _props5.selectChangeCallback,
|
|
497
|
-
chooseFlag = _props5.chooseFlag;
|
|
498
|
-
|
|
499
|
-
removeRows.forEach(function (removeRow) {
|
|
500
|
-
selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
|
|
501
|
-
return selectedRowKey === removeRow[rowKey];
|
|
502
|
-
}), 1);
|
|
503
|
-
selectedRowsState.splice(selectedRowsState.findIndex(function (selectedRow) {
|
|
504
|
-
return selectedRow[rowKey] === removeRow[rowKey];
|
|
505
|
-
}), 1);
|
|
506
|
-
});
|
|
507
|
-
var newSelRowKeysTags = [];
|
|
508
|
-
if (chooseFlag) {
|
|
509
|
-
selectedRowsState.forEach(function (selectedRow) {
|
|
510
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
511
|
-
_tag2['default'],
|
|
512
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
513
|
-
return _this3.onCloseTag(selectedRow[rowKey]);
|
|
514
|
-
} },
|
|
515
|
-
selectedRow[rowKeyCname]
|
|
516
|
-
));
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
_this3.setState({
|
|
520
|
-
selectedRowKeysState: selectedRowKeysState,
|
|
521
|
-
selectedRowsState: selectedRowsState,
|
|
522
|
-
selRowKeysTags: newSelRowKeysTags
|
|
523
|
-
});
|
|
524
|
-
if (selectChangeCallback) {
|
|
525
|
-
selectChangeCallback(selectedRowKeysState, selectedRowsState, false, removeRows);
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
this.numeralFormat = function (text) {
|
|
530
|
-
var strText = text;
|
|
531
|
-
if (text === 0 || text === '0') {
|
|
532
|
-
return '0.00';
|
|
533
|
-
} else if (Number.isFinite(text)) {
|
|
534
|
-
// 有限值数字 用于检查一个数值是否是有限的。如果数值是有限数(即不是 Infinity、-Infinity 或 NaN),那么 Number.isFinite() 返回 true,否则返回 false。
|
|
535
|
-
strText = (0, _numeral2['default'])(text).format('0,0.00');
|
|
536
|
-
} else if (typeof text === 'string') {
|
|
537
|
-
// 字符串
|
|
538
|
-
if (/^\d+(\.\d+)?$/.test(text)) {
|
|
539
|
-
// 数字字符串
|
|
540
|
-
strText = (0, _numeral2['default'])(text).format('0,0.00');
|
|
541
|
-
} else {
|
|
542
|
-
strText = text;
|
|
543
|
-
}
|
|
544
|
-
} else {
|
|
545
|
-
strText = text;
|
|
546
|
-
}
|
|
547
|
-
// if (text || text === 0 || isNaN(text)) {
|
|
548
|
-
// if (typeof text === 'string') {
|
|
549
|
-
// if (/^\d+(\.\d+)?$/.test(text)) {
|
|
550
|
-
// strText = numeral(text).format('0,0.00');
|
|
551
|
-
// } else {
|
|
552
|
-
// strText = text;
|
|
553
|
-
// }
|
|
554
|
-
// } else if (typeof text === 'number') {
|
|
555
|
-
// if (Number.isInfinite(text) || isNaN(NaN)) {
|
|
556
|
-
// strText = text;
|
|
557
|
-
// } else {
|
|
558
|
-
// strText = numeral(text).format('0,0.00');
|
|
559
|
-
// }
|
|
560
|
-
// }
|
|
561
|
-
// }
|
|
562
|
-
return strText;
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
this.rowSelected = function (record) {
|
|
566
|
-
var _state6 = _this3.state,
|
|
567
|
-
selectedRowKeysState = _state6.selectedRowKeysState,
|
|
568
|
-
selectedRowsState = _state6.selectedRowsState;
|
|
569
|
-
|
|
570
|
-
var selectedRowKeysStateArr = selectedRowKeysState;
|
|
571
|
-
var selectedRowsStateArr = selectedRowsState;
|
|
572
|
-
var _props6 = _this3.props,
|
|
573
|
-
rowKey = _props6.rowKey,
|
|
574
|
-
rowKeyCname = _props6.rowKeyCname,
|
|
575
|
-
selectChangeCallback = _props6.selectChangeCallback,
|
|
576
|
-
chooseFlag = _props6.chooseFlag;
|
|
577
|
-
|
|
578
|
-
var flag = false;
|
|
579
|
-
var newSelRowKeysTags = [];
|
|
580
|
-
selectedRowKeysState.forEach(function (item) {
|
|
581
|
-
if (item === record[rowKey]) {
|
|
582
|
-
flag = true;
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
if (flag) {
|
|
586
|
-
selectedRowKeysStateArr.splice(selectedRowKeysStateArr.findIndex(function (selectedRowKey) {
|
|
587
|
-
return selectedRowKey === record[rowKey];
|
|
588
|
-
}), 1);
|
|
589
|
-
selectedRowsStateArr.splice(selectedRowsStateArr.findIndex(function (selectedRow) {
|
|
590
|
-
return selectedRow[rowKey] === record[rowKey];
|
|
591
|
-
}), 1);
|
|
592
|
-
if (chooseFlag) {
|
|
593
|
-
selectedRowsStateArr.forEach(function (selectedRow) {
|
|
594
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
595
|
-
_tag2['default'],
|
|
596
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
597
|
-
return _this3.onRowSelectedClose(selectedRow[rowKey]);
|
|
598
|
-
} },
|
|
599
|
-
selectedRow[rowKeyCname]
|
|
600
|
-
));
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
} else if (_this3.props.rowType === 'radio') {
|
|
604
|
-
selectedRowKeysStateArr = [];
|
|
605
|
-
selectedRowsStateArr = [];
|
|
606
|
-
selectedRowKeysStateArr.push(record[rowKey]);
|
|
607
|
-
selectedRowsStateArr.push(record);
|
|
608
|
-
if (chooseFlag) {
|
|
609
|
-
selectedRowsStateArr.forEach(function (selectedRow) {
|
|
610
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
611
|
-
_tag2['default'],
|
|
612
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
613
|
-
return _this3.onRowSelectedClose(selectedRow[rowKey]);
|
|
614
|
-
} },
|
|
615
|
-
selectedRow[rowKeyCname]
|
|
616
|
-
));
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
} else {
|
|
620
|
-
selectedRowKeysStateArr.push(record[rowKey]);
|
|
621
|
-
selectedRowsStateArr.push(record);
|
|
622
|
-
if (chooseFlag) {
|
|
623
|
-
selectedRowsStateArr.forEach(function (selectedRow) {
|
|
624
|
-
newSelRowKeysTags.push(_react2['default'].createElement(
|
|
625
|
-
_tag2['default'],
|
|
626
|
-
{ key: selectedRow[rowKey], closable: true, afterClose: function afterClose() {
|
|
627
|
-
return _this3.onRowSelectedClose(selectedRow[rowKey]);
|
|
628
|
-
} },
|
|
629
|
-
selectedRow[rowKeyCname]
|
|
630
|
-
));
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
_this3.setState({
|
|
635
|
-
selectedRowKeysState: selectedRowKeysStateArr,
|
|
636
|
-
selectedRowsState: selectedRowsStateArr,
|
|
637
|
-
selRowKeysTags: newSelRowKeysTags
|
|
638
|
-
});
|
|
639
|
-
if (selectChangeCallback) {
|
|
640
|
-
selectChangeCallback(selectedRowKeysStateArr, selectedRowsStateArr);
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
this.handleTableChange = function (pagination) {
|
|
645
|
-
var _props7 = _this3.props,
|
|
646
|
-
selfDealPageChangeFunc = _props7.selfDealPageChangeFunc,
|
|
647
|
-
getSearchCondition = _props7.getSearchCondition,
|
|
648
|
-
handleSearch = _props7.handleSearch,
|
|
649
|
-
handleSearchNew = _props7.handleSearchNew;
|
|
650
|
-
|
|
651
|
-
var formVal = {};
|
|
652
|
-
if (getSearchCondition && typeof getSearchCondition === 'function') {
|
|
653
|
-
formVal = getSearchCondition();
|
|
654
|
-
}
|
|
655
|
-
var paginationInfo = { offset: pagination.current, limit: pagination.pageSize };
|
|
656
|
-
_this3.setState({ pagination: paginationInfo });
|
|
657
|
-
if (selfDealPageChangeFunc && typeof selfDealPageChangeFunc === 'function') {
|
|
658
|
-
selfDealPageChangeFunc(paginationInfo, formVal);
|
|
659
|
-
} else if (handleSearch && typeof handleSearch === 'function') {
|
|
660
|
-
handleSearch(paginationInfo, formVal);
|
|
661
|
-
} else if (handleSearchNew && typeof handleSearchNew === 'function') {
|
|
662
|
-
handleSearchNew(paginationInfo, formVal);
|
|
663
|
-
}
|
|
664
|
-
};
|
|
665
|
-
};
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
666
16
|
|
|
17
|
+
var isMobile = window.matchMedia('(max-width: 768px)').matches;
|
|
667
18
|
exports['default'] = (0, _dva.connect)(function (state) {
|
|
668
19
|
return {
|
|
669
20
|
globalData: state.globalData
|
|
670
21
|
};
|
|
671
|
-
})(
|
|
22
|
+
})(isMobile ? _indexM2['default'] : _indexPC2['default']);
|
|
672
23
|
module.exports = exports['default'];
|