fmui-base 2.3.17 → 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 CHANGED
@@ -3,6 +3,8 @@
3
3
  ---npm publish
4
4
 
5
5
  ## 更新日志
6
+ - 2.3.19:移动端流程表单支持在线编辑
7
+ - 2.3.18:流程抢占加签支持加签多人,流程表单支持在线编辑
6
8
  - 2.3.17:流程提交保存时增加表单的乐观锁校验功能,用来校验该表单数据在办理时有无被其他人修改过
7
9
  - 2.3.16:选人组件:常用类型增加用户全选功能
8
10
  - 2.3.15:时分字段保存丢失值,子表删除时页面空白
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,9 +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
- t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key].initData();
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
+ }
1405
+ }
1406
+ t.resolveMobileOfficeAllowEdit();
1394
1407
 
1395
1408
  //修改样式
1396
1409
  var styleStr = "";
@@ -1441,9 +1454,17 @@ var PageHome = function (_React$Component) {
1441
1454
  }
1442
1455
  t.setState({
1443
1456
  itemParam: itemParam,
1444
- loaded: true
1457
+ loaded: true,
1458
+ mobileOfficeAllowEdit: false,
1459
+ mobileOfficeResolved: false
1445
1460
  }, function () {
1446
- t.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key].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
+ }
1466
+ }
1467
+ t.resolveMobileOfficeAllowEdit();
1447
1468
 
1448
1469
  //修改样式
1449
1470
  var styleStr = "";
@@ -1564,8 +1585,21 @@ var PageHome = function (_React$Component) {
1564
1585
  this.refs['selectMember_' + key].initSelectData();
1565
1586
  }
1566
1587
  }
1567
- if (itemType == 'upload' || itemType == 'image' && itemParam.imagetype != '1' || itemType == 'weboffice') {
1568
- this.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key].initData();
1588
+ if (itemType == 'upload' || itemType == 'image' && itemParam.imagetype != '1') {
1589
+ var uploadRef = this.refs["upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key];
1590
+ if (uploadRef && typeof uploadRef.initData === 'function') {
1591
+ uploadRef.initData();
1592
+ }
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();
1569
1603
  }
1570
1604
  if (itemType == 'note') {
1571
1605
  if (itemParam.noteFileIds) {
@@ -3589,10 +3623,159 @@ var PageHome = function (_React$Component) {
3589
3623
  }
3590
3624
 
3591
3625
  //预览附件
3626
+ /** 新建正文生成 recordId 后回写字段,保证提交与再次编辑复用同一 id */
3592
3627
 
3628
+ }, {
3629
+ key: 'applyGeneratedRecordId',
3630
+ value: function applyGeneratedRecordId(recordId) {
3631
+ if (!recordId) {
3632
+ return;
3633
+ }
3634
+ var t = this;
3635
+ var itemParam = t.state.itemParam;
3636
+ if (!itemParam || itemParam.itemType !== 'weboffice') {
3637
+ return;
3638
+ }
3639
+ // 已有同一 recordId 则无需重复回写
3640
+ if (itemParam.value === recordId || String(itemParam.value) === String(recordId)) {
3641
+ return;
3642
+ }
3643
+ itemParam.value = recordId;
3644
+ t.setState({
3645
+ itemParam: itemParam,
3646
+ mobileOfficeResolved: false,
3647
+ mobileOfficeAllowEdit: false
3648
+ }, function () {
3649
+ t.resolveMobileOfficeAllowEdit();
3650
+ });
3651
+ var data = t.editData(itemParam.key, recordId, t.props.data);
3652
+ if (typeof t.props.onChange === 'function') {
3653
+ t.props.onChange(data, itemParam);
3654
+ }
3655
+ }
3656
+ }, {
3657
+ key: 'buildOfficeCtx',
3658
+ value: function buildOfficeCtx(file) {
3659
+ var t = this;
3660
+ var recordId = '';
3661
+ var value = t.state.itemParam.value;
3662
+ if (value) {
3663
+ if (typeof value === 'string') {
3664
+ recordId = value;
3665
+ } else if (value instanceof Array && value.length > 0) {
3666
+ // weboffice 字段存库为 recordId 字符串;列表态兜底取 id
3667
+ recordId = value[0].recordId || value[0].id || '';
3668
+ }
3669
+ }
3670
+ return {
3671
+ recordId: recordId,
3672
+ attachmentId: file ? file.id : t.state.itemParam.initIds,
3673
+ moduleCode: t.state.module,
3674
+ module: t.state.module,
3675
+ readOnly: t.state.itemParam.readOnly,
3676
+ formData: t.props.data,
3677
+ dataId: t.props.dataId,
3678
+ processInstanceId: t.props.processInstanceId,
3679
+ fileExt: file ? file.fileExt : '.doc',
3680
+ onRecordIdGenerated: t.applyGeneratedRecordId.bind(t)
3681
+ };
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
+ }
3733
+ }, {
3734
+ key: 'openWeboffice',
3735
+ value: function openWeboffice(mode) {
3736
+ console.info('openWeboffice', mode);
3737
+ if (typeof MobileOffice === 'undefined') {
3738
+ _Toast2.default.show({ content: 'Office SDK 未加载' });
3739
+ return;
3740
+ }
3741
+ var t = this;
3742
+ var ctx = t.buildOfficeCtx();
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
+ }
3757
+ MobileOffice.open(ctx);
3758
+ }
3759
+ }, {
3760
+ key: 'previewWeboffice',
3761
+ value: function previewWeboffice(file) {
3762
+ console.info('previewWeboffice-->');
3763
+ if (typeof MobileOffice === 'undefined') {
3764
+ var id = file.id;
3765
+ var fileExt = file.fileExt;
3766
+ downloadFile(id, 'android', fileExt);
3767
+ return;
3768
+ }
3769
+ var ctx = this.buildOfficeCtx(file);
3770
+ MobileOffice.preview(ctx);
3771
+ }
3593
3772
  }, {
3594
3773
  key: 'viewFile',
3595
3774
  value: function viewFile(file) {
3775
+ if (this.state.itemParam && this.state.itemParam.itemType === 'weboffice') {
3776
+ this.previewWeboffice(file);
3777
+ return;
3778
+ }
3596
3779
  var id = file.id;
3597
3780
  var fileExt = file.fileExt;
3598
3781
  downloadFile(id, 'android', fileExt);
@@ -3601,6 +3784,17 @@ var PageHome = function (_React$Component) {
3601
3784
  key: 'clickPop',
3602
3785
  value: function clickPop() {
3603
3786
  if (!this.state.itemParam.readOnly) {
3787
+ // weboffice:仅 wps 走云编辑;其它类型(如 html)仍提示不支持
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
+ }
3795
+ this.openWeboffice('edit');
3796
+ return false;
3797
+ }
3604
3798
  _Toast2.default.show({
3605
3799
  content: "移动端暂不支持该类型编辑"
3606
3800
  });
@@ -4661,7 +4855,24 @@ var PageHome = function (_React$Component) {
4661
4855
  _react2.default.createElement(
4662
4856
  'div',
4663
4857
  { className: 't-W100' },
4664
- _react2.default.createElement(_upload2.default, {
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, {
4665
4876
  ref: "upload_" + t.state.itemParam.tableName + "_" + t.state.itemParam.key,
4666
4877
  canAdd: false,
4667
4878
  canDel: false,
@@ -4671,10 +4882,37 @@ var PageHome = function (_React$Component) {
4671
4882
  initIds: t.state.itemParam.initIds,
4672
4883
  dir: t.state.module,
4673
4884
  fileSizeLimit: 0,
4885
+ onView: t.previewWeboffice.bind(t),
4674
4886
  onChange: function onChange(value, isInit) {
4675
4887
  t.handleChangeOffice(t.state.itemParam.key, value, isInit);
4676
4888
  }
4677
- })
4889
+ }) : _react2.default.createElement(
4890
+ 'div',
4891
+ { className: 't-field-box t-FBH t-FBAC t-FBJ' },
4892
+ _react2.default.createElement(
4893
+ 'div',
4894
+ { className: t.state.itemParam.required ? 't-field-layout-h-label required' : 't-field-layout-h-label' },
4895
+ _react2.default.createElement(
4896
+ 'span',
4897
+ { style: t.state.itemParam.formStyleObj.titleStyle == null ? {} : t.state.itemParam.formStyleObj.titleStyle },
4898
+ t.state.itemParam.title
4899
+ )
4900
+ ),
4901
+ _react2.default.createElement(
4902
+ 'div',
4903
+ { className: 't-P16' },
4904
+ _react2.default.createElement(
4905
+ 'span',
4906
+ {
4907
+ className: 't-FCblue t-FS14',
4908
+ onClick: function onClick() {
4909
+ t.openWeboffice('edit');
4910
+ }
4911
+ },
4912
+ '\u7F16\u8F91\u6B63\u6587'
4913
+ )
4914
+ )
4915
+ )
4678
4916
  ),
4679
4917
  t.state.itemParam.isVerifySing == "1" ? _react2.default.createElement('i', { className: 'iconfont icon-checked t-PT10', style: { color: 'green' } }) : t.state.itemParam.isVerifySing == "2" ? _react2.default.createElement('i', { className: 'iconfont icon-close t-PT10', style: { color: 'red' } }) : ""
4680
4918
  )
@@ -8899,7 +8899,7 @@ var PageHome = function (_React$Component) {
8899
8899
  placeholder: '\u8BF7\u9009\u62E9',
8900
8900
  code: 'org,group',
8901
8901
  chooseType: 'userNotOrg',
8902
- checkType: this.state.participantMode == '3' ? 'radio' : 'checkbox',
8902
+ checkType: 'checkbox',
8903
8903
  ref: "selectMember_addSign",
8904
8904
  isDelete: true,
8905
8905
  onChange: this.addSignCallback.bind(this)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.17",
3
+ "version": "2.3.19",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",