ztxkui 4.2.23-613 → 4.2.23-615

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.
@@ -68,6 +68,7 @@ import useBaseContext from '../utils/useBaseContext';
68
68
  import { Modal, message, Button } from '../../index.build';
69
69
  import ElectronSignaturesFragment from './electron-signatures-fragment';
70
70
  import useMemoizedFn from '../utils/useMemoizedFn';
71
+ import checkSealCoUse from '../utils/checkSealCoUse';
71
72
  import useMergeRecords from './hooks/useMergeRecords';
72
73
  // 附件相关
73
74
  import useFileTypeColumns from './fileComponents/useFileTypeColumns';
@@ -486,380 +487,392 @@ var ElectronSignatures = function (props) {
486
487
  },
487
488
  /** 验证组件是否通过校验 */
488
489
  validateElectronTable: function (validateInfo) { return __awaiter(void 0, void 0, void 0, function () {
489
- var validateAttachType, resultData, submitData, currentData, _a, _b, isQunjKey, _c, qunjSealKey, fileList, hasElectronicSeal, electronicSealFileList, hasQunj, electronicSealIdList, docAttachMap, qunjSeal, contractId, isContranctNum, isEdit, needDg, needQys, needQj, preElectronicSealIdList, qunjChecked, isOnlyQj, isValidateAttachTypeIndex, msg, isValidateDgIndex, msg, isValidateAttachType, msg, msg, checkElectron, electronicSealedFileList_1, isMoreQunjCountIndex, msg, isMoreQunjCount, msg, isCheckTakeOutNoAddress, isCheckTakeOutNoAddressIndex, msg, msg, msg, hasNoWritContranctNum, msg, hasNoCheckedQjSeal, msg, noNumSealName_1, hasNoNumCheckedQjSeal, msg, msg, electronList, selectedSealIds_1, _i, electronList_1, seal, requiredIds, hasMatch, msg;
490
+ var validateAttachType, resultData, submitData, currentData, _a, _b, isQunjKey, _c, qunjSealKey, fileList, hasElectronicSeal, electronicSealFileList, hasQunj, electronicSealIdList, docAttachMap, qunjSeal, contractId, isContranctNum, isEdit, needDg, needQys, needQj, preElectronicSealIdList, qunjChecked, isOnlyQj, isValidateAttachTypeIndex, msg, isValidateDgIndex, msg, isValidateAttachType, msg, msg, checkElectron, electronicSealedFileList_1, isMoreQunjCountIndex, msg, isMoreQunjCount, msg, isCheckTakeOutNoAddress, isCheckTakeOutNoAddressIndex, msg, msg, msg, hasNoWritContranctNum, msg, hasNoCheckedQjSeal, msg, noNumSealName_1, hasNoNumCheckedQjSeal, msg, msg, qjSealNos_1, isCoUsePass;
490
491
  var _d, _e, _f, _g, _h, _j, _k;
491
492
  return __generator(this, function (_l) {
492
- validateAttachType = (validateInfo || {}).validateAttachType;
493
- resultData = getAllData();
494
- submitData = resultData[firstDataType];
495
- currentData = allData[firstDataType];
496
- _a = ((_d = currentData.fileFieldsNameRef) === null || _d === void 0 ? void 0 : _d.current) || {}, _b = _a.isQunj, isQunjKey = _b === void 0 ? 'isQunj' : _b, _c = _a.qunjSeal, qunjSealKey = _c === void 0 ? 'qunjSeal' : _c;
497
- fileList = submitData.fileList;
498
- hasElectronicSeal = fileList === null || fileList === void 0 ? void 0 : fileList.some(function (item) { return !!item.isElectronicSeal; });
499
- electronicSealFileList = (_g = (_f = (_e = fileList === null || fileList === void 0 ? void 0 : fileList.filter) === null || _e === void 0 ? void 0 : _e.call(fileList, function (item) { return !!item.isElectronicSeal; })) === null || _f === void 0 ? void 0 : _f.map) === null || _g === void 0 ? void 0 : _g.call(_f, function (item) { return item.attachId; });
500
- hasQunj = fileList === null || fileList === void 0 ? void 0 : fileList.some(function (item) { return !!(item === null || item === void 0 ? void 0 : item[isQunjKey]); });
501
- electronicSealIdList = submitData.electronicSealIdList || [];
502
- docAttachMap = {};
503
- try {
504
- docAttachMap = submitData.docAttachMap
505
- ? JSON.parse(submitData.docAttachMap)
506
- : {};
507
- }
508
- catch (err) {
509
- console.log(i18next.t('解析数据失败!!!!!'));
510
- }
511
- qunjSeal = submitData.qunjSeal;
512
- contractId = submitData.contractId;
513
- isContranctNum = currentData.isContranctNum;
514
- isEdit = currentData.isEdit;
515
- needDg = currentData.needDg;
516
- needQys = currentData.needQys;
517
- needQj = currentData.needQj;
518
- preElectronicSealIdList = currentData === null || currentData === void 0 ? void 0 : currentData.clickElectronicSealIdList;
519
- qunjChecked = currentData.qunjChecked;
520
- isOnlyQj = fileList.length === 0;
521
- // 0. 智能合同比对相关验证
522
- if (isEdit && needDg) {
523
- if (isChoiseChangeTemplateValid) {
524
- isValidateAttachTypeIndex = fileList.findIndex(function (item) {
525
- return (item.attachId &&
526
- !item.templateAttachId &&
527
- (validateAttachType
528
- ? validateAttachType(item)
529
- : item.attachType === '001'));
530
- });
531
- if (isValidateAttachTypeIndex !== -1) {
532
- msg = i18next.t('第 {{slot0}} 行数据,附件类型为合同本身,需要挑选比对模板!', { slot0: isValidateAttachTypeIndex + 1 });
533
- message.warning(msg);
534
- return [2 /*return*/, Promise.reject(msg)];
493
+ switch (_l.label) {
494
+ case 0:
495
+ validateAttachType = (validateInfo || {}).validateAttachType;
496
+ resultData = getAllData();
497
+ submitData = resultData[firstDataType];
498
+ currentData = allData[firstDataType];
499
+ _a = ((_d = currentData.fileFieldsNameRef) === null || _d === void 0 ? void 0 : _d.current) || {}, _b = _a.isQunj, isQunjKey = _b === void 0 ? 'isQunj' : _b, _c = _a.qunjSeal, qunjSealKey = _c === void 0 ? 'qunjSeal' : _c;
500
+ fileList = submitData.fileList;
501
+ hasElectronicSeal = fileList === null || fileList === void 0 ? void 0 : fileList.some(function (item) { return !!item.isElectronicSeal; });
502
+ electronicSealFileList = (_g = (_f = (_e = fileList === null || fileList === void 0 ? void 0 : fileList.filter) === null || _e === void 0 ? void 0 : _e.call(fileList, function (item) { return !!item.isElectronicSeal; })) === null || _f === void 0 ? void 0 : _f.map) === null || _g === void 0 ? void 0 : _g.call(_f, function (item) { return item.attachId; });
503
+ hasQunj = fileList === null || fileList === void 0 ? void 0 : fileList.some(function (item) { return !!(item === null || item === void 0 ? void 0 : item[isQunjKey]); });
504
+ electronicSealIdList = submitData.electronicSealIdList || [];
505
+ docAttachMap = {};
506
+ try {
507
+ docAttachMap = submitData.docAttachMap
508
+ ? JSON.parse(submitData.docAttachMap)
509
+ : {};
535
510
  }
536
- }
537
- isValidateDgIndex = fileList.findIndex(function (item) {
538
- return (item.attachId &&
539
- item.templateAttachId &&
540
- !item.taskId &&
541
- (validateAttachType
542
- ? validateAttachType(item)
543
- : item.attachType === '001'));
544
- });
545
- if (isValidateDgIndex !== -1) {
546
- msg = i18next.t('第 {{slot0}} 行数据,没有生成任务id,请点击开始比对按钮!', { slot0: isValidateDgIndex + 1 });
547
- message.warning(msg);
548
- return [2 /*return*/, Promise.reject(msg)];
549
- }
550
- isValidateAttachType = fileList.findIndex(function (item) {
551
- return !item.attachType;
552
- });
553
- if (resetProps.isAllowedPatchFileType &&
554
- isValidateAttachType !== -1) {
555
- msg = i18next.t('第 {{slot0}} 行数据,没有选择附件类型,请选择!', { slot0: isValidateAttachType + 1 });
556
- message.warning(msg);
557
- return [2 /*return*/, Promise.reject(msg)];
558
- }
559
- }
560
- // 1. 指定盖章位置后,又修改了选中印章信息 并且本次一定手动指定了签署位置
561
- if (isEdit &&
562
- needQys &&
563
- !isClickElectronSureRef.current &&
564
- !isOnlyQj &&
565
- preElectronicSealIdList &&
566
- electronicSealIdList.length !== (preElectronicSealIdList === null || preElectronicSealIdList === void 0 ? void 0 : preElectronicSealIdList.length)) {
567
- Modal.confirm({
568
- title: i18next.t('当前所勾选的电子印章信息与上一次盖章时有差异,请确认是否继续?'),
569
- okText: i18next.t('是'),
570
- okType: 'danger',
571
- cancelText: i18next.t('否'),
572
- onOk: function () {
573
- isClickElectronSureRef.current = true;
574
- },
575
- onCancel: function () {
576
- isClickElectronSureRef.current = false;
577
- },
578
- });
579
- return [2 /*return*/, Promise.reject(i18next.t('当前所勾选的电子印章信息与上一次盖章时有差异,请确认是否继续?'))];
580
- }
581
- // 2. 给附件勾选了加盖电子印章 但是未选择电子印章列表
582
- if (isEdit &&
583
- needQys &&
584
- electronicSealIdList.length === 0 &&
585
- hasElectronicSeal &&
586
- !isOnlyQj) {
587
- msg = i18next.t('请勾选加盖电子印章所需要的印章列表!');
588
- message.warning(msg);
589
- return [2 /*return*/, Promise.reject(msg)];
590
- }
591
- checkElectron = (_h = fileList === null || fileList === void 0 ? void 0 : fileList.find) === null || _h === void 0 ? void 0 : _h.call(fileList, function (item) { return !!(item === null || item === void 0 ? void 0 : item.isElectronicSeal); });
592
- if (isEdit &&
593
- needQys &&
594
- contractId &&
595
- docAttachMap &&
596
- electronicSealFileList &&
597
- checkElectron) {
598
- electronicSealedFileList_1 = [];
599
- Object.keys(docAttachMap).forEach(function (key) {
600
- // const value = docAttachMap[key];
601
- if (electronicSealFileList.find(function (attachId) { return attachId === key; }) ||
602
- key !== 'needYjzrr') {
603
- // 将当前合同下已经盖章的附件 添加到 已盖章附件列表中
604
- electronicSealedFileList_1.push(key);
511
+ catch (err) {
512
+ console.log(i18next.t('解析数据失败!!!!!'));
605
513
  }
606
- });
607
- if (!isEqual(electronicSealFileList.sort(), electronicSealedFileList_1.sort())) {
608
- message.warning(i18next.t('附件盖章信息有变动,请重新确认盖章信息'));
609
- return [2 /*return*/, Promise.reject(i18next.t('附件盖章信息有变动,请重新确认盖章信息'))];
610
- }
611
- }
612
- // 3. 群杰超过4倍 禁止提交审批
613
- if (isEdit && needQj && isContranctNum) {
614
- // 单附件都需要选群杰章 校验逻辑
615
- if (isSingleQj && hasQunj) {
616
- isMoreQunjCountIndex = fileList.findIndex(function (file) {
617
- var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
618
- // 如果没有勾选,不需要验证
619
- if (!isQunj) {
620
- return false;
514
+ qunjSeal = submitData.qunjSeal;
515
+ contractId = submitData.contractId;
516
+ isContranctNum = currentData.isContranctNum;
517
+ isEdit = currentData.isEdit;
518
+ needDg = currentData.needDg;
519
+ needQys = currentData.needQys;
520
+ needQj = currentData.needQj;
521
+ preElectronicSealIdList = currentData === null || currentData === void 0 ? void 0 : currentData.clickElectronicSealIdList;
522
+ qunjChecked = currentData.qunjChecked;
523
+ isOnlyQj = fileList.length === 0;
524
+ // 0. 智能合同比对相关验证
525
+ if (isEdit && needDg) {
526
+ if (isChoiseChangeTemplateValid) {
527
+ isValidateAttachTypeIndex = fileList.findIndex(function (item) {
528
+ return (item.attachId &&
529
+ !item.templateAttachId &&
530
+ (validateAttachType
531
+ ? validateAttachType(item)
532
+ : item.attachType === '001'));
533
+ });
534
+ if (isValidateAttachTypeIndex !== -1) {
535
+ msg = i18next.t('第 {{slot0}} 行数据,附件类型为合同本身,需要挑选比对模板!', { slot0: isValidateAttachTypeIndex + 1 });
536
+ message.warning(msg);
537
+ return [2 /*return*/, Promise.reject(msg)];
538
+ }
621
539
  }
622
- var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
623
- var isMoreQunjCount = countIsValidate(qunjSeal, false);
624
- if (!isMoreQunjCount) {
625
- return true;
540
+ isValidateDgIndex = fileList.findIndex(function (item) {
541
+ return (item.attachId &&
542
+ item.templateAttachId &&
543
+ !item.taskId &&
544
+ (validateAttachType
545
+ ? validateAttachType(item)
546
+ : item.attachType === '001'));
547
+ });
548
+ if (isValidateDgIndex !== -1) {
549
+ msg = i18next.t('第 {{slot0}} 行数据,没有生成任务id,请点击开始比对按钮!', { slot0: isValidateDgIndex + 1 });
550
+ message.warning(msg);
551
+ return [2 /*return*/, Promise.reject(msg)];
552
+ }
553
+ isValidateAttachType = fileList.findIndex(function (item) {
554
+ return !item.attachType;
555
+ });
556
+ if (resetProps.isAllowedPatchFileType &&
557
+ isValidateAttachType !== -1) {
558
+ msg = i18next.t('第 {{slot0}} 行数据,没有选择附件类型,请选择!', { slot0: isValidateAttachType + 1 });
559
+ message.warning(msg);
560
+ return [2 /*return*/, Promise.reject(msg)];
626
561
  }
627
- return false;
628
- });
629
- if (isMoreQunjCountIndex !== -1) {
630
- msg = i18next.t('第{{slot0}}行数据,您的群杰章用印次数远远超过合理次数范围,请修改。', { slot0: isMoreQunjCountIndex + 1 });
631
- message.warning(msg);
632
- return [2 /*return*/, Promise.reject(msg)];
633
562
  }
634
- }
635
- // 整体盖群杰章校验逻辑
636
- if (!isSingleQj) {
637
- isMoreQunjCount = countIsValidate(qunjSeal, false);
638
- if (!isMoreQunjCount) {
639
- msg = i18next.t('您的群杰章用印次数远远超过合理次数范围,请修改。');
563
+ // 1. 指定盖章位置后,又修改了选中印章信息 并且本次一定手动指定了签署位置
564
+ if (isEdit &&
565
+ needQys &&
566
+ !isClickElectronSureRef.current &&
567
+ !isOnlyQj &&
568
+ preElectronicSealIdList &&
569
+ electronicSealIdList.length !== (preElectronicSealIdList === null || preElectronicSealIdList === void 0 ? void 0 : preElectronicSealIdList.length)) {
570
+ Modal.confirm({
571
+ title: i18next.t('当前所勾选的电子印章信息与上一次盖章时有差异,请确认是否继续?'),
572
+ okText: i18next.t('是'),
573
+ okType: 'danger',
574
+ cancelText: i18next.t('否'),
575
+ onOk: function () {
576
+ isClickElectronSureRef.current = true;
577
+ },
578
+ onCancel: function () {
579
+ isClickElectronSureRef.current = false;
580
+ },
581
+ });
582
+ return [2 /*return*/, Promise.reject(i18next.t('当前所勾选的电子印章信息与上一次盖章时有差异,请确认是否继续?'))];
583
+ }
584
+ // 2. 给附件勾选了加盖电子印章 但是未选择电子印章列表
585
+ if (isEdit &&
586
+ needQys &&
587
+ electronicSealIdList.length === 0 &&
588
+ hasElectronicSeal &&
589
+ !isOnlyQj) {
590
+ msg = i18next.t('请勾选加盖电子印章所需要的印章列表!');
640
591
  message.warning(msg);
641
592
  return [2 /*return*/, Promise.reject(msg)];
642
593
  }
643
- }
644
- }
645
- isCheckTakeOutNoAddress = function (data) {
646
- if (data &&
647
- data.qunjSeal &&
648
- data.qunjSeal.isTakeOut + '' === '1' &&
649
- (!data.qunjAddress || data.qunjAddress.length === 0)) {
650
- return true;
651
- }
652
- return false;
653
- };
654
- if (isEdit && needQj) {
655
- // 对于那种每个附件都需要选择群杰用印的逻辑
656
- if (isSingleQj) {
657
- isCheckTakeOutNoAddressIndex = fileList.findIndex(function (file) {
658
- var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
659
- // 如果没有勾选,不需要验证
660
- if (!isQunj) {
661
- return false;
662
- }
663
- var isCheckTakeOutNoAddressResult = isCheckTakeOutNoAddress(file);
664
- if (isCheckTakeOutNoAddressResult) {
665
- return true;
594
+ checkElectron = (_h = fileList === null || fileList === void 0 ? void 0 : fileList.find) === null || _h === void 0 ? void 0 : _h.call(fileList, function (item) { return !!(item === null || item === void 0 ? void 0 : item.isElectronicSeal); });
595
+ if (isEdit &&
596
+ needQys &&
597
+ contractId &&
598
+ docAttachMap &&
599
+ electronicSealFileList &&
600
+ checkElectron) {
601
+ electronicSealedFileList_1 = [];
602
+ Object.keys(docAttachMap).forEach(function (key) {
603
+ // const value = docAttachMap[key];
604
+ if (electronicSealFileList.find(function (attachId) { return attachId === key; }) ||
605
+ key !== 'needYjzrr') {
606
+ // 将当前合同下已经盖章的附件 添加到 已盖章附件列表中
607
+ electronicSealedFileList_1.push(key);
608
+ }
609
+ });
610
+ if (!isEqual(electronicSealFileList.sort(), electronicSealedFileList_1.sort())) {
611
+ message.warning(i18next.t('附件盖章信息有变动,请重新确认盖章信息'));
612
+ return [2 /*return*/, Promise.reject(i18next.t('附件盖章信息有变动,请重新确认盖章信息'))];
666
613
  }
667
- return false;
668
- });
669
- if (isCheckTakeOutNoAddressIndex !== -1) {
670
- msg = i18next.t('第{{slot0}}行数据,您的群杰章用选了外部用印,但是没有选择外部用印的地址!', { slot0: isCheckTakeOutNoAddressIndex + 1 });
671
- message.warning(msg);
672
- return [2 /*return*/, Promise.reject(msg)];
673
614
  }
674
- }
675
- else if (isCheckTakeOutNoAddress(submitData)) {
676
- msg = i18next.t('您的群杰印章选了外部用印,但是没有选择外部用印的地址!');
677
- message.warning(msg);
678
- return [2 /*return*/, Promise.reject(msg)];
679
- }
680
- }
681
- // 4. 没有确认盖章
682
- if (isEdit &&
683
- needQys &&
684
- hasElectronicSeal &&
685
- !contractId &&
686
- !isOnlyQj) {
687
- msg = i18next.t('请点击指定签署位置按钮,指定签署位置后方可提交!');
688
- message.warning(msg);
689
- return [2 /*return*/, Promise.reject(msg)];
690
- }
691
- // 5. 合同份数验证
692
- if (isEdit && needQj) {
693
- // 单附件都需要选群杰章 校验逻辑
694
- if (isSingleQj && hasQunj) {
695
- // 合同份数校验
696
- if (isContranctNum) {
697
- hasNoWritContranctNum = fileList.findIndex(function (file) {
698
- var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
699
- // 如果没有勾选,不需要验证
700
- if (!isQunj) {
615
+ // 3. 群杰超过4倍 禁止提交审批
616
+ if (isEdit && needQj && isContranctNum) {
617
+ // 单附件都需要选群杰章 校验逻辑
618
+ if (isSingleQj && hasQunj) {
619
+ isMoreQunjCountIndex = fileList.findIndex(function (file) {
620
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
621
+ // 如果没有勾选,不需要验证
622
+ if (!isQunj) {
623
+ return false;
624
+ }
625
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
626
+ var isMoreQunjCount = countIsValidate(qunjSeal, false);
627
+ if (!isMoreQunjCount) {
628
+ return true;
629
+ }
701
630
  return false;
631
+ });
632
+ if (isMoreQunjCountIndex !== -1) {
633
+ msg = i18next.t('第{{slot0}}行数据,您的群杰章用印次数远远超过合理次数范围,请修改。', { slot0: isMoreQunjCountIndex + 1 });
634
+ message.warning(msg);
635
+ return [2 /*return*/, Promise.reject(msg)];
702
636
  }
703
- var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
704
- if (!qunjSeal.contranctNum) {
705
- return true;
637
+ }
638
+ // 整体盖群杰章校验逻辑
639
+ if (!isSingleQj) {
640
+ isMoreQunjCount = countIsValidate(qunjSeal, false);
641
+ if (!isMoreQunjCount) {
642
+ msg = i18next.t('您的群杰章用印次数远远超过合理次数范围,请修改。');
643
+ message.warning(msg);
644
+ return [2 /*return*/, Promise.reject(msg)];
706
645
  }
707
- return false;
708
- });
709
- if (hasNoWritContranctNum !== -1) {
710
- msg = i18next.t('第{{slot0}}行数据,没有填写群杰章合同份数。', { slot0: hasNoWritContranctNum + 1 });
711
- message.warning(msg);
712
- return [2 /*return*/, Promise.reject(msg)];
713
646
  }
714
647
  }
715
- hasNoCheckedQjSeal = fileList.findIndex(function (file) {
716
- var _a, _b;
717
- var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
718
- // 如果没有勾选,不需要验证
719
- if (!isQunj) {
720
- return false;
721
- }
722
- var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
723
- if (!((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) ||
724
- ((_b = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _b === void 0 ? void 0 : _b.length) === 0) {
648
+ isCheckTakeOutNoAddress = function (data) {
649
+ if (data &&
650
+ data.qunjSeal &&
651
+ data.qunjSeal.isTakeOut + '' === '1' &&
652
+ (!data.qunjAddress || data.qunjAddress.length === 0)) {
725
653
  return true;
726
654
  }
727
655
  return false;
728
- });
729
- if (hasNoCheckedQjSeal !== -1) {
730
- msg = i18next.t('第{{slot0}}行数据,勾选了盖群杰章,但是没有选择群杰印章', { slot0: hasNoCheckedQjSeal + 1 });
731
- message.warning(msg);
732
- return [2 /*return*/, Promise.reject(msg)];
733
- }
734
- noNumSealName_1 = '';
735
- hasNoNumCheckedQjSeal = fileList.findIndex(function (file) {
736
- var _a;
737
- var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
738
- // 如果没有勾选,不需要验证
739
- if (!isQunj) {
740
- return false;
741
- }
742
- var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
743
- if (Array.isArray(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
744
- ((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
745
- var noNumItem = qunjSeal.details.find(function (item) { return !item.sealCount; });
746
- if (noNumItem) {
747
- noNumSealName_1 = noNumItem.sealName;
748
- return true;
656
+ };
657
+ if (isEdit && needQj) {
658
+ // 对于那种每个附件都需要选择群杰用印的逻辑
659
+ if (isSingleQj) {
660
+ isCheckTakeOutNoAddressIndex = fileList.findIndex(function (file) {
661
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
662
+ // 如果没有勾选,不需要验证
663
+ if (!isQunj) {
664
+ return false;
665
+ }
666
+ var isCheckTakeOutNoAddressResult = isCheckTakeOutNoAddress(file);
667
+ if (isCheckTakeOutNoAddressResult) {
668
+ return true;
669
+ }
670
+ return false;
671
+ });
672
+ if (isCheckTakeOutNoAddressIndex !== -1) {
673
+ msg = i18next.t('第{{slot0}}行数据,您的群杰章用选了外部用印,但是没有选择外部用印的地址!', { slot0: isCheckTakeOutNoAddressIndex + 1 });
674
+ message.warning(msg);
675
+ return [2 /*return*/, Promise.reject(msg)];
749
676
  }
750
677
  }
751
- return false;
752
- });
753
- if (hasNoNumCheckedQjSeal !== -1) {
754
- msg = i18next.t('第{{slot0}}行数据,请检查是否选了印章,但是没填用印次数的印章。如:{{noNumSealName}}', {
755
- slot0: hasNoNumCheckedQjSeal + 1,
756
- noNumSealName: noNumSealName_1,
757
- });
758
- message.warning(msg);
759
- return [2 /*return*/, Promise.reject(msg)];
760
- }
761
- }
762
- // 整体盖群杰章校验逻辑
763
- // 20250424 验证逻辑增加必须选择了群杰印章
764
- if (!isSingleQj &&
765
- qunjChecked &&
766
- (qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
767
- ((_j = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _j === void 0 ? void 0 : _j.length) > 0) {
768
- // 合同份数为空
769
- if (isContranctNum && !qunjSeal.contranctNum) {
770
- message.warning(i18next.t('请填写合同份数!'));
771
- return [2 /*return*/, Promise.reject(i18next.t('请填写合同份数!'))];
772
- }
773
- // 勾选了群杰印章 没有填用印次数
774
- if (((_k = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _k === void 0 ? void 0 : _k.length) > 0) {
775
- qunjSeal.details.forEach(function (item) {
776
- if (!item.sealCount) {
777
- message.warning(i18next.t('请填写{{slot0}} 的用印次数!', {
778
- slot0: item.sealName,
779
- }));
780
- }
781
- });
782
- if (qunjSeal.details.filter(function (item) { return !item.sealCount; }).length > 0) {
783
- return [2 /*return*/, Promise.reject(i18next.t('请填写用印次数!'))];
678
+ else if (isCheckTakeOutNoAddress(submitData)) {
679
+ msg = i18next.t('您的群杰印章选了外部用印,但是没有选择外部用印的地址!');
680
+ message.warning(msg);
681
+ return [2 /*return*/, Promise.reject(msg)];
784
682
  }
785
683
  }
786
- else {
787
- msg = i18next.t('请选择群杰用印!');
684
+ // 4. 没有确认盖章
685
+ if (isEdit &&
686
+ needQys &&
687
+ hasElectronicSeal &&
688
+ !contractId &&
689
+ !isOnlyQj) {
690
+ msg = i18next.t('请点击指定签署位置按钮,指定签署位置后方可提交!');
788
691
  message.warning(msg);
789
692
  return [2 /*return*/, Promise.reject(msg)];
790
693
  }
791
- }
792
- }
793
- // 5.1 校验契约锁印章中带有"必须共同使用"标识的印章(mustUseWithOthers + useWithSealIds)
794
- if (isEdit && needQys && electronicSealIdList.length > 0) {
795
- electronList = currentData.electronList || [];
796
- selectedSealIds_1 = new Set(electronicSealIdList.map(function (id) { return id + ''; }));
797
- for (_i = 0, electronList_1 = electronList; _i < electronList_1.length; _i++) {
798
- seal = electronList_1[_i];
799
- if (selectedSealIds_1.has(seal.sealId + '') &&
800
- seal.mustUseWithOthers &&
801
- seal.useWithSealIds) {
802
- requiredIds = seal.useWithSealIds
803
- .split(',')
804
- .map(function (id) { return id.trim(); })
805
- .filter(Boolean);
806
- hasMatch = requiredIds.some(function (id) {
807
- return selectedSealIds_1.has(id);
808
- });
809
- if (!hasMatch) {
810
- msg = i18next.t('当前所选的{{sealName}},要求必须和{{requiredSealNames}}其中之一一起使用,请重新勾选印章。', {
811
- sealName: seal.sealName,
812
- requiredSealNames: seal.useWithSealNames,
694
+ // 5. 合同份数验证
695
+ if (isEdit && needQj) {
696
+ // 单附件都需要选群杰章 校验逻辑
697
+ if (isSingleQj && hasQunj) {
698
+ // 合同份数校验
699
+ if (isContranctNum) {
700
+ hasNoWritContranctNum = fileList.findIndex(function (file) {
701
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
702
+ // 如果没有勾选,不需要验证
703
+ if (!isQunj) {
704
+ return false;
705
+ }
706
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
707
+ if (!qunjSeal.contranctNum) {
708
+ return true;
709
+ }
710
+ return false;
711
+ });
712
+ if (hasNoWritContranctNum !== -1) {
713
+ msg = i18next.t('第{{slot0}}行数据,没有填写群杰章合同份数。', { slot0: hasNoWritContranctNum + 1 });
714
+ message.warning(msg);
715
+ return [2 /*return*/, Promise.reject(msg)];
716
+ }
717
+ }
718
+ hasNoCheckedQjSeal = fileList.findIndex(function (file) {
719
+ var _a, _b;
720
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
721
+ // 如果没有勾选,不需要验证
722
+ if (!isQunj) {
723
+ return false;
724
+ }
725
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
726
+ if (!((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) ||
727
+ ((_b = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _b === void 0 ? void 0 : _b.length) === 0) {
728
+ return true;
729
+ }
730
+ return false;
813
731
  });
814
- message.warning(msg);
815
- return [2 /*return*/, Promise.reject(msg)];
816
- }
817
- }
818
- }
819
- }
820
- // 6. 调接口检测 是否存在未确认盖章位置的印章
821
- if (needQys &&
822
- isEdit &&
823
- hasElectronicSeal &&
824
- electronicSealIdList.length > 0) {
825
- setLoading({
826
- spinning: true,
827
- tip: i18next.t('服务器验证中...'),
828
- });
829
- // 调用接口
830
- return [2 /*return*/, getNoSealInfoList({
831
- contractId: contractId,
832
- sealIdList: electronicSealIdList,
833
- deptId: resetProps.deptId,
834
- secondDepId: resetProps.secondDepId,
835
- needYjzrr: docAttachMap.needYjzrr === 'true' ||
836
- docAttachMap.needYjzrr === true
837
- ? true
838
- : false,
839
- })
840
- .then(function (res) {
841
- setLoading({
842
- spinning: false,
843
- });
844
- if (res.length > 0) {
845
- currentUnSealListRef.current = res;
846
- modalHandleRef.current.setInfo(true, {
847
- unSealList: res,
732
+ if (hasNoCheckedQjSeal !== -1) {
733
+ msg = i18next.t('第{{slot0}}行数据,勾选了盖群杰章,但是没有选择群杰印章', { slot0: hasNoCheckedQjSeal + 1 });
734
+ message.warning(msg);
735
+ return [2 /*return*/, Promise.reject(msg)];
736
+ }
737
+ noNumSealName_1 = '';
738
+ hasNoNumCheckedQjSeal = fileList.findIndex(function (file) {
739
+ var _a;
740
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
741
+ // 如果没有勾选,不需要验证
742
+ if (!isQunj) {
743
+ return false;
744
+ }
745
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
746
+ if (Array.isArray(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
747
+ ((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
748
+ var noNumItem = qunjSeal.details.find(function (item) { return !item.sealCount; });
749
+ if (noNumItem) {
750
+ noNumSealName_1 = noNumItem.sealName;
751
+ return true;
752
+ }
753
+ }
754
+ return false;
848
755
  });
849
- return Promise.reject(i18next.t('还有印章未通过校验'));
756
+ if (hasNoNumCheckedQjSeal !== -1) {
757
+ msg = i18next.t('第{{slot0}}行数据,请检查是否选了印章,但是没填用印次数的印章。如:{{noNumSealName}}', {
758
+ slot0: hasNoNumCheckedQjSeal + 1,
759
+ noNumSealName: noNumSealName_1,
760
+ });
761
+ message.warning(msg);
762
+ return [2 /*return*/, Promise.reject(msg)];
763
+ }
850
764
  }
851
- else {
852
- return Promise.resolve(true);
765
+ // 整体盖群杰章校验逻辑
766
+ // 20250424 验证逻辑增加必须选择了群杰印章
767
+ if (!isSingleQj &&
768
+ qunjChecked &&
769
+ (qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
770
+ ((_j = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _j === void 0 ? void 0 : _j.length) > 0) {
771
+ // 合同份数为空
772
+ if (isContranctNum && !qunjSeal.contranctNum) {
773
+ message.warning(i18next.t('请填写合同份数!'));
774
+ return [2 /*return*/, Promise.reject(i18next.t('请填写合同份数!'))];
775
+ }
776
+ // 勾选了群杰印章 没有填用印次数
777
+ if (((_k = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _k === void 0 ? void 0 : _k.length) > 0) {
778
+ qunjSeal.details.forEach(function (item) {
779
+ if (!item.sealCount) {
780
+ message.warning(i18next.t('请填写{{slot0}} 的用印次数!', {
781
+ slot0: item.sealName,
782
+ }));
783
+ }
784
+ });
785
+ if (qunjSeal.details.filter(function (item) { return !item.sealCount; }).length > 0) {
786
+ return [2 /*return*/, Promise.reject(i18next.t('请填写用印次数!'))];
787
+ }
788
+ }
789
+ else {
790
+ msg = i18next.t('请选择群杰用印!');
791
+ message.warning(msg);
792
+ return [2 /*return*/, Promise.reject(msg)];
793
+ }
853
794
  }
854
- })
855
- .catch(function (err) {
795
+ }
796
+ if (!isEdit) return [3 /*break*/, 2];
797
+ qjSealNos_1 = new Set();
798
+ ((qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) || []).forEach(function (item) {
799
+ if (item === null || item === void 0 ? void 0 : item.sealNo) {
800
+ qjSealNos_1.add(item.sealNo + '');
801
+ }
802
+ });
803
+ (fileList || []).forEach(function (file) {
804
+ var _a;
805
+ var details = (_a = file === null || file === void 0 ? void 0 : file[qunjSealKey]) === null || _a === void 0 ? void 0 : _a.details;
806
+ (Array.isArray(details) ? details : []).forEach(function (item) {
807
+ if (item === null || item === void 0 ? void 0 : item.sealNo) {
808
+ qjSealNos_1.add(item.sealNo + '');
809
+ }
810
+ });
811
+ });
812
+ if (!(electronicSealIdList.length > 0 || qjSealNos_1.size > 0)) return [3 /*break*/, 2];
813
+ setLoading({
814
+ spinning: true,
815
+ tip: i18next.t('服务器验证中...'),
816
+ });
817
+ return [4 /*yield*/, checkSealCoUse({
818
+ request: request,
819
+ qysSealIds: electronicSealIdList,
820
+ qjSealNos: __spreadArray([], qjSealNos_1),
821
+ })];
822
+ case 1:
823
+ isCoUsePass = _l.sent();
824
+ setLoading({
825
+ spinning: false,
826
+ });
827
+ if (!isCoUsePass) {
828
+ return [2 /*return*/, Promise.reject(false)];
829
+ }
830
+ _l.label = 2;
831
+ case 2:
832
+ // 6. 调接口检测 是否存在未确认盖章位置的印章
833
+ if (needQys &&
834
+ isEdit &&
835
+ hasElectronicSeal &&
836
+ electronicSealIdList.length > 0) {
856
837
  setLoading({
857
- spinning: false,
838
+ spinning: true,
839
+ tip: i18next.t('服务器验证中...'),
858
840
  });
859
- return Promise.reject(err);
860
- })];
841
+ // 调用接口
842
+ return [2 /*return*/, getNoSealInfoList({
843
+ contractId: contractId,
844
+ sealIdList: electronicSealIdList,
845
+ deptId: resetProps.deptId,
846
+ secondDepId: resetProps.secondDepId,
847
+ needYjzrr: docAttachMap.needYjzrr === 'true' ||
848
+ docAttachMap.needYjzrr === true
849
+ ? true
850
+ : false,
851
+ })
852
+ .then(function (res) {
853
+ setLoading({
854
+ spinning: false,
855
+ });
856
+ if (res.length > 0) {
857
+ currentUnSealListRef.current = res;
858
+ modalHandleRef.current.setInfo(true, {
859
+ unSealList: res,
860
+ });
861
+ return Promise.reject(i18next.t('还有印章未通过校验'));
862
+ }
863
+ else {
864
+ return Promise.resolve(true);
865
+ }
866
+ })
867
+ .catch(function (err) {
868
+ setLoading({
869
+ spinning: false,
870
+ });
871
+ return Promise.reject(err);
872
+ })];
873
+ }
874
+ return [2 /*return*/, Promise.resolve(true)];
861
875
  }
862
- return [2 /*return*/, Promise.resolve(true)];
863
876
  });
864
877
  }); },
865
878
  /** 切换部门时,应该清空电子印章相关数据 */