easy3wui 1.5.36 → 1.5.37-beta1
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 +82 -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,31 @@ var formItemRightWithBtn = {
|
|
|
275
277
|
var formItemStyle = {
|
|
276
278
|
marginBottom: 6
|
|
277
279
|
};
|
|
280
|
+
// 手机号区号及正则表 当有国家区号相同时后加区号在原本的区号基础上加 '+序号'
|
|
281
|
+
var arrMobileAssociation = [{ 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
|
+
var objMobileRegular = {
|
|
287
|
+
'+86': /^1[34578]\d{9}$/,
|
|
288
|
+
'+852': /^\d+$/,
|
|
289
|
+
'+886': /^\d+$/,
|
|
290
|
+
'+853': /^\d+$/,
|
|
291
|
+
// '+852': /^([5|6|9])\d{7}$/,
|
|
292
|
+
// '+886': /^[0][9]\d{8}$/,
|
|
293
|
+
// '+853': /^6\d{7}$/,
|
|
294
|
+
'+1': /^\d+$/,
|
|
295
|
+
'+49': /^\d+$/,
|
|
296
|
+
'+33': /^\d+$/,
|
|
297
|
+
'+34': /^\d+$/,
|
|
298
|
+
'+81': /^\d+$/,
|
|
299
|
+
'+82': /^\d+$/,
|
|
300
|
+
'+61': /^\d+$/,
|
|
301
|
+
'+1+0': /^\d+$/,
|
|
302
|
+
'+91': /^\d+$/,
|
|
303
|
+
'+7': /^\d+$/
|
|
304
|
+
};
|
|
278
305
|
|
|
279
306
|
var Easy3wFormPage = function (_Component) {
|
|
280
307
|
(0, _inherits3['default'])(Easy3wFormPage, _Component);
|
|
@@ -345,6 +372,8 @@ var Easy3wFormPage = function (_Component) {
|
|
|
345
372
|
return _this.timePickerHandler(itemNew);
|
|
346
373
|
case 'input':
|
|
347
374
|
return _this.inputHandler(itemNew);
|
|
375
|
+
case 'mobile':
|
|
376
|
+
return _this.mobileHandler(itemNew);
|
|
348
377
|
case 'textarea':
|
|
349
378
|
return _this.textareaHandler(itemNew);
|
|
350
379
|
// case 'inputNumber':
|
|
@@ -512,7 +541,13 @@ var Easy3wFormPage = function (_Component) {
|
|
|
512
541
|
} else {
|
|
513
542
|
addRules = [{ max: maxLength, message: '\u5F55\u5165\u6587\u5B57\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7' + maxLength, transform: _this.touchTransform }].concat(addRules);
|
|
514
543
|
}
|
|
544
|
+
} else if (fieldType === 'mobile') {
|
|
545
|
+
var mobileAddonBefore = form.getFieldValue('mobileAddonBefore');
|
|
546
|
+
// console.log('mobileAddonBefore', mobileAddonBefore, objMobileRegular[mobileAddonBefore]);
|
|
547
|
+
// objMobileRegular[mobileAddonBefore]
|
|
548
|
+
addRules = [{ pattern: objMobileRegular[mobileAddonBefore], message: '手机格式错误!' }].concat(addRules);
|
|
515
549
|
}
|
|
550
|
+
|
|
516
551
|
var decoratorObj = {
|
|
517
552
|
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }].concat(addRules)
|
|
518
553
|
};
|
|
@@ -1115,6 +1150,40 @@ var Easy3wFormPage = function (_Component) {
|
|
|
1115
1150
|
cmptPros = _item$cmptPros === undefined ? {} : _item$cmptPros;
|
|
1116
1151
|
|
|
1117
1152
|
return _react2['default'].createElement(_input2['default'], cmptPros);
|
|
1153
|
+
}, _this.mobileHandler = function (item) {
|
|
1154
|
+
var fieldId = item.fieldId,
|
|
1155
|
+
required = item.required,
|
|
1156
|
+
_item$cmptPros2 = item.cmptPros,
|
|
1157
|
+
cmptPros = _item$cmptPros2 === undefined ? {} : _item$cmptPros2;
|
|
1158
|
+
|
|
1159
|
+
var addonBeforeCmptPros = item.addonBeforeCmptPros || {};
|
|
1160
|
+
addonBeforeCmptPros = (0, _extends3['default'])({ allowClear: false, style: { minWidth: '90px' } }, addonBeforeCmptPros);
|
|
1161
|
+
var itemArea = _this.selectHandler({ cmptPros: (0, _extends3['default'])({ optionLst: arrMobileAssociation }, addonBeforeCmptPros) });
|
|
1162
|
+
|
|
1163
|
+
var decoratorObj = {
|
|
1164
|
+
rules: [{ required: required, message: '请填写区号' }],
|
|
1165
|
+
initialValue: '+86'
|
|
1166
|
+
};
|
|
1167
|
+
return _react2['default'].createElement(_input2['default'], (0, _extends3['default'])({
|
|
1168
|
+
addonBefore: _this.props.form.getFieldDecorator(fieldId + 'AddonBefore', (0, _extends3['default'])({}, decoratorObj))(itemArea),
|
|
1169
|
+
onBlur: function onBlur(e) {
|
|
1170
|
+
return _this.onBlurMobile(e, fieldId);
|
|
1171
|
+
}
|
|
1172
|
+
}, cmptPros));
|
|
1173
|
+
}, _this.onBlurMobile = function (e, fieldId) {
|
|
1174
|
+
var mobileAreaCode = _this.props.form.getFieldValue(fieldId + 'AddonBefore');
|
|
1175
|
+
if (e && e.target && e.target.value && mobileAreaCode) {
|
|
1176
|
+
var xhr = new XMLHttpRequest();
|
|
1177
|
+
xhr.onreadystatechange = function () {
|
|
1178
|
+
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
1179
|
+
// 请求成功,处理响应数据
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
var data = JSON.stringify({ e3wMobile: e.target.value, e3wMobileNation: mobileAreaCode });
|
|
1183
|
+
xhr.open("POST", _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
|
|
1184
|
+
xhr.setRequestHeader("Content-Type", "application/json"); // 设置请求头
|
|
1185
|
+
xhr.send(data); // 发送请求
|
|
1186
|
+
}
|
|
1118
1187
|
}, _this.selectHandler = function (item) {
|
|
1119
1188
|
var cmptPros = item.cmptPros;
|
|
1120
1189
|
var optionLst = cmptPros.optionLst;
|
|
@@ -1264,8 +1333,8 @@ var Easy3wFormPage = function (_Component) {
|
|
|
1264
1333
|
_message3['default'].info('\u8F93\u5165\u5B57\u6570\u4E0D\u80FD\u8D85\u8FC7' + maxLength);
|
|
1265
1334
|
}
|
|
1266
1335
|
}, _this.textareaHandler = function (item) {
|
|
1267
|
-
var _item$
|
|
1268
|
-
cmptPros = _item$
|
|
1336
|
+
var _item$cmptPros3 = item.cmptPros,
|
|
1337
|
+
cmptPros = _item$cmptPros3 === undefined ? {} : _item$cmptPros3;
|
|
1269
1338
|
|
|
1270
1339
|
var maxlength = void 0;
|
|
1271
1340
|
if (cmptPros.maxLength || cmptPros.maxlength) {
|
|
@@ -1605,6 +1674,11 @@ var Easy3wFormPage = function (_Component) {
|
|
|
1605
1674
|
/** input start */
|
|
1606
1675
|
|
|
1607
1676
|
/** input end */
|
|
1677
|
+
/** mobile start */
|
|
1678
|
+
|
|
1679
|
+
// 手机录入框失去焦点
|
|
1680
|
+
|
|
1681
|
+
/** mobile end */
|
|
1608
1682
|
|
|
1609
1683
|
/** select start */
|
|
1610
1684
|
|