fmui-base 2.3.26 → 2.3.27

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.27:批示意见附件样式调整
6
7
  - 2.3.26:月日字符时间类型不回显,办理后丢失问题修复
7
8
  - 2.3.25:表单乐观锁只有自定义流程生效 非approve流程不生效
8
9
  - 2.3.24:流程办理选人组件支持选择群组和职务
@@ -23,6 +23,10 @@ var _db = require('../db/db');
23
23
 
24
24
  var _db2 = _interopRequireDefault(_db);
25
25
 
26
+ var _upload = require('../upload/upload');
27
+
28
+ var _upload2 = _interopRequireDefault(_upload);
29
+
26
30
  require('whatwg-fetch');
27
31
 
28
32
  require('es6-promise');
@@ -31,8 +35,6 @@ require('./List.less');
31
35
 
32
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
37
 
34
- function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
35
-
36
38
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
39
 
38
40
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
@@ -51,27 +53,9 @@ var PageHome = function (_React$Component) {
51
53
 
52
54
  var _this = _possibleConstructorReturn(this, (PageHome.__proto__ || Object.getPrototypeOf(PageHome)).call(this, props));
53
55
 
54
- var setting = getSysAttachSetting();
55
-
56
- //预览类型,view:永中预览,download:下载
57
- var viewType = 'view';
58
-
59
- if (setting.sysAttachmentView == 0) {
60
- //如果设置中预览关闭则默认下载
61
- viewType = "download";
62
- }
63
-
64
- // let startUserName = decodeURI(this.props.params.startUserName);//创建人用户
65
- // let startUserGroupName = decodeURI(this.props.params.startUserGroupName);//创建人组织
66
- //let startUserId = this.props.params.startUserId;
67
- var token = document.getElementById('token').value;
68
56
  _this.state = {
69
- // attachId:props.attachId,
70
57
  loadImg: _variables2.default.loadImg + "&fid=",
71
- // imgUrl:getImagePreUrl()+'/attachment/download?token='+token+'&',
72
- // queryUrl: context + '/api/m/plugin/attachment/mobile/getAttachmentByIds?token='+token+'&ids=',
73
- commentList: [],
74
- viewType: viewType
58
+ commentList: props.list || []
75
59
  };
76
60
 
77
61
  return _this;
@@ -81,13 +65,10 @@ var PageHome = function (_React$Component) {
81
65
  key: 'componentDidMount',
82
66
  value: function componentDidMount() {
83
67
  var t = this;
84
- var token = document.getElementById('token').value;
85
- this.initData(token, function (commentList) {
86
- t.setState({
87
- commentList: commentList
88
- }, function () {
89
- t.casigin();
90
- });
68
+ t.setState({
69
+ commentList: t.props.list || []
70
+ }, function () {
71
+ t.casigin();
91
72
  });
92
73
  }
93
74
 
@@ -168,149 +149,15 @@ var PageHome = function (_React$Component) {
168
149
  }
169
150
  }
170
151
 
171
- //初始化ids
152
+ /** 批示意见 attachId 多为 | 分隔,Upload 组件 initIds 用逗号 */
172
153
 
173
154
  }, {
174
- key: 'initData',
175
- value: function () {
176
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(token, sucess) {
177
- var t, context, url, commentList, attachIds;
178
- return regeneratorRuntime.wrap(function _callee$(_context) {
179
- while (1) {
180
- switch (_context.prev = _context.next) {
181
- case 0:
182
- t = this;
183
- context = document.getElementById("context").value;
184
- url = context + '/api/m/plugin/attachment/mobile/getAttachmentByIds?token=' + token + '&ids=';
185
- commentList = this.props.list;
186
- attachIds = "";
187
-
188
- if (!commentList || typeof commentList == 'undefined' || commentList.length == 0) {
189
- commentList = [];
190
- }
191
- // var attachMap = {};
192
- commentList.map(function (item) {
193
- // var commentId = item.id;
194
- var attachId = item.attachId;
195
- if (attachId) {
196
- attachId = attachId.replaceAll("|", ",");
197
- attachIds = attachIds + "," + attachId;
198
- // attachMap[commentId] = attachId;
199
- }
200
- });
201
-
202
- if (!attachIds) {
203
- _context.next = 14;
204
- break;
205
- }
206
-
207
- attachIds = attachIds.substring(1);
208
- _context.next = 11;
209
- return t.promises(url + attachIds).then(function (e) {
210
- commentList.map(function (item) {
211
- // var commentId = item.id;
212
- var attachId = item.attachId;
213
- if (attachId) {
214
- var fileList = [];
215
- var attachArray = attachId.split("|");
216
- attachArray.map(function (attachItem) {
217
- for (var i = 0; i < e.length; i++) {
218
- if (attachItem == e[i].id) {
219
- fileList.push(e[i]);
220
- }
221
- }
222
- });
223
- item.fileList = fileList;
224
- }
225
- });
226
- });
227
-
228
- case 11:
229
- sucess(commentList);
230
- _context.next = 15;
231
- break;
232
-
233
- case 14:
234
- sucess(commentList);
235
-
236
- case 15:
237
- case 'end':
238
- return _context.stop();
239
- }
240
- }
241
- }, _callee, this);
242
- }));
243
-
244
- function initData(_x, _x2) {
245
- return _ref.apply(this, arguments);
246
- }
247
-
248
- return initData;
249
- }()
250
- }, {
251
- key: 'promises',
252
- value: function promises(url) {
253
- return new Promise(function (resolve, reject) {
254
- try {
255
- fetch(url, {
256
- method: "POST",
257
- headers: {
258
- 'Content-Type': 'application/x-www-form-urlencoded'
259
- }
260
- }).then(function (res) {
261
- if (res.ok) {
262
- res.json().then(function (obj) {
263
- var objList = obj.data;
264
- resolve(objList);
265
- });
266
- } else if (res.status == 401) {
267
- // To do with res
268
- }
269
- });
270
- } catch (e) {
271
- console.log(e);
272
- }
273
- });
274
- }
275
-
276
- //预览
277
-
278
- }, {
279
- key: 'view',
280
- value: function view(file) {
281
- var id = file.id;
282
- if (this.state.viewType == 'view') {
283
- var fileExt = file.fileExt;
284
- downloadFile(id, 'android', fileExt);
285
- } else {
286
- downloadFile(id);
287
- }
288
- }
289
-
290
- //下载批示意见附件
291
-
292
- }, {
293
- key: 'downloadAttach',
294
- value: function downloadAttach(file, e) {
295
- if (e && e.stopPropagation) {
296
- e.stopPropagation();
297
- }
298
- if (e && e.preventDefault) {
299
- e.preventDefault();
300
- }
301
- // 公众号不支持下载
302
- if (getLoginUserInfo().thirdMenuType == 'WeChat') {
303
- return;
304
- }
305
- var id = file.id;
306
- var fileExt = file.fileExt;
307
- if (typeof downloadFile === 'function') {
308
- try {
309
- downloadFile(id, 'download', fileExt);
310
- } catch (err) {
311
- downloadFile(id);
312
- }
155
+ key: 'getAttachInitIds',
156
+ value: function getAttachInitIds(attachId) {
157
+ if (!attachId) {
158
+ return '';
313
159
  }
160
+ return String(attachId).replace(/\|/g, ',');
314
161
  }
315
162
  }, {
316
163
  key: 'getCommentSign',
@@ -404,49 +251,18 @@ var PageHome = function (_React$Component) {
404
251
  { className: 't-PR16' },
405
252
  _react2.default.createElement('img', { width: '100%', height: '128', src: t.state.loadImg + item.fullMessage })
406
253
  ),
407
- _react2.default.createElement(
254
+ item.attachId ? _react2.default.createElement(
408
255
  'div',
409
- { className: 'comment-attach-list' },
410
- item.fileList && item.fileList.length > 0 ? item.fileList.map(function (item2, i) {
411
- function calculate(no) {
412
- var a = no / 1024;
413
- if (a < 1) {
414
- return no + 'B';
415
- }
416
- var b = a / 1024;
417
- if (b < 1) {
418
- return Math.round(a * 100) / 100 + 'KB';
419
- }
420
- return Math.round(b * 100) / 100 + 'MB';
421
- }
422
- var showDownload = getLoginUserInfo().thirdMenuType != 'WeChat';
423
- return _react2.default.createElement(
424
- 'div',
425
- { className: 't-FBH comment-attach-item', key: i },
426
- _react2.default.createElement(
427
- 'div',
428
- { className: 'dd-t-border t-P6 t-MB10 t-FB1', onClick: t.view.bind(t, item2) },
429
- _react2.default.createElement('i', { className: 'iconfont icon-file t-FC9 t-FL t-MR6' }),
430
- _react2.default.createElement(
431
- 'div',
432
- { className: 'dd-t-list-text-content' },
433
- _react2.default.createElement(
434
- 'div',
435
- { className: 't-list-title comment-attach-name t-LH1_4' },
436
- typeof item2.fileDisplayName == 'undefined' ? item2.name : item2.fileDisplayName
437
- ),
438
- _react2.default.createElement(
439
- 'div',
440
- { className: 'dd-t-list-time t-FBAC' },
441
- calculate(typeof item2.fileSize == 'undefined' ? item2.size : item2.fileSize)
442
- )
443
- )
444
- ),
445
- _react2.default.createElement('i', { className: showDownload ? 'iconfont icon-download1 comment-attach-download' : 't-DN',
446
- onClick: t.downloadAttach.bind(t, item2) })
447
- );
448
- }) : ""
449
- ),
256
+ { className: 'comment-attach-list t-PR16' },
257
+ _react2.default.createElement(_upload2.default, {
258
+ key: 'comment_attach_' + item.id,
259
+ required: false,
260
+ canAdd: false,
261
+ canDel: false,
262
+ canDownload: true,
263
+ initIds: t.getAttachInitIds(item.attachId)
264
+ })
265
+ ) : null,
450
266
  _react2.default.createElement(
451
267
  Box,
452
268
  { vAlign: 'start', hAlign: 'end', id: 'commentSign-' + item.id, className: 't-FBH t-PR16' },
@@ -5,45 +5,7 @@
5
5
  padding-right:0px;
6
6
  }
7
7
 
8
- /* 批示意见附件:名称完整换行显示 */
8
+ /* 批示意见附件复用 Upload 组件样式,仅保留容器间距 */
9
9
  .comment-attach-list {
10
- .comment-attach-item {
11
- align-items: flex-start;
12
- }
13
-
14
- .comment-attach-name,
15
- .t-list-title.comment-attach-name {
16
- display: block !important;
17
- white-space: normal !important;
18
- word-break: break-all !important;
19
- overflow-wrap: break-word !important;
20
- word-wrap: break-word !important;
21
- overflow: visible !important;
22
- text-overflow: clip !important;
23
- -webkit-line-clamp: unset !important;
24
- line-clamp: unset !important;
25
- -webkit-box-orient: horizontal !important;
26
- max-width: 100%;
27
- line-height: 1.4;
28
- }
29
-
30
- .dd-t-list-text-content {
31
- min-width: 0;
32
- overflow: visible;
33
- }
34
-
35
- /* 与表单附件下载按钮保持一致:普通图标,无蓝色圆底 */
36
- .comment-attach-download {
37
- flex-shrink: 0;
38
- margin-right: 5px;
39
- margin-top: 8px;
40
- font-size: 16px;
41
- background: transparent;
42
- color: inherit;
43
- width: auto;
44
- height: auto;
45
- line-height: inherit;
46
- border-radius: 0;
47
- text-align: center;
48
- }
10
+ margin-top: 4px;
49
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.26",
3
+ "version": "2.3.27",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",