fmui-base 2.3.32 → 2.3.34

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.34:移动端支持新疆CA电子签章功能,去除截图base64png图片的操作
7
+ - 2.3.33:移动端支持新疆CA电子签章功能,移动端选人组件增加一些再次加载的入口
6
8
  - 2.3.32:移动端子表字段为空时不存,只读情况下不再默认拼一行空子表
7
9
  - 2.3.31:移动端推送点开的流程表单切换组织不显示,集成新疆CA
8
10
  - 2.3.30:移动端日期型字段日期格式(xx年xx月xx日)移动端办理后丢失
@@ -53,36 +53,145 @@ var PageHome = function (_React$Component) {
53
53
 
54
54
  var _this = _possibleConstructorReturn(this, (PageHome.__proto__ || Object.getPrototypeOf(PageHome)).call(this, props));
55
55
 
56
+ var list = props.list || [];
56
57
  _this.state = {
57
58
  loadImg: _variables2.default.loadImg + "&fid=",
58
- commentList: props.list || []
59
+ commentList: list,
60
+ // 意见表 ca_signature_img:有值则优先渲染(可来自接口字段或二次拉取)
61
+ caSignatureMap: _this.buildCaSignatureMap(list)
59
62
  };
60
-
61
63
  return _this;
62
64
  }
63
65
 
64
66
  _createClass(PageHome, [{
67
+ key: 'buildCaSignatureMap',
68
+ value: function buildCaSignatureMap(list) {
69
+ var map = {};
70
+ if (!list || !list.length) {
71
+ return map;
72
+ }
73
+ for (var i = 0; i < list.length; i++) {
74
+ var item = list[i];
75
+ if (item && item.id && item.caSignatureImg) {
76
+ var img = this.normalizeBase64(item.caSignatureImg);
77
+ if (img) {
78
+ map[item.id] = img;
79
+ }
80
+ }
81
+ }
82
+ return map;
83
+ }
84
+ }, {
65
85
  key: 'componentDidMount',
66
86
  value: function componentDidMount() {
67
87
  var t = this;
88
+ var list = t.props.list || [];
68
89
  t.setState({
69
- commentList: t.props.list || []
90
+ commentList: list,
91
+ caSignatureMap: Object.assign({}, t.state.caSignatureMap, t.buildCaSignatureMap(list))
70
92
  }, function () {
71
- t.casigin();
93
+ t.casigin(t.props);
72
94
  });
73
95
  }
96
+ }, {
97
+ key: 'componentWillReceiveProps',
98
+ value: function componentWillReceiveProps(nextProps) {
99
+ var t = this;
100
+ var nextList = nextProps.list || [];
101
+ var prevList = this.props.list || [];
102
+ var listChanged = nextList !== prevList || nextList.length !== prevList.length || nextList[0] && prevList[0] && nextList[0].id !== prevList[0].id;
103
+ var caChanged = nextProps.caFirm !== this.props.caFirm || nextProps.caESignatureName !== this.props.caESignatureName || nextProps.caFormSign !== this.props.caFormSign;
104
+ if (listChanged) {
105
+ t.setState({
106
+ commentList: nextList,
107
+ caSignatureMap: Object.assign({}, t.state.caSignatureMap, t.buildCaSignatureMap(nextList))
108
+ }, function () {
109
+ t.casigin(nextProps);
110
+ });
111
+ } else if (caChanged) {
112
+ t.casigin(nextProps);
113
+ }
114
+ }
74
115
 
75
- //批示意见验签
116
+ /** 去掉 dataURL 前缀与空白,保留完整 base64(禁止按 PNG 尾标截取) */
117
+
118
+ }, {
119
+ key: 'normalizeBase64',
120
+ value: function normalizeBase64(signatureImg) {
121
+ if (!signatureImg) {
122
+ return '';
123
+ }
124
+ var imgData = String(signatureImg);
125
+ var base64Mark = 'base64,';
126
+ var markIdx = imgData.indexOf(base64Mark);
127
+ if (markIdx > -1) {
128
+ imgData = imgData.substring(markIdx + base64Mark.length);
129
+ }
130
+ return imgData.replace(/\s+/g, '');
131
+ }
132
+ }, {
133
+ key: 'applyCaSignatureImg',
134
+ value: function applyCaSignatureImg(commentId, signatureImg) {
135
+ var t = this;
136
+ if (!commentId || !signatureImg) {
137
+ return;
138
+ }
139
+ var imgData = t.normalizeBase64(signatureImg);
140
+ if (!imgData) {
141
+ return;
142
+ }
143
+ t.setState(function (prev) {
144
+ var map = Object.assign({}, prev.caSignatureMap || {});
145
+ if (map[commentId] === imgData) {
146
+ return null;
147
+ }
148
+ map[commentId] = imgData;
149
+ return { caSignatureMap: map };
150
+ });
151
+ }
152
+
153
+ /** 按意见 id 补拉 ca_signature_img(仅补列表里还没有的) */
154
+
155
+ }, {
156
+ key: 'loadCaSignatureImgs',
157
+ value: function loadCaSignatureImgs(commentList) {
158
+ var t = this;
159
+ if (!commentList || !commentList.length) {
160
+ return;
161
+ }
162
+ commentList.forEach(function (item) {
163
+ if (!item || !item.id) {
164
+ return;
165
+ }
166
+ if (t.state.caSignatureMap && t.state.caSignatureMap[item.id]) {
167
+ return;
168
+ }
169
+ _db2.default.FlowApproval.getXinjiangCaImage({ commentId: item.id }).then(function (content) {
170
+ var signatureImg = content && content.image;
171
+ if (signatureImg) {
172
+ t.applyCaSignatureImg(item.id, signatureImg);
173
+ }
174
+ }).catch(function () {});
175
+ });
176
+ }
177
+
178
+ //批示意见验签 / 本地签名快照落款
76
179
 
77
180
  }, {
78
181
  key: 'casigin',
79
- value: function casigin() {
182
+ value: function casigin(props) {
80
183
  console.log("批示意见验签");
81
- var commentList = this.props.list;
82
- var isCaUser = this.props.isCaUser; //是否是CA加签用户
83
- var caFirm = this.props.caFirm; //是否是开启CA加签
84
- var caESignatureName = this.props.caESignatureName; //CA电子签名名称
85
- var caFormSign = this.props.caFormSign; //CA表单签名
184
+ props = props || this.props;
185
+ var commentList = props.list;
186
+ var isCaUser = props.isCaUser;
187
+ var caFirm = props.caFirm;
188
+ var caESignatureName = props.caESignatureName;
189
+ var caFormSign = props.caFormSign;
190
+ var t = this;
191
+
192
+ // 有 ca_signature_img 一律按该图渲染:先用列表字段,缺的再按 id 补拉
193
+ t.loadCaSignatureImgs(commentList);
194
+
86
195
  if (commentList && caFirm && caFirm != '' && caFormSign == '1') {
87
196
  commentList.map(function (item) {
88
197
  var param = {};
@@ -90,20 +199,11 @@ var PageHome = function (_React$Component) {
90
199
  param.relationId = getLoginUserInfo().mobile;
91
200
  param.msg = item.fullMessage;
92
201
  param.commentId = item.id;
93
- // setTimeout(function(){
94
- // $("#"+item.id+"_sucess").show();
95
- // },1000)
96
202
  _db2.default.FlowApproval.verifySign(param).then(function (content) {
97
203
  var result = content.verifySignRes;
98
204
  var signatureImg = content.signatureImg;
99
205
  if (signatureImg && signatureImg != null && signatureImg != '') {
100
- if ($("#commentSign-" + item.id).find(".signPic").length > 0) {
101
- $("#commentSign-" + item.id).find(".signPic").attr("src", 'data:image/png;base64,' + signatureImg);
102
- } else {
103
- var signPicHtml = '<img class="t-H64 t-PR5 signPic" src="data:image/png;base64,' + signatureImg + '"/>';
104
- $("#commentSign-" + item.id).find('.comment-html').append(signPicHtml);
105
- $("#commentSign-" + item.id).find(".userName").css("display", "none");
106
- }
206
+ t.applyCaSignatureImg(item.id, signatureImg);
107
207
  }
108
208
 
109
209
  if (result == 'success') {
@@ -115,12 +215,6 @@ var PageHome = function (_React$Component) {
115
215
  $("#commentSign-" + item.id).removeClass('t-PR16');
116
216
  $("#" + item.id + "_fail").show();
117
217
  }
118
- // else{
119
- // Toast.show({
120
- // type: 'error',
121
- // content: error.errorMsg,
122
- // });
123
- // }
124
218
  });
125
219
  });
126
220
  } else if (caESignatureName == '1' && isCaUser == '1' && caFirm == 'bjca') {
@@ -130,36 +224,10 @@ var PageHome = function (_React$Component) {
130
224
  param.relationId = getLoginUserInfo().mobile;
131
225
  param.msg = item.fullMessage;
132
226
  param.commentId = item.id;
133
- // setTimeout(function(){
134
- // $("#"+item.id+"_sucess").show();
135
- // },1000)
136
227
  _db2.default.FlowApproval.getBeiJingCaImage(param).then(function (content) {
137
228
  var signatureImg = content.image;
138
229
  if (signatureImg && signatureImg != null && signatureImg != '') {
139
- if ($("#commentSign-" + item.id).find(".signPic").length > 0) {
140
- $("#commentSign-" + item.id).find(".signPic").attr("src", 'data:image/png;base64,' + signatureImg);
141
- } else {
142
- var signPicHtml = '<img class="t-H64 t-PR5 signPic" src="data:image/png;base64,' + signatureImg + '"/>';
143
- $("#commentSign-" + item.id).find('.comment-html').append(signPicHtml);
144
- $("#commentSign-" + item.id).find(".userName").css("display", "none");
145
- }
146
- }
147
- }).catch(function (error) {});
148
- });
149
- } else if (caESignatureName == '1' && caFirm == 'xjca') {
150
- commentList.map(function (item) {
151
- var param = {};
152
- param.commentId = item.id;
153
- _db2.default.FlowApproval.getXinjiangCaImage(param).then(function (content) {
154
- var signatureImg = content.image;
155
- if (signatureImg && signatureImg != null && signatureImg != '') {
156
- if ($("#commentSign-" + item.id).find(".signPic").length > 0) {
157
- $("#commentSign-" + item.id).find(".signPic").attr("src", 'data:image/png;base64,' + signatureImg);
158
- } else {
159
- var signPicHtml = '<img class="t-H64 t-PR5 signPic" src="data:image/png;base64,' + signatureImg + '"/>';
160
- $("#commentSign-" + item.id).find('.comment-html').append(signPicHtml);
161
- $("#commentSign-" + item.id).find(".userName").css("display", "none");
162
- }
230
+ t.applyCaSignatureImg(item.id, signatureImg);
163
231
  }
164
232
  }).catch(function (error) {});
165
233
  });
@@ -210,7 +278,9 @@ var PageHome = function (_React$Component) {
210
278
  { className: 't-PR5' },
211
279
  item.orgShowName
212
280
  );
213
- var signPicHtml = item.signPic ? _react2.default.createElement('img', { className: 't-H64 t-PR5 signPic', src: t.state.loadImg + item.signPic }) : "";
281
+ var caImg = t.state.caSignatureMap && t.state.caSignatureMap[item.id] || t.normalizeBase64(item.caSignatureImg);
282
+ var hasSignImg = !!(caImg || item.signPic != null && item.signPic !== '');
283
+ var signPicHtml = caImg ? _react2.default.createElement('img', { className: 't-H64 t-PR5 signPic', src: 'data:image/png;base64,' + caImg }) : item.signPic ? _react2.default.createElement('img', { className: 't-H64 t-PR5 signPic', src: t.state.loadImg + item.signPic }) : "";
214
284
  var taskNameHtml = _react2.default.createElement(
215
285
  'span',
216
286
  { className: 't-PR5' },
@@ -220,7 +290,7 @@ var PageHome = function (_React$Component) {
220
290
  var inscriptionShowArray = item.inscriptionShow.split(",");
221
291
  var _returnHtml = inscriptionShowArray.map(function (inscriptionItem) {
222
292
  if (inscriptionItem) {
223
- if (inscriptionItem == "userName" && (item.inscriptionShow.indexOf("signImg") < 0 || item.inscriptionShow.indexOf("signImg") >= 0 && (typeof item.signPic == 'undefined' || item.signPic == null || item.signPic == ""))) {
293
+ if (inscriptionItem == "userName" && (item.inscriptionShow.indexOf("signImg") < 0 || item.inscriptionShow.indexOf("signImg") >= 0 && !hasSignImg)) {
224
294
  return userNameHtml;
225
295
  } else if (inscriptionItem == "date") {
226
296
  return dateHtml;
package/lib/db/db.js CHANGED
@@ -280,14 +280,8 @@ context.create('FlowApproval', {
280
280
  header: {
281
281
  Authorization: 'Bearer ' + getLoginUserInfo().token
282
282
  },
283
- method: 'POST',
284
- willFetch: function willFetch() {
285
- _Toast2.default.show({
286
- content: _react2.default.createElement(_loading2.default, null),
287
- hasMask: true,
288
- duration: 800
289
- });
290
- }
283
+ method: 'POST'
284
+ // 静默读取本地快照,避免每条意见都弹出 Loading 遮罩
291
285
  },
292
286
 
293
287
  getPreTaskInfo: {
package/lib/form/form.js CHANGED
@@ -4916,7 +4916,7 @@ var PageHome = function (_React$Component) {
4916
4916
  _react2.default.createElement(
4917
4917
  'div',
4918
4918
  { className: 't-PT10 t-FB1' },
4919
- _react2.default.createElement(_List2.default, { list: t.state.itemParam.value, isCaUser: t.state.isCaUser, caFirm: t.state.caFirm, caESignatureName: t.state.caESignatureName }),
4919
+ _react2.default.createElement(_List2.default, { list: t.state.itemParam.value, isCaUser: t.state.isCaUser, caFirm: t.state.caFirm, caESignatureName: t.state.caESignatureName, caFormSign: t.state.caFormSign }),
4920
4920
  _react2.default.createElement(
4921
4921
  'div',
4922
4922
  { className: t.state.commentField == this.state.itemParam.uniqueName ? 't-PL10 t-PR10' : 't-DN' },
@@ -387,11 +387,33 @@ var Page = function (_React$Component) {
387
387
 
388
388
  }, {
389
389
  key: 'componentWillReceiveProps',
390
- value: function componentWillReceiveProps() {
391
- this.setState({
392
- showSecret: this.props.showSecret, //是否开启定密 true/false
393
- secretlevel: this.props.secretlevel == null ? "" : this.props.secretlevel //密级 绝密-1/机密-2/秘密-3/非密-4
394
- });
390
+ value: function componentWillReceiveProps(nextProps) {
391
+ var nextState = {
392
+ showSecret: nextProps.showSecret, //是否开启定密 true/false
393
+ secretlevel: nextProps.secretlevel == null ? "" : nextProps.secretlevel //密级 绝密-1/机密-2/秘密-3/非密-4
394
+ };
395
+ // 字段关联动态改必填/只读时,需同步到 state,否则红星标识不刷新
396
+ if (typeof nextProps.required !== 'undefined' && nextProps.required !== this.state.required) {
397
+ nextState.required = nextProps.required;
398
+ }
399
+ if (typeof nextProps.readOnly !== 'undefined' && nextProps.readOnly !== this.state.readOnly) {
400
+ nextState.readOnly = nextProps.readOnly;
401
+ }
402
+ // 显式传 isDelete 时以 props 为准;未传时随 readOnly 推导(表单选人常用)
403
+ if (typeof nextProps.isDelete !== 'undefined') {
404
+ if (nextProps.isDelete !== this.state.isDelete) {
405
+ nextState.isDelete = nextProps.isDelete;
406
+ }
407
+ } else if (typeof nextProps.readOnly !== 'undefined' && nextProps.readOnly !== this.state.readOnly) {
408
+ nextState.isDelete = !nextProps.readOnly;
409
+ }
410
+ if (typeof nextProps.label !== 'undefined' && nextProps.label !== this.state.label) {
411
+ nextState.label = nextProps.label;
412
+ }
413
+ if (typeof nextProps.placeholder !== 'undefined' && nextProps.placeholder !== this.state.placeholder) {
414
+ nextState.placeholder = nextProps.placeholder;
415
+ }
416
+ this.setState(nextState);
395
417
  }
396
418
 
397
419
  //检查是否有额外tab
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.32",
3
+ "version": "2.3.34",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",