fmui-base 2.3.18 → 2.3.19
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 +1 -0
- package/lib/form/form.js +129 -13
- 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: [], //态度列表
|
|
@@ -1388,12 +1392,18 @@ var PageHome = function (_React$Component) {
|
|
|
1388
1392
|
}
|
|
1389
1393
|
t.setState({
|
|
1390
1394
|
itemParam: itemParam,
|
|
1391
|
-
loaded: true
|
|
1395
|
+
loaded: true,
|
|
1396
|
+
mobileOfficeAllowEdit: false,
|
|
1397
|
+
mobileOfficeResolved: false
|
|
1392
1398
|
}, function () {
|
|
1393
|
-
|
|
1394
|
-
if (
|
|
1395
|
-
uploadRef.
|
|
1399
|
+
// 只读可直接挂 Upload;可编辑须等 resolve,禁止在解析前 initData 回写 value
|
|
1400
|
+
if (t.state.itemParam.readOnly) {
|
|
1401
|
+
var uploadRef = t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1402
|
+
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
1403
|
+
uploadRef.initData();
|
|
1404
|
+
}
|
|
1396
1405
|
}
|
|
1406
|
+
t.resolveMobileOfficeAllowEdit();
|
|
1397
1407
|
|
|
1398
1408
|
//修改样式
|
|
1399
1409
|
var styleStr = "";
|
|
@@ -1444,12 +1454,17 @@ var PageHome = function (_React$Component) {
|
|
|
1444
1454
|
}
|
|
1445
1455
|
t.setState({
|
|
1446
1456
|
itemParam: itemParam,
|
|
1447
|
-
loaded: true
|
|
1457
|
+
loaded: true,
|
|
1458
|
+
mobileOfficeAllowEdit: false,
|
|
1459
|
+
mobileOfficeResolved: false
|
|
1448
1460
|
}, function () {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
uploadRef.initData
|
|
1461
|
+
if (t.state.itemParam.readOnly) {
|
|
1462
|
+
var uploadRef = t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1463
|
+
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
1464
|
+
uploadRef.initData();
|
|
1465
|
+
}
|
|
1452
1466
|
}
|
|
1467
|
+
t.resolveMobileOfficeAllowEdit();
|
|
1453
1468
|
|
|
1454
1469
|
//修改样式
|
|
1455
1470
|
var styleStr = "";
|
|
@@ -1570,12 +1585,22 @@ var PageHome = function (_React$Component) {
|
|
|
1570
1585
|
this.refs['selectMember_' + key].initSelectData();
|
|
1571
1586
|
}
|
|
1572
1587
|
}
|
|
1573
|
-
if (itemType == 'upload' || itemType == 'image' && itemParam.imagetype != '1'
|
|
1588
|
+
if (itemType == 'upload' || itemType == 'image' && itemParam.imagetype != '1') {
|
|
1574
1589
|
var uploadRef = this.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1575
1590
|
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
1576
1591
|
uploadRef.initData();
|
|
1577
1592
|
}
|
|
1578
1593
|
}
|
|
1594
|
+
// 扩展把字段改成 weboffice 时:与专用分支一致,解析完成前不 initData
|
|
1595
|
+
if (itemType == 'weboffice') {
|
|
1596
|
+
if (t.state.itemParam.readOnly) {
|
|
1597
|
+
var woUploadRef = this.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
1598
|
+
if (woUploadRef && typeof woUploadRef.initData === 'function') {
|
|
1599
|
+
woUploadRef.initData();
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
t.resolveMobileOfficeAllowEdit();
|
|
1603
|
+
}
|
|
1579
1604
|
if (itemType == 'note') {
|
|
1580
1605
|
if (itemParam.noteFileIds) {
|
|
1581
1606
|
this.refs["note_file_" + t.state.itemParam.fieldId].initData();
|
|
@@ -3617,7 +3642,11 @@ var PageHome = function (_React$Component) {
|
|
|
3617
3642
|
}
|
|
3618
3643
|
itemParam.value = recordId;
|
|
3619
3644
|
t.setState({
|
|
3620
|
-
itemParam: itemParam
|
|
3645
|
+
itemParam: itemParam,
|
|
3646
|
+
mobileOfficeResolved: false,
|
|
3647
|
+
mobileOfficeAllowEdit: false
|
|
3648
|
+
}, function () {
|
|
3649
|
+
t.resolveMobileOfficeAllowEdit();
|
|
3621
3650
|
});
|
|
3622
3651
|
var data = t.editData(itemParam.key, recordId, t.props.data);
|
|
3623
3652
|
if (typeof t.props.onChange === 'function') {
|
|
@@ -3651,6 +3680,56 @@ var PageHome = function (_React$Component) {
|
|
|
3651
3680
|
onRecordIdGenerated: t.applyGeneratedRecordId.bind(t)
|
|
3652
3681
|
};
|
|
3653
3682
|
}
|
|
3683
|
+
|
|
3684
|
+
/** 移动端是否允许云编辑入口:当前仅放行 wpsWebOffice */
|
|
3685
|
+
|
|
3686
|
+
}, {
|
|
3687
|
+
key: 'isMobileWpsWebOffice',
|
|
3688
|
+
value: function isMobileWpsWebOffice(resolved) {
|
|
3689
|
+
if (!resolved) {
|
|
3690
|
+
return false;
|
|
3691
|
+
}
|
|
3692
|
+
return resolved.strategy === 'wpsWebOffice' || resolved.officeType === 'wpsWebOffice';
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
/**
|
|
3696
|
+
* 解析正文类型,决定是否显示「编辑正文」。
|
|
3697
|
+
* 可编辑且未解析完成:不挂 Upload(占位),避免 initData 把 recordId 冲成附件 id。
|
|
3698
|
+
* 解析后:wps → 编辑正文;非 wps → Upload 只读样式。
|
|
3699
|
+
*/
|
|
3700
|
+
|
|
3701
|
+
}, {
|
|
3702
|
+
key: 'resolveMobileOfficeAllowEdit',
|
|
3703
|
+
value: function resolveMobileOfficeAllowEdit() {
|
|
3704
|
+
var t = this;
|
|
3705
|
+
if (!t.state.itemParam || t.state.itemParam.itemType !== 'weboffice') {
|
|
3706
|
+
return;
|
|
3707
|
+
}
|
|
3708
|
+
var finish = function finish(allow) {
|
|
3709
|
+
t.setState({
|
|
3710
|
+
mobileOfficeAllowEdit: !!allow,
|
|
3711
|
+
mobileOfficeResolved: true
|
|
3712
|
+
}, function () {
|
|
3713
|
+
// 仅 Upload 场景再 initData
|
|
3714
|
+
if (t.state.itemParam.readOnly || !t.state.mobileOfficeAllowEdit) {
|
|
3715
|
+
var uploadRef = t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
|
|
3716
|
+
if (uploadRef && typeof uploadRef.initData === 'function') {
|
|
3717
|
+
uploadRef.initData();
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
};
|
|
3722
|
+
if (typeof MobileOffice === 'undefined' || typeof MobileOffice.resolveType !== 'function') {
|
|
3723
|
+
finish(false);
|
|
3724
|
+
return;
|
|
3725
|
+
}
|
|
3726
|
+
var ctx = t.buildOfficeCtx();
|
|
3727
|
+
MobileOffice.resolveType(ctx).then(function (resolved) {
|
|
3728
|
+
finish(t.isMobileWpsWebOffice(resolved));
|
|
3729
|
+
}).catch(function () {
|
|
3730
|
+
finish(false);
|
|
3731
|
+
});
|
|
3732
|
+
}
|
|
3654
3733
|
}, {
|
|
3655
3734
|
key: 'openWeboffice',
|
|
3656
3735
|
value: function openWeboffice(mode) {
|
|
@@ -3659,8 +3738,22 @@ var PageHome = function (_React$Component) {
|
|
|
3659
3738
|
_Toast2.default.show({ content: 'Office SDK 未加载' });
|
|
3660
3739
|
return;
|
|
3661
3740
|
}
|
|
3662
|
-
var
|
|
3741
|
+
var t = this;
|
|
3742
|
+
var ctx = t.buildOfficeCtx();
|
|
3663
3743
|
ctx.mode = mode || 'edit';
|
|
3744
|
+
// 可编辑入口二次校验:仅 wpsWebOffice
|
|
3745
|
+
if (mode !== 'preview' && ctx.mode !== 'preview' && !ctx.readOnly) {
|
|
3746
|
+
MobileOffice.resolveType(ctx).then(function (resolved) {
|
|
3747
|
+
if (!t.isMobileWpsWebOffice(resolved)) {
|
|
3748
|
+
_Toast2.default.show({ content: '移动端暂仅支持 WPS 中台在线编辑,请到 PC 端操作' });
|
|
3749
|
+
return;
|
|
3750
|
+
}
|
|
3751
|
+
MobileOffice.open(ctx);
|
|
3752
|
+
}).catch(function () {
|
|
3753
|
+
_Toast2.default.show({ content: '无法识别正文类型' });
|
|
3754
|
+
});
|
|
3755
|
+
return;
|
|
3756
|
+
}
|
|
3664
3757
|
MobileOffice.open(ctx);
|
|
3665
3758
|
}
|
|
3666
3759
|
}, {
|
|
@@ -3691,8 +3784,14 @@ var PageHome = function (_React$Component) {
|
|
|
3691
3784
|
key: 'clickPop',
|
|
3692
3785
|
value: function clickPop() {
|
|
3693
3786
|
if (!this.state.itemParam.readOnly) {
|
|
3694
|
-
// weboffice 走云编辑;其它类型(如 html)仍提示不支持
|
|
3787
|
+
// weboffice:仅 wps 走云编辑;其它类型(如 html)仍提示不支持
|
|
3695
3788
|
if (this.state.itemParam.itemType === 'weboffice') {
|
|
3789
|
+
if (!this.state.mobileOfficeResolved || !this.state.mobileOfficeAllowEdit) {
|
|
3790
|
+
_Toast2.default.show({
|
|
3791
|
+
content: '移动端暂仅支持 WPS 中台在线编辑,请到 PC 端操作'
|
|
3792
|
+
});
|
|
3793
|
+
return false;
|
|
3794
|
+
}
|
|
3696
3795
|
this.openWeboffice('edit');
|
|
3697
3796
|
return false;
|
|
3698
3797
|
}
|
|
@@ -4756,7 +4855,24 @@ var PageHome = function (_React$Component) {
|
|
|
4756
4855
|
_react2.default.createElement(
|
|
4757
4856
|
'div',
|
|
4758
4857
|
{ className: 't-W100' },
|
|
4759
|
-
t.state.itemParam.readOnly ? _react2.default.createElement(
|
|
4858
|
+
!t.state.itemParam.readOnly && !t.state.mobileOfficeResolved ? _react2.default.createElement(
|
|
4859
|
+
'div',
|
|
4860
|
+
{ className: 't-field-box t-FBH t-FBAC t-FBJ' },
|
|
4861
|
+
_react2.default.createElement(
|
|
4862
|
+
'div',
|
|
4863
|
+
{ className: t.state.itemParam.required ? 't-field-layout-h-label required' : 't-field-layout-h-label' },
|
|
4864
|
+
_react2.default.createElement(
|
|
4865
|
+
'span',
|
|
4866
|
+
{ style: t.state.itemParam.formStyleObj.titleStyle == null ? {} : t.state.itemParam.formStyleObj.titleStyle },
|
|
4867
|
+
t.state.itemParam.title
|
|
4868
|
+
)
|
|
4869
|
+
),
|
|
4870
|
+
_react2.default.createElement(
|
|
4871
|
+
'div',
|
|
4872
|
+
{ className: 't-P16 t-FCgray t-FS14' },
|
|
4873
|
+
'\u52A0\u8F7D\u4E2D...'
|
|
4874
|
+
)
|
|
4875
|
+
) : t.state.itemParam.readOnly || !t.state.mobileOfficeAllowEdit ? _react2.default.createElement(_upload2.default, {
|
|
4760
4876
|
ref: "upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key,
|
|
4761
4877
|
canAdd: false,
|
|
4762
4878
|
canDel: false,
|