ydb-components-material 0.1.168 → 0.1.170
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/build/docs/404.html +3 -3
- package/build/docs/_demos/:uuid +3 -3
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/{umi.7ac91b08.js → umi.be8de605.js} +1 -1
- package/build/docs/~demos/:uuid.html +3 -3
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/dist/BizComps.js +1 -1
- package/dist/BizComps.js.map +1 -1
- package/es/components/file-list/index.js +23 -3
- package/es/components/file-list/item.d.ts +7 -0
- package/es/components/file-list/item.js +43 -5
- package/es/components/file-list/signUtil.js +1 -1
- package/es/components/file-list/signerInfo.js +2 -2
- package/es/components/sign-file/index.d.ts +1 -0
- package/es/components/sign-file/index.js +91 -2
- package/lib/components/file-list/index.js +23 -3
- package/lib/components/file-list/item.d.ts +7 -0
- package/lib/components/file-list/item.js +43 -5
- package/lib/components/file-list/signUtil.js +1 -1
- package/lib/components/file-list/signerInfo.js +2 -2
- package/lib/components/sign-file/index.d.ts +1 -0
- package/lib/components/sign-file/index.js +91 -2
- package/lowcode/sign-file/meta.ts +15 -1
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/sign-file/meta.js +13 -0
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/sign-file/meta.js +13 -0
- package/package.json +3 -3
|
@@ -101,14 +101,20 @@ var FileList = function FileList(_ref) {
|
|
|
101
101
|
var _useState3 = useState(false),
|
|
102
102
|
showMerge = _useState3[0],
|
|
103
103
|
setShowMerge = _useState3[1];
|
|
104
|
-
|
|
104
|
+
// 签署完成后自动打开维护签署人信息
|
|
105
|
+
// 状态放在 FileList(FileItem 的父级),因为 FileItem 在签章/签批完成后会因 fileId 变化被重新挂载,
|
|
106
|
+
// 局部 state 会丢失。这里记录需要自动弹窗的材料位置,等重挂载后的 FileItem 挂载完成再触发弹窗
|
|
107
|
+
var _useState4 = useState(null),
|
|
108
|
+
needSignerInfo = _useState4[0],
|
|
109
|
+
setNeedSignerInfo = _useState4[1];
|
|
110
|
+
var _useState5 = useState({
|
|
105
111
|
materialName: '',
|
|
106
112
|
fileList: [],
|
|
107
113
|
index: 0,
|
|
108
114
|
subIndex: 0
|
|
109
115
|
}),
|
|
110
|
-
curMerge =
|
|
111
|
-
setCurMerge =
|
|
116
|
+
curMerge = _useState5[0],
|
|
117
|
+
setCurMerge = _useState5[1];
|
|
112
118
|
var convertNumbersToChinese = function convertNumbersToChinese(str) {
|
|
113
119
|
// 定义基础映射关系
|
|
114
120
|
var digitMap = {
|
|
@@ -245,6 +251,14 @@ var FileList = function FileList(_ref) {
|
|
|
245
251
|
setFileArray([].concat(fileArray));
|
|
246
252
|
};
|
|
247
253
|
|
|
254
|
+
// 签署完成后需要自动打开维护签署人信息:记录目标材料位置,等对应 FileItem 挂载后触发弹窗
|
|
255
|
+
var handleNeedSignerInfo = function handleNeedSignerInfo(pos) {
|
|
256
|
+
setNeedSignerInfo(pos);
|
|
257
|
+
};
|
|
258
|
+
var handleCloseSignerInfo = function handleCloseSignerInfo() {
|
|
259
|
+
setNeedSignerInfo(null);
|
|
260
|
+
};
|
|
261
|
+
|
|
248
262
|
// 如果 文件列表中都是图片,且数量大于1 判断需要合并
|
|
249
263
|
var judgeNeedMerge = function judgeNeedMerge(files) {
|
|
250
264
|
console.log('files--------judgeNeedMerge', files);
|
|
@@ -354,6 +368,9 @@ var FileList = function FileList(_ref) {
|
|
|
354
368
|
parentPageUrl: parentPageUrl,
|
|
355
369
|
toSign: toSign,
|
|
356
370
|
saveSignerInfo: saveSignerInfo,
|
|
371
|
+
autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.subIndex === subIndex && needSignerInfo.fileIndex === i),
|
|
372
|
+
onNeedSignerInfo: handleNeedSignerInfo,
|
|
373
|
+
onCloseSignerInfo: handleCloseSignerInfo,
|
|
357
374
|
style: {
|
|
358
375
|
marginBottom: '12px'
|
|
359
376
|
}
|
|
@@ -389,6 +406,9 @@ var FileList = function FileList(_ref) {
|
|
|
389
406
|
closeLoading: closeLoading,
|
|
390
407
|
parentPageUrl: parentPageUrl,
|
|
391
408
|
saveSignerInfo: saveSignerInfo,
|
|
409
|
+
autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.fileIndex === i),
|
|
410
|
+
onNeedSignerInfo: handleNeedSignerInfo,
|
|
411
|
+
onCloseSignerInfo: handleCloseSignerInfo,
|
|
392
412
|
style: {
|
|
393
413
|
marginBottom: '12px'
|
|
394
414
|
}
|
|
@@ -29,6 +29,13 @@ export interface FileItemProps {
|
|
|
29
29
|
download: (value: any) => void;
|
|
30
30
|
saveSignerInfo: (value: any) => Promise<boolean>;
|
|
31
31
|
signInfoMap?: object;
|
|
32
|
+
autoShowSignerInfo?: boolean;
|
|
33
|
+
onNeedSignerInfo?: (pos: {
|
|
34
|
+
index: number;
|
|
35
|
+
subIndex?: number;
|
|
36
|
+
fileIndex: number;
|
|
37
|
+
}) => void;
|
|
38
|
+
onCloseSignerInfo?: () => void;
|
|
32
39
|
}
|
|
33
40
|
declare const FileItem: React.FC<FileItemProps>;
|
|
34
41
|
export default FileItem;
|
|
@@ -55,7 +55,10 @@ var FileItem = function FileItem(_ref) {
|
|
|
55
55
|
signInfoMap = _ref.signInfoMap,
|
|
56
56
|
applySeal = _ref.applySeal,
|
|
57
57
|
parentPageUrl = _ref.parentPageUrl,
|
|
58
|
-
toSign = _ref.toSign
|
|
58
|
+
toSign = _ref.toSign,
|
|
59
|
+
autoShowSignerInfo = _ref.autoShowSignerInfo,
|
|
60
|
+
onNeedSignerInfo = _ref.onNeedSignerInfo,
|
|
61
|
+
onCloseSignerInfo = _ref.onCloseSignerInfo;
|
|
59
62
|
console.log('fileItem', file, maxFileSize);
|
|
60
63
|
var fileName = file.fileName,
|
|
61
64
|
fileUrl = file.fileUrl,
|
|
@@ -611,7 +614,14 @@ var FileItem = function FileItem(_ref) {
|
|
|
611
614
|
// 轮询回调是旧闭包,这里读 ref 拿最新值,避免读到挂载时的初始 false
|
|
612
615
|
var needOther = needOtherSignRef.current;
|
|
613
616
|
console.log('needOtherSign-----', needOther);
|
|
614
|
-
|
|
617
|
+
if (needOther) {
|
|
618
|
+
// 弹窗状态放到父级 FileList 控制,避免 FileItem 因 fileId 变化重挂载导致弹窗状态丢失
|
|
619
|
+
onNeedSignerInfo && onNeedSignerInfo({
|
|
620
|
+
index: index,
|
|
621
|
+
subIndex: subIndex,
|
|
622
|
+
fileIndex: fileIndex
|
|
623
|
+
});
|
|
624
|
+
}
|
|
615
625
|
};
|
|
616
626
|
|
|
617
627
|
// 获取签章结果
|
|
@@ -628,7 +638,13 @@ var FileItem = function FileItem(_ref) {
|
|
|
628
638
|
}
|
|
629
639
|
valChange(val, fileIndex, index, subIndex);
|
|
630
640
|
// invalidHandle()
|
|
631
|
-
needOtherSignRef.current
|
|
641
|
+
if (needOtherSignRef.current) {
|
|
642
|
+
onNeedSignerInfo && onNeedSignerInfo({
|
|
643
|
+
index: index,
|
|
644
|
+
subIndex: subIndex,
|
|
645
|
+
fileIndex: fileIndex
|
|
646
|
+
});
|
|
647
|
+
}
|
|
632
648
|
}
|
|
633
649
|
};
|
|
634
650
|
var queryFileLibs = function queryFileLibs() {
|
|
@@ -933,6 +949,15 @@ var FileItem = function FileItem(_ref) {
|
|
|
933
949
|
});
|
|
934
950
|
}
|
|
935
951
|
}, [fileId]);
|
|
952
|
+
|
|
953
|
+
// 父级 FileList 通知:本组件(重挂载后)需要自动打开维护签署人信息
|
|
954
|
+
// 打开后立即回调清除标记,避免下次切换材料位置时误弹
|
|
955
|
+
useEffect(function () {
|
|
956
|
+
if (autoShowSignerInfo) {
|
|
957
|
+
setShowSignerInfo(true);
|
|
958
|
+
onCloseSignerInfo && onCloseSignerInfo();
|
|
959
|
+
}
|
|
960
|
+
}, [autoShowSignerInfo, onCloseSignerInfo]);
|
|
936
961
|
useEffect(function () {
|
|
937
962
|
try {
|
|
938
963
|
var stored = localStorage.getItem(fileId);
|
|
@@ -948,8 +973,20 @@ var FileItem = function FileItem(_ref) {
|
|
|
948
973
|
originalUrlRef.current = originalUrl || '';
|
|
949
974
|
if (docId && contrId && nameVal) {
|
|
950
975
|
openLoading();
|
|
976
|
+
// 兜底:连续 10 次轮询仍未成功则结束轮询,避免无限请求
|
|
977
|
+
var pollCount = 0;
|
|
951
978
|
timerRef.current = setInterval(function () {
|
|
952
|
-
getSignedFile(docId, contrId, nameVal)
|
|
979
|
+
getSignedFile(docId, contrId, nameVal).then(function (success) {
|
|
980
|
+
// 成功时 getSignedFile 内部会清除轮询并关闭 loading
|
|
981
|
+
if (!success) {
|
|
982
|
+
pollCount += 1;
|
|
983
|
+
if (pollCount >= 10) {
|
|
984
|
+
clearInterval(timerRef.current);
|
|
985
|
+
timerRef.current = null;
|
|
986
|
+
closeLoading();
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
});
|
|
953
990
|
}, 3000);
|
|
954
991
|
}
|
|
955
992
|
}
|
|
@@ -1241,7 +1278,8 @@ var FileItem = function FileItem(_ref) {
|
|
|
1241
1278
|
}), showSignerInfo && /*#__PURE__*/React.createElement(SignerInfo, {
|
|
1242
1279
|
signerInfo: signerInfo,
|
|
1243
1280
|
handleClose: function handleClose() {
|
|
1244
|
-
|
|
1281
|
+
setShowSignerInfo(false);
|
|
1282
|
+
onCloseSignerInfo && onCloseSignerInfo();
|
|
1245
1283
|
},
|
|
1246
1284
|
saveSignerInfo: saveSignerInfo,
|
|
1247
1285
|
signatureEnable: signatureEnable,
|
|
@@ -262,8 +262,8 @@ function getSignUrl(userInfo, config, fileName, fileId, fileUrl) {
|
|
|
262
262
|
signurl(params, config).then(function (res) {
|
|
263
263
|
console.log(res, '页面结果');
|
|
264
264
|
if (res.data.code == 0) {
|
|
265
|
+
setSignInfo(fileName, fileId, fileUrl);
|
|
265
266
|
if (config.fileList) {
|
|
266
|
-
setSignInfo(fileName, fileId, fileUrl);
|
|
267
267
|
localStorage.setItem(config.tokenTY, JSON.stringify(config.fileList));
|
|
268
268
|
}
|
|
269
269
|
resolve(res.data.signUrl);
|
|
@@ -368,10 +368,10 @@ function SignerInfo(props) {
|
|
|
368
368
|
}, signatureEnable && isNeedOtherSign && /*#__PURE__*/React.createElement(_Checkbox, {
|
|
369
369
|
id: "1",
|
|
370
370
|
value: "1"
|
|
371
|
-
}, "\
|
|
371
|
+
}, "\u7B7E\u540D"), signEnable && isNeedOtherSeal && item.signType === 1 && /*#__PURE__*/React.createElement(_Checkbox, {
|
|
372
372
|
id: "2",
|
|
373
373
|
value: "2"
|
|
374
|
-
}, "\
|
|
374
|
+
}, "\u7B7E\u7AE0")))));
|
|
375
375
|
})), /*#__PURE__*/React.createElement("div", {
|
|
376
376
|
className: "footer"
|
|
377
377
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -10,6 +10,7 @@ import downloadIcon from "./icon/download.svg";
|
|
|
10
10
|
import fileIcon from "./icon/file.svg";
|
|
11
11
|
import closeIcon from "./icon/close.svg";
|
|
12
12
|
import SignPage from "../file-list/sign";
|
|
13
|
+
import { getSignRes } from "../file-list/signUtil";
|
|
13
14
|
import SealPage from "../file-list/seal";
|
|
14
15
|
import { querySeal } from "../file-list/sealUtil";
|
|
15
16
|
import { getGuideImg, getUrlById, onlinePreview } from "../../api";
|
|
@@ -30,7 +31,8 @@ var SignFile = function SignFile(_ref) {
|
|
|
30
31
|
style = _ref.style,
|
|
31
32
|
download = _ref.download,
|
|
32
33
|
valChange = _ref.valChange,
|
|
33
|
-
applySeal = _ref.applySeal
|
|
34
|
+
applySeal = _ref.applySeal,
|
|
35
|
+
toSign = _ref.toSign;
|
|
34
36
|
var fileName = file.fileName,
|
|
35
37
|
fileUrl = file.fileUrl,
|
|
36
38
|
fileId = file.fileId,
|
|
@@ -73,6 +75,8 @@ var SignFile = function SignFile(_ref) {
|
|
|
73
75
|
currentFileId = _useState1[0],
|
|
74
76
|
setCurrentFileId = _useState1[1];
|
|
75
77
|
var fileCopy = useRef(_extends({}, file));
|
|
78
|
+
var timerRef = useRef(null);
|
|
79
|
+
var originalUrlRef = useRef('');
|
|
76
80
|
|
|
77
81
|
// 预览材料
|
|
78
82
|
var preview = /*#__PURE__*/function () {
|
|
@@ -432,6 +436,51 @@ var SignFile = function SignFile(_ref) {
|
|
|
432
436
|
setHasSigned(true);
|
|
433
437
|
}
|
|
434
438
|
};
|
|
439
|
+
var getSignedFile = /*#__PURE__*/function () {
|
|
440
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(documentIdVal, contractIdVal, nameVal) {
|
|
441
|
+
var newFile;
|
|
442
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
443
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
444
|
+
case 0:
|
|
445
|
+
console.log('params---', documentIdVal, contractIdVal, nameVal, file);
|
|
446
|
+
_context6.next = 1;
|
|
447
|
+
return getSignRes(documentIdVal, contractIdVal, nameVal, true, {
|
|
448
|
+
token: token,
|
|
449
|
+
tokenTY: tokenTY,
|
|
450
|
+
baseUrl: baseUrl,
|
|
451
|
+
env: env,
|
|
452
|
+
isPC: isPC
|
|
453
|
+
});
|
|
454
|
+
case 1:
|
|
455
|
+
newFile = _context6.sent;
|
|
456
|
+
if (!newFile) {
|
|
457
|
+
_context6.next = 2;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
clearInterval(timerRef.current);
|
|
461
|
+
timerRef.current = null;
|
|
462
|
+
localStorage.removeItem(fileId);
|
|
463
|
+
// closeLoading()
|
|
464
|
+
getRes(_extends({}, file, {
|
|
465
|
+
fileId: newFile.fileId,
|
|
466
|
+
fileName: nameVal,
|
|
467
|
+
fileUrl: newFile.fileUrlList[2],
|
|
468
|
+
originalUrl: originalUrlRef.current,
|
|
469
|
+
isSigned: true
|
|
470
|
+
}));
|
|
471
|
+
return _context6.abrupt("return", true);
|
|
472
|
+
case 2:
|
|
473
|
+
return _context6.abrupt("return", false);
|
|
474
|
+
case 3:
|
|
475
|
+
case "end":
|
|
476
|
+
return _context6.stop();
|
|
477
|
+
}
|
|
478
|
+
}, _callee6);
|
|
479
|
+
}));
|
|
480
|
+
return function getSignedFile(_x3, _x4, _x5) {
|
|
481
|
+
return _ref7.apply(this, arguments);
|
|
482
|
+
};
|
|
483
|
+
}();
|
|
435
484
|
useEffect(function () {
|
|
436
485
|
if (currentFileId) {
|
|
437
486
|
getViewUrl(currentFileId).then(function (url) {
|
|
@@ -439,6 +488,46 @@ var SignFile = function SignFile(_ref) {
|
|
|
439
488
|
});
|
|
440
489
|
}
|
|
441
490
|
}, [currentFileId]);
|
|
491
|
+
useEffect(function () {
|
|
492
|
+
try {
|
|
493
|
+
var stored = localStorage.getItem(fileId);
|
|
494
|
+
if (stored) {
|
|
495
|
+
console.log('stored---', stored);
|
|
496
|
+
var _JSON$parse = JSON.parse(stored),
|
|
497
|
+
contrId = _JSON$parse.contractId,
|
|
498
|
+
docId = _JSON$parse.documentId,
|
|
499
|
+
nameVal = _JSON$parse.fileName,
|
|
500
|
+
originalUrl = _JSON$parse.fileUrl;
|
|
501
|
+
console.log('docId', docId, contrId, nameVal);
|
|
502
|
+
localStorage.removeItem(fileId);
|
|
503
|
+
originalUrlRef.current = originalUrl || '';
|
|
504
|
+
if (docId && contrId && nameVal) {
|
|
505
|
+
// openLoading()
|
|
506
|
+
// 兜底:连续 10 次轮询仍未成功则结束轮询,避免无限请求
|
|
507
|
+
var pollCount = 0;
|
|
508
|
+
timerRef.current = setInterval(function () {
|
|
509
|
+
getSignedFile(docId, contrId, nameVal).then(function (success) {
|
|
510
|
+
// 成功时 getSignedFile 内部会清除轮询并关闭 loading
|
|
511
|
+
if (!success) {
|
|
512
|
+
pollCount += 1;
|
|
513
|
+
if (pollCount >= 10) {
|
|
514
|
+
clearInterval(timerRef.current);
|
|
515
|
+
timerRef.current = null;
|
|
516
|
+
// closeLoading()
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}, 3000);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
} catch (e) {}
|
|
524
|
+
return function () {
|
|
525
|
+
if (timerRef.current) {
|
|
526
|
+
clearInterval(timerRef.current);
|
|
527
|
+
timerRef.current = null;
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}, [fileId]);
|
|
442
531
|
return /*#__PURE__*/React.createElement(_Loading, {
|
|
443
532
|
tip: '加载中...',
|
|
444
533
|
fullScreen: true,
|
|
@@ -489,6 +578,7 @@ var SignFile = function SignFile(_ref) {
|
|
|
489
578
|
src: downloadIcon,
|
|
490
579
|
alt: ""
|
|
491
580
|
}), "\u4E0B\u8F7D")), isShowSignPage && /*#__PURE__*/React.createElement(SignPage, {
|
|
581
|
+
toSign: toSign,
|
|
492
582
|
isShowSignPage: isShowSignPage,
|
|
493
583
|
userInfo: userInfo,
|
|
494
584
|
file: sealedFile || fileCopy.current,
|
|
@@ -497,7 +587,6 @@ var SignFile = function SignFile(_ref) {
|
|
|
497
587
|
baseUrl: baseUrl,
|
|
498
588
|
env: env,
|
|
499
589
|
isPC: isPC,
|
|
500
|
-
getRes: getRes,
|
|
501
590
|
handleClose: function handleClose() {
|
|
502
591
|
return setIsShowSignPage(false);
|
|
503
592
|
},
|
|
@@ -107,14 +107,20 @@ var FileList = function FileList(_ref) {
|
|
|
107
107
|
var _useState3 = (0, _react.useState)(false),
|
|
108
108
|
showMerge = _useState3[0],
|
|
109
109
|
setShowMerge = _useState3[1];
|
|
110
|
-
|
|
110
|
+
// 签署完成后自动打开维护签署人信息
|
|
111
|
+
// 状态放在 FileList(FileItem 的父级),因为 FileItem 在签章/签批完成后会因 fileId 变化被重新挂载,
|
|
112
|
+
// 局部 state 会丢失。这里记录需要自动弹窗的材料位置,等重挂载后的 FileItem 挂载完成再触发弹窗
|
|
113
|
+
var _useState4 = (0, _react.useState)(null),
|
|
114
|
+
needSignerInfo = _useState4[0],
|
|
115
|
+
setNeedSignerInfo = _useState4[1];
|
|
116
|
+
var _useState5 = (0, _react.useState)({
|
|
111
117
|
materialName: '',
|
|
112
118
|
fileList: [],
|
|
113
119
|
index: 0,
|
|
114
120
|
subIndex: 0
|
|
115
121
|
}),
|
|
116
|
-
curMerge =
|
|
117
|
-
setCurMerge =
|
|
122
|
+
curMerge = _useState5[0],
|
|
123
|
+
setCurMerge = _useState5[1];
|
|
118
124
|
var convertNumbersToChinese = function convertNumbersToChinese(str) {
|
|
119
125
|
// 定义基础映射关系
|
|
120
126
|
var digitMap = {
|
|
@@ -251,6 +257,14 @@ var FileList = function FileList(_ref) {
|
|
|
251
257
|
setFileArray([].concat(fileArray));
|
|
252
258
|
};
|
|
253
259
|
|
|
260
|
+
// 签署完成后需要自动打开维护签署人信息:记录目标材料位置,等对应 FileItem 挂载后触发弹窗
|
|
261
|
+
var handleNeedSignerInfo = function handleNeedSignerInfo(pos) {
|
|
262
|
+
setNeedSignerInfo(pos);
|
|
263
|
+
};
|
|
264
|
+
var handleCloseSignerInfo = function handleCloseSignerInfo() {
|
|
265
|
+
setNeedSignerInfo(null);
|
|
266
|
+
};
|
|
267
|
+
|
|
254
268
|
// 如果 文件列表中都是图片,且数量大于1 判断需要合并
|
|
255
269
|
var judgeNeedMerge = function judgeNeedMerge(files) {
|
|
256
270
|
console.log('files--------judgeNeedMerge', files);
|
|
@@ -360,6 +374,9 @@ var FileList = function FileList(_ref) {
|
|
|
360
374
|
parentPageUrl: parentPageUrl,
|
|
361
375
|
toSign: toSign,
|
|
362
376
|
saveSignerInfo: saveSignerInfo,
|
|
377
|
+
autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.subIndex === subIndex && needSignerInfo.fileIndex === i),
|
|
378
|
+
onNeedSignerInfo: handleNeedSignerInfo,
|
|
379
|
+
onCloseSignerInfo: handleCloseSignerInfo,
|
|
363
380
|
style: {
|
|
364
381
|
marginBottom: '12px'
|
|
365
382
|
}
|
|
@@ -395,6 +412,9 @@ var FileList = function FileList(_ref) {
|
|
|
395
412
|
closeLoading: closeLoading,
|
|
396
413
|
parentPageUrl: parentPageUrl,
|
|
397
414
|
saveSignerInfo: saveSignerInfo,
|
|
415
|
+
autoShowSignerInfo: !!(needSignerInfo && needSignerInfo.index === index && needSignerInfo.fileIndex === i),
|
|
416
|
+
onNeedSignerInfo: handleNeedSignerInfo,
|
|
417
|
+
onCloseSignerInfo: handleCloseSignerInfo,
|
|
398
418
|
style: {
|
|
399
419
|
marginBottom: '12px'
|
|
400
420
|
}
|
|
@@ -29,6 +29,13 @@ export interface FileItemProps {
|
|
|
29
29
|
download: (value: any) => void;
|
|
30
30
|
saveSignerInfo: (value: any) => Promise<boolean>;
|
|
31
31
|
signInfoMap?: object;
|
|
32
|
+
autoShowSignerInfo?: boolean;
|
|
33
|
+
onNeedSignerInfo?: (pos: {
|
|
34
|
+
index: number;
|
|
35
|
+
subIndex?: number;
|
|
36
|
+
fileIndex: number;
|
|
37
|
+
}) => void;
|
|
38
|
+
onCloseSignerInfo?: () => void;
|
|
32
39
|
}
|
|
33
40
|
declare const FileItem: React.FC<FileItemProps>;
|
|
34
41
|
export default FileItem;
|
|
@@ -61,7 +61,10 @@ var FileItem = function FileItem(_ref) {
|
|
|
61
61
|
signInfoMap = _ref.signInfoMap,
|
|
62
62
|
applySeal = _ref.applySeal,
|
|
63
63
|
parentPageUrl = _ref.parentPageUrl,
|
|
64
|
-
toSign = _ref.toSign
|
|
64
|
+
toSign = _ref.toSign,
|
|
65
|
+
autoShowSignerInfo = _ref.autoShowSignerInfo,
|
|
66
|
+
onNeedSignerInfo = _ref.onNeedSignerInfo,
|
|
67
|
+
onCloseSignerInfo = _ref.onCloseSignerInfo;
|
|
65
68
|
console.log('fileItem', file, maxFileSize);
|
|
66
69
|
var fileName = file.fileName,
|
|
67
70
|
fileUrl = file.fileUrl,
|
|
@@ -617,7 +620,14 @@ var FileItem = function FileItem(_ref) {
|
|
|
617
620
|
// 轮询回调是旧闭包,这里读 ref 拿最新值,避免读到挂载时的初始 false
|
|
618
621
|
var needOther = needOtherSignRef.current;
|
|
619
622
|
console.log('needOtherSign-----', needOther);
|
|
620
|
-
|
|
623
|
+
if (needOther) {
|
|
624
|
+
// 弹窗状态放到父级 FileList 控制,避免 FileItem 因 fileId 变化重挂载导致弹窗状态丢失
|
|
625
|
+
onNeedSignerInfo && onNeedSignerInfo({
|
|
626
|
+
index: index,
|
|
627
|
+
subIndex: subIndex,
|
|
628
|
+
fileIndex: fileIndex
|
|
629
|
+
});
|
|
630
|
+
}
|
|
621
631
|
};
|
|
622
632
|
|
|
623
633
|
// 获取签章结果
|
|
@@ -634,7 +644,13 @@ var FileItem = function FileItem(_ref) {
|
|
|
634
644
|
}
|
|
635
645
|
valChange(val, fileIndex, index, subIndex);
|
|
636
646
|
// invalidHandle()
|
|
637
|
-
needOtherSignRef.current
|
|
647
|
+
if (needOtherSignRef.current) {
|
|
648
|
+
onNeedSignerInfo && onNeedSignerInfo({
|
|
649
|
+
index: index,
|
|
650
|
+
subIndex: subIndex,
|
|
651
|
+
fileIndex: fileIndex
|
|
652
|
+
});
|
|
653
|
+
}
|
|
638
654
|
}
|
|
639
655
|
};
|
|
640
656
|
var queryFileLibs = function queryFileLibs() {
|
|
@@ -939,6 +955,15 @@ var FileItem = function FileItem(_ref) {
|
|
|
939
955
|
});
|
|
940
956
|
}
|
|
941
957
|
}, [fileId]);
|
|
958
|
+
|
|
959
|
+
// 父级 FileList 通知:本组件(重挂载后)需要自动打开维护签署人信息
|
|
960
|
+
// 打开后立即回调清除标记,避免下次切换材料位置时误弹
|
|
961
|
+
(0, _react.useEffect)(function () {
|
|
962
|
+
if (autoShowSignerInfo) {
|
|
963
|
+
setShowSignerInfo(true);
|
|
964
|
+
onCloseSignerInfo && onCloseSignerInfo();
|
|
965
|
+
}
|
|
966
|
+
}, [autoShowSignerInfo, onCloseSignerInfo]);
|
|
942
967
|
(0, _react.useEffect)(function () {
|
|
943
968
|
try {
|
|
944
969
|
var stored = localStorage.getItem(fileId);
|
|
@@ -954,8 +979,20 @@ var FileItem = function FileItem(_ref) {
|
|
|
954
979
|
originalUrlRef.current = originalUrl || '';
|
|
955
980
|
if (docId && contrId && nameVal) {
|
|
956
981
|
openLoading();
|
|
982
|
+
// 兜底:连续 10 次轮询仍未成功则结束轮询,避免无限请求
|
|
983
|
+
var pollCount = 0;
|
|
957
984
|
timerRef.current = setInterval(function () {
|
|
958
|
-
getSignedFile(docId, contrId, nameVal)
|
|
985
|
+
getSignedFile(docId, contrId, nameVal).then(function (success) {
|
|
986
|
+
// 成功时 getSignedFile 内部会清除轮询并关闭 loading
|
|
987
|
+
if (!success) {
|
|
988
|
+
pollCount += 1;
|
|
989
|
+
if (pollCount >= 10) {
|
|
990
|
+
clearInterval(timerRef.current);
|
|
991
|
+
timerRef.current = null;
|
|
992
|
+
closeLoading();
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
});
|
|
959
996
|
}, 3000);
|
|
960
997
|
}
|
|
961
998
|
}
|
|
@@ -1247,7 +1284,8 @@ var FileItem = function FileItem(_ref) {
|
|
|
1247
1284
|
}), showSignerInfo && /*#__PURE__*/_react["default"].createElement(_signerInfo["default"], {
|
|
1248
1285
|
signerInfo: signerInfo,
|
|
1249
1286
|
handleClose: function handleClose() {
|
|
1250
|
-
|
|
1287
|
+
setShowSignerInfo(false);
|
|
1288
|
+
onCloseSignerInfo && onCloseSignerInfo();
|
|
1251
1289
|
},
|
|
1252
1290
|
saveSignerInfo: saveSignerInfo,
|
|
1253
1291
|
signatureEnable: signatureEnable,
|
|
@@ -266,8 +266,8 @@ function getSignUrl(userInfo, config, fileName, fileId, fileUrl) {
|
|
|
266
266
|
(0, _api.signurl)(params, config).then(function (res) {
|
|
267
267
|
console.log(res, '页面结果');
|
|
268
268
|
if (res.data.code == 0) {
|
|
269
|
+
setSignInfo(fileName, fileId, fileUrl);
|
|
269
270
|
if (config.fileList) {
|
|
270
|
-
setSignInfo(fileName, fileId, fileUrl);
|
|
271
271
|
localStorage.setItem(config.tokenTY, JSON.stringify(config.fileList));
|
|
272
272
|
}
|
|
273
273
|
resolve(res.data.signUrl);
|
|
@@ -374,10 +374,10 @@ function SignerInfo(props) {
|
|
|
374
374
|
}, signatureEnable && isNeedOtherSign && /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
375
375
|
id: "1",
|
|
376
376
|
value: "1"
|
|
377
|
-
}, "\
|
|
377
|
+
}, "\u7B7E\u540D"), signEnable && isNeedOtherSeal && item.signType === 1 && /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
378
378
|
id: "2",
|
|
379
379
|
value: "2"
|
|
380
|
-
}, "\
|
|
380
|
+
}, "\u7B7E\u7AE0")))));
|
|
381
381
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
382
382
|
className: "footer"
|
|
383
383
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -15,6 +15,7 @@ var _download = _interopRequireDefault(require("./icon/download.svg"));
|
|
|
15
15
|
var _file = _interopRequireDefault(require("./icon/file.svg"));
|
|
16
16
|
var _close = _interopRequireDefault(require("./icon/close.svg"));
|
|
17
17
|
var _sign = _interopRequireDefault(require("../file-list/sign"));
|
|
18
|
+
var _signUtil = require("../file-list/signUtil");
|
|
18
19
|
var _seal = _interopRequireDefault(require("../file-list/seal"));
|
|
19
20
|
var _sealUtil = require("../file-list/sealUtil");
|
|
20
21
|
var _api = require("../../api");
|
|
@@ -36,7 +37,8 @@ var SignFile = function SignFile(_ref) {
|
|
|
36
37
|
style = _ref.style,
|
|
37
38
|
download = _ref.download,
|
|
38
39
|
valChange = _ref.valChange,
|
|
39
|
-
applySeal = _ref.applySeal
|
|
40
|
+
applySeal = _ref.applySeal,
|
|
41
|
+
toSign = _ref.toSign;
|
|
40
42
|
var fileName = file.fileName,
|
|
41
43
|
fileUrl = file.fileUrl,
|
|
42
44
|
fileId = file.fileId,
|
|
@@ -79,6 +81,8 @@ var SignFile = function SignFile(_ref) {
|
|
|
79
81
|
currentFileId = _useState1[0],
|
|
80
82
|
setCurrentFileId = _useState1[1];
|
|
81
83
|
var fileCopy = (0, _react.useRef)((0, _extends2["default"])({}, file));
|
|
84
|
+
var timerRef = (0, _react.useRef)(null);
|
|
85
|
+
var originalUrlRef = (0, _react.useRef)('');
|
|
82
86
|
|
|
83
87
|
// 预览材料
|
|
84
88
|
var preview = /*#__PURE__*/function () {
|
|
@@ -438,6 +442,51 @@ var SignFile = function SignFile(_ref) {
|
|
|
438
442
|
setHasSigned(true);
|
|
439
443
|
}
|
|
440
444
|
};
|
|
445
|
+
var getSignedFile = /*#__PURE__*/function () {
|
|
446
|
+
var _ref7 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(documentIdVal, contractIdVal, nameVal) {
|
|
447
|
+
var newFile;
|
|
448
|
+
return _regenerator["default"].wrap(function (_context6) {
|
|
449
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
450
|
+
case 0:
|
|
451
|
+
console.log('params---', documentIdVal, contractIdVal, nameVal, file);
|
|
452
|
+
_context6.next = 1;
|
|
453
|
+
return (0, _signUtil.getSignRes)(documentIdVal, contractIdVal, nameVal, true, {
|
|
454
|
+
token: token,
|
|
455
|
+
tokenTY: tokenTY,
|
|
456
|
+
baseUrl: baseUrl,
|
|
457
|
+
env: env,
|
|
458
|
+
isPC: isPC
|
|
459
|
+
});
|
|
460
|
+
case 1:
|
|
461
|
+
newFile = _context6.sent;
|
|
462
|
+
if (!newFile) {
|
|
463
|
+
_context6.next = 2;
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
clearInterval(timerRef.current);
|
|
467
|
+
timerRef.current = null;
|
|
468
|
+
localStorage.removeItem(fileId);
|
|
469
|
+
// closeLoading()
|
|
470
|
+
getRes((0, _extends2["default"])({}, file, {
|
|
471
|
+
fileId: newFile.fileId,
|
|
472
|
+
fileName: nameVal,
|
|
473
|
+
fileUrl: newFile.fileUrlList[2],
|
|
474
|
+
originalUrl: originalUrlRef.current,
|
|
475
|
+
isSigned: true
|
|
476
|
+
}));
|
|
477
|
+
return _context6.abrupt("return", true);
|
|
478
|
+
case 2:
|
|
479
|
+
return _context6.abrupt("return", false);
|
|
480
|
+
case 3:
|
|
481
|
+
case "end":
|
|
482
|
+
return _context6.stop();
|
|
483
|
+
}
|
|
484
|
+
}, _callee6);
|
|
485
|
+
}));
|
|
486
|
+
return function getSignedFile(_x3, _x4, _x5) {
|
|
487
|
+
return _ref7.apply(this, arguments);
|
|
488
|
+
};
|
|
489
|
+
}();
|
|
441
490
|
(0, _react.useEffect)(function () {
|
|
442
491
|
if (currentFileId) {
|
|
443
492
|
getViewUrl(currentFileId).then(function (url) {
|
|
@@ -445,6 +494,46 @@ var SignFile = function SignFile(_ref) {
|
|
|
445
494
|
});
|
|
446
495
|
}
|
|
447
496
|
}, [currentFileId]);
|
|
497
|
+
(0, _react.useEffect)(function () {
|
|
498
|
+
try {
|
|
499
|
+
var stored = localStorage.getItem(fileId);
|
|
500
|
+
if (stored) {
|
|
501
|
+
console.log('stored---', stored);
|
|
502
|
+
var _JSON$parse = JSON.parse(stored),
|
|
503
|
+
contrId = _JSON$parse.contractId,
|
|
504
|
+
docId = _JSON$parse.documentId,
|
|
505
|
+
nameVal = _JSON$parse.fileName,
|
|
506
|
+
originalUrl = _JSON$parse.fileUrl;
|
|
507
|
+
console.log('docId', docId, contrId, nameVal);
|
|
508
|
+
localStorage.removeItem(fileId);
|
|
509
|
+
originalUrlRef.current = originalUrl || '';
|
|
510
|
+
if (docId && contrId && nameVal) {
|
|
511
|
+
// openLoading()
|
|
512
|
+
// 兜底:连续 10 次轮询仍未成功则结束轮询,避免无限请求
|
|
513
|
+
var pollCount = 0;
|
|
514
|
+
timerRef.current = setInterval(function () {
|
|
515
|
+
getSignedFile(docId, contrId, nameVal).then(function (success) {
|
|
516
|
+
// 成功时 getSignedFile 内部会清除轮询并关闭 loading
|
|
517
|
+
if (!success) {
|
|
518
|
+
pollCount += 1;
|
|
519
|
+
if (pollCount >= 10) {
|
|
520
|
+
clearInterval(timerRef.current);
|
|
521
|
+
timerRef.current = null;
|
|
522
|
+
// closeLoading()
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
}, 3000);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} catch (e) {}
|
|
530
|
+
return function () {
|
|
531
|
+
if (timerRef.current) {
|
|
532
|
+
clearInterval(timerRef.current);
|
|
533
|
+
timerRef.current = null;
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
}, [fileId]);
|
|
448
537
|
return /*#__PURE__*/_react["default"].createElement(_loading["default"], {
|
|
449
538
|
tip: '加载中...',
|
|
450
539
|
fullScreen: true,
|
|
@@ -495,6 +584,7 @@ var SignFile = function SignFile(_ref) {
|
|
|
495
584
|
src: _download["default"],
|
|
496
585
|
alt: ""
|
|
497
586
|
}), "\u4E0B\u8F7D")), isShowSignPage && /*#__PURE__*/_react["default"].createElement(_sign["default"], {
|
|
587
|
+
toSign: toSign,
|
|
498
588
|
isShowSignPage: isShowSignPage,
|
|
499
589
|
userInfo: userInfo,
|
|
500
590
|
file: sealedFile || fileCopy.current,
|
|
@@ -503,7 +593,6 @@ var SignFile = function SignFile(_ref) {
|
|
|
503
593
|
baseUrl: baseUrl,
|
|
504
594
|
env: env,
|
|
505
595
|
isPC: isPC,
|
|
506
|
-
getRes: getRes,
|
|
507
596
|
handleClose: function handleClose() {
|
|
508
597
|
return setIsShowSignPage(false);
|
|
509
598
|
},
|