easy3wui 1.5.50 → 1.5.51-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.js +103 -329
- package/lib/Easy3wGetDesensitization/index.js +43 -0
- package/lib/Easy3wGridPage/index.js +105 -363
- package/lib/index.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports['default'] = Easy3wGetDesensitization;
|
|
5
|
+
// 脱敏规则:
|
|
6
|
+
// 1. 手机号:脱敏为前三位和后四位,中间用****代替
|
|
7
|
+
// 2. 邮箱:脱敏为用户名的第一个字母和最后一个字母,中间用****代替,@后面的地址不变
|
|
8
|
+
// 3. 身份证:脱敏为前三位和后四位,中间用****代替
|
|
9
|
+
// 4. 其他字符串:不做脱敏
|
|
10
|
+
function Easy3wGetDesensitization(strDesensitization, objRegex) {
|
|
11
|
+
// strDesensitization: 待脱敏的字符串 字符串类型
|
|
12
|
+
// objRegex: 自定义正则表达式 对象类型
|
|
13
|
+
// 返回脱敏后的字符串
|
|
14
|
+
var strText = strDesensitization;
|
|
15
|
+
if (strText && typeof strText === 'string') {
|
|
16
|
+
var _ref = objRegex || {},
|
|
17
|
+
phoneRegexNew = _ref.phoneRegex,
|
|
18
|
+
emailRegexNew = _ref.emailRegex,
|
|
19
|
+
idRegexNew = _ref.idRegex; // 自定义正则表达式
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var phoneRegex = phoneRegexNew || /^1[3-9]\d{9}$/; // 手机号
|
|
23
|
+
var emailRegex = emailRegexNew || /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/; // 邮箱
|
|
24
|
+
var idRegex = idRegexNew || /(^[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位
|
|
25
|
+
if (phoneRegex.test(strText)) {
|
|
26
|
+
// 手机号
|
|
27
|
+
strText = strText.slice(0, 3) + '****' + strText.slice(-4); // 脱敏手机号
|
|
28
|
+
} else if (emailRegex.test(strText)) {
|
|
29
|
+
// 邮箱
|
|
30
|
+
var _strText$split = strText.split('@'),
|
|
31
|
+
username = _strText$split[0],
|
|
32
|
+
domain = _strText$split[1];
|
|
33
|
+
|
|
34
|
+
var desensitizedUsername = username.slice(0, 1) + '****';
|
|
35
|
+
strText = desensitizedUsername + '@' + domain; // 脱敏邮箱
|
|
36
|
+
} else if (idRegex.test(strText)) {
|
|
37
|
+
// 身份证
|
|
38
|
+
strText = strText.slice(0, 3) + '***********' + strText.slice(-4); // 脱敏身份证
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return strText;
|
|
42
|
+
}
|
|
43
|
+
module.exports = exports['default'];
|
|
@@ -56,26 +56,24 @@ var _tooltip2 = _interopRequireDefault(_tooltip);
|
|
|
56
56
|
|
|
57
57
|
require('antd/lib/tooltip/style');
|
|
58
58
|
|
|
59
|
-
var _icon = require('antd/lib/icon');
|
|
60
|
-
|
|
61
|
-
var _icon2 = _interopRequireDefault(_icon);
|
|
62
|
-
|
|
63
|
-
require('antd/lib/icon/style');
|
|
64
|
-
|
|
65
|
-
var _modal = require('antd/lib/modal');
|
|
66
|
-
|
|
67
|
-
var _modal2 = _interopRequireDefault(_modal);
|
|
68
|
-
|
|
69
|
-
require('antd/lib/modal/style');
|
|
70
|
-
|
|
71
59
|
var _numeral = require('numeral');
|
|
72
60
|
|
|
73
61
|
var _numeral2 = _interopRequireDefault(_numeral);
|
|
74
62
|
|
|
63
|
+
var _dva = require('dva');
|
|
64
|
+
|
|
65
|
+
var _easy3wui = require('easy3wui');
|
|
66
|
+
|
|
75
67
|
var _comonConfig = require('comonConfigPath/comonConfig');
|
|
76
68
|
|
|
77
69
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
78
70
|
|
|
71
|
+
(0, _dva.connect)(function (state) {
|
|
72
|
+
return {
|
|
73
|
+
globalData: state.globalData
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
79
77
|
var Easy3wGridPage = function (_Component) {
|
|
80
78
|
(0, _inherits3['default'])(Easy3wGridPage, _Component);
|
|
81
79
|
|
|
@@ -104,13 +102,7 @@ var Easy3wGridPage = function (_Component) {
|
|
|
104
102
|
));
|
|
105
103
|
});
|
|
106
104
|
}
|
|
107
|
-
var dataList = _this.props.dataList;
|
|
108
|
-
|
|
109
|
-
var arrData = dataList && dataList.length ? _this.deepCopy(dataList) : [];
|
|
110
105
|
_this.state = {
|
|
111
|
-
// 数据
|
|
112
|
-
arrData: arrData, // 列表
|
|
113
|
-
// 选择
|
|
114
106
|
selectedRowKeysState: selectedKey || [],
|
|
115
107
|
selectedRowsState: selectedVal || [],
|
|
116
108
|
selRowKeysTags: selRowKeysTags,
|
|
@@ -120,64 +112,100 @@ var Easy3wGridPage = function (_Component) {
|
|
|
120
112
|
}
|
|
121
113
|
|
|
122
114
|
Easy3wGridPage.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
123
|
-
var _props$dataList = this.props.dataList,
|
|
124
|
-
dataList = _props$dataList === undefined ? [] : _props$dataList;
|
|
125
|
-
var _nextProps$dataList = nextProps.dataList,
|
|
126
|
-
nextDataList = _nextProps$dataList === undefined ? [] : _nextProps$dataList;
|
|
127
|
-
|
|
128
|
-
var isEqual = this.touchDeepEqual(nextDataList, dataList);
|
|
129
|
-
if (!isEqual) {
|
|
130
|
-
this.setState({
|
|
131
|
-
arrData: nextDataList.length ? this.deepCopy(nextDataList) : []
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
115
|
if (nextProps.cleanFlag === '1') {
|
|
135
116
|
this.delAll();
|
|
136
117
|
}
|
|
137
118
|
};
|
|
138
|
-
// ---------------------------------- 数据脱敏 start ----------------------------------
|
|
139
|
-
// 数据校验与脱敏
|
|
140
|
-
|
|
141
|
-
// 数据脱敏--显隐
|
|
142
|
-
|
|
143
|
-
// ---------------------------------- 数据脱敏 end ----------------------------------
|
|
144
|
-
// 生成表格
|
|
145
|
-
|
|
146
|
-
// 数组深度复制
|
|
147
|
-
|
|
148
|
-
// 数组深度比较
|
|
149
|
-
|
|
150
119
|
|
|
151
120
|
Easy3wGridPage.prototype.render = function render() {
|
|
152
121
|
var _this2 = this;
|
|
153
122
|
|
|
154
123
|
var _props = this.props,
|
|
155
124
|
columns = _props.columns,
|
|
125
|
+
totalResult = _props.totalResult,
|
|
126
|
+
dataList = _props.dataList,
|
|
156
127
|
loading = _props.loading,
|
|
157
128
|
getCheckboxProps = _props.getCheckboxProps,
|
|
158
129
|
needPaginationFlag = _props.needPaginationFlag,
|
|
130
|
+
autoAddNumber = _props.autoAddNumber,
|
|
159
131
|
gridProps = _props.gridProps,
|
|
160
|
-
totalResult = _props.totalResult,
|
|
161
132
|
rowKey = _props.rowKey,
|
|
162
133
|
checkType = _props.checkType,
|
|
163
134
|
bordered = _props.bordered,
|
|
164
135
|
chooseFlag = _props.chooseFlag,
|
|
165
136
|
scroll = _props.scroll,
|
|
166
137
|
className = _props.className,
|
|
167
|
-
paginationInfo = _props.paginationInfo
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// const arrColumns = this.touchCreateColumns([].concat(columns));
|
|
171
|
-
// const arrColumns = this.touchCreateColumns(JSON.parse(JSON.stringify(columns)));
|
|
172
|
-
|
|
173
|
-
var arrColumns = this.touchCreateColumns(this.deepCopy(columns));
|
|
174
|
-
// const arrColumns = this.touchCreateColumns(columns);
|
|
138
|
+
paginationInfo = _props.paginationInfo,
|
|
139
|
+
globalData = _props.globalData;
|
|
140
|
+
var dataDesensitizationEyeFlag = globalData.dataDesensitizationEyeFlag;
|
|
175
141
|
var _state = this.state,
|
|
176
142
|
selectedRowKeysState = _state.selectedRowKeysState,
|
|
177
143
|
selectedRowsState = _state.selectedRowsState,
|
|
178
144
|
selRowKeysTags = _state.selRowKeysTags;
|
|
179
145
|
|
|
180
146
|
var paginationProps = false; // 默认不分页
|
|
147
|
+
var recursion = function recursion(arr) {
|
|
148
|
+
arr.forEach(function (item) {
|
|
149
|
+
var columnsType = item.type;
|
|
150
|
+
switch (columnsType) {
|
|
151
|
+
case 'shortText':
|
|
152
|
+
item.className = 'e3wGridShortText';break;
|
|
153
|
+
case 'longText':
|
|
154
|
+
item.className = 'e3wGridLongText';break;
|
|
155
|
+
case 'number':
|
|
156
|
+
item.className = 'e3wGridNumber';break;
|
|
157
|
+
case 'maxText':
|
|
158
|
+
item.className = 'e3wMaxText';break;
|
|
159
|
+
case 'numeralFormat':
|
|
160
|
+
item.className = 'e3wGridNumber';break;
|
|
161
|
+
default:
|
|
162
|
+
item.className = 'e3wGridShortText';
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
if (item.children) {
|
|
166
|
+
recursion(item.children);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
var recursionT = function recursionT(arr) {
|
|
171
|
+
arr.forEach(function (item) {
|
|
172
|
+
if (!item.render) {
|
|
173
|
+
item.render = function (text) {
|
|
174
|
+
var strTextNew = _comonConfig.dataDesensitizationFlag ? dataDesensitizationEyeFlag ? text : (0, _easy3wui.Easy3wGetDesensitization)(text) : text;
|
|
175
|
+
if (strTextNew && strTextNew.length * 14 > 160) {
|
|
176
|
+
return _react2['default'].createElement(
|
|
177
|
+
_tooltip2['default'],
|
|
178
|
+
{ placement: 'topLeft', title: strTextNew, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
179
|
+
strTextNew
|
|
180
|
+
);
|
|
181
|
+
} else {
|
|
182
|
+
return strTextNew;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
if (item.type === 'numeralFormat') {
|
|
186
|
+
item.render = function (text) {
|
|
187
|
+
return _react2['default'].createElement(
|
|
188
|
+
_tooltip2['default'],
|
|
189
|
+
{ placement: 'topLeft', title: _this2.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
190
|
+
_this2.numeralFormat(text)
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}if (item.fixed) {
|
|
195
|
+
item.className = 'e3wText';
|
|
196
|
+
item.minWidth = 5;
|
|
197
|
+
}
|
|
198
|
+
if (item.children) {
|
|
199
|
+
recursionT(item.children);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
recursion(columns);
|
|
204
|
+
if (dataList) {
|
|
205
|
+
if (dataList.length > 0) {
|
|
206
|
+
recursionT(columns);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
181
209
|
var rowSelection = null;
|
|
182
210
|
if (checkType) {
|
|
183
211
|
// 若需选择框
|
|
@@ -204,6 +232,7 @@ var Easy3wGridPage = function (_Component) {
|
|
|
204
232
|
}
|
|
205
233
|
};
|
|
206
234
|
}
|
|
235
|
+
var myColumns = columns;
|
|
207
236
|
// 处理分页 start
|
|
208
237
|
if (needPaginationFlag) {
|
|
209
238
|
var defaultCurrent = paginationInfo ? paginationInfo.offset : 1;
|
|
@@ -222,10 +251,34 @@ var Easy3wGridPage = function (_Component) {
|
|
|
222
251
|
showQuickJumper: true,
|
|
223
252
|
pageSizeOptions: ['10', '20', '30', '40', '50', '100']
|
|
224
253
|
};
|
|
254
|
+
if (autoAddNumber) {
|
|
255
|
+
if (columns.length > 0) {
|
|
256
|
+
myColumns = [{
|
|
257
|
+
title: '序号',
|
|
258
|
+
dataIndex: 'number',
|
|
259
|
+
className: 'e3wGridShortText',
|
|
260
|
+
render: function render(text, record, index) {
|
|
261
|
+
return _react2['default'].createElement(
|
|
262
|
+
'div',
|
|
263
|
+
null,
|
|
264
|
+
(current - 1) * limit + index + 1,
|
|
265
|
+
' '
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}].concat(columns);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
225
271
|
}
|
|
226
272
|
var printArr = location.hash.split('/');
|
|
227
273
|
var printValue = this.props.printValue || 'print';
|
|
228
274
|
var printFlag = printArr[1] === printValue;
|
|
275
|
+
if (printFlag) {
|
|
276
|
+
myColumns.forEach(function (item) {
|
|
277
|
+
if (item.fixed) {
|
|
278
|
+
item.fixed = null;
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
229
282
|
var alertRegionFlag = false;
|
|
230
283
|
if (selRowKeysTags && selRowKeysTags instanceof Array && selRowKeysTags.length) {
|
|
231
284
|
alertRegionFlag = true;
|
|
@@ -245,8 +298,8 @@ var Easy3wGridPage = function (_Component) {
|
|
|
245
298
|
{ className: gridProps || this.props.rowType ? gridProps.onRow || this.props.rowType ? 'onRow' : null : null },
|
|
246
299
|
_react2['default'].createElement(_table2['default'], (0, _extends3['default'])({
|
|
247
300
|
className: printFlag ? 'scrollPrint' : className || 'scrollX',
|
|
248
|
-
columns:
|
|
249
|
-
dataSource:
|
|
301
|
+
columns: myColumns,
|
|
302
|
+
dataSource: dataList,
|
|
250
303
|
pagination: paginationProps,
|
|
251
304
|
loading: loading,
|
|
252
305
|
rowKey: rowKey,
|
|
@@ -583,317 +636,6 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
583
636
|
handleSearch(paginationInfo, formVal);
|
|
584
637
|
}
|
|
585
638
|
};
|
|
586
|
-
|
|
587
|
-
this.getcheckDesensitizeData = function (str, record, dataIndex) {
|
|
588
|
-
var phoneRegex = /^1[3-9]\d{9}$/; // 手机号
|
|
589
|
-
var emailRegex = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/; // 邮箱
|
|
590
|
-
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位身份证
|
|
591
|
-
// let { arrData } = this.state;
|
|
592
|
-
// const { dataList } = this.props;
|
|
593
|
-
// if (arrData && arrData.length === 0) {
|
|
594
|
-
// arrData = [...dataList];
|
|
595
|
-
// }
|
|
596
|
-
var strDesensitize = str; // 脱敏字符串
|
|
597
|
-
record[dataIndex + '-dataDesensitizationFlagTrue'] = false; // 当前字段--数据脱敏标识--未脱敏成功
|
|
598
|
-
if (phoneRegex.test(str)) {
|
|
599
|
-
// 手机号
|
|
600
|
-
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
601
|
-
strDesensitize = str.slice(0, 3) + '****' + str.slice(-4); // 脱敏手机号
|
|
602
|
-
} else if (emailRegex.test(str)) {
|
|
603
|
-
// 邮箱
|
|
604
|
-
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
605
|
-
|
|
606
|
-
var _str$split = str.split('@'),
|
|
607
|
-
username = _str$split[0],
|
|
608
|
-
domain = _str$split[1];
|
|
609
|
-
|
|
610
|
-
var desensitizedUsername = username.slice(0, 1) + '****';
|
|
611
|
-
strDesensitize = desensitizedUsername + '@' + domain; // 脱敏邮箱
|
|
612
|
-
} else if (idRegex.test(str)) {
|
|
613
|
-
// 身份证
|
|
614
|
-
record[dataIndex + '-dataDesensitizationFlagTrue'] = true; // 当前字段--数据脱敏标识--脱敏成功
|
|
615
|
-
strDesensitize = str.slice(0, 3) + '********' + str.slice(-4); // 脱敏身份证
|
|
616
|
-
}
|
|
617
|
-
// this.setState({
|
|
618
|
-
// arrData, // 更新数据
|
|
619
|
-
// });
|
|
620
|
-
return strDesensitize;
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
this.getImplicit = function (event, dataIndex, index) {
|
|
624
|
-
event.stopPropagation(); // 禁止事件冒泡
|
|
625
|
-
var arrData = _this3.state.arrData;
|
|
626
|
-
|
|
627
|
-
if (_comonConfig.dataDesensitizationUrl) {
|
|
628
|
-
var xhr = new XMLHttpRequest();
|
|
629
|
-
xhr.onreadystatechange = function () {
|
|
630
|
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
631
|
-
// 请求成功,处理响应数据
|
|
632
|
-
var _JSON$parse = JSON.parse(xhr.responseText),
|
|
633
|
-
_data = _JSON$parse.data;
|
|
634
|
-
|
|
635
|
-
var _ref = _data || {},
|
|
636
|
-
passFlag = _ref.passFlag,
|
|
637
|
-
passMsg = _ref.passMsg;
|
|
638
|
-
|
|
639
|
-
if (passFlag) {
|
|
640
|
-
arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] = !arrData[index][dataIndex + '-dataDesensitizationEyeFlag']; // 当前字段--数据脱敏标识--显隐
|
|
641
|
-
_this3.setState({
|
|
642
|
-
arrData: arrData // 更新数据
|
|
643
|
-
});
|
|
644
|
-
} else {
|
|
645
|
-
_modal2['default'].error({
|
|
646
|
-
content: passMsg || '用户无权限,请联系管理员',
|
|
647
|
-
okText: '确定'
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
var data = JSON.stringify({});
|
|
653
|
-
xhr.open('POST', _comonConfig.dataDesensitizationUrl, true); // 异步请求
|
|
654
|
-
xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
|
|
655
|
-
xhr.send(data); // 发送请求
|
|
656
|
-
} else {
|
|
657
|
-
arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] = !arrData[index][dataIndex + '-dataDesensitizationEyeFlag']; // 当前字段--数据脱敏标识--显隐
|
|
658
|
-
_this3.setState({
|
|
659
|
-
arrData: arrData // 更新数据
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
// return false;
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
this.touchCreateColumns = function (columns) {
|
|
666
|
-
var _props8 = _this3.props,
|
|
667
|
-
dataList = _props8.dataList,
|
|
668
|
-
autoAddNumber = _props8.autoAddNumber,
|
|
669
|
-
paginationInfo = _props8.paginationInfo;
|
|
670
|
-
var arrData = _this3.state.arrData;
|
|
671
|
-
|
|
672
|
-
var current = paginationInfo ? paginationInfo.offset : _this3.state.pagination.offset;
|
|
673
|
-
var limit = paginationInfo ? paginationInfo.limit : _this3.state.pagination.limit;
|
|
674
|
-
var printArr = location.hash.split('/');
|
|
675
|
-
var printValue = _this3.props.printValue || 'print';
|
|
676
|
-
var printFlag = printArr[1] === printValue;
|
|
677
|
-
var recursion = function recursion(arr) {
|
|
678
|
-
for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
|
|
679
|
-
var _ref2;
|
|
680
|
-
|
|
681
|
-
if (_isArray) {
|
|
682
|
-
if (_i >= _iterator.length) break;
|
|
683
|
-
_ref2 = _iterator[_i++];
|
|
684
|
-
} else {
|
|
685
|
-
_i = _iterator.next();
|
|
686
|
-
if (_i.done) break;
|
|
687
|
-
_ref2 = _i.value;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
var item = _ref2;
|
|
691
|
-
|
|
692
|
-
var columnsType = item.type;
|
|
693
|
-
if (item.fixed && printFlag) {
|
|
694
|
-
item.fixed = null;
|
|
695
|
-
}
|
|
696
|
-
switch (columnsType) {
|
|
697
|
-
case 'shortText':
|
|
698
|
-
item.className = 'e3wGridShortText';break;
|
|
699
|
-
case 'longText':
|
|
700
|
-
item.className = 'e3wGridLongText';break;
|
|
701
|
-
case 'number':
|
|
702
|
-
item.className = 'e3wGridNumber';break;
|
|
703
|
-
case 'maxText':
|
|
704
|
-
item.className = 'e3wMaxText';break;
|
|
705
|
-
case 'numeralFormat':
|
|
706
|
-
item.className = 'e3wGridNumber';break;
|
|
707
|
-
default:
|
|
708
|
-
item.className = 'e3wGridShortText';
|
|
709
|
-
break;
|
|
710
|
-
}
|
|
711
|
-
if (item.children) {
|
|
712
|
-
recursion(item.children);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
var recursionT = function recursionT(arr) {
|
|
717
|
-
var _loop = function _loop(item) {
|
|
718
|
-
if (item.fixed && printFlag) {
|
|
719
|
-
item.fixed = null;
|
|
720
|
-
}
|
|
721
|
-
var dataIndex = item.dataIndex;
|
|
722
|
-
|
|
723
|
-
if (!item.render) {
|
|
724
|
-
item.render = function (text, record, index) {
|
|
725
|
-
var renderTextDesensitize = '';
|
|
726
|
-
if (_comonConfig.dataDesensitizationFlag) {
|
|
727
|
-
renderTextDesensitize = _this3.getcheckDesensitizeData(text, record, dataIndex);
|
|
728
|
-
}
|
|
729
|
-
if (_comonConfig.dataDesensitizationFlag && record[dataIndex + '-dataDesensitizationFlagTrue']) {
|
|
730
|
-
if (text && text.length * 14 > 160) {
|
|
731
|
-
return _react2['default'].createElement(
|
|
732
|
-
_tooltip2['default'],
|
|
733
|
-
{ placement: 'topLeft', title: _react2['default'].createElement(
|
|
734
|
-
'span',
|
|
735
|
-
null,
|
|
736
|
-
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? text : renderTextDesensitize,
|
|
737
|
-
' ',
|
|
738
|
-
_react2['default'].createElement(
|
|
739
|
-
'a',
|
|
740
|
-
{ onClick: function onClick(e) {
|
|
741
|
-
return _this3.getImplicit(e, dataIndex, index);
|
|
742
|
-
} },
|
|
743
|
-
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
744
|
-
)
|
|
745
|
-
), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
746
|
-
_react2['default'].createElement(
|
|
747
|
-
'span',
|
|
748
|
-
null,
|
|
749
|
-
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? '' + text : renderTextDesensitize,
|
|
750
|
-
' ',
|
|
751
|
-
_react2['default'].createElement(
|
|
752
|
-
'a',
|
|
753
|
-
{ onClick: function onClick(e) {
|
|
754
|
-
return _this3.getImplicit(e, dataIndex, index);
|
|
755
|
-
} },
|
|
756
|
-
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
757
|
-
)
|
|
758
|
-
)
|
|
759
|
-
);
|
|
760
|
-
} else {
|
|
761
|
-
return _react2['default'].createElement(
|
|
762
|
-
'span',
|
|
763
|
-
null,
|
|
764
|
-
arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? '' + text : renderTextDesensitize,
|
|
765
|
-
' ',
|
|
766
|
-
_react2['default'].createElement(
|
|
767
|
-
'a',
|
|
768
|
-
{ onClick: function onClick(e) {
|
|
769
|
-
return _this3.getImplicit(e, dataIndex, index);
|
|
770
|
-
} },
|
|
771
|
-
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
772
|
-
)
|
|
773
|
-
);
|
|
774
|
-
}
|
|
775
|
-
} else if (text && text.length * 14 > 160) {
|
|
776
|
-
return _react2['default'].createElement(
|
|
777
|
-
_tooltip2['default'],
|
|
778
|
-
{ placement: 'topLeft', title: text, style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
779
|
-
text
|
|
780
|
-
);
|
|
781
|
-
} else {
|
|
782
|
-
return text;
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
if (item.type === 'numeralFormat') {
|
|
786
|
-
item.render = function (text) {
|
|
787
|
-
return _react2['default'].createElement(
|
|
788
|
-
_tooltip2['default'],
|
|
789
|
-
{ placement: 'topLeft', title: _this3.numeralFormat(text), style: { whiteSpace: 'pre-wrap', wordWrap: 'break-word' } },
|
|
790
|
-
_this3.numeralFormat(text)
|
|
791
|
-
);
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
}if (item.fixed) {
|
|
795
|
-
item.className = 'e3wText';
|
|
796
|
-
item.minWidth = 5;
|
|
797
|
-
}
|
|
798
|
-
if (item.children) {
|
|
799
|
-
recursionT(item.children);
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
for (var _iterator2 = arr, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
804
|
-
var _ref3;
|
|
805
|
-
|
|
806
|
-
if (_isArray2) {
|
|
807
|
-
if (_i2 >= _iterator2.length) break;
|
|
808
|
-
_ref3 = _iterator2[_i2++];
|
|
809
|
-
} else {
|
|
810
|
-
_i2 = _iterator2.next();
|
|
811
|
-
if (_i2.done) break;
|
|
812
|
-
_ref3 = _i2.value;
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
var item = _ref3;
|
|
816
|
-
|
|
817
|
-
_loop(item);
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
recursion(columns);
|
|
821
|
-
if (dataList) {
|
|
822
|
-
if (dataList.length > 0) {
|
|
823
|
-
recursionT(columns);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
var columnsNew = columns;
|
|
827
|
-
if (autoAddNumber) {
|
|
828
|
-
if (columnsNew.length > 0) {
|
|
829
|
-
columnsNew = [{
|
|
830
|
-
title: '序号',
|
|
831
|
-
dataIndex: 'number',
|
|
832
|
-
className: 'e3wGridShortText',
|
|
833
|
-
render: function render(text, record, index) {
|
|
834
|
-
return _react2['default'].createElement(
|
|
835
|
-
'div',
|
|
836
|
-
null,
|
|
837
|
-
(current - 1) * limit + index + 1,
|
|
838
|
-
' '
|
|
839
|
-
);
|
|
840
|
-
}
|
|
841
|
-
}].concat(columnsNew);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
return [].concat(columnsNew);
|
|
845
|
-
};
|
|
846
|
-
|
|
847
|
-
this.deepCopy = function (obj) {
|
|
848
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
849
|
-
return obj;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
var copy = Array.isArray(obj) ? [] : {};
|
|
853
|
-
|
|
854
|
-
for (var key in obj) {
|
|
855
|
-
if (_react2['default'].isValidElement(obj[key])) {
|
|
856
|
-
copy[key] = obj[key];
|
|
857
|
-
} else if (key === 'children' && Array.isArray(obj[key]) || typeof obj[key] === 'object') {
|
|
858
|
-
copy[key] = _this3.deepCopy(obj[key]);
|
|
859
|
-
} else {
|
|
860
|
-
copy[key] = obj[key];
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
return copy;
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
this.touchDeepEqual = function (arrOne, arrTwo) {
|
|
868
|
-
if (arrOne.length === 0 && arrTwo.length === 0) {
|
|
869
|
-
return true;
|
|
870
|
-
}
|
|
871
|
-
if (arrOne.length !== arrTwo.length) {
|
|
872
|
-
return false;
|
|
873
|
-
}
|
|
874
|
-
for (var i = 0; i < arrOne.length; i += 1) {
|
|
875
|
-
var objOneKeys = Object.keys(arrOne[i]);
|
|
876
|
-
var objTwoKeys = Object.keys(arrTwo[i]);
|
|
877
|
-
if (objOneKeys.length !== objTwoKeys.length) {
|
|
878
|
-
return false;
|
|
879
|
-
}
|
|
880
|
-
for (var key in arrOne[i]) {
|
|
881
|
-
if (_react2['default'].isValidElement(arrOne[i][key]) || _react2['default'].isValidElement(arrTwo[i][key])) {
|
|
882
|
-
// 是一个 React 元素
|
|
883
|
-
} else if (key === 'children' && Array.isArray(arrOne[i][key]) && Array.isArray(arrTwo[i][key])) {
|
|
884
|
-
var isEqual = _this3.touchDeepEqual(arrOne[i][key], arrTwo[i][key]);
|
|
885
|
-
if (isEqual) {
|
|
886
|
-
// 相等
|
|
887
|
-
} else {
|
|
888
|
-
return false;
|
|
889
|
-
}
|
|
890
|
-
} else if (arrOne[i][key] !== arrTwo[i][key]) {
|
|
891
|
-
return false;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
return true;
|
|
896
|
-
};
|
|
897
639
|
};
|
|
898
640
|
|
|
899
641
|
exports['default'] = Easy3wGridPage;
|
package/lib/index.js
CHANGED
|
@@ -380,4 +380,13 @@ Object.defineProperty(exports, 'Easy3wAESDecrypt', {
|
|
|
380
380
|
}
|
|
381
381
|
});
|
|
382
382
|
|
|
383
|
+
var _Easy3wGetDesensitization = require('./Easy3wGetDesensitization');
|
|
384
|
+
|
|
385
|
+
Object.defineProperty(exports, 'Easy3wGetDesensitization', {
|
|
386
|
+
enumerable: true,
|
|
387
|
+
get: function get() {
|
|
388
|
+
return _interopRequireDefault(_Easy3wGetDesensitization)['default'];
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
|
|
383
392
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|