easy3wui 1.5.48 → 1.5.49-beta2
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/Easy3wFormPage/index.js +4 -7
- package/lib/Easy3wGridPage/index.js +266 -215
- package/package.json +1 -1
|
@@ -498,7 +498,8 @@ var Easy3wFormPage = function (_Component) {
|
|
|
498
498
|
_this.getcheckDesensitizeData = function (str, item) {
|
|
499
499
|
var phoneRegex = /^1[3-9]\d{9}$/; // 手机号
|
|
500
500
|
var emailRegex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/; // 邮箱
|
|
501
|
-
var idRegex =
|
|
501
|
+
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]$)/; // 身份证
|
|
502
|
+
item.dataDesensitizationFlagTrue = false; // 当前字段--数据脱敏标识--脱敏成功
|
|
502
503
|
if (phoneRegex.test(str)) {
|
|
503
504
|
// 手机号
|
|
504
505
|
item.dataDesensitizationFlagTrue = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
@@ -513,12 +514,8 @@ var Easy3wFormPage = function (_Component) {
|
|
|
513
514
|
|
|
514
515
|
var desensitizedUsername = username.slice(0, 1) + '****';
|
|
515
516
|
return desensitizedUsername + '@' + domain; // 脱敏邮箱
|
|
516
|
-
} else if (idRegex.test(str)
|
|
517
|
-
//
|
|
518
|
-
item.dataDesensitizationFlagTrue = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
519
|
-
return str.slice(0, 3) + '***********' + str.slice(-4); // 脱敏身份证
|
|
520
|
-
} else if (idRegex.test(str) && str.length === 15) {
|
|
521
|
-
// 15位身份证
|
|
517
|
+
} else if (idRegex.test(str)) {
|
|
518
|
+
// 身份证
|
|
522
519
|
item.dataDesensitizationFlagTrue = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
523
520
|
return str.slice(0, 3) + '********' + str.slice(-4); // 脱敏身份证
|
|
524
521
|
} else {
|
|
@@ -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,22 @@ 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
|
+
if (nextProps.dataList.length !== dataList.length || JSON.stringify(nextProps.dataList) !== JSON.stringify(dataList)) {
|
|
135
|
+
this.setState({
|
|
136
|
+
arrData: nextProps.dataList && nextProps.dataList.length ? JSON.parse(JSON.stringify(nextProps.dataList)) : []
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (nextProps.columns.length !== columns.length || JSON.stringify(nextProps.columns) !== JSON.stringify(columns)) {
|
|
140
|
+
this.setState({
|
|
141
|
+
arrColumns: nextProps.columns && nextProps.columns.length ? this.formatColumns((0, _cloneDeep2['default'])(nextProps.columns)) : []
|
|
142
|
+
});
|
|
143
|
+
}
|
|
117
144
|
if (nextProps.cleanFlag === '1') {
|
|
118
145
|
this.delAll();
|
|
119
146
|
}
|
|
@@ -123,151 +150,40 @@ var Easy3wGridPage = function (_Component) {
|
|
|
123
150
|
|
|
124
151
|
// 数据脱敏--显隐
|
|
125
152
|
|
|
126
|
-
|
|
127
153
|
// ---------------------------------- 数据脱敏 end ----------------------------------
|
|
154
|
+
// 生成表格
|
|
155
|
+
|
|
156
|
+
|
|
128
157
|
Easy3wGridPage.prototype.render = function render() {
|
|
129
158
|
var _this2 = this;
|
|
130
159
|
|
|
131
|
-
var
|
|
132
|
-
columns =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
160
|
+
var _props2 = this.props,
|
|
161
|
+
columns = _props2.columns,
|
|
162
|
+
loading = _props2.loading,
|
|
163
|
+
getCheckboxProps = _props2.getCheckboxProps,
|
|
164
|
+
needPaginationFlag = _props2.needPaginationFlag,
|
|
165
|
+
gridProps = _props2.gridProps,
|
|
166
|
+
totalResult = _props2.totalResult,
|
|
167
|
+
rowKey = _props2.rowKey,
|
|
168
|
+
checkType = _props2.checkType,
|
|
169
|
+
bordered = _props2.bordered,
|
|
170
|
+
chooseFlag = _props2.chooseFlag,
|
|
171
|
+
scroll = _props2.scroll,
|
|
172
|
+
className = _props2.className,
|
|
173
|
+
paginationInfo = _props2.paginationInfo;
|
|
174
|
+
var arrData = this.state.arrData;
|
|
175
|
+
// [].concat(arrA)
|
|
176
|
+
// const arrColumns = this.touchCreateColumns([].concat(columns));
|
|
177
|
+
// const arrColumns = this.touchCreateColumns(JSON.parse(JSON.stringify(columns)));
|
|
178
|
+
|
|
179
|
+
var arrColumns = this.touchCreateColumns((0, _cloneDeep2['default'])(columns));
|
|
180
|
+
// const arrColumns = this.touchCreateColumns(columns);
|
|
147
181
|
var _state = this.state,
|
|
148
182
|
selectedRowKeysState = _state.selectedRowKeysState,
|
|
149
183
|
selectedRowsState = _state.selectedRowsState,
|
|
150
184
|
selRowKeysTags = _state.selRowKeysTags;
|
|
151
185
|
|
|
152
186
|
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
187
|
var rowSelection = null;
|
|
272
188
|
if (checkType) {
|
|
273
189
|
// 若需选择框
|
|
@@ -294,7 +210,6 @@ var Easy3wGridPage = function (_Component) {
|
|
|
294
210
|
}
|
|
295
211
|
};
|
|
296
212
|
}
|
|
297
|
-
var myColumns = columns;
|
|
298
213
|
// 处理分页 start
|
|
299
214
|
if (needPaginationFlag) {
|
|
300
215
|
var defaultCurrent = paginationInfo ? paginationInfo.offset : 1;
|
|
@@ -313,34 +228,10 @@ var Easy3wGridPage = function (_Component) {
|
|
|
313
228
|
showQuickJumper: true,
|
|
314
229
|
pageSizeOptions: ['10', '20', '30', '40', '50', '100']
|
|
315
230
|
};
|
|
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
231
|
}
|
|
334
232
|
var printArr = location.hash.split('/');
|
|
335
233
|
var printValue = this.props.printValue || 'print';
|
|
336
234
|
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
235
|
var alertRegionFlag = false;
|
|
345
236
|
if (selRowKeysTags && selRowKeysTags instanceof Array && selRowKeysTags.length) {
|
|
346
237
|
alertRegionFlag = true;
|
|
@@ -360,8 +251,8 @@ var Easy3wGridPage = function (_Component) {
|
|
|
360
251
|
{ className: gridProps || this.props.rowType ? gridProps.onRow || this.props.rowType ? 'onRow' : null : null },
|
|
361
252
|
_react2['default'].createElement(_table2['default'], (0, _extends3['default'])({
|
|
362
253
|
className: printFlag ? 'scrollPrint' : className || 'scrollX',
|
|
363
|
-
columns:
|
|
364
|
-
dataSource:
|
|
254
|
+
columns: this.state.arrColumns && this.state.arrColumns.length ? this.state.arrColumns : arrColumns,
|
|
255
|
+
dataSource: arrData,
|
|
365
256
|
pagination: paginationProps,
|
|
366
257
|
loading: loading,
|
|
367
258
|
rowKey: rowKey,
|
|
@@ -401,11 +292,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
401
292
|
var _state2 = _this3.state,
|
|
402
293
|
selectedRowKeysState = _state2.selectedRowKeysState,
|
|
403
294
|
selectedRowsState = _state2.selectedRowsState;
|
|
404
|
-
var
|
|
405
|
-
rowKey =
|
|
406
|
-
rowKeyCname =
|
|
407
|
-
selectChangeCallback =
|
|
408
|
-
chooseFlag =
|
|
295
|
+
var _props3 = _this3.props,
|
|
296
|
+
rowKey = _props3.rowKey,
|
|
297
|
+
rowKeyCname = _props3.rowKeyCname,
|
|
298
|
+
selectChangeCallback = _props3.selectChangeCallback,
|
|
299
|
+
chooseFlag = _props3.chooseFlag;
|
|
409
300
|
|
|
410
301
|
selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
|
|
411
302
|
return selectedRowKey === closeKey;
|
|
@@ -442,11 +333,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
442
333
|
|
|
443
334
|
var selectedRowKeysStateArr = selectedRowKeysState;
|
|
444
335
|
var selectedRowsStateArr = selectedRowsState;
|
|
445
|
-
var
|
|
446
|
-
rowKey =
|
|
447
|
-
rowKeyCname =
|
|
448
|
-
selectChangeCallback =
|
|
449
|
-
chooseFlag =
|
|
336
|
+
var _props4 = _this3.props,
|
|
337
|
+
rowKey = _props4.rowKey,
|
|
338
|
+
rowKeyCname = _props4.rowKeyCname,
|
|
339
|
+
selectChangeCallback = _props4.selectChangeCallback,
|
|
340
|
+
chooseFlag = _props4.chooseFlag;
|
|
450
341
|
|
|
451
342
|
var newSelRowKeysTags = [];
|
|
452
343
|
selectedRowKeysStateArr.splice(selectedRowKeysStateArr.findIndex(function (selectedRowKey) {
|
|
@@ -493,12 +384,12 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
493
384
|
var _state4 = _this3.state,
|
|
494
385
|
selectedRowKeysState = _state4.selectedRowKeysState,
|
|
495
386
|
selectedRowsState = _state4.selectedRowsState;
|
|
496
|
-
var
|
|
497
|
-
rowKey =
|
|
498
|
-
rowKeyCname =
|
|
499
|
-
selectChangeCallback =
|
|
500
|
-
chooseFlag =
|
|
501
|
-
checkType =
|
|
387
|
+
var _props5 = _this3.props,
|
|
388
|
+
rowKey = _props5.rowKey,
|
|
389
|
+
rowKeyCname = _props5.rowKeyCname,
|
|
390
|
+
selectChangeCallback = _props5.selectChangeCallback,
|
|
391
|
+
chooseFlag = _props5.chooseFlag,
|
|
392
|
+
checkType = _props5.checkType;
|
|
502
393
|
|
|
503
394
|
if (checkType === 'radio') {
|
|
504
395
|
selectedRowKeysState = [];
|
|
@@ -534,11 +425,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
534
425
|
var _state5 = _this3.state,
|
|
535
426
|
selectedRowKeysState = _state5.selectedRowKeysState,
|
|
536
427
|
selectedRowsState = _state5.selectedRowsState;
|
|
537
|
-
var
|
|
538
|
-
rowKey =
|
|
539
|
-
rowKeyCname =
|
|
540
|
-
selectChangeCallback =
|
|
541
|
-
chooseFlag =
|
|
428
|
+
var _props6 = _this3.props,
|
|
429
|
+
rowKey = _props6.rowKey,
|
|
430
|
+
rowKeyCname = _props6.rowKeyCname,
|
|
431
|
+
selectChangeCallback = _props6.selectChangeCallback,
|
|
432
|
+
chooseFlag = _props6.chooseFlag;
|
|
542
433
|
|
|
543
434
|
removeRows.forEach(function (removeRow) {
|
|
544
435
|
selectedRowKeysState.splice(selectedRowKeysState.findIndex(function (selectedRowKey) {
|
|
@@ -611,11 +502,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
611
502
|
|
|
612
503
|
var selectedRowKeysStateArr = selectedRowKeysState;
|
|
613
504
|
var selectedRowsStateArr = selectedRowsState;
|
|
614
|
-
var
|
|
615
|
-
rowKey =
|
|
616
|
-
rowKeyCname =
|
|
617
|
-
selectChangeCallback =
|
|
618
|
-
chooseFlag =
|
|
505
|
+
var _props7 = _this3.props,
|
|
506
|
+
rowKey = _props7.rowKey,
|
|
507
|
+
rowKeyCname = _props7.rowKeyCname,
|
|
508
|
+
selectChangeCallback = _props7.selectChangeCallback,
|
|
509
|
+
chooseFlag = _props7.chooseFlag;
|
|
619
510
|
|
|
620
511
|
var flag = false;
|
|
621
512
|
var newSelRowKeysTags = [];
|
|
@@ -684,10 +575,10 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
684
575
|
};
|
|
685
576
|
|
|
686
577
|
this.handleTableChange = function (pagination) {
|
|
687
|
-
var
|
|
688
|
-
selfDealPageChangeFunc =
|
|
689
|
-
getSearchCondition =
|
|
690
|
-
handleSearch =
|
|
578
|
+
var _props8 = _this3.props,
|
|
579
|
+
selfDealPageChangeFunc = _props8.selfDealPageChangeFunc,
|
|
580
|
+
getSearchCondition = _props8.getSearchCondition,
|
|
581
|
+
handleSearch = _props8.handleSearch;
|
|
691
582
|
|
|
692
583
|
var formVal = getSearchCondition();
|
|
693
584
|
var paginationInfo = { offset: pagination.current, limit: pagination.pageSize };
|
|
@@ -699,39 +590,45 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
699
590
|
}
|
|
700
591
|
};
|
|
701
592
|
|
|
702
|
-
this.getcheckDesensitizeData = function (str,
|
|
593
|
+
this.getcheckDesensitizeData = function (str, record, dataIndex) {
|
|
703
594
|
var phoneRegex = /^1[3-9]\d{9}$/; // 手机号
|
|
704
595
|
var emailRegex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/; // 邮箱
|
|
705
|
-
var idRegex =
|
|
706
|
-
|
|
596
|
+
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位身份证
|
|
597
|
+
// let { arrData } = this.state;
|
|
598
|
+
// const { dataList } = this.props;
|
|
599
|
+
// if (arrData && arrData.length === 0) {
|
|
600
|
+
// arrData = [...dataList];
|
|
601
|
+
// }
|
|
602
|
+
var strDesensitize = str; // 脱敏字符串
|
|
603
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = false; // 当前字段--数据脱敏标识--未脱敏成功
|
|
707
604
|
if (phoneRegex.test(str)) {
|
|
708
605
|
// 手机号
|
|
709
|
-
|
|
710
|
-
|
|
606
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
607
|
+
strDesensitize = str.slice(0, 3) + '****' + str.slice(-4); // 脱敏手机号
|
|
711
608
|
} else if (emailRegex.test(str)) {
|
|
712
609
|
// 邮箱
|
|
713
|
-
|
|
610
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
714
611
|
|
|
715
612
|
var _str$split = str.split('@'),
|
|
716
613
|
username = _str$split[0],
|
|
717
614
|
domain = _str$split[1];
|
|
718
615
|
|
|
719
616
|
var desensitizedUsername = username.slice(0, 1) + '****';
|
|
720
|
-
|
|
721
|
-
} else if (idRegex.test(str)
|
|
722
|
-
//
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
} else if (idRegex.test(str) && str.length === 15) {
|
|
726
|
-
// 15位身份证
|
|
727
|
-
item.dataDesensitizationFlagTrue = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
728
|
-
return str.slice(0, 3) + '********' + str.slice(-4); // 脱敏身份证
|
|
729
|
-
} else {
|
|
730
|
-
return str;
|
|
617
|
+
strDesensitize = desensitizedUsername + '@' + domain; // 脱敏邮箱
|
|
618
|
+
} else if (idRegex.test(str)) {
|
|
619
|
+
// 身份证
|
|
620
|
+
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
621
|
+
strDesensitize = str.slice(0, 3) + '********' + str.slice(-4); // 脱敏身份证
|
|
731
622
|
}
|
|
623
|
+
// this.setState({
|
|
624
|
+
// arrData, // 更新数据
|
|
625
|
+
// });
|
|
626
|
+
return strDesensitize;
|
|
732
627
|
};
|
|
733
628
|
|
|
734
|
-
this.getImplicit = function (dataIndex,
|
|
629
|
+
this.getImplicit = function (dataIndex, index) {
|
|
630
|
+
var arrData = _this3.state.arrData;
|
|
631
|
+
|
|
735
632
|
if (_comonConfig.dataDesensitizationUrl) {
|
|
736
633
|
var xhr = new XMLHttpRequest();
|
|
737
634
|
xhr.onreadystatechange = function () {
|
|
@@ -745,9 +642,10 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
745
642
|
passMsg = _ref.passMsg;
|
|
746
643
|
|
|
747
644
|
if (passFlag) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
645
|
+
arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] = !arrData[index][dataIndex + '-dataDesensitizationEyeFlag']; // 当前字段--数据脱敏标识--显隐
|
|
646
|
+
_this3.setState({
|
|
647
|
+
arrData: arrData // 更新数据
|
|
648
|
+
});
|
|
751
649
|
} else {
|
|
752
650
|
_modal2['default'].error({
|
|
753
651
|
content: passMsg || '用户无权限,请联系管理员',
|
|
@@ -761,10 +659,163 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
761
659
|
xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
|
|
762
660
|
xhr.send(data); // 发送请求
|
|
763
661
|
} else {
|
|
764
|
-
|
|
662
|
+
arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] = !arrData[index][dataIndex + '-dataDesensitizationEyeFlag']; // 当前字段--数据脱敏标识--显隐
|
|
663
|
+
_this3.setState({
|
|
664
|
+
arrData: arrData // 更新数据
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
this.touchCreateColumns = function (columns) {
|
|
670
|
+
var _props9 = _this3.props,
|
|
671
|
+
dataList = _props9.dataList,
|
|
672
|
+
autoAddNumber = _props9.autoAddNumber,
|
|
673
|
+
paginationInfo = _props9.paginationInfo;
|
|
674
|
+
var arrData = _this3.state.arrData;
|
|
675
|
+
|
|
676
|
+
var current = paginationInfo ? paginationInfo.offset : _this3.state.pagination.offset;
|
|
677
|
+
var limit = paginationInfo ? paginationInfo.limit : _this3.state.pagination.limit;
|
|
678
|
+
var printArr = location.hash.split('/');
|
|
679
|
+
var printValue = _this3.props.printValue || 'print';
|
|
680
|
+
var printFlag = printArr[1] === printValue;
|
|
681
|
+
var recursion = function recursion(arr) {
|
|
682
|
+
arr.forEach(function (item) {
|
|
683
|
+
var columnsType = item.type;
|
|
684
|
+
if (item.fixed && printFlag) {
|
|
685
|
+
item.fixed = null;
|
|
686
|
+
}
|
|
687
|
+
switch (columnsType) {
|
|
688
|
+
case 'shortText':
|
|
689
|
+
item.className = 'e3wGridShortText';break;
|
|
690
|
+
case 'longText':
|
|
691
|
+
item.className = 'e3wGridLongText';break;
|
|
692
|
+
case 'number':
|
|
693
|
+
item.className = 'e3wGridNumber';break;
|
|
694
|
+
case 'maxText':
|
|
695
|
+
item.className = 'e3wMaxText';break;
|
|
696
|
+
case 'numeralFormat':
|
|
697
|
+
item.className = 'e3wGridNumber';break;
|
|
698
|
+
default:
|
|
699
|
+
item.className = 'e3wGridShortText';
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
if (item.children) {
|
|
703
|
+
recursion(item.children);
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
var recursionT = function recursionT(arr) {
|
|
708
|
+
arr.forEach(function (item) {
|
|
709
|
+
if (item.fixed && printFlag) {
|
|
710
|
+
item.fixed = null;
|
|
711
|
+
}
|
|
712
|
+
var dataIndex = item.dataIndex;
|
|
765
713
|
|
|
766
|
-
|
|
714
|
+
if (!item.render) {
|
|
715
|
+
item.render = function (text, record, index) {
|
|
716
|
+
var renderTextDesensitize = '';
|
|
717
|
+
if (_comonConfig.dataDesensitizationFlag) {
|
|
718
|
+
renderTextDesensitize = _this3.getcheckDesensitizeData(text, record, dataIndex);
|
|
719
|
+
}
|
|
720
|
+
if (_comonConfig.dataDesensitizationFlag && record[dataIndex + '-dataDesensitizationFlagTrue']) {
|
|
721
|
+
if (text && text.length * 14 > 160) {
|
|
722
|
+
return _react2['default'].createElement(
|
|
723
|
+
_tooltip2['default'],
|
|
724
|
+
{ placement: 'topLeft', title: _react2['default'].createElement(
|
|
725
|
+
'span',
|
|
726
|
+
null,
|
|
727
|
+
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? text : renderTextDesensitize,
|
|
728
|
+
' ',
|
|
729
|
+
_react2['default'].createElement(
|
|
730
|
+
'a',
|
|
731
|
+
{ onClick: function onClick() {
|
|
732
|
+
return _this3.getImplicit(dataIndex, index);
|
|
733
|
+
} },
|
|
734
|
+
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
735
|
+
)
|
|
736
|
+
), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
737
|
+
_react2['default'].createElement(
|
|
738
|
+
'span',
|
|
739
|
+
null,
|
|
740
|
+
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? '' + text : renderTextDesensitize,
|
|
741
|
+
' ',
|
|
742
|
+
_react2['default'].createElement(
|
|
743
|
+
'a',
|
|
744
|
+
{ onClick: function onClick() {
|
|
745
|
+
return _this3.getImplicit(dataIndex, index);
|
|
746
|
+
} },
|
|
747
|
+
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
748
|
+
)
|
|
749
|
+
)
|
|
750
|
+
);
|
|
751
|
+
} else {
|
|
752
|
+
return _react2['default'].createElement(
|
|
753
|
+
'span',
|
|
754
|
+
null,
|
|
755
|
+
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? '' + text : renderTextDesensitize,
|
|
756
|
+
' ',
|
|
757
|
+
_react2['default'].createElement(
|
|
758
|
+
'a',
|
|
759
|
+
{ onClick: function onClick() {
|
|
760
|
+
return _this3.getImplicit(dataIndex, index);
|
|
761
|
+
} },
|
|
762
|
+
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
763
|
+
)
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
} else if (text && text.length * 14 > 160) {
|
|
767
|
+
return _react2['default'].createElement(
|
|
768
|
+
_tooltip2['default'],
|
|
769
|
+
{ placement: 'topLeft', title: text, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
770
|
+
text
|
|
771
|
+
);
|
|
772
|
+
} else {
|
|
773
|
+
return text;
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
if (item.type === 'numeralFormat') {
|
|
777
|
+
item.render = function (text) {
|
|
778
|
+
return _react2['default'].createElement(
|
|
779
|
+
_tooltip2['default'],
|
|
780
|
+
{ placement: 'topLeft', title: _this3.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
781
|
+
_this3.numeralFormat(text)
|
|
782
|
+
);
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
}if (item.fixed) {
|
|
786
|
+
item.className = 'e3wText';
|
|
787
|
+
item.minWidth = 5;
|
|
788
|
+
}
|
|
789
|
+
if (item.children) {
|
|
790
|
+
recursionT(item.children);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
recursion(columns);
|
|
795
|
+
if (dataList) {
|
|
796
|
+
if (dataList.length > 0) {
|
|
797
|
+
recursionT(columns);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
var columnsNew = columns;
|
|
801
|
+
if (autoAddNumber) {
|
|
802
|
+
if (columns.length > 0) {
|
|
803
|
+
columnsNew = [{
|
|
804
|
+
title: '序号',
|
|
805
|
+
dataIndex: 'number',
|
|
806
|
+
className: 'e3wGridShortText',
|
|
807
|
+
render: function render(text, record, index) {
|
|
808
|
+
return _react2['default'].createElement(
|
|
809
|
+
'div',
|
|
810
|
+
null,
|
|
811
|
+
(current - 1) * limit + index + 1,
|
|
812
|
+
' '
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
}].concat(columns);
|
|
816
|
+
}
|
|
767
817
|
}
|
|
818
|
+
return columnsNew;
|
|
768
819
|
};
|
|
769
820
|
};
|
|
770
821
|
|