fmui-base 2.3.18 → 2.3.20
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/README.md +2 -0
- package/lib/form/form.js +148 -17
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/form/form.js
CHANGED
|
@@ -201,6 +201,10 @@ var PageHome = function (_React$Component) {
|
|
|
201
201
|
dataType: dataType,
|
|
202
202
|
prefixName: prefixName,
|
|
203
203
|
loaded: false,
|
|
204
|
+
// 移动端 weboffice:解析完成前不挂 Upload,避免 initData 把 recordId 冲成附件 id
|
|
205
|
+
// resolved 后:仅 wpsWebOffice 显示「编辑正文」,其它走只读 Upload
|
|
206
|
+
mobileOfficeAllowEdit: false,
|
|
207
|
+
mobileOfficeResolved: false,
|
|
204
208
|
commentList: [],
|
|
205
209
|
phraseListNew: [],
|
|
206
210
|
attitudeList: [], //态度列表
|
|
@@ -1267,10 +1271,6 @@ var PageHome = function (_React$Component) {
|
|
|
1267
1271
|
popCode = form.popuserMap.popCode;
|
|
1268
1272
|
chooseWay = form.popuserMap.chooseWay;
|
|
1269
1273
|
itemParam.chooseObj = form.popuserMap.chooseObj;
|
|
1270
|
-
//表单默认值
|
|
1271
|
-
if (form.popuserMap.defaultUserScopeJson) {
|
|
1272
|
-
itemParam.defaultValue = JSON.parse(form.popuserMap.defaultUserScopeJson);
|
|
1273
|
-
}
|
|
1274
1274
|
} else {
|
|
1275
1275
|
popCode = form.popuserMap.chooseObj;
|
|
1276
1276
|
//兼容老数据
|
|
@@ -1290,6 +1290,25 @@ var PageHome = function (_React$Component) {
|
|
|
1290
1290
|
}
|
|
1291
1291
|
chooseWay = form.popuserMap.chooseWay;
|
|
1292
1292
|
}
|
|
1293
|
+
//表单默认值(当前用户/组织):与宏值一致,赋值字段清空已保存值,走 defaultValue 回填
|
|
1294
|
+
if (form.popuserMap.defaultUserScopeJson) {
|
|
1295
|
+
try {
|
|
1296
|
+
itemParam.defaultValue = JSON.parse(form.popuserMap.defaultUserScopeJson);
|
|
1297
|
+
} catch (e) {
|
|
1298
|
+
itemParam.defaultValue = form.popuserMap.defaultUserScopeJson;
|
|
1299
|
+
}
|
|
1300
|
+
if (fuzhiFields && fuzhiFields.split(",").indexOf(itemParam.uniqueName) != -1 && itemParam.defaultValue) {
|
|
1301
|
+
value = "";
|
|
1302
|
+
if (mainTblData && mainTblData.length) {
|
|
1303
|
+
for (var _pu = 0; _pu < mainTblData.length; _pu++) {
|
|
1304
|
+
if (mainTblData[_pu].key == key) {
|
|
1305
|
+
mainTblData[_pu].value = "";
|
|
1306
|
+
break;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1293
1312
|
if (form.popuserMap.chooseScope) {
|
|
1294
1313
|
if (form.popuserMap.chooseScope == 5) {
|
|
1295
1314
|
itemParam.queryLimit = form.popuserMap.chooseScope;
|
|
@@ -1388,12 +1407,18 @@ var PageHome = function (_React$Component) {
|
|
|
1388
1407
|
}
|
|
1389
1408
|
t.setState({
|
|
1390
1409
|
itemParam: itemParam,
|
|
1391
|
-
loaded: true
|
|
1410
|
+
loaded: true,
|
|
1411
|
+
mobileOfficeAllowEdit: false,
|
|
1412
|
+
mobileOfficeResolved: false
|
|
1392
1413
|
}, function () {
|
|
1393
|
-
|
|
1394
|
-
if (
|
|
1395
|
-
uploadRef.
|
|
1414
|
+
// 只读可直接挂 Upload;可编辑须等 resolve,禁止在解析前 initData 回写 value
|
|
1415
|
+
if (t.state.itemParam.readOnly) {
|
|
1416
|
+
var uploadRef = t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1417
|
+
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
1418
|
+
uploadRef.initData();
|
|
1419
|
+
}
|
|
1396
1420
|
}
|
|
1421
|
+
t.resolveMobileOfficeAllowEdit();
|
|
1397
1422
|
|
|
1398
1423
|
//修改样式
|
|
1399
1424
|
var styleStr = "";
|
|
@@ -1444,12 +1469,17 @@ var PageHome = function (_React$Component) {
|
|
|
1444
1469
|
}
|
|
1445
1470
|
t.setState({
|
|
1446
1471
|
itemParam: itemParam,
|
|
1447
|
-
loaded: true
|
|
1472
|
+
loaded: true,
|
|
1473
|
+
mobileOfficeAllowEdit: false,
|
|
1474
|
+
mobileOfficeResolved: false
|
|
1448
1475
|
}, function () {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
uploadRef.initData
|
|
1476
|
+
if (t.state.itemParam.readOnly) {
|
|
1477
|
+
var uploadRef = t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1478
|
+
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
1479
|
+
uploadRef.initData();
|
|
1480
|
+
}
|
|
1452
1481
|
}
|
|
1482
|
+
t.resolveMobileOfficeAllowEdit();
|
|
1453
1483
|
|
|
1454
1484
|
//修改样式
|
|
1455
1485
|
var styleStr = "";
|
|
@@ -1570,12 +1600,22 @@ var PageHome = function (_React$Component) {
|
|
|
1570
1600
|
this.refs['selectMember_' + key].initSelectData();
|
|
1571
1601
|
}
|
|
1572
1602
|
}
|
|
1573
|
-
if (itemType == 'upload' || itemType == 'image' && itemParam.imagetype != '1'
|
|
1603
|
+
if (itemType == 'upload' || itemType == 'image' && itemParam.imagetype != '1') {
|
|
1574
1604
|
var uploadRef = this.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1575
1605
|
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
1576
1606
|
uploadRef.initData();
|
|
1577
1607
|
}
|
|
1578
1608
|
}
|
|
1609
|
+
// 扩展把字段改成 weboffice 时:与专用分支一致,解析完成前不 initData
|
|
1610
|
+
if (itemType == 'weboffice') {
|
|
1611
|
+
if (t.state.itemParam.readOnly) {
|
|
1612
|
+
var woUploadRef = this.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1613
|
+
if (woUploadRef && typeof woUploadRef.initData === 'function') {
|
|
1614
|
+
woUploadRef.initData();
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
t.resolveMobileOfficeAllowEdit();
|
|
1618
|
+
}
|
|
1579
1619
|
if (itemType == 'note') {
|
|
1580
1620
|
if (itemParam.noteFileIds) {
|
|
1581
1621
|
this.refs["note_file_" + t.state.itemParam.fieldId].initData();
|
|
@@ -3617,7 +3657,11 @@ var PageHome = function (_React$Component) {
|
|
|
3617
3657
|
}
|
|
3618
3658
|
itemParam.value = recordId;
|
|
3619
3659
|
t.setState({
|
|
3620
|
-
itemParam: itemParam
|
|
3660
|
+
itemParam: itemParam,
|
|
3661
|
+
mobileOfficeResolved: false,
|
|
3662
|
+
mobileOfficeAllowEdit: false
|
|
3663
|
+
}, function () {
|
|
3664
|
+
t.resolveMobileOfficeAllowEdit();
|
|
3621
3665
|
});
|
|
3622
3666
|
var data = t.editData(itemParam.key, recordId, t.props.data);
|
|
3623
3667
|
if (typeof t.props.onChange === 'function') {
|
|
@@ -3651,6 +3695,56 @@ var PageHome = function (_React$Component) {
|
|
|
3651
3695
|
onRecordIdGenerated: t.applyGeneratedRecordId.bind(t)
|
|
3652
3696
|
};
|
|
3653
3697
|
}
|
|
3698
|
+
|
|
3699
|
+
/** 移动端是否允许云编辑入口:当前仅放行 wpsWebOffice */
|
|
3700
|
+
|
|
3701
|
+
}, {
|
|
3702
|
+
key: 'isMobileWpsWebOffice',
|
|
3703
|
+
value: function isMobileWpsWebOffice(resolved) {
|
|
3704
|
+
if (!resolved) {
|
|
3705
|
+
return false;
|
|
3706
|
+
}
|
|
3707
|
+
return resolved.strategy === 'wpsWebOffice' || resolved.officeType === 'wpsWebOffice';
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
/**
|
|
3711
|
+
* 解析正文类型,决定是否显示「编辑正文」。
|
|
3712
|
+
* 可编辑且未解析完成:不挂 Upload(占位),避免 initData 把 recordId 冲成附件 id。
|
|
3713
|
+
* 解析后:wps → 编辑正文;非 wps → Upload 只读样式。
|
|
3714
|
+
*/
|
|
3715
|
+
|
|
3716
|
+
}, {
|
|
3717
|
+
key: 'resolveMobileOfficeAllowEdit',
|
|
3718
|
+
value: function resolveMobileOfficeAllowEdit() {
|
|
3719
|
+
var t = this;
|
|
3720
|
+
if (!t.state.itemParam || t.state.itemParam.itemType !== 'weboffice') {
|
|
3721
|
+
return;
|
|
3722
|
+
}
|
|
3723
|
+
var finish = function finish(allow) {
|
|
3724
|
+
t.setState({
|
|
3725
|
+
mobileOfficeAllowEdit: !!allow,
|
|
3726
|
+
mobileOfficeResolved: true
|
|
3727
|
+
}, function () {
|
|
3728
|
+
// 仅 Upload 场景再 initData
|
|
3729
|
+
if (t.state.itemParam.readOnly || !t.state.mobileOfficeAllowEdit) {
|
|
3730
|
+
var uploadRef = t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
3731
|
+
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
3732
|
+
uploadRef.initData();
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
});
|
|
3736
|
+
};
|
|
3737
|
+
if (typeof MobileOffice === 'undefined' || typeof MobileOffice.resolveType !== 'function') {
|
|
3738
|
+
finish(false);
|
|
3739
|
+
return;
|
|
3740
|
+
}
|
|
3741
|
+
var ctx = t.buildOfficeCtx();
|
|
3742
|
+
MobileOffice.resolveType(ctx).then(function (resolved) {
|
|
3743
|
+
finish(t.isMobileWpsWebOffice(resolved));
|
|
3744
|
+
}).catch(function () {
|
|
3745
|
+
finish(false);
|
|
3746
|
+
});
|
|
3747
|
+
}
|
|
3654
3748
|
}, {
|
|
3655
3749
|
key: 'openWeboffice',
|
|
3656
3750
|
value: function openWeboffice(mode) {
|
|
@@ -3659,8 +3753,22 @@ var PageHome = function (_React$Component) {
|
|
|
3659
3753
|
_Toast2.default.show({ content: 'Office SDK 未加载' });
|
|
3660
3754
|
return;
|
|
3661
3755
|
}
|
|
3662
|
-
var
|
|
3756
|
+
var t = this;
|
|
3757
|
+
var ctx = t.buildOfficeCtx();
|
|
3663
3758
|
ctx.mode = mode || 'edit';
|
|
3759
|
+
// 可编辑入口二次校验:仅 wpsWebOffice
|
|
3760
|
+
if (mode !== 'preview' && ctx.mode !== 'preview' && !ctx.readOnly) {
|
|
3761
|
+
MobileOffice.resolveType(ctx).then(function (resolved) {
|
|
3762
|
+
if (!t.isMobileWpsWebOffice(resolved)) {
|
|
3763
|
+
_Toast2.default.show({ content: '移动端暂仅支持 WPS 中台在线编辑,请到 PC 端操作' });
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3766
|
+
MobileOffice.open(ctx);
|
|
3767
|
+
}).catch(function () {
|
|
3768
|
+
_Toast2.default.show({ content: '无法识别正文类型' });
|
|
3769
|
+
});
|
|
3770
|
+
return;
|
|
3771
|
+
}
|
|
3664
3772
|
MobileOffice.open(ctx);
|
|
3665
3773
|
}
|
|
3666
3774
|
}, {
|
|
@@ -3691,8 +3799,14 @@ var PageHome = function (_React$Component) {
|
|
|
3691
3799
|
key: 'clickPop',
|
|
3692
3800
|
value: function clickPop() {
|
|
3693
3801
|
if (!this.state.itemParam.readOnly) {
|
|
3694
|
-
// weboffice 走云编辑;其它类型(如 html)仍提示不支持
|
|
3802
|
+
// weboffice:仅 wps 走云编辑;其它类型(如 html)仍提示不支持
|
|
3695
3803
|
if (this.state.itemParam.itemType === 'weboffice') {
|
|
3804
|
+
if (!this.state.mobileOfficeResolved || !this.state.mobileOfficeAllowEdit) {
|
|
3805
|
+
_Toast2.default.show({
|
|
3806
|
+
content: '移动端暂仅支持 WPS 中台在线编辑,请到 PC 端操作'
|
|
3807
|
+
});
|
|
3808
|
+
return false;
|
|
3809
|
+
}
|
|
3696
3810
|
this.openWeboffice('edit');
|
|
3697
3811
|
return false;
|
|
3698
3812
|
}
|
|
@@ -4756,7 +4870,24 @@ var PageHome = function (_React$Component) {
|
|
|
4756
4870
|
_react2.default.createElement(
|
|
4757
4871
|
'div',
|
|
4758
4872
|
{ className: 't-W100' },
|
|
4759
|
-
t.state.itemParam.readOnly ? _react2.default.createElement(
|
|
4873
|
+
!t.state.itemParam.readOnly && !t.state.mobileOfficeResolved ? _react2.default.createElement(
|
|
4874
|
+
'div',
|
|
4875
|
+
{ className: 't-field-box t-FBH t-FBAC t-FBJ' },
|
|
4876
|
+
_react2.default.createElement(
|
|
4877
|
+
'div',
|
|
4878
|
+
{ className: t.state.itemParam.required ? 't-field-layout-h-label required' : 't-field-layout-h-label' },
|
|
4879
|
+
_react2.default.createElement(
|
|
4880
|
+
'span',
|
|
4881
|
+
{ style: t.state.itemParam.formStyleObj.titleStyle == null ? {} : t.state.itemParam.formStyleObj.titleStyle },
|
|
4882
|
+
t.state.itemParam.title
|
|
4883
|
+
)
|
|
4884
|
+
),
|
|
4885
|
+
_react2.default.createElement(
|
|
4886
|
+
'div',
|
|
4887
|
+
{ className: 't-P16 t-FCgray t-FS14' },
|
|
4888
|
+
'\u52A0\u8F7D\u4E2D...'
|
|
4889
|
+
)
|
|
4890
|
+
) : t.state.itemParam.readOnly || !t.state.mobileOfficeAllowEdit ? _react2.default.createElement(_upload2.default, {
|
|
4760
4891
|
ref: "upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key,
|
|
4761
4892
|
canAdd: false,
|
|
4762
4893
|
canDel: false,
|