easy3wui 1.5.36 → 1.5.37
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 +81 -8
- package/package.json +1 -1
|
@@ -204,14 +204,10 @@ var _dva = require('dva');
|
|
|
204
204
|
|
|
205
205
|
var _easy3wui = require('easy3wui');
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
var _comonConfig = require('comonConfigPath/comonConfig');
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
// import Easy3wUpload from '../../Easy3wUpload';
|
|
211
|
-
// import Easy3wUploadB from '../../Easy3wUploadB';
|
|
212
|
-
// import Easy3wUploadM from '../../Easy3wUploadM';
|
|
209
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
213
210
|
|
|
214
|
-
// 引入富文本表格功能
|
|
215
211
|
var options = {
|
|
216
212
|
defaultRows: 3, // 默认行数
|
|
217
213
|
defaultColumns: 3, // 默认列数
|
|
@@ -219,6 +215,12 @@ var options = {
|
|
|
219
215
|
columnResizable: false, // 是否允许拖动调整列宽, 默认false
|
|
220
216
|
exportAttrString: 'style="border: 1"' // 指定输出HTML时附加到table标签上的属性字符串
|
|
221
217
|
};
|
|
218
|
+
// import TagSelect from '../Easy3wTagSelect/index.js';
|
|
219
|
+
// import Easy3wUpload from '../../Easy3wUpload';
|
|
220
|
+
// import Easy3wUploadB from '../../Easy3wUploadB';
|
|
221
|
+
// import Easy3wUploadM from '../../Easy3wUploadM';
|
|
222
|
+
// 引入富文本表格功能
|
|
223
|
+
|
|
222
224
|
_braftEditor2['default'].use((0, _table2['default'])(options)); // 表格
|
|
223
225
|
|
|
224
226
|
_moment2['default'].locale('zh-cn');
|
|
@@ -275,6 +277,32 @@ var formItemRightWithBtn = {
|
|
|
275
277
|
var formItemStyle = {
|
|
276
278
|
marginBottom: 6
|
|
277
279
|
};
|
|
280
|
+
// 手机号区号及正则表 当有国家区号相同时后加区号在原本的区号基础上加 '+序号'
|
|
281
|
+
var arrMobileAssociationDefault = [{ label: '中国', value: '+86', pattern: /^1[34578]\d{9}$/ }, { label: '香港', value: '+852', pattern: /^\d+$/ }, { label: '台湾', value: '+886', pattern: /^\d+$/ }, { label: '澳门', value: '+853', pattern: /^\d+$/ },
|
|
282
|
+
// { label: '香港', value: '+852', pattern: /^([5|6|9])\d{7}$/ },
|
|
283
|
+
// { label: '台湾', value: '+886', pattern: /^[0][9]\d{8}$/ },
|
|
284
|
+
// { label: '澳门', value: '+853', pattern: /^6\d{7}$/ },
|
|
285
|
+
{ label: '美国', value: '+1', pattern: /^\d+$/ }, { label: '德国', value: '+49', pattern: /^\d+$/ }, { label: '法国', value: '+33', pattern: /^\d+$/ }, { label: '英国', value: '+34', pattern: /^\d+$/ }, { label: '日本', value: '+81', pattern: /^\d+$/ }, { label: '韩国', value: '+82', pattern: /^\d+$/ }, { label: '澳大利亚', value: '+61', pattern: /^\d+$/ }, { label: '加拿大', value: '+1+0', pattern: /^\d+$/ }, { label: '印度', value: '+91', pattern: /^\d+$/ }, { label: '俄罗斯', value: '+7', pattern: /^\d+$/ }];
|
|
286
|
+
// 号码正则
|
|
287
|
+
var objMobileRegularDefault = {
|
|
288
|
+
'+86': /^1[34578]\d{9}$/,
|
|
289
|
+
'+852': /^\d+$/,
|
|
290
|
+
'+886': /^\d+$/,
|
|
291
|
+
'+853': /^\d+$/,
|
|
292
|
+
// '+852': /^([5|6|9])\d{7}$/,
|
|
293
|
+
// '+886': /^[0][9]\d{8}$/,
|
|
294
|
+
// '+853': /^6\d{7}$/,
|
|
295
|
+
'+1': /^\d+$/,
|
|
296
|
+
'+49': /^\d+$/,
|
|
297
|
+
'+33': /^\d+$/,
|
|
298
|
+
'+34': /^\d+$/,
|
|
299
|
+
'+81': /^\d+$/,
|
|
300
|
+
'+82': /^\d+$/,
|
|
301
|
+
'+61': /^\d+$/,
|
|
302
|
+
'+1+0': /^\d+$/,
|
|
303
|
+
'+91': /^\d+$/,
|
|
304
|
+
'+7': /^\d+$/
|
|
305
|
+
};
|
|
278
306
|
|
|
279
307
|
var Easy3wFormPage = function (_Component) {
|
|
280
308
|
(0, _inherits3['default'])(Easy3wFormPage, _Component);
|
|
@@ -345,6 +373,8 @@ var Easy3wFormPage = function (_Component) {
|
|
|
345
373
|
return _this.timePickerHandler(itemNew);
|
|
346
374
|
case 'input':
|
|
347
375
|
return _this.inputHandler(itemNew);
|
|
376
|
+
case 'mobile':
|
|
377
|
+
return _this.mobileHandler(itemNew);
|
|
348
378
|
case 'textarea':
|
|
349
379
|
return _this.textareaHandler(itemNew);
|
|
350
380
|
// case 'inputNumber':
|
|
@@ -512,6 +542,9 @@ var Easy3wFormPage = function (_Component) {
|
|
|
512
542
|
} else {
|
|
513
543
|
addRules = [{ max: maxLength, message: '\u5F55\u5165\u6587\u5B57\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7' + maxLength, transform: _this.touchTransform }].concat(addRules);
|
|
514
544
|
}
|
|
545
|
+
} else if (fieldType === 'mobile') {
|
|
546
|
+
var e3wMobileNation = form.getFieldValue(fieldId + 'AddonBefore');
|
|
547
|
+
addRules = [{ pattern: _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[e3wMobileNation] : objMobileRegularDefault[e3wMobileNation], message: '手机格式错误!' }].concat(addRules);
|
|
515
548
|
}
|
|
516
549
|
var decoratorObj = {
|
|
517
550
|
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }].concat(addRules)
|
|
@@ -1115,6 +1148,41 @@ var Easy3wFormPage = function (_Component) {
|
|
|
1115
1148
|
cmptPros = _item$cmptPros === undefined ? {} : _item$cmptPros;
|
|
1116
1149
|
|
|
1117
1150
|
return _react2['default'].createElement(_input2['default'], cmptPros);
|
|
1151
|
+
}, _this.mobileHandler = function (item) {
|
|
1152
|
+
var fieldId = item.fieldId,
|
|
1153
|
+
required = item.required,
|
|
1154
|
+
_item$cmptPros2 = item.cmptPros,
|
|
1155
|
+
cmptPros = _item$cmptPros2 === undefined ? {} : _item$cmptPros2;
|
|
1156
|
+
|
|
1157
|
+
var addonBeforeCmptPros = item.addonBeforeCmptPros || {};
|
|
1158
|
+
addonBeforeCmptPros = (0, _extends3['default'])({ allowClear: false, style: { minWidth: '90px' } }, addonBeforeCmptPros);
|
|
1159
|
+
var itemArea = _this.selectHandler({ cmptPros: (0, _extends3['default'])({ optionLst: _comonConfig.arrMobileAssociation || arrMobileAssociationDefault }, addonBeforeCmptPros) });
|
|
1160
|
+
|
|
1161
|
+
var decoratorObj = {
|
|
1162
|
+
rules: [{ required: required, message: '请填写区号' }],
|
|
1163
|
+
initialValue: '+86'
|
|
1164
|
+
};
|
|
1165
|
+
return _react2['default'].createElement(_input2['default'], (0, _extends3['default'])({
|
|
1166
|
+
addonBefore: _this.props.form.getFieldDecorator(fieldId + 'AddonBefore', (0, _extends3['default'])({}, decoratorObj))(itemArea),
|
|
1167
|
+
onBlur: function onBlur(e) {
|
|
1168
|
+
return _this.onBlurMobile(e, fieldId);
|
|
1169
|
+
}
|
|
1170
|
+
}, cmptPros));
|
|
1171
|
+
}, _this.onBlurMobile = function (e, fieldId) {
|
|
1172
|
+
var e3wMobileNation = _this.props.form.getFieldValue(fieldId + 'AddonBefore');
|
|
1173
|
+
var pattern = _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[e3wMobileNation] : objMobileRegularDefault[e3wMobileNation];
|
|
1174
|
+
if (e && e.target && e.target.value && e3wMobileNation && pattern.test(e.target.value)) {
|
|
1175
|
+
var xhr = new XMLHttpRequest();
|
|
1176
|
+
xhr.onreadystatechange = function () {
|
|
1177
|
+
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
1178
|
+
// 请求成功,处理响应数据
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
var data = JSON.stringify({ e3wMobile: e.target.value, e3wMobileNation: e3wMobileNation });
|
|
1182
|
+
xhr.open('POST', _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
|
|
1183
|
+
xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
|
|
1184
|
+
xhr.send(data); // 发送请求
|
|
1185
|
+
}
|
|
1118
1186
|
}, _this.selectHandler = function (item) {
|
|
1119
1187
|
var cmptPros = item.cmptPros;
|
|
1120
1188
|
var optionLst = cmptPros.optionLst;
|
|
@@ -1264,8 +1332,8 @@ var Easy3wFormPage = function (_Component) {
|
|
|
1264
1332
|
_message3['default'].info('\u8F93\u5165\u5B57\u6570\u4E0D\u80FD\u8D85\u8FC7' + maxLength);
|
|
1265
1333
|
}
|
|
1266
1334
|
}, _this.textareaHandler = function (item) {
|
|
1267
|
-
var _item$
|
|
1268
|
-
cmptPros = _item$
|
|
1335
|
+
var _item$cmptPros3 = item.cmptPros,
|
|
1336
|
+
cmptPros = _item$cmptPros3 === undefined ? {} : _item$cmptPros3;
|
|
1269
1337
|
|
|
1270
1338
|
var maxlength = void 0;
|
|
1271
1339
|
if (cmptPros.maxLength || cmptPros.maxlength) {
|
|
@@ -1605,6 +1673,11 @@ var Easy3wFormPage = function (_Component) {
|
|
|
1605
1673
|
/** input start */
|
|
1606
1674
|
|
|
1607
1675
|
/** input end */
|
|
1676
|
+
/** mobile start */
|
|
1677
|
+
|
|
1678
|
+
// 手机录入框失去焦点
|
|
1679
|
+
|
|
1680
|
+
/** mobile end */
|
|
1608
1681
|
|
|
1609
1682
|
/** select start */
|
|
1610
1683
|
|