easy3wui 1.5.49-beta1 → 1.5.49-beta3
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/lib/Easy3wFormPage/index copy.js +2187 -0
- package/lib/Easy3wGridPage/index.js +274 -209
- package/package.json +1 -1
|
@@ -72,6 +72,10 @@ var _numeral = require('numeral');
|
|
|
72
72
|
|
|
73
73
|
var _numeral2 = _interopRequireDefault(_numeral);
|
|
74
74
|
|
|
75
|
+
var _cloneDeep = require('lodash/cloneDeep');
|
|
76
|
+
|
|
77
|
+
var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
|
|
78
|
+
|
|
75
79
|
var _comonConfig = require('comonConfigPath/comonConfig');
|
|
76
80
|
|
|
77
81
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
@@ -104,7 +108,14 @@ var Easy3wGridPage = function (_Component) {
|
|
|
104
108
|
));
|
|
105
109
|
});
|
|
106
110
|
}
|
|
111
|
+
var dataList = _this.props.dataList;
|
|
112
|
+
|
|
113
|
+
var arrData = dataList && dataList.length ? JSON.parse(JSON.stringify(dataList)) : [];
|
|
107
114
|
_this.state = {
|
|
115
|
+
// 数据
|
|
116
|
+
arrData: arrData, // 列表
|
|
117
|
+
arrColumns: [], // 列
|
|
118
|
+
// 选择
|
|
108
119
|
selectedRowKeysState: selectedKey || [],
|
|
109
120
|
selectedRowsState: selectedVal || [],
|
|
110
121
|
selRowKeysTags: selRowKeysTags,
|
|
@@ -114,6 +125,32 @@ var Easy3wGridPage = function (_Component) {
|
|
|
114
125
|
}
|
|
115
126
|
|
|
116
127
|
Easy3wGridPage.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
128
|
+
var _props = this.props,
|
|
129
|
+
_props$dataList = _props.dataList,
|
|
130
|
+
dataList = _props$dataList === undefined ? [] : _props$dataList,
|
|
131
|
+
_props$columns = _props.columns,
|
|
132
|
+
columns = _props$columns === undefined ? [] : _props$columns;
|
|
133
|
+
|
|
134
|
+
var arrDataFlag = false;
|
|
135
|
+
var arrColumnsFlag = false;
|
|
136
|
+
var objSetData = {};
|
|
137
|
+
if (nextProps.dataList && nextProps.dataList.length !== dataList.length || JSON.stringify(nextProps.dataList) !== JSON.stringify(dataList)) {
|
|
138
|
+
arrDataFlag = true;
|
|
139
|
+
objSetData.arrData = nextProps.dataList && nextProps.dataList.length ? JSON.parse(JSON.stringify(nextProps.dataList)) : [];
|
|
140
|
+
// this.setState({
|
|
141
|
+
// arrData: nextProps.dataList && nextProps.dataList.length ? JSON.parse(JSON.stringify(nextProps.dataList)) : [],
|
|
142
|
+
// });
|
|
143
|
+
}
|
|
144
|
+
if (nextProps.columns && nextProps.columns.length !== columns.length) {
|
|
145
|
+
arrColumnsFlag = true;
|
|
146
|
+
objSetData.arrColumns = nextProps.columns && nextProps.columns.length ? this.touchCreateColumns((0, _cloneDeep2['default'])(nextProps.columns)) : [];
|
|
147
|
+
// this.setState({
|
|
148
|
+
// arrColumns: nextProps.columns && nextProps.columns.length ? this.touchCreateColumns(cloneDeep(nextProps.columns)) : [],
|
|
149
|
+
// });
|
|
150
|
+
}
|
|
151
|
+
if (arrColumnsFlag || arrDataFlag) {
|
|
152
|
+
this.setState((0, _extends3['default'])({}, objSetData));
|
|
153
|
+
}
|
|
117
154
|
if (nextProps.cleanFlag === '1') {
|
|
118
155
|
this.delAll();
|
|
119
156
|
}
|
|
@@ -123,151 +160,40 @@ var Easy3wGridPage = function (_Component) {
|
|
|
123
160
|
|
|
124
161
|
// 数据脱敏--显隐
|
|
125
162
|
|
|
126
|
-
|
|
127
163
|
// ---------------------------------- 数据脱敏 end ----------------------------------
|
|
164
|
+
// 生成表格
|
|
165
|
+
|
|
166
|
+
|
|
128
167
|
Easy3wGridPage.prototype.render = function render() {
|
|
129
168
|
var _this2 = this;
|
|
130
169
|
|
|
131
|
-
var
|
|
132
|
-
columns =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
170
|
+
var _props2 = this.props,
|
|
171
|
+
columns = _props2.columns,
|
|
172
|
+
loading = _props2.loading,
|
|
173
|
+
getCheckboxProps = _props2.getCheckboxProps,
|
|
174
|
+
needPaginationFlag = _props2.needPaginationFlag,
|
|
175
|
+
gridProps = _props2.gridProps,
|
|
176
|
+
totalResult = _props2.totalResult,
|
|
177
|
+
rowKey = _props2.rowKey,
|
|
178
|
+
checkType = _props2.checkType,
|
|
179
|
+
bordered = _props2.bordered,
|
|
180
|
+
chooseFlag = _props2.chooseFlag,
|
|
181
|
+
scroll = _props2.scroll,
|
|
182
|
+
className = _props2.className,
|
|
183
|
+
paginationInfo = _props2.paginationInfo;
|
|
184
|
+
var arrData = this.state.arrData;
|
|
185
|
+
// [].concat(arrA)
|
|
186
|
+
// const arrColumns = this.touchCreateColumns([].concat(columns));
|
|
187
|
+
// const arrColumns = this.touchCreateColumns(JSON.parse(JSON.stringify(columns)));
|
|
188
|
+
|
|
189
|
+
var arrColumns = this.touchCreateColumns((0, _cloneDeep2['default'])(columns));
|
|
190
|
+
// const arrColumns = this.touchCreateColumns(columns);
|
|
147
191
|
var _state = this.state,
|
|
148
192
|
selectedRowKeysState = _state.selectedRowKeysState,
|
|
149
193
|
selectedRowsState = _state.selectedRowsState,
|
|
150
194
|
selRowKeysTags = _state.selRowKeysTags;
|
|
151
195
|
|
|
152
196
|
var paginationProps = false; // 默认不分页
|
|
153
|
-
var recursion = function recursion(arr) {
|
|
154
|
-
arr.forEach(function (item) {
|
|
155
|
-
var columnsType = item.type;
|
|
156
|
-
switch (columnsType) {
|
|
157
|
-
case 'shortText':
|
|
158
|
-
item.className = 'e3wGridShortText';break;
|
|
159
|
-
case 'longText':
|
|
160
|
-
item.className = 'e3wGridLongText';break;
|
|
161
|
-
case 'number':
|
|
162
|
-
item.className = 'e3wGridNumber';break;
|
|
163
|
-
case 'maxText':
|
|
164
|
-
item.className = 'e3wMaxText';break;
|
|
165
|
-
case 'numeralFormat':
|
|
166
|
-
item.className = 'e3wGridNumber';break;
|
|
167
|
-
default:
|
|
168
|
-
item.className = 'e3wGridShortText';
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
if (item.children) {
|
|
172
|
-
recursion(item.children);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
var recursionT = function recursionT(arr) {
|
|
177
|
-
arr.forEach(function (item) {
|
|
178
|
-
var dataIndex = item.dataIndex;
|
|
179
|
-
|
|
180
|
-
if (!item.render) {
|
|
181
|
-
item.render = function (text, record, index) {
|
|
182
|
-
var _record$id = record.id,
|
|
183
|
-
id = _record$id === undefined ? '' : _record$id;
|
|
184
|
-
|
|
185
|
-
var renderTextDesensitize = '';
|
|
186
|
-
if (_comonConfig.dataDesensitizationFlag) {
|
|
187
|
-
renderTextDesensitize = _this2.getcheckDesensitizeData(text, item, index);
|
|
188
|
-
}
|
|
189
|
-
var dataDesensitizationFlagTrue = item.dataDesensitizationFlagTrue;
|
|
190
|
-
|
|
191
|
-
if (_comonConfig.dataDesensitizationFlag && dataDesensitizationFlagTrue) {
|
|
192
|
-
if (text && text.length * 14 > 160) {
|
|
193
|
-
return _react2['default'].createElement(
|
|
194
|
-
_tooltip2['default'],
|
|
195
|
-
{ placement: 'topLeft', title: _react2['default'].createElement(
|
|
196
|
-
'span',
|
|
197
|
-
null,
|
|
198
|
-
_this2.state[dataIndex + '-' + id + '-' + index + '-dataDesensitizationEyeFlag'] ? text : renderTextDesensitize,
|
|
199
|
-
' ',
|
|
200
|
-
_react2['default'].createElement(
|
|
201
|
-
'a',
|
|
202
|
-
{ onClick: function onClick() {
|
|
203
|
-
return _this2.getImplicit(dataIndex, id, index);
|
|
204
|
-
} },
|
|
205
|
-
_react2['default'].createElement(_icon2['default'], { type: _this2.state[dataIndex + '-' + id + '-' + index + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
206
|
-
)
|
|
207
|
-
), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
208
|
-
_react2['default'].createElement(
|
|
209
|
-
'span',
|
|
210
|
-
null,
|
|
211
|
-
_this2.state[dataIndex + '-' + id + '-' + index + '-dataDesensitizationEyeFlag'] ? text : renderTextDesensitize,
|
|
212
|
-
' ',
|
|
213
|
-
_react2['default'].createElement(
|
|
214
|
-
'a',
|
|
215
|
-
{ onClick: function onClick() {
|
|
216
|
-
return _this2.getImplicit(dataIndex, id, index);
|
|
217
|
-
} },
|
|
218
|
-
_react2['default'].createElement(_icon2['default'], { type: _this2.state[dataIndex + '-' + id + '-' + index + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
219
|
-
)
|
|
220
|
-
)
|
|
221
|
-
);
|
|
222
|
-
} else {
|
|
223
|
-
return _react2['default'].createElement(
|
|
224
|
-
'span',
|
|
225
|
-
null,
|
|
226
|
-
_this2.state[dataIndex + '-' + id + '-' + index + '-dataDesensitizationEyeFlag'] ? text : renderTextDesensitize,
|
|
227
|
-
' ',
|
|
228
|
-
_react2['default'].createElement(
|
|
229
|
-
'a',
|
|
230
|
-
{ onClick: function onClick() {
|
|
231
|
-
return _this2.getImplicit(dataIndex, id, index);
|
|
232
|
-
} },
|
|
233
|
-
_react2['default'].createElement(_icon2['default'], { type: _this2.state[dataIndex + '-' + id + '-' + index + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
234
|
-
)
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
} else if (text && text.length * 14 > 160) {
|
|
238
|
-
return _react2['default'].createElement(
|
|
239
|
-
_tooltip2['default'],
|
|
240
|
-
{ placement: 'topLeft', title: text, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
241
|
-
text
|
|
242
|
-
);
|
|
243
|
-
} else {
|
|
244
|
-
return text;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
if (item.type === 'numeralFormat') {
|
|
248
|
-
item.render = function (text) {
|
|
249
|
-
return _react2['default'].createElement(
|
|
250
|
-
_tooltip2['default'],
|
|
251
|
-
{ placement: 'topLeft', title: _this2.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
252
|
-
_this2.numeralFormat(text)
|
|
253
|
-
);
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}if (item.fixed) {
|
|
257
|
-
item.className = 'e3wText';
|
|
258
|
-
item.minWidth = 5;
|
|
259
|
-
}
|
|
260
|
-
if (item.children) {
|
|
261
|
-
recursionT(item.children);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
|
-
recursion(columns);
|
|
266
|
-
if (dataList) {
|
|
267
|
-
if (dataList.length > 0) {
|
|
268
|
-
recursionT(columns);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
197
|
var rowSelection = null;
|
|
272
198
|
if (checkType) {
|
|
273
199
|
// 若需选择框
|
|
@@ -294,7 +220,6 @@ var Easy3wGridPage = function (_Component) {
|
|
|
294
220
|
}
|
|
295
221
|
};
|
|
296
222
|
}
|
|
297
|
-
var myColumns = columns;
|
|
298
223
|
// 处理分页 start
|
|
299
224
|
if (needPaginationFlag) {
|
|
300
225
|
var defaultCurrent = paginationInfo ? paginationInfo.offset : 1;
|
|
@@ -313,34 +238,10 @@ var Easy3wGridPage = function (_Component) {
|
|
|
313
238
|
showQuickJumper: true,
|
|
314
239
|
pageSizeOptions: ['10', '20', '30', '40', '50', '100']
|
|
315
240
|
};
|
|
316
|
-
if (autoAddNumber) {
|
|
317
|
-
if (columns.length > 0) {
|
|
318
|
-
myColumns = [{
|
|
319
|
-
title: '序号',
|
|
320
|
-
dataIndex: 'number',
|
|
321
|
-
className: 'e3wGridShortText',
|
|
322
|
-
render: function render(text, record, index) {
|
|
323
|
-
return _react2['default'].createElement(
|
|
324
|
-
'div',
|
|
325
|
-
null,
|
|
326
|
-
(current - 1) * limit + index + 1,
|
|
327
|
-
' '
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
}].concat(columns);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
241
|
}
|
|
334
242
|
var printArr = location.hash.split('/');
|
|
335
243
|
var printValue = this.props.printValue || 'print';
|
|
336
244
|
var printFlag = printArr[1] === printValue;
|
|
337
|
-
if (printFlag) {
|
|
338
|
-
myColumns.forEach(function (item) {
|
|
339
|
-
if (item.fixed) {
|
|
340
|
-
item.fixed = null;
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
245
|
var alertRegionFlag = false;
|
|
345
246
|
if (selRowKeysTags && selRowKeysTags instanceof Array && selRowKeysTags.length) {
|
|
346
247
|
alertRegionFlag = true;
|
|
@@ -360,8 +261,8 @@ var Easy3wGridPage = function (_Component) {
|
|
|
360
261
|
{ className: gridProps || this.props.rowType ? gridProps.onRow || this.props.rowType ? 'onRow' : null : null },
|
|
361
262
|
_react2['default'].createElement(_table2['default'], (0, _extends3['default'])({
|
|
362
263
|
className: printFlag ? 'scrollPrint' : className || 'scrollX',
|
|
363
|
-
columns:
|
|
364
|
-
dataSource:
|
|
264
|
+
columns: this.state.arrColumns && this.state.arrColumns.length ? this.state.arrColumns : arrColumns,
|
|
265
|
+
dataSource: arrData,
|
|
365
266
|
pagination: paginationProps,
|
|
366
267
|
loading: loading,
|
|
367
268
|
rowKey: rowKey,
|
|
@@ -401,11 +302,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
401
302
|
var _state2 = _this3.state,
|
|
402
303
|
selectedRowKeysState = _state2.selectedRowKeysState,
|
|
403
304
|
selectedRowsState = _state2.selectedRowsState;
|
|
404
|
-
var
|
|
405
|
-
rowKey =
|
|
406
|
-
rowKeyCname =
|
|
407
|
-
selectChangeCallback =
|
|
408
|
-
chooseFlag =
|
|
305
|
+
var _props3 = _this3.props,
|
|
306
|
+
rowKey = _props3.rowKey,
|
|
307
|
+
rowKeyCname = _props3.rowKeyCname,
|
|
308
|
+
selectChangeCallback = _props3.selectChangeCallback,
|
|
309
|
+
chooseFlag = _props3.chooseFlag;
|
|
409
310
|
|
|
410
311
|
selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
|
|
411
312
|
return selectedRowKey === closeKey;
|
|
@@ -442,11 +343,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
442
343
|
|
|
443
344
|
var selectedRowKeysStateArr = selectedRowKeysState;
|
|
444
345
|
var selectedRowsStateArr = selectedRowsState;
|
|
445
|
-
var
|
|
446
|
-
rowKey =
|
|
447
|
-
rowKeyCname =
|
|
448
|
-
selectChangeCallback =
|
|
449
|
-
chooseFlag =
|
|
346
|
+
var _props4 = _this3.props,
|
|
347
|
+
rowKey = _props4.rowKey,
|
|
348
|
+
rowKeyCname = _props4.rowKeyCname,
|
|
349
|
+
selectChangeCallback = _props4.selectChangeCallback,
|
|
350
|
+
chooseFlag = _props4.chooseFlag;
|
|
450
351
|
|
|
451
352
|
var newSelRowKeysTags = [];
|
|
452
353
|
selectedRowKeysStateArr.splice(selectedRowKeysStateArr.findIndex(function (selectedRowKey) {
|
|
@@ -493,12 +394,12 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
493
394
|
var _state4 = _this3.state,
|
|
494
395
|
selectedRowKeysState = _state4.selectedRowKeysState,
|
|
495
396
|
selectedRowsState = _state4.selectedRowsState;
|
|
496
|
-
var
|
|
497
|
-
rowKey =
|
|
498
|
-
rowKeyCname =
|
|
499
|
-
selectChangeCallback =
|
|
500
|
-
chooseFlag =
|
|
501
|
-
checkType =
|
|
397
|
+
var _props5 = _this3.props,
|
|
398
|
+
rowKey = _props5.rowKey,
|
|
399
|
+
rowKeyCname = _props5.rowKeyCname,
|
|
400
|
+
selectChangeCallback = _props5.selectChangeCallback,
|
|
401
|
+
chooseFlag = _props5.chooseFlag,
|
|
402
|
+
checkType = _props5.checkType;
|
|
502
403
|
|
|
503
404
|
if (checkType === 'radio') {
|
|
504
405
|
selectedRowKeysState = [];
|
|
@@ -534,11 +435,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
534
435
|
var _state5 = _this3.state,
|
|
535
436
|
selectedRowKeysState = _state5.selectedRowKeysState,
|
|
536
437
|
selectedRowsState = _state5.selectedRowsState;
|
|
537
|
-
var
|
|
538
|
-
rowKey =
|
|
539
|
-
rowKeyCname =
|
|
540
|
-
selectChangeCallback =
|
|
541
|
-
chooseFlag =
|
|
438
|
+
var _props6 = _this3.props,
|
|
439
|
+
rowKey = _props6.rowKey,
|
|
440
|
+
rowKeyCname = _props6.rowKeyCname,
|
|
441
|
+
selectChangeCallback = _props6.selectChangeCallback,
|
|
442
|
+
chooseFlag = _props6.chooseFlag;
|
|
542
443
|
|
|
543
444
|
removeRows.forEach(function (removeRow) {
|
|
544
445
|
selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
|
|
@@ -611,11 +512,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
611
512
|
|
|
612
513
|
var selectedRowKeysStateArr = selectedRowKeysState;
|
|
613
514
|
var selectedRowsStateArr = selectedRowsState;
|
|
614
|
-
var
|
|
615
|
-
rowKey =
|
|
616
|
-
rowKeyCname =
|
|
617
|
-
selectChangeCallback =
|
|
618
|
-
chooseFlag =
|
|
515
|
+
var _props7 = _this3.props,
|
|
516
|
+
rowKey = _props7.rowKey,
|
|
517
|
+
rowKeyCname = _props7.rowKeyCname,
|
|
518
|
+
selectChangeCallback = _props7.selectChangeCallback,
|
|
519
|
+
chooseFlag = _props7.chooseFlag;
|
|
619
520
|
|
|
620
521
|
var flag = false;
|
|
621
522
|
var newSelRowKeysTags = [];
|
|
@@ -684,10 +585,10 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
684
585
|
};
|
|
685
586
|
|
|
686
587
|
this.handleTableChange = function (pagination) {
|
|
687
|
-
var
|
|
688
|
-
selfDealPageChangeFunc =
|
|
689
|
-
getSearchCondition =
|
|
690
|
-
handleSearch =
|
|
588
|
+
var _props8 = _this3.props,
|
|
589
|
+
selfDealPageChangeFunc = _props8.selfDealPageChangeFunc,
|
|
590
|
+
getSearchCondition = _props8.getSearchCondition,
|
|
591
|
+
handleSearch = _props8.handleSearch;
|
|
691
592
|
|
|
692
593
|
var formVal = getSearchCondition();
|
|
693
594
|
var paginationInfo = { offset: pagination.current, limit: pagination.pageSize };
|
|
@@ -699,35 +600,45 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
699
600
|
}
|
|
700
601
|
};
|
|
701
602
|
|
|
702
|
-
this.getcheckDesensitizeData = function (str,
|
|
603
|
+
this.getcheckDesensitizeData = function (str, record, dataIndex) {
|
|
703
604
|
var phoneRegex = /^1[3-9]\d{9}$/; // 手机号
|
|
704
605
|
var emailRegex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/; // 邮箱
|
|
705
|
-
var idRegex = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/; // 身份证
|
|
706
|
-
|
|
606
|
+
var idRegex = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$)/; // 身份证 可匹配15位或18位身份证
|
|
607
|
+
// let { arrData } = this.state;
|
|
608
|
+
// const { dataList } = this.props;
|
|
609
|
+
// if (arrData && arrData.length === 0) {
|
|
610
|
+
// arrData = [...dataList];
|
|
611
|
+
// }
|
|
612
|
+
var strDesensitize = str; // 脱敏字符串
|
|
613
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = false; // 当前字段--数据脱敏标识--未脱敏成功
|
|
707
614
|
if (phoneRegex.test(str)) {
|
|
708
615
|
// 手机号
|
|
709
|
-
|
|
710
|
-
|
|
616
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
617
|
+
strDesensitize = str.slice(0, 3) + '****' + str.slice(-4); // 脱敏手机号
|
|
711
618
|
} else if (emailRegex.test(str)) {
|
|
712
619
|
// 邮箱
|
|
713
|
-
|
|
620
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
714
621
|
|
|
715
622
|
var _str$split = str.split('@'),
|
|
716
623
|
username = _str$split[0],
|
|
717
624
|
domain = _str$split[1];
|
|
718
625
|
|
|
719
626
|
var desensitizedUsername = username.slice(0, 1) + '****';
|
|
720
|
-
|
|
627
|
+
strDesensitize = desensitizedUsername + '@' + domain; // 脱敏邮箱
|
|
721
628
|
} else if (idRegex.test(str)) {
|
|
722
629
|
// 身份证
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
} else {
|
|
726
|
-
return str;
|
|
630
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
631
|
+
strDesensitize = str.slice(0, 3) + '********' + str.slice(-4); // 脱敏身份证
|
|
727
632
|
}
|
|
633
|
+
// this.setState({
|
|
634
|
+
// arrData, // 更新数据
|
|
635
|
+
// });
|
|
636
|
+
return strDesensitize;
|
|
728
637
|
};
|
|
729
638
|
|
|
730
|
-
this.getImplicit = function (dataIndex,
|
|
639
|
+
this.getImplicit = function (dataIndex, index) {
|
|
640
|
+
var arrData = _this3.state.arrData;
|
|
641
|
+
|
|
731
642
|
if (_comonConfig.dataDesensitizationUrl) {
|
|
732
643
|
var xhr = new XMLHttpRequest();
|
|
733
644
|
xhr.onreadystatechange = function () {
|
|
@@ -741,9 +652,10 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
741
652
|
passMsg = _ref.passMsg;
|
|
742
653
|
|
|
743
654
|
if (passFlag) {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
655
|
+
arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] = !arrData[index][dataIndex + '-dataDesensitizationEyeFlag']; // 当前字段--数据脱敏标识--显隐
|
|
656
|
+
_this3.setState({
|
|
657
|
+
arrData: arrData // 更新数据
|
|
658
|
+
});
|
|
747
659
|
} else {
|
|
748
660
|
_modal2['default'].error({
|
|
749
661
|
content: passMsg || '用户无权限,请联系管理员',
|
|
@@ -757,10 +669,163 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
757
669
|
xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
|
|
758
670
|
xhr.send(data); // 发送请求
|
|
759
671
|
} else {
|
|
760
|
-
|
|
672
|
+
arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] = !arrData[index][dataIndex + '-dataDesensitizationEyeFlag']; // 当前字段--数据脱敏标识--显隐
|
|
673
|
+
_this3.setState({
|
|
674
|
+
arrData: arrData // 更新数据
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
this.touchCreateColumns = function (columns) {
|
|
680
|
+
var _props9 = _this3.props,
|
|
681
|
+
dataList = _props9.dataList,
|
|
682
|
+
autoAddNumber = _props9.autoAddNumber,
|
|
683
|
+
paginationInfo = _props9.paginationInfo;
|
|
684
|
+
var arrData = _this3.state.arrData;
|
|
685
|
+
|
|
686
|
+
var current = paginationInfo ? paginationInfo.offset : _this3.state.pagination.offset;
|
|
687
|
+
var limit = paginationInfo ? paginationInfo.limit : _this3.state.pagination.limit;
|
|
688
|
+
var printArr = location.hash.split('/');
|
|
689
|
+
var printValue = _this3.props.printValue || 'print';
|
|
690
|
+
var printFlag = printArr[1] === printValue;
|
|
691
|
+
var recursion = function recursion(arr) {
|
|
692
|
+
arr.forEach(function (item) {
|
|
693
|
+
var columnsType = item.type;
|
|
694
|
+
if (item.fixed && printFlag) {
|
|
695
|
+
item.fixed = null;
|
|
696
|
+
}
|
|
697
|
+
switch (columnsType) {
|
|
698
|
+
case 'shortText':
|
|
699
|
+
item.className = 'e3wGridShortText';break;
|
|
700
|
+
case 'longText':
|
|
701
|
+
item.className = 'e3wGridLongText';break;
|
|
702
|
+
case 'number':
|
|
703
|
+
item.className = 'e3wGridNumber';break;
|
|
704
|
+
case 'maxText':
|
|
705
|
+
item.className = 'e3wMaxText';break;
|
|
706
|
+
case 'numeralFormat':
|
|
707
|
+
item.className = 'e3wGridNumber';break;
|
|
708
|
+
default:
|
|
709
|
+
item.className = 'e3wGridShortText';
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
if (item.children) {
|
|
713
|
+
recursion(item.children);
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
};
|
|
717
|
+
var recursionT = function recursionT(arr) {
|
|
718
|
+
arr.forEach(function (item) {
|
|
719
|
+
if (item.fixed && printFlag) {
|
|
720
|
+
item.fixed = null;
|
|
721
|
+
}
|
|
722
|
+
var dataIndex = item.dataIndex;
|
|
761
723
|
|
|
762
|
-
|
|
724
|
+
if (!item.render) {
|
|
725
|
+
item.render = function (text, record, index) {
|
|
726
|
+
var renderTextDesensitize = '';
|
|
727
|
+
if (_comonConfig.dataDesensitizationFlag) {
|
|
728
|
+
renderTextDesensitize = _this3.getcheckDesensitizeData(text, record, dataIndex);
|
|
729
|
+
}
|
|
730
|
+
if (_comonConfig.dataDesensitizationFlag && record[dataIndex + '-dataDesensitizationFlagTrue']) {
|
|
731
|
+
if (text && text.length * 14 > 160) {
|
|
732
|
+
return _react2['default'].createElement(
|
|
733
|
+
_tooltip2['default'],
|
|
734
|
+
{ placement: 'topLeft', title: _react2['default'].createElement(
|
|
735
|
+
'span',
|
|
736
|
+
null,
|
|
737
|
+
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? text : renderTextDesensitize,
|
|
738
|
+
' ',
|
|
739
|
+
_react2['default'].createElement(
|
|
740
|
+
'a',
|
|
741
|
+
{ onClick: function onClick() {
|
|
742
|
+
return _this3.getImplicit(dataIndex, index);
|
|
743
|
+
} },
|
|
744
|
+
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
745
|
+
)
|
|
746
|
+
), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
747
|
+
_react2['default'].createElement(
|
|
748
|
+
'span',
|
|
749
|
+
null,
|
|
750
|
+
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? '' + text : renderTextDesensitize,
|
|
751
|
+
' ',
|
|
752
|
+
_react2['default'].createElement(
|
|
753
|
+
'a',
|
|
754
|
+
{ onClick: function onClick() {
|
|
755
|
+
return _this3.getImplicit(dataIndex, index);
|
|
756
|
+
} },
|
|
757
|
+
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
758
|
+
)
|
|
759
|
+
)
|
|
760
|
+
);
|
|
761
|
+
} else {
|
|
762
|
+
return _react2['default'].createElement(
|
|
763
|
+
'span',
|
|
764
|
+
null,
|
|
765
|
+
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? '' + text : renderTextDesensitize,
|
|
766
|
+
' ',
|
|
767
|
+
_react2['default'].createElement(
|
|
768
|
+
'a',
|
|
769
|
+
{ onClick: function onClick() {
|
|
770
|
+
return _this3.getImplicit(dataIndex, index);
|
|
771
|
+
} },
|
|
772
|
+
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
773
|
+
)
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
} else if (text && text.length * 14 > 160) {
|
|
777
|
+
return _react2['default'].createElement(
|
|
778
|
+
_tooltip2['default'],
|
|
779
|
+
{ placement: 'topLeft', title: text, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
780
|
+
text
|
|
781
|
+
);
|
|
782
|
+
} else {
|
|
783
|
+
return text;
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
if (item.type === 'numeralFormat') {
|
|
787
|
+
item.render = function (text) {
|
|
788
|
+
return _react2['default'].createElement(
|
|
789
|
+
_tooltip2['default'],
|
|
790
|
+
{ placement: 'topLeft', title: _this3.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
791
|
+
_this3.numeralFormat(text)
|
|
792
|
+
);
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
}if (item.fixed) {
|
|
796
|
+
item.className = 'e3wText';
|
|
797
|
+
item.minWidth = 5;
|
|
798
|
+
}
|
|
799
|
+
if (item.children) {
|
|
800
|
+
recursionT(item.children);
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
};
|
|
804
|
+
recursion(columns);
|
|
805
|
+
if (dataList) {
|
|
806
|
+
if (dataList.length > 0) {
|
|
807
|
+
recursionT(columns);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
var columnsNew = columns;
|
|
811
|
+
if (autoAddNumber) {
|
|
812
|
+
if (columns.length > 0) {
|
|
813
|
+
columnsNew = [{
|
|
814
|
+
title: '序号',
|
|
815
|
+
dataIndex: 'number',
|
|
816
|
+
className: 'e3wGridShortText',
|
|
817
|
+
render: function render(text, record, index) {
|
|
818
|
+
return _react2['default'].createElement(
|
|
819
|
+
'div',
|
|
820
|
+
null,
|
|
821
|
+
(current - 1) * limit + index + 1,
|
|
822
|
+
' '
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
}].concat(columns);
|
|
826
|
+
}
|
|
763
827
|
}
|
|
828
|
+
return columnsNew;
|
|
764
829
|
};
|
|
765
830
|
};
|
|
766
831
|
|