easy3wui 1.5.7 → 1.5.8-2.beta
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 +17 -1
- package/assets/btn.css +7 -1
- package/assets/card.css +14 -0
- package/assets/editBigTable.css +17 -0
- package/assets/flow.css +1235 -224
- package/assets/formPage.css +212 -5
- package/assets/gridPage.css +12 -2
- package/assets/index.css +1610 -348
- package/assets/login.css +0 -3
- package/assets/tree.css +4 -0
- package/lib/Easy3wButton/index.js +4 -2
- package/lib/Easy3wButtonOne/index.js +10 -2
- package/lib/Easy3wCaHandler/index.js +130 -24
- package/lib/Easy3wCard/index.js +11 -53
- package/lib/Easy3wCard/indexM.js +80 -0
- package/lib/Easy3wCard/indexPC.js +75 -0
- package/lib/Easy3wCol/index.js +53 -0
- package/lib/Easy3wDownLoad/index copy.js +333 -0
- package/lib/Easy3wDownLoad/index.js +129 -19
- package/lib/Easy3wEditBigTable/Easy3wEditBigTableForm.js +295 -0
- package/lib/Easy3wEditBigTable/Editors/EditorNumber.js +92 -0
- package/lib/Easy3wEditBigTable/Editors/EditorsDatePicker.js +168 -0
- package/lib/Easy3wEditBigTable/Editors/EditorsInputNumber.js +141 -0
- package/lib/Easy3wEditBigTable/index.js +1175 -0
- package/lib/Easy3wFlow/index.js +722 -25
- package/lib/Easy3wFormPage/index.js +28 -1553
- package/lib/Easy3wFormPage/indexM.js +4274 -0
- package/lib/Easy3wFormPage/indexPC.js +4006 -0
- package/lib/Easy3wGetDesensitization/index.js +43 -0
- package/lib/Easy3wGridCheckBox/index.js +1 -1
- package/lib/Easy3wGridDatePicker/index.js +1 -1
- package/lib/Easy3wGridDateTimePicker/index.js +1 -1
- package/lib/Easy3wGridInput/index.js +31 -4
- package/lib/Easy3wGridInputAmount/index.js +93 -0
- package/lib/Easy3wGridInputDigit/index.js +83 -0
- package/lib/Easy3wGridInputEmail/index.js +73 -0
- package/lib/Easy3wGridPage/index.js +10 -580
- package/lib/Easy3wGridPage/indexM.js +696 -0
- package/lib/Easy3wGridPage/indexPC.js +668 -0
- package/lib/Easy3wGridSelect/index.js +4 -2
- package/lib/Easy3wGridTextArea/index.js +57 -6
- package/lib/Easy3wModal/index.js +180 -7
- package/lib/Easy3wRow/index.js +53 -0
- package/lib/Easy3wTree/index.js +318 -0
- package/lib/Easy3wUIConfig/index.js +30 -0
- package/lib/Easy3wUpload/index.js +86 -42
- package/lib/Easy3wUploadB/index copy 2.js +1011 -0
- package/lib/Easy3wUploadB/index copy 3.js +1088 -0
- package/lib/Easy3wUploadB/index.js +300 -145
- package/lib/Easy3wUploadM/index copy.js +523 -0
- package/lib/Easy3wUploadM/index.js +122 -51
- package/lib/index.js +81 -0
- package/package.json +5 -2
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
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
|
+
var _dva = require('dva');
|
|
64
|
+
|
|
65
|
+
var _easy3wui = require('easy3wui');
|
|
66
|
+
|
|
67
|
+
var _comonConfig = require('comonConfigPath/comonConfig');
|
|
68
|
+
|
|
69
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
70
|
+
|
|
71
|
+
var Easy3wGridPagePC = function (_Component) {
|
|
72
|
+
(0, _inherits3['default'])(Easy3wGridPagePC, _Component);
|
|
73
|
+
|
|
74
|
+
function Easy3wGridPagePC(props) {
|
|
75
|
+
(0, _classCallCheck3['default'])(this, Easy3wGridPagePC);
|
|
76
|
+
|
|
77
|
+
var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
|
78
|
+
|
|
79
|
+
_initialiseProps.call(_this);
|
|
80
|
+
|
|
81
|
+
var _this$props = _this.props,
|
|
82
|
+
selectedVal = _this$props.selectedVal,
|
|
83
|
+
selectedKey = _this$props.selectedKey,
|
|
84
|
+
rowKey = _this$props.rowKey,
|
|
85
|
+
rowKeyCname = _this$props.rowKeyCname;
|
|
86
|
+
|
|
87
|
+
var selRowKeysTags = [];
|
|
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
|
+
Easy3wGridPagePC.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
110
|
+
if (nextProps.cleanFlag === '1') {
|
|
111
|
+
this.delAll();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
Easy3wGridPagePC.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
|
+
Easy3wGridPagePC.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 Easy3wGridPagePC;
|
|
343
|
+
}(_react.Component);
|
|
344
|
+
|
|
345
|
+
Easy3wGridPagePC.propTypes = {
|
|
346
|
+
columns: _propTypes2['default'].array.isRequired,
|
|
347
|
+
bordered: _propTypes2['default'].bool
|
|
348
|
+
};
|
|
349
|
+
Easy3wGridPagePC.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
|
+
};
|
|
666
|
+
|
|
667
|
+
exports['default'] = Easy3wGridPagePC;
|
|
668
|
+
module.exports = exports['default'];
|
|
@@ -61,7 +61,7 @@ var Easy3wGridSelect = function (_Component) {
|
|
|
61
61
|
selectOpts = optionLst.map(function (opt) {
|
|
62
62
|
return _react2['default'].createElement(
|
|
63
63
|
Option,
|
|
64
|
-
{ key: opt.value },
|
|
64
|
+
{ key: opt.value, disabled: opt.disabled },
|
|
65
65
|
opt.label
|
|
66
66
|
);
|
|
67
67
|
});
|
|
@@ -74,7 +74,9 @@ var Easy3wGridSelect = function (_Component) {
|
|
|
74
74
|
})(_react2['default'].createElement(
|
|
75
75
|
_select2['default'],
|
|
76
76
|
(0, _extends3['default'])({
|
|
77
|
-
style: { minWidth: 100, width: '100%' }
|
|
77
|
+
style: { minWidth: 100, width: '100%' },
|
|
78
|
+
showSearch: true // 是否开启搜索
|
|
79
|
+
, optionFilterProp: 'children' // 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索
|
|
78
80
|
}, cmptPros),
|
|
79
81
|
_react2['default'].createElement(
|
|
80
82
|
Option,
|