ydb-components-material 0.1.205 → 0.1.207

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.
Files changed (34) hide show
  1. package/build/docs/404.html +3 -3
  2. package/build/docs/_demos/:uuid +3 -3
  3. package/build/docs/colorful-button.html +3 -3
  4. package/build/docs/colorful-input.html +3 -3
  5. package/build/docs/index.html +3 -3
  6. package/build/docs/{umi.8fad4777.js → umi.76fc6935.js} +1 -1
  7. package/build/docs/{umi.e7085fcc.css → umi.8d01e385.css} +1 -1
  8. package/build/docs/~demos/:uuid.html +3 -3
  9. package/build/docs/~demos/colorful-button-demo.html +3 -3
  10. package/build/docs/~demos/colorful-input-demo.html +3 -3
  11. package/build/lowcode/assets-daily.json +11 -11
  12. package/build/lowcode/assets-dev.json +2 -2
  13. package/build/lowcode/assets-prod.json +11 -11
  14. package/build/lowcode/meta.js +1 -1
  15. package/build/lowcode/render/default/view.css +1 -1
  16. package/build/lowcode/render/default/view.js +1 -1
  17. package/build/lowcode/view.css +1 -1
  18. package/build/lowcode/view.js +1 -1
  19. package/dist/BizComps.css +1 -1
  20. package/dist/BizComps.js +1 -1
  21. package/dist/BizComps.js.map +1 -1
  22. package/es/components/file-list/index.d.ts +4 -0
  23. package/es/components/file-list/index.js +22 -0
  24. package/es/components/file-list/item.d.ts +1 -0
  25. package/es/components/file-list/item.js +73 -13
  26. package/es/components/file-list/item.scss +34 -0
  27. package/lib/components/file-list/index.d.ts +4 -0
  28. package/lib/components/file-list/index.js +23 -1
  29. package/lib/components/file-list/item.d.ts +1 -0
  30. package/lib/components/file-list/item.js +73 -13
  31. package/lib/components/file-list/item.scss +34 -0
  32. package/lowcode_es/meta.js +1 -1
  33. package/lowcode_lib/meta.js +1 -1
  34. package/package.json +3 -3
@@ -1,5 +1,9 @@
1
1
  import React from 'react';
2
2
  import './index.scss';
3
+ /**
4
+ * 检查列表中是否还存在 loading 为 true 的文件(包含二级材料),有则返回 true
5
+ */
6
+ export declare const hasLoadingFileInList: (list: any[]) => boolean;
3
7
  export interface FileListProps {
4
8
  /**
5
9
  * 列表数据
@@ -34,6 +34,21 @@ var MATERIAL_FORMAT = {
34
34
  };
35
35
  var OTHER = 1; // 角色数组中"他人"对应的值
36
36
 
37
+ /**
38
+ * 检查列表中是否还存在 loading 为 true 的文件(包含二级材料),有则返回 true
39
+ */
40
+ export var hasLoadingFileInList = function hasLoadingFileInList(list) {
41
+ return (list || []).some(function (item) {
42
+ if ((item.fileList || []).some(function (file) {
43
+ return file && file.loading;
44
+ })) return true;
45
+ return (item.subMaterials || []).some(function (sub) {
46
+ return (sub.fileList || []).some(function (file) {
47
+ return file && file.loading;
48
+ });
49
+ });
50
+ });
51
+ };
37
52
  var FileList = function FileList(_ref) {
38
53
  var fileList = _ref.fileList,
39
54
  token = _ref.token,
@@ -212,6 +227,11 @@ var FileList = function FileList(_ref) {
212
227
  });
213
228
  return list;
214
229
  };
230
+
231
+ // 传给 FileItem:签署前检查列表中是否还有 loading 中的文件
232
+ var hasLoadingFile = function hasLoadingFile() {
233
+ return hasLoadingFileInList(fileArray);
234
+ };
215
235
  var handleChange = function handleChange(value, fileIndex, index, subIndex) {
216
236
  // console.log('handleChange', value, fileIndex, index, subIndex);
217
237
  // 先找到一级目录
@@ -388,6 +408,7 @@ var FileList = function FileList(_ref) {
388
408
  download: download,
389
409
  applySeal: applySeal,
390
410
  valChange: handleChange,
411
+ hasLoadingFile: hasLoadingFile,
391
412
  openLoading: openLoading,
392
413
  closeLoading: closeLoading,
393
414
  parentPageUrl: parentPageUrl,
@@ -427,6 +448,7 @@ var FileList = function FileList(_ref) {
427
448
  download: download,
428
449
  applySeal: applySeal,
429
450
  valChange: handleChange,
451
+ hasLoadingFile: hasLoadingFile,
430
452
  openLoading: openLoading,
431
453
  closeLoading: closeLoading,
432
454
  parentPageUrl: parentPageUrl,
@@ -29,6 +29,7 @@ export interface FileItemProps {
29
29
  download: (value: any) => void;
30
30
  saveSignerInfo: (value: any) => Promise<boolean>;
31
31
  signInfoMap?: object;
32
+ hasLoadingFile?: () => boolean;
32
33
  autoShowSignerInfo?: boolean;
33
34
  onNeedSignerInfo?: (pos: {
34
35
  index: number;
@@ -29,6 +29,7 @@ var RadioGroup = _Radio.Group;
29
29
  var SELF = 0;
30
30
  var OTHER = 1;
31
31
  var FileItem = function FileItem(_ref) {
32
+ var _this = this;
32
33
  var index = _ref.index,
33
34
  subIndex = _ref.subIndex,
34
35
  fileIndex = _ref.fileIndex,
@@ -53,6 +54,7 @@ var FileItem = function FileItem(_ref) {
53
54
  closeLoading = _ref.closeLoading,
54
55
  saveSignerInfo = _ref.saveSignerInfo,
55
56
  signInfoMap = _ref.signInfoMap,
57
+ hasLoadingFile = _ref.hasLoadingFile,
56
58
  applySeal = _ref.applySeal,
57
59
  parentPageUrl = _ref.parentPageUrl,
58
60
  toSign = _ref.toSign,
@@ -65,7 +67,8 @@ var FileItem = function FileItem(_ref) {
65
67
  fileId = file.fileId,
66
68
  isSigned = file.isSigned,
67
69
  isSealed = file.isSealed,
68
- fileType = file.fileType;
70
+ fileType = file.fileType,
71
+ loading = file.loading;
69
72
  var materialName = fileConfig.materialName,
70
73
  signatureEnable = fileConfig.signatureEnable,
71
74
  signEnable = fileConfig.signEnable,
@@ -212,6 +215,14 @@ var FileItem = function FileItem(_ref) {
212
215
  var _useState19 = useState(0),
213
216
  signKey = _useState19[0],
214
217
  setSignKey = _useState19[1];
218
+ // 签批结果轮询中:在当前材料图片上展示局部 loading
219
+ var _useState20 = useState(false),
220
+ signPolling = _useState20[0],
221
+ setSignPolling = _useState20[1];
222
+ // 材料图片区域的 loading:文件自身 loading 或签批结果轮询中
223
+ var isLoading = loading || signPolling;
224
+ // 预览/下载在 loading 期间的提示语,区分「文件加载」与「签批结果轮询」
225
+ var loadingTip = signPolling ? '签批结果获取中,请稍后' : '数据获取中,请稍后';
215
226
  var timerRef = useRef(null);
216
227
  var originalUrlRef = useRef('');
217
228
  var rootRef = useRef(null);
@@ -244,7 +255,8 @@ var FileItem = function FileItem(_ref) {
244
255
  fileName: nameVal,
245
256
  fileUrl: newFile.fileUrlList[2],
246
257
  originalUrl: originalUrlRef.current,
247
- isSigned: true
258
+ isSigned: true,
259
+ loading: false
248
260
  }));
249
261
  return _context.abrupt("return", true);
250
262
  case 2:
@@ -351,18 +363,25 @@ var FileItem = function FileItem(_ref) {
351
363
  return _regeneratorRuntime.wrap(function (_context2) {
352
364
  while (1) switch (_context2.prev = _context2.next) {
353
365
  case 0:
354
- if (fileUrl) {
366
+ if (!isLoading) {
355
367
  _context2.next = 1;
356
368
  break;
357
369
  }
370
+ _Message.warning(loadingTip);
358
371
  return _context2.abrupt("return");
359
372
  case 1:
373
+ if (fileUrl) {
374
+ _context2.next = 2;
375
+ break;
376
+ }
377
+ return _context2.abrupt("return");
378
+ case 2:
360
379
  // console.log('fileUrl', fileUrl, fileId);
361
380
  captureComponentTop();
362
381
  setPreviewIframeUrl(fileUrl);
363
382
  setIsShowPreview(true);
364
383
  // if (!fileId) return;
365
- _context2.next = 2;
384
+ _context2.next = 3;
366
385
  return getUrlById({
367
386
  id: fileId,
368
387
  effectiveTime: 3600000
@@ -374,13 +393,13 @@ var FileItem = function FileItem(_ref) {
374
393
  isPC: isPC,
375
394
  accessToken: accessToken
376
395
  });
377
- case 2:
396
+ case 3:
378
397
  urlRes = _context2.sent;
379
398
  if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
380
- _context2.next = 4;
399
+ _context2.next = 5;
381
400
  break;
382
401
  }
383
- _context2.next = 3;
402
+ _context2.next = 4;
384
403
  return onlinePreview({
385
404
  url: urlRes.presignedUrlList[2]
386
405
  }, {
@@ -391,11 +410,11 @@ var FileItem = function FileItem(_ref) {
391
410
  isPC: isPC,
392
411
  accessToken: accessToken
393
412
  });
394
- case 3:
413
+ case 4:
395
414
  res = _context2.sent;
396
415
  setPreviewIframeUrl(res.url);
397
416
  setIsShowPreview(true);
398
- case 4:
417
+ case 5:
399
418
  case "end":
400
419
  return _context2.stop();
401
420
  }
@@ -469,6 +488,20 @@ var FileItem = function FileItem(_ref) {
469
488
  };
470
489
  }();
471
490
 
491
+ // 签字要跳转三方页面 跳之前存一下当前页面数据
492
+ var saveStorage = function saveStorage() {
493
+ var loginAccountId = userInfo.loginAccountId;
494
+ var previousData = window.localStorage.getItem(_this.state.applicationId + loginAccountId);
495
+ var previousDataVal = JSON.parse(previousData || '{}');
496
+ // 消费过了。删除一下
497
+ delete previousDataVal.isFormEdited;
498
+ window.localStorage.setItem(_this.state.applicationId + loginAccountId, JSON.stringify(_extends({}, previousDataVal, {
499
+ material: {
500
+ fileList: fileList
501
+ }
502
+ })));
503
+ };
504
+
472
505
  // 手写签批
473
506
  var sign = function sign() {
474
507
  if (!signatureEnable) {
@@ -481,6 +514,7 @@ var FileItem = function FileItem(_ref) {
481
514
  return k + 1;
482
515
  });
483
516
  setIsShowSignPage(true);
517
+ saveStorage();
484
518
  };
485
519
 
486
520
  // 签章
@@ -595,6 +629,12 @@ var FileItem = function FileItem(_ref) {
595
629
  setShowSignerInfo(true);
596
630
  };
597
631
  var signAndSeal = function signAndSeal() {
632
+ // 有材料还在 loading(如签批结果轮询中)时拦截签署,避免还有未完成的请求就跳转签署页面
633
+ if (hasLoadingFile && hasLoadingFile()) {
634
+ _Message.warning('部分材料正在处理中,请稍后再签署');
635
+ return;
636
+ }
637
+
598
638
  // 当前是个人 不需要签批。需要签他人签署 就直接打开维护签署人信息,这种情况属于签章开启 但是个人待办法人事项的时候
599
639
  if (userInfo.acctType !== '20' && !signatureEnable && needOtherSign) {
600
640
  openSignerInfo();
@@ -899,6 +939,10 @@ var FileItem = function FileItem(_ref) {
899
939
  };
900
940
  }();
901
941
  var onDownload = function onDownload() {
942
+ if (isLoading) {
943
+ _Message.warning(loadingTip);
944
+ return;
945
+ }
902
946
  if (disabled) return;
903
947
  var format = getFileExtension(fileName);
904
948
  download({
@@ -1062,7 +1106,12 @@ var FileItem = function FileItem(_ref) {
1062
1106
  localStorage.removeItem(fileId);
1063
1107
  originalUrlRef.current = originalUrl || '';
1064
1108
  if (docId && contrId && nameVal) {
1065
- openLoading();
1109
+ // openLoading()
1110
+ setSignPolling(true);
1111
+ // 轮询期间把 loading 标记到 file 对象上,沿用统一的 loading 展示逻辑
1112
+ valChange(_extends({}, file, {
1113
+ loading: true
1114
+ }), fileIndex, index, subIndex);
1066
1115
  // 兜底:连续 10 次轮询仍未成功则结束轮询,避免无限请求
1067
1116
  var pollCount = 0;
1068
1117
  timerRef.current = setInterval(function () {
@@ -1070,11 +1119,18 @@ var FileItem = function FileItem(_ref) {
1070
1119
  // 成功时 getSignedFile 内部会清除轮询并关闭 loading
1071
1120
  if (!success) {
1072
1121
  pollCount += 1;
1073
- if (pollCount >= 20) {
1122
+ if (pollCount >= 10) {
1074
1123
  clearInterval(timerRef.current);
1075
1124
  timerRef.current = null;
1076
1125
  closeLoading();
1126
+ setSignPolling(false);
1127
+ valChange(_extends({}, file, {
1128
+ loading: false
1129
+ }), fileIndex, index, subIndex);
1130
+ _Message.error('签批结果获取失败,请重试');
1077
1131
  }
1132
+ } else {
1133
+ setSignPolling(false);
1078
1134
  }
1079
1135
  });
1080
1136
  }, 3000);
@@ -1117,7 +1173,7 @@ var FileItem = function FileItem(_ref) {
1117
1173
  className: "error_msg",
1118
1174
  src: errorMsgIcon,
1119
1175
  alt: ""
1120
- })) : /*#__PURE__*/React.createElement("div", {
1176
+ })) : !isLoading && /*#__PURE__*/React.createElement("div", {
1121
1177
  className: "add",
1122
1178
  onClick: function onClick() {
1123
1179
  return upload();
@@ -1151,7 +1207,11 @@ var FileItem = function FileItem(_ref) {
1151
1207
  }, /*#__PURE__*/React.createElement("img", {
1152
1208
  src: CheckedIcon,
1153
1209
  alt: ""
1154
- }), "\u5DF2\u7B7E\u7AE0")))), isPC && /*#__PURE__*/React.createElement("div", {
1210
+ }), "\u5DF2\u7B7E\u7AE0"))), isLoading && /*#__PURE__*/React.createElement("div", {
1211
+ className: "loading_mask"
1212
+ }, /*#__PURE__*/React.createElement("span", {
1213
+ className: "loading_spinner"
1214
+ }))), isPC && /*#__PURE__*/React.createElement("div", {
1155
1215
  className: "blocks"
1156
1216
  }, /*#__PURE__*/React.createElement("div", {
1157
1217
  className: "status"
@@ -106,6 +106,30 @@
106
106
  }
107
107
  }
108
108
  }
109
+
110
+ .loading_mask {
111
+ position: absolute;
112
+ top: 0;
113
+ left: 0;
114
+ width: 100%;
115
+ height: 100%;
116
+ z-index: 4;
117
+ display: flex;
118
+ justify-content: center;
119
+ align-items: center;
120
+ border-radius: 8px;
121
+ background: rgba(255, 255, 255, 0.75);
122
+ cursor: wait;
123
+
124
+ .loading_spinner {
125
+ width: 20px;
126
+ height: 20px;
127
+ border: 2px solid #d6e4ff;
128
+ border-top-color: #1678ff;
129
+ border-radius: 50%;
130
+ animation: file_item_spin 0.8s linear infinite;
131
+ }
132
+ }
109
133
  }
110
134
 
111
135
  .blocks {
@@ -498,3 +522,13 @@
498
522
  }
499
523
 
500
524
  }
525
+
526
+ @keyframes file_item_spin {
527
+ from {
528
+ transform: rotate(0deg);
529
+ }
530
+
531
+ to {
532
+ transform: rotate(360deg);
533
+ }
534
+ }
@@ -1,5 +1,9 @@
1
1
  import React from 'react';
2
2
  import './index.scss';
3
+ /**
4
+ * 检查列表中是否还存在 loading 为 true 的文件(包含二级材料),有则返回 true
5
+ */
6
+ export declare const hasLoadingFileInList: (list: any[]) => boolean;
3
7
  export interface FileListProps {
4
8
  /**
5
9
  * 列表数据
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports["default"] = void 0;
5
+ exports.hasLoadingFileInList = exports["default"] = void 0;
6
6
  var _balloon = _interopRequireDefault(require("@alifd/next/lib/balloon"));
7
7
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
8
  var _react = _interopRequireWildcard(require("react"));
@@ -40,6 +40,21 @@ var MATERIAL_FORMAT = {
40
40
  };
41
41
  var OTHER = 1; // 角色数组中"他人"对应的值
42
42
 
43
+ /**
44
+ * 检查列表中是否还存在 loading 为 true 的文件(包含二级材料),有则返回 true
45
+ */
46
+ var hasLoadingFileInList = exports.hasLoadingFileInList = function hasLoadingFileInList(list) {
47
+ return (list || []).some(function (item) {
48
+ if ((item.fileList || []).some(function (file) {
49
+ return file && file.loading;
50
+ })) return true;
51
+ return (item.subMaterials || []).some(function (sub) {
52
+ return (sub.fileList || []).some(function (file) {
53
+ return file && file.loading;
54
+ });
55
+ });
56
+ });
57
+ };
43
58
  var FileList = function FileList(_ref) {
44
59
  var fileList = _ref.fileList,
45
60
  token = _ref.token,
@@ -218,6 +233,11 @@ var FileList = function FileList(_ref) {
218
233
  });
219
234
  return list;
220
235
  };
236
+
237
+ // 传给 FileItem:签署前检查列表中是否还有 loading 中的文件
238
+ var hasLoadingFile = function hasLoadingFile() {
239
+ return hasLoadingFileInList(fileArray);
240
+ };
221
241
  var handleChange = function handleChange(value, fileIndex, index, subIndex) {
222
242
  // console.log('handleChange', value, fileIndex, index, subIndex);
223
243
  // 先找到一级目录
@@ -394,6 +414,7 @@ var FileList = function FileList(_ref) {
394
414
  download: download,
395
415
  applySeal: applySeal,
396
416
  valChange: handleChange,
417
+ hasLoadingFile: hasLoadingFile,
397
418
  openLoading: openLoading,
398
419
  closeLoading: closeLoading,
399
420
  parentPageUrl: parentPageUrl,
@@ -433,6 +454,7 @@ var FileList = function FileList(_ref) {
433
454
  download: download,
434
455
  applySeal: applySeal,
435
456
  valChange: handleChange,
457
+ hasLoadingFile: hasLoadingFile,
436
458
  openLoading: openLoading,
437
459
  closeLoading: closeLoading,
438
460
  parentPageUrl: parentPageUrl,
@@ -29,6 +29,7 @@ export interface FileItemProps {
29
29
  download: (value: any) => void;
30
30
  saveSignerInfo: (value: any) => Promise<boolean>;
31
31
  signInfoMap?: object;
32
+ hasLoadingFile?: () => boolean;
32
33
  autoShowSignerInfo?: boolean;
33
34
  onNeedSignerInfo?: (pos: {
34
35
  index: number;
@@ -35,6 +35,7 @@ var RadioGroup = _radio["default"].Group;
35
35
  var SELF = 0;
36
36
  var OTHER = 1;
37
37
  var FileItem = function FileItem(_ref) {
38
+ var _this = this;
38
39
  var index = _ref.index,
39
40
  subIndex = _ref.subIndex,
40
41
  fileIndex = _ref.fileIndex,
@@ -59,6 +60,7 @@ var FileItem = function FileItem(_ref) {
59
60
  closeLoading = _ref.closeLoading,
60
61
  saveSignerInfo = _ref.saveSignerInfo,
61
62
  signInfoMap = _ref.signInfoMap,
63
+ hasLoadingFile = _ref.hasLoadingFile,
62
64
  applySeal = _ref.applySeal,
63
65
  parentPageUrl = _ref.parentPageUrl,
64
66
  toSign = _ref.toSign,
@@ -71,7 +73,8 @@ var FileItem = function FileItem(_ref) {
71
73
  fileId = file.fileId,
72
74
  isSigned = file.isSigned,
73
75
  isSealed = file.isSealed,
74
- fileType = file.fileType;
76
+ fileType = file.fileType,
77
+ loading = file.loading;
75
78
  var materialName = fileConfig.materialName,
76
79
  signatureEnable = fileConfig.signatureEnable,
77
80
  signEnable = fileConfig.signEnable,
@@ -218,6 +221,14 @@ var FileItem = function FileItem(_ref) {
218
221
  var _useState19 = (0, _react.useState)(0),
219
222
  signKey = _useState19[0],
220
223
  setSignKey = _useState19[1];
224
+ // 签批结果轮询中:在当前材料图片上展示局部 loading
225
+ var _useState20 = (0, _react.useState)(false),
226
+ signPolling = _useState20[0],
227
+ setSignPolling = _useState20[1];
228
+ // 材料图片区域的 loading:文件自身 loading 或签批结果轮询中
229
+ var isLoading = loading || signPolling;
230
+ // 预览/下载在 loading 期间的提示语,区分「文件加载」与「签批结果轮询」
231
+ var loadingTip = signPolling ? '签批结果获取中,请稍后' : '数据获取中,请稍后';
221
232
  var timerRef = (0, _react.useRef)(null);
222
233
  var originalUrlRef = (0, _react.useRef)('');
223
234
  var rootRef = (0, _react.useRef)(null);
@@ -250,7 +261,8 @@ var FileItem = function FileItem(_ref) {
250
261
  fileName: nameVal,
251
262
  fileUrl: newFile.fileUrlList[2],
252
263
  originalUrl: originalUrlRef.current,
253
- isSigned: true
264
+ isSigned: true,
265
+ loading: false
254
266
  }));
255
267
  return _context.abrupt("return", true);
256
268
  case 2:
@@ -357,18 +369,25 @@ var FileItem = function FileItem(_ref) {
357
369
  return _regenerator["default"].wrap(function (_context2) {
358
370
  while (1) switch (_context2.prev = _context2.next) {
359
371
  case 0:
360
- if (fileUrl) {
372
+ if (!isLoading) {
361
373
  _context2.next = 1;
362
374
  break;
363
375
  }
376
+ _message["default"].warning(loadingTip);
364
377
  return _context2.abrupt("return");
365
378
  case 1:
379
+ if (fileUrl) {
380
+ _context2.next = 2;
381
+ break;
382
+ }
383
+ return _context2.abrupt("return");
384
+ case 2:
366
385
  // console.log('fileUrl', fileUrl, fileId);
367
386
  captureComponentTop();
368
387
  setPreviewIframeUrl(fileUrl);
369
388
  setIsShowPreview(true);
370
389
  // if (!fileId) return;
371
- _context2.next = 2;
390
+ _context2.next = 3;
372
391
  return (0, _api.getUrlById)({
373
392
  id: fileId,
374
393
  effectiveTime: 3600000
@@ -380,13 +399,13 @@ var FileItem = function FileItem(_ref) {
380
399
  isPC: isPC,
381
400
  accessToken: accessToken
382
401
  });
383
- case 2:
402
+ case 3:
384
403
  urlRes = _context2.sent;
385
404
  if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
386
- _context2.next = 4;
405
+ _context2.next = 5;
387
406
  break;
388
407
  }
389
- _context2.next = 3;
408
+ _context2.next = 4;
390
409
  return (0, _api.onlinePreview)({
391
410
  url: urlRes.presignedUrlList[2]
392
411
  }, {
@@ -397,11 +416,11 @@ var FileItem = function FileItem(_ref) {
397
416
  isPC: isPC,
398
417
  accessToken: accessToken
399
418
  });
400
- case 3:
419
+ case 4:
401
420
  res = _context2.sent;
402
421
  setPreviewIframeUrl(res.url);
403
422
  setIsShowPreview(true);
404
- case 4:
423
+ case 5:
405
424
  case "end":
406
425
  return _context2.stop();
407
426
  }
@@ -475,6 +494,20 @@ var FileItem = function FileItem(_ref) {
475
494
  };
476
495
  }();
477
496
 
497
+ // 签字要跳转三方页面 跳之前存一下当前页面数据
498
+ var saveStorage = function saveStorage() {
499
+ var loginAccountId = userInfo.loginAccountId;
500
+ var previousData = window.localStorage.getItem(_this.state.applicationId + loginAccountId);
501
+ var previousDataVal = JSON.parse(previousData || '{}');
502
+ // 消费过了。删除一下
503
+ delete previousDataVal.isFormEdited;
504
+ window.localStorage.setItem(_this.state.applicationId + loginAccountId, JSON.stringify((0, _extends3["default"])({}, previousDataVal, {
505
+ material: {
506
+ fileList: fileList
507
+ }
508
+ })));
509
+ };
510
+
478
511
  // 手写签批
479
512
  var sign = function sign() {
480
513
  if (!signatureEnable) {
@@ -487,6 +520,7 @@ var FileItem = function FileItem(_ref) {
487
520
  return k + 1;
488
521
  });
489
522
  setIsShowSignPage(true);
523
+ saveStorage();
490
524
  };
491
525
 
492
526
  // 签章
@@ -601,6 +635,12 @@ var FileItem = function FileItem(_ref) {
601
635
  setShowSignerInfo(true);
602
636
  };
603
637
  var signAndSeal = function signAndSeal() {
638
+ // 有材料还在 loading(如签批结果轮询中)时拦截签署,避免还有未完成的请求就跳转签署页面
639
+ if (hasLoadingFile && hasLoadingFile()) {
640
+ _message["default"].warning('部分材料正在处理中,请稍后再签署');
641
+ return;
642
+ }
643
+
604
644
  // 当前是个人 不需要签批。需要签他人签署 就直接打开维护签署人信息,这种情况属于签章开启 但是个人待办法人事项的时候
605
645
  if (userInfo.acctType !== '20' && !signatureEnable && needOtherSign) {
606
646
  openSignerInfo();
@@ -905,6 +945,10 @@ var FileItem = function FileItem(_ref) {
905
945
  };
906
946
  }();
907
947
  var onDownload = function onDownload() {
948
+ if (isLoading) {
949
+ _message["default"].warning(loadingTip);
950
+ return;
951
+ }
908
952
  if (disabled) return;
909
953
  var format = (0, _file2.getFileExtension)(fileName);
910
954
  download({
@@ -1068,7 +1112,12 @@ var FileItem = function FileItem(_ref) {
1068
1112
  localStorage.removeItem(fileId);
1069
1113
  originalUrlRef.current = originalUrl || '';
1070
1114
  if (docId && contrId && nameVal) {
1071
- openLoading();
1115
+ // openLoading()
1116
+ setSignPolling(true);
1117
+ // 轮询期间把 loading 标记到 file 对象上,沿用统一的 loading 展示逻辑
1118
+ valChange((0, _extends3["default"])({}, file, {
1119
+ loading: true
1120
+ }), fileIndex, index, subIndex);
1072
1121
  // 兜底:连续 10 次轮询仍未成功则结束轮询,避免无限请求
1073
1122
  var pollCount = 0;
1074
1123
  timerRef.current = setInterval(function () {
@@ -1076,11 +1125,18 @@ var FileItem = function FileItem(_ref) {
1076
1125
  // 成功时 getSignedFile 内部会清除轮询并关闭 loading
1077
1126
  if (!success) {
1078
1127
  pollCount += 1;
1079
- if (pollCount >= 20) {
1128
+ if (pollCount >= 10) {
1080
1129
  clearInterval(timerRef.current);
1081
1130
  timerRef.current = null;
1082
1131
  closeLoading();
1132
+ setSignPolling(false);
1133
+ valChange((0, _extends3["default"])({}, file, {
1134
+ loading: false
1135
+ }), fileIndex, index, subIndex);
1136
+ _message["default"].error('签批结果获取失败,请重试');
1083
1137
  }
1138
+ } else {
1139
+ setSignPolling(false);
1084
1140
  }
1085
1141
  });
1086
1142
  }, 3000);
@@ -1123,7 +1179,7 @@ var FileItem = function FileItem(_ref) {
1123
1179
  className: "error_msg",
1124
1180
  src: _icon_errorMsg["default"],
1125
1181
  alt: ""
1126
- })) : /*#__PURE__*/_react["default"].createElement("div", {
1182
+ })) : !isLoading && /*#__PURE__*/_react["default"].createElement("div", {
1127
1183
  className: "add",
1128
1184
  onClick: function onClick() {
1129
1185
  return upload();
@@ -1157,7 +1213,11 @@ var FileItem = function FileItem(_ref) {
1157
1213
  }, /*#__PURE__*/_react["default"].createElement("img", {
1158
1214
  src: _checked["default"],
1159
1215
  alt: ""
1160
- }), "\u5DF2\u7B7E\u7AE0")))), isPC && /*#__PURE__*/_react["default"].createElement("div", {
1216
+ }), "\u5DF2\u7B7E\u7AE0"))), isLoading && /*#__PURE__*/_react["default"].createElement("div", {
1217
+ className: "loading_mask"
1218
+ }, /*#__PURE__*/_react["default"].createElement("span", {
1219
+ className: "loading_spinner"
1220
+ }))), isPC && /*#__PURE__*/_react["default"].createElement("div", {
1161
1221
  className: "blocks"
1162
1222
  }, /*#__PURE__*/_react["default"].createElement("div", {
1163
1223
  className: "status"
@@ -106,6 +106,30 @@
106
106
  }
107
107
  }
108
108
  }
109
+
110
+ .loading_mask {
111
+ position: absolute;
112
+ top: 0;
113
+ left: 0;
114
+ width: 100%;
115
+ height: 100%;
116
+ z-index: 4;
117
+ display: flex;
118
+ justify-content: center;
119
+ align-items: center;
120
+ border-radius: 8px;
121
+ background: rgba(255, 255, 255, 0.75);
122
+ cursor: wait;
123
+
124
+ .loading_spinner {
125
+ width: 20px;
126
+ height: 20px;
127
+ border: 2px solid #d6e4ff;
128
+ border-top-color: #1678ff;
129
+ border-radius: 50%;
130
+ animation: file_item_spin 0.8s linear infinite;
131
+ }
132
+ }
109
133
  }
110
134
 
111
135
  .blocks {
@@ -498,3 +522,13 @@
498
522
  }
499
523
 
500
524
  }
525
+
526
+ @keyframes file_item_spin {
527
+ from {
528
+ transform: rotate(0deg);
529
+ }
530
+
531
+ to {
532
+ transform: rotate(360deg);
533
+ }
534
+ }
@@ -101,7 +101,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
101
101
  packageName = 'ydb-components-material';
102
102
  }
103
103
  if (version === void 0) {
104
- version = '0.1.205';
104
+ version = '0.1.207';
105
105
  }
106
106
  if (basicLibraryVersion === void 0) {
107
107
  basicLibraryVersion = {
@@ -106,7 +106,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
106
106
  packageName = 'ydb-components-material';
107
107
  }
108
108
  if (version === void 0) {
109
- version = '0.1.205';
109
+ version = '0.1.207';
110
110
  }
111
111
  if (basicLibraryVersion === void 0) {
112
112
  basicLibraryVersion = {