fmui-base 2.3.32 → 2.3.33

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,7 @@
3
3
  ---npm publish
4
4
 
5
5
  ## 更新日志
6
+ - 2.3.33:移动端支持新疆CA电子签章功能,移动端选人组件增加一些再次加载的入口
6
7
  - 2.3.32:移动端子表字段为空时不存,只读情况下不再默认拼一行空子表
7
8
  - 2.3.31:移动端推送点开的流程表单切换组织不显示,集成新疆CA
8
9
  - 2.3.30:移动端日期型字段日期格式(xx年xx月xx日)移动端办理后丢失
@@ -53,36 +53,161 @@ 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 前缀,并只保留第一张 PNG(兼容库内多段 base64 粘连) */
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
+ imgData = imgData.replace(/\s+/g, '');
131
+ var pngStart = imgData.indexOf('iVBORw0KGgo');
132
+ if (pngStart > 0) {
133
+ imgData = imgData.substring(pngStart);
134
+ }
135
+ if (pngStart >= 0) {
136
+ var endMark = 'ASUVORK5CYII';
137
+ var endIdx = imgData.indexOf(endMark);
138
+ if (endIdx >= 0) {
139
+ endIdx = endIdx + endMark.length;
140
+ while (endIdx < imgData.length && imgData.charAt(endIdx) === '=') {
141
+ endIdx++;
142
+ }
143
+ imgData = imgData.substring(0, endIdx);
144
+ }
145
+ }
146
+ return imgData;
147
+ }
148
+ }, {
149
+ key: 'applyCaSignatureImg',
150
+ value: function applyCaSignatureImg(commentId, signatureImg) {
151
+ var t = this;
152
+ if (!commentId || !signatureImg) {
153
+ return;
154
+ }
155
+ var imgData = t.normalizeBase64(signatureImg);
156
+ if (!imgData) {
157
+ return;
158
+ }
159
+ t.setState(function (prev) {
160
+ var map = Object.assign({}, prev.caSignatureMap || {});
161
+ if (map[commentId] === imgData) {
162
+ return null;
163
+ }
164
+ map[commentId] = imgData;
165
+ return { caSignatureMap: map };
166
+ });
167
+ }
168
+
169
+ /** 按意见 id 补拉 ca_signature_img(仅补列表里还没有的) */
170
+
171
+ }, {
172
+ key: 'loadCaSignatureImgs',
173
+ value: function loadCaSignatureImgs(commentList) {
174
+ var t = this;
175
+ if (!commentList || !commentList.length) {
176
+ return;
177
+ }
178
+ commentList.forEach(function (item) {
179
+ if (!item || !item.id) {
180
+ return;
181
+ }
182
+ if (t.state.caSignatureMap && t.state.caSignatureMap[item.id]) {
183
+ return;
184
+ }
185
+ _db2.default.FlowApproval.getXinjiangCaImage({ commentId: item.id }).then(function (content) {
186
+ var signatureImg = content && content.image;
187
+ if (signatureImg) {
188
+ t.applyCaSignatureImg(item.id, signatureImg);
189
+ }
190
+ }).catch(function () {});
191
+ });
192
+ }
193
+
194
+ //批示意见验签 / 本地签名快照落款
76
195
 
77
196
  }, {
78
197
  key: 'casigin',
79
- value: function casigin() {
198
+ value: function casigin(props) {
80
199
  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表单签名
200
+ props = props || this.props;
201
+ var commentList = props.list;
202
+ var isCaUser = props.isCaUser;
203
+ var caFirm = props.caFirm;
204
+ var caESignatureName = props.caESignatureName;
205
+ var caFormSign = props.caFormSign;
206
+ var t = this;
207
+
208
+ // 有 ca_signature_img 一律按该图渲染:先用列表字段,缺的再按 id 补拉
209
+ t.loadCaSignatureImgs(commentList);
210
+
86
211
  if (commentList && caFirm && caFirm != '' && caFormSign == '1') {
87
212
  commentList.map(function (item) {
88
213
  var param = {};
@@ -90,20 +215,11 @@ var PageHome = function (_React$Component) {
90
215
  param.relationId = getLoginUserInfo().mobile;
91
216
  param.msg = item.fullMessage;
92
217
  param.commentId = item.id;
93
- // setTimeout(function(){
94
- // $("#"+item.id+"_sucess").show();
95
- // },1000)
96
218
  _db2.default.FlowApproval.verifySign(param).then(function (content) {
97
219
  var result = content.verifySignRes;
98
220
  var signatureImg = content.signatureImg;
99
221
  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
- }
222
+ t.applyCaSignatureImg(item.id, signatureImg);
107
223
  }
108
224
 
109
225
  if (result == 'success') {
@@ -115,12 +231,6 @@ var PageHome = function (_React$Component) {
115
231
  $("#commentSign-" + item.id).removeClass('t-PR16');
116
232
  $("#" + item.id + "_fail").show();
117
233
  }
118
- // else{
119
- // Toast.show({
120
- // type: 'error',
121
- // content: error.errorMsg,
122
- // });
123
- // }
124
234
  });
125
235
  });
126
236
  } else if (caESignatureName == '1' && isCaUser == '1' && caFirm == 'bjca') {
@@ -130,36 +240,10 @@ var PageHome = function (_React$Component) {
130
240
  param.relationId = getLoginUserInfo().mobile;
131
241
  param.msg = item.fullMessage;
132
242
  param.commentId = item.id;
133
- // setTimeout(function(){
134
- // $("#"+item.id+"_sucess").show();
135
- // },1000)
136
243
  _db2.default.FlowApproval.getBeiJingCaImage(param).then(function (content) {
137
244
  var signatureImg = content.image;
138
245
  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
- }
246
+ t.applyCaSignatureImg(item.id, signatureImg);
163
247
  }
164
248
  }).catch(function (error) {});
165
249
  });
@@ -210,7 +294,9 @@ var PageHome = function (_React$Component) {
210
294
  { className: 't-PR5' },
211
295
  item.orgShowName
212
296
  );
213
- var signPicHtml = item.signPic ? _react2.default.createElement('img', { className: 't-H64 t-PR5 signPic', src: t.state.loadImg + item.signPic }) : "";
297
+ var caImg = t.state.caSignatureMap && t.state.caSignatureMap[item.id] || t.normalizeBase64(item.caSignatureImg);
298
+ var hasSignImg = !!(caImg || item.signPic != null && item.signPic !== '');
299
+ 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
300
  var taskNameHtml = _react2.default.createElement(
215
301
  'span',
216
302
  { className: 't-PR5' },
@@ -220,7 +306,7 @@ var PageHome = function (_React$Component) {
220
306
  var inscriptionShowArray = item.inscriptionShow.split(",");
221
307
  var _returnHtml = inscriptionShowArray.map(function (inscriptionItem) {
222
308
  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 == ""))) {
309
+ if (inscriptionItem == "userName" && (item.inscriptionShow.indexOf("signImg") < 0 || item.inscriptionShow.indexOf("signImg") >= 0 && !hasSignImg)) {
224
310
  return userNameHtml;
225
311
  } else if (inscriptionItem == "date") {
226
312
  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.33",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",