zmdms-webui 3.1.8 → 3.2.0

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 (71) hide show
  1. package/dist/es/applayoutsider/menu/MainMenu.js +1 -1
  2. package/dist/es/applayoutsider/menu/SubMenu.js +8 -1
  3. package/dist/es/canvastable/canvasTable.js +1 -0
  4. package/dist/es/config/MyStorage.js +11 -5
  5. package/dist/es/config/ZtxkContext.d.ts +10 -0
  6. package/dist/es/config/ZtxkContext.js +2 -0
  7. package/dist/es/config/index.js +1 -0
  8. package/dist/es/config/utils.js +58 -1
  9. package/dist/es/dynamicsetting/dynamicDrawer.js +61 -19
  10. package/dist/es/dynamicsetting/dynamicSetting.js +4 -4
  11. package/dist/es/dynamicsetting/hooks.js +4 -4
  12. package/dist/es/dynamicsetting/index.css +1 -1
  13. package/dist/es/dynamicsetting/index.js +1 -0
  14. package/dist/es/dynamicsetting/interface.d.ts +5 -0
  15. package/dist/es/dynamicsetting/useDynamic.js +5 -1
  16. package/dist/es/dynamicsetting/useSearch.js +26 -6
  17. package/dist/es/dynamicsetting/useTemplate.d.ts +4 -0
  18. package/dist/es/dynamicsetting/useTemplate.js +428 -0
  19. package/dist/es/electronsignatures/content.js +974 -0
  20. package/dist/es/electronsignatures/dgcomponents/contract-comparison.js +2 -2
  21. package/dist/es/electronsignatures/dgcomponents/file-comparison-btn.js +136 -0
  22. package/dist/es/electronsignatures/dgcomponents/new-contract-comparison.js +54 -0
  23. package/dist/es/electronsignatures/dgcomponents/useContractColumns.js +110 -39
  24. package/dist/es/electronsignatures/electron-signatures-fragment.js +11 -3
  25. package/dist/es/electronsignatures/electroncomponents/electron-seal-batch-download.js +179 -67
  26. package/dist/es/electronsignatures/electroncomponents/electron-seal-detail.js +5 -5
  27. package/dist/es/electronsignatures/electroncomponents/electron-seal-item-detail.js +15 -0
  28. package/dist/es/electronsignatures/electroncomponents/electron-seal-item.js +9 -6
  29. package/dist/es/electronsignatures/electroncomponents/useElectronColumns.js +330 -154
  30. package/dist/es/electronsignatures/electroncomponents/useFetchElectronData.js +60 -10
  31. package/dist/es/electronsignatures/electroncomponents/utils.js +119 -28
  32. package/dist/es/electronsignatures/filecomponents/file-operation.js +6 -4
  33. package/dist/es/electronsignatures/filecomponents/new-file-operation.js +56 -0
  34. package/dist/es/electronsignatures/filecomponents/useFileColumns.js +179 -102
  35. package/dist/es/electronsignatures/hooks/useGetQjVerifyCode.js +134 -0
  36. package/dist/es/electronsignatures/hooks/useMergeRecords.js +4 -3
  37. package/dist/es/electronsignatures/hooks/useParseElectronSetting.js +5 -3
  38. package/dist/es/electronsignatures/hooks/useParseIsNeedElectronData.js +21 -2
  39. package/dist/es/electronsignatures/hooks/useParseQunjSingleData.js +6 -1
  40. package/dist/es/electronsignatures/hooks/useParseRecords.js +41 -34
  41. package/dist/es/electronsignatures/index.css +1 -1
  42. package/dist/es/electronsignatures/index.js +18 -833
  43. package/dist/es/electronsignatures/interface.d.ts +129 -5
  44. package/dist/es/electronsignatures/interface.js +9 -4
  45. package/dist/es/electronsignatures/qunjcomponents/qunj-check.js +2 -2
  46. package/dist/es/electronsignatures/qunjcomponents/qunj-detail.js +135 -14
  47. package/dist/es/electronsignatures/qunjcomponents/qunj-list.js +33 -13
  48. package/dist/es/electronsignatures/qunjcomponents/useFetchQunjData.js +8 -3
  49. package/dist/es/electronsignatures/qunjcomponents/useQunjColumns.js +202 -202
  50. package/dist/es/electronsignatures/translatecomponents/TranslateButton.js +27 -0
  51. package/dist/es/electronsignatures/translatecomponents/useTranslateCom.js +35 -0
  52. package/dist/es/form/common-search-list.js +28 -9
  53. package/dist/es/form/form.js +13 -11
  54. package/dist/es/form/useCommonSearch.js +3 -4
  55. package/dist/es/table/components/EnhanceBodyBasicCell.js +9 -0
  56. package/dist/es/table/components/useDragRef.js +6 -0
  57. package/dist/es/table/constant.js +4 -1
  58. package/dist/es/table/hooks/useCtrl.js +44 -0
  59. package/dist/es/table/hooks/useSelectSubtotal.js +376 -0
  60. package/dist/es/table/index.css +1 -1
  61. package/dist/es/table/interface.d.ts +2 -0
  62. package/dist/es/table/table.js +14 -2
  63. package/dist/index.build.d.ts +1 -0
  64. package/dist/index.dark.css +1 -1
  65. package/dist/index.default.css +1 -1
  66. package/dist/index.es.js +1 -0
  67. package/dist/less/components/DynamicSetting/style/index.less +38 -0
  68. package/dist/less/components/ElectronSignatures/style/index.less +37 -5
  69. package/dist/less/components/Table/style/index.less +32 -0
  70. package/package.json +2 -2
  71. package/dist/es/electronsignatures/electroncomponents/electron-seal-download.js +0 -74
@@ -0,0 +1,974 @@
1
+ import { __rest, __assign, __spreadArray, __awaiter, __generator } from '../_virtual/_tslib.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { createContext, memo, useRef, useMemo, useState, useEffect, useImperativeHandle } from 'react';
4
+ import { Button, Table } from 'antd';
5
+ import '../config/ZtxkContext.js';
6
+ import useBaseContext from '../config/useBaseContext.js';
7
+ import '../config/MyStorage.js';
8
+ import ElectronSignaturesFragment from './electron-signatures-fragment.js';
9
+ import { useMemoizedFn } from 'ahooks';
10
+ import useMergeRecords from './hooks/useMergeRecords.js';
11
+ import useFileTypeColumns from './filecomponents/useFileTypeColumns.js';
12
+ import useFileColumns from './filecomponents/useFileColumns.js';
13
+ import useElectronColumns from './electroncomponents/useElectronColumns.js';
14
+ import ElectronSealBatchDownload from './electroncomponents/electron-seal-batch-download.js';
15
+ import useCheckedSealInfoList from './electroncomponents/useCheckedSealInfoList.js';
16
+ import LastQysModal from './electroncomponents/last-qys-modal.js';
17
+ import useQunjColumns from './qunjcomponents/useQunjColumns.js';
18
+ import useContractColumns from './dgcomponents/useContractColumns.js';
19
+ import useDg from './dgcomponents/useDg.js';
20
+ import FileComparisonBtn from './dgcomponents/file-comparison-btn.js';
21
+ import useTranslateCom from './translatecomponents/useTranslateCom.js';
22
+ import { currentRecordIsOnlyQunj, FLOW_IDS } from './utils.js';
23
+ import { countIsValidate } from './hooks/useParseQunjListData.js';
24
+ import FileUpload from './filecomponents/file-upload.js';
25
+ import { DATA_TYPE_KEY } from './hooks/useParseRecords.js';
26
+ import useCheckedSealInfoList$1 from './electroncomponents/useGetDeptInfo.js';
27
+ import dayjs from 'dayjs';
28
+ import isEqual from 'lodash/isEqual';
29
+ import useGetQjVerifyCode from './hooks/useGetQjVerifyCode.js';
30
+ import myMessage from '../message/index.js';
31
+ import ModalComponent from '../modal/modal.js';
32
+
33
+ var ElectronSignaturesContext = createContext({
34
+ isNewQys: true,
35
+ isQjVerifyCode: true,
36
+ });
37
+ /**
38
+ * 一开始这个组件想设计成 可以传入多中类型的数据 但是发现这种做法会有很多问题
39
+ * 不同的数据类型 共享一个表头 那么其实这样就做不到隐藏某些表头的效果
40
+ */
41
+ var ElectronSignatures = function (props) {
42
+ var _a, _b, _c;
43
+ var request = props.request, isTranslation = props.isTranslation, previewUrl = props.previewUrl, _d = props.isUnControlled, isUnControlled = _d === void 0 ? true : _d, _e = props.contractNumFlowIds, contractNumFlowIds = _e === void 0 ? FLOW_IDS : _e, fileUploadProps = props.fileUploadProps, isShowFileUpload = props.isShowFileUpload, isShowFileUploadIndependence = props.isShowFileUploadIndependence, otherOptions = props.otherOptions, _fileBaseUrl = props.fileBaseUrl, _apiBaseUrl = props.apiBaseUrl, electronHandleRef = props.electronHandleRef, _onValueChange = props.onValueChange, isValidateSuccess = props.isValidateSuccess, refreshCode = props.refreshCode, onCheckedComparison = props.onCheckedComparison, _onFileTypeChangeGetItem = props.onFileTypeChangeGetItem, tableScroll = props.tableScroll, _getCreateTimeHand = props.getCreateTimeHand, isShowElectronBatchBtn = props.isShowElectronBatchBtn, isShowDownloadBatchBtn = props.isShowDownloadBatchBtn, isShowBatchDeleteBtn = props.isShowBatchDeleteBtn, isShowBatchDeleteBtnIndependence = props.isShowBatchDeleteBtnIndependence, beforeBatchDelete = props.beforeBatchDelete, isShowBatchPreviewBtn = props.isShowBatchPreviewBtn, isShowFileComparisonBtn = props.isShowFileComparisonBtn, batchDownloadZipName = props.batchDownloadZipName, isShowDoubleSignedBatchBtn = props.isShowDoubleSignedBatchBtn, _f = props.isShowFileType, isShowFileType = _f === void 0 ? true : _f, _g = props.isShowFileTypeMerge, isShowFileTypeMerge = _g === void 0 ? true : _g,
44
+ // fmsIsElectronicSealLabel = '产业链综合服务平台-客户电子签章',
45
+ _h = props.fmsIsElectronicSealLabel,
46
+ // fmsIsElectronicSealLabel = '产业链综合服务平台-客户电子签章',
47
+ fmsIsElectronicSealLabel = _h === void 0 ? "加盖产融章" : _h,
48
+ // fmsIsElectronicSealPushLabel = '推送银行',
49
+ _j = props.fmsIsElectronicSealPushLabel,
50
+ // fmsIsElectronicSealPushLabel = '推送银行',
51
+ fmsIsElectronicSealPushLabel = _j === void 0 ? "加盖银行签章" : _j, _k = props.openingContractSealLabel, openingContractSealLabel = _k === void 0 ? "盖光盈电子章" : _k, isSingleQj = props.isSingleQj, _l = props.isQjUseModal, isQjUseModal = _l === void 0 ? true : _l, defaultJustNeedQj = props.defaultJustNeedQj, isDeleteAllFileWhenJustUseQj = props.isDeleteAllFileWhenJustUseQj, _m = props.isShowQysWhenNeedNotQys, isShowQysWhenNeedNotQys = _m === void 0 ? true : _m, _o = props.isControlNeedQys, isControlNeedQys = _o === void 0 ? true : _o, isDeletePlaceholderFileData = props.isDeletePlaceholderFileData, isSupportNoAttachQj = props.isSupportNoAttachQj, caseId = props.caseId, _p = props.isChoiseChangeTemplateValid, isChoiseChangeTemplateValid = _p === void 0 ? true : _p, _q = props.isToggleQys, isToggleQys = _q === void 0 ? false : _q, _r = props.isQjVerifyCode, isQjVerifyCode = _r === void 0 ? false : _r, _s = props.isNewQys, isNewQys = _s === void 0 ? false : _s, _t = props.isShowBatchUseElectronicSealBtn, isShowBatchUseElectronicSealBtn = _t === void 0 ? true : _t, isShowBatchUseOpeningContractSealBtn = props.isShowBatchUseOpeningContractSealBtn, isShowOpeningContractSeal = props.isShowOpeningContractSeal, customButtons = props.customButtons, goWorkflowSeal = props.goWorkflowSeal, isShowSealApply = props.isShowSealApply, otherColumns = props.otherColumns, isShowOpeningContractSealNotRelyQys = props.isShowOpeningContractSealNotRelyQys, isNoWatermarkProcess = props.isNoWatermarkProcess, qunjListRenderFilter = props.qunjListRenderFilter, resetProps = __rest(props, ["request", "isTranslation", "previewUrl", "isUnControlled", "contractNumFlowIds", "fileUploadProps", "isShowFileUpload", "isShowFileUploadIndependence", "otherOptions", "fileBaseUrl", "apiBaseUrl", "electronHandleRef", "onValueChange", "isValidateSuccess", "refreshCode", "onCheckedComparison", "onFileTypeChangeGetItem", "tableScroll", "getCreateTimeHand", "isShowElectronBatchBtn", "isShowDownloadBatchBtn", "isShowBatchDeleteBtn", "isShowBatchDeleteBtnIndependence", "beforeBatchDelete", "isShowBatchPreviewBtn", "isShowFileComparisonBtn", "batchDownloadZipName", "isShowDoubleSignedBatchBtn", "isShowFileType", "isShowFileTypeMerge", "fmsIsElectronicSealLabel", "fmsIsElectronicSealPushLabel", "openingContractSealLabel", "isSingleQj", "isQjUseModal", "defaultJustNeedQj", "isDeleteAllFileWhenJustUseQj", "isShowQysWhenNeedNotQys", "isControlNeedQys", "isDeletePlaceholderFileData", "isSupportNoAttachQj", "caseId", "isChoiseChangeTemplateValid", "isToggleQys", "isQjVerifyCode", "isNewQys", "isShowBatchUseElectronicSealBtn", "isShowBatchUseOpeningContractSealBtn", "isShowOpeningContractSeal", "customButtons", "goWorkflowSeal", "isShowSealApply", "otherColumns", "isShowOpeningContractSealNotRelyQys", "isNoWatermarkProcess", "qunjListRenderFilter"]);
52
+ var selectRows = useRef(null);
53
+ var onValueChange = useMemoizedFn(function (info) {
54
+ _onValueChange && _onValueChange(info);
55
+ });
56
+ var onFileTypeChangeGetItem = useMemoizedFn(function (info) {
57
+ if (_onFileTypeChangeGetItem) {
58
+ return _onFileTypeChangeGetItem(info);
59
+ }
60
+ return __assign(__assign({}, info), { templateAttachId: undefined, templateAttachName: undefined, taskId: undefined });
61
+ });
62
+ var getCreateTimeHand = useMemoizedFn(function (record) {
63
+ // 这里方法有点问题做了下替换。后续看是否有问题
64
+ if (_getCreateTimeHand) {
65
+ return _getCreateTimeHand(record);
66
+ }
67
+ return record.createTime;
68
+ });
69
+ // 验证契约锁是否全部盖章
70
+ var getNoSealInfoList = useCheckedSealInfoList(request).getNoSealInfoList;
71
+ // 获得部门信息
72
+ var getDeptInfo = useCheckedSealInfoList$1(request).getDeptInfo;
73
+ // 达观操作
74
+ var _u = useDg(request), compareHandle = _u.compareHandle, lookCompareHandle = _u.lookCompareHandle;
75
+ // 存储当前点击的选择比对模板的一些参数
76
+ var dgInfoRef = useRef({});
77
+ var myCompareHandle = useMemoizedFn(function (templateId) {
78
+ return new Promise(function (resolve, reject) {
79
+ var _a = dgInfoRef.current, realIndex = _a.realIndex, attachId = _a.attachId, setRecords = _a.setRecords;
80
+ if (templateId && attachId) {
81
+ compareHandle(templateId, attachId)
82
+ .then(function (res) {
83
+ var _a, _b, _c;
84
+ if ((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.taskId) {
85
+ setRecords(function (preRecords) {
86
+ var _a;
87
+ var copyRecords = preRecords.slice();
88
+ var item = copyRecords[realIndex];
89
+ copyRecords.splice(realIndex, 1, __assign(__assign({}, item), { taskId: (_a = res.data.data) === null || _a === void 0 ? void 0 : _a.taskId }));
90
+ return copyRecords;
91
+ });
92
+ resolve((_c = res.data.data) === null || _c === void 0 ? void 0 : _c.taskId);
93
+ }
94
+ else {
95
+ reject("调用合同比对接口失败");
96
+ }
97
+ })
98
+ .catch(function (err) {
99
+ reject(err || "调用合同比对接口失败");
100
+ });
101
+ }
102
+ });
103
+ });
104
+ // 基础地址
105
+ var _v = useBaseContext(), API_BASE_URL = _v.apiBaseUrl, FILE_BASE_URL = _v.fileBaseUrl;
106
+ var apiBaseUrl = _apiBaseUrl || API_BASE_URL;
107
+ var fileBaseUrl = _fileBaseUrl || FILE_BASE_URL;
108
+ // 将配置分级处理
109
+ var allOptions = [];
110
+ // 有些流程可能会没有部门id,只有二级单元id。把他们两个作为一个或条件
111
+ // 对于那些没有传入部门数据和流程数据的参数统统干掉
112
+ // 这样会导致一个bug。那就是首次加载的时候,可能没有数据。但是后续又通过接口拿到了数据。
113
+ // 这里之前是不会有部门、流程的限制的。是因为用印流程他实际也是用了多个类型的附件,但是实际上
114
+ // 他不会有多个类型的附件。会导致多一个空行出来
115
+ if (Array.isArray(otherOptions)) {
116
+ var newOtherOptions = otherOptions.filter(function (item) {
117
+ return (item.deptId || item.secondDepId) && item.flowId ? true : false;
118
+ });
119
+ allOptions = __spreadArray([resetProps], newOtherOptions, true);
120
+ }
121
+ else if (otherOptions &&
122
+ ((otherOptions === null || otherOptions === void 0 ? void 0 : otherOptions.deptId) || (otherOptions === null || otherOptions === void 0 ? void 0 : otherOptions.secondDepId)) &&
123
+ (otherOptions === null || otherOptions === void 0 ? void 0 : otherOptions.flowId)) {
124
+ allOptions = [resetProps, otherOptions];
125
+ }
126
+ else {
127
+ allOptions = [resetProps];
128
+ }
129
+ // 根据收集到的流程id、权限人id列表,来判断是否请求群杰验证码数据
130
+ var _w = useGetQjVerifyCode({
131
+ allOptions: allOptions,
132
+ request: request,
133
+ isNewQys: isNewQys,
134
+ }), qjVerifyCodeData = _w.qjVerifyCodeData, getQjVerifyCodeHandle = _w.getQjVerifyCodeHandle;
135
+ /**
136
+ * 当前是否是编辑状态
137
+ */
138
+ var currentIsEditMemo = useMemo(function () {
139
+ return ((resetProps === null || resetProps === void 0 ? void 0 : resetProps.canEdit) + "" === "1" || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.canEdit) === true);
140
+ }, [resetProps.canEdit]);
141
+ // 表格是否处于loading中
142
+ var _x = useState(), loading = _x[0], setLoading = _x[1];
143
+ // 当前是否处于仅需要群杰印章的状态
144
+ var _y = useState(defaultJustNeedQj || false), justNeedQj = _y[0], setJustNeedQj = _y[1];
145
+ var _z = useState(""), organizationId = _z[0], setOrganizationId = _z[1];
146
+ /**
147
+ * 通过部门Id获得公司id
148
+ */
149
+ useEffect(function () {
150
+ var _deptId = resetProps.deptId;
151
+ // HR流程是行政组织,没有公司这一个概念
152
+ if (_deptId && !isNoWatermarkProcess) {
153
+ // 调用接口
154
+ getDeptInfo({
155
+ id: _deptId,
156
+ }).then(function (res) {
157
+ setOrganizationId((res === null || res === void 0 ? void 0 : res.companyId) || "");
158
+ });
159
+ }
160
+ // eslint-disable-next-line react-hooks/exhaustive-deps
161
+ }, [resetProps.deptId, isNoWatermarkProcess]);
162
+ useEffect(function () {
163
+ setJustNeedQj(defaultJustNeedQj || false);
164
+ }, [defaultJustNeedQj]);
165
+ // 记录下传入配置的顺序
166
+ // 这里做一下改造,将dataTypeSort作为一个动态变化的值来控制
167
+ var dataTypeString = (_c = (_b = (_a = allOptions === null || allOptions === void 0 ? void 0 : allOptions.map) === null || _a === void 0 ? void 0 : _a.call(allOptions, function (option, index) {
168
+ var dataType = option.dataType;
169
+ return dataType || "".concat(index);
170
+ })) === null || _b === void 0 ? void 0 : _b.join) === null || _c === void 0 ? void 0 : _c.call(_b, ",");
171
+ var dataTypeSort = useMemo(function () {
172
+ return allOptions.map(function (option, index) {
173
+ var dataType = option.dataType;
174
+ return dataType || "".concat(index);
175
+ });
176
+ // eslint-disable-next-line react-hooks/exhaustive-deps
177
+ }, [dataTypeString]);
178
+ // const [dataTypeSort] = useState<string[]>(() => {
179
+ // return allOptions.map((option, index) => {
180
+ // const { dataType } = option;
181
+ // return dataType || `${index}`;
182
+ // });
183
+ // });
184
+ // 第一份数据的数据类型
185
+ var firstDataType = resetProps.dataType || dataTypeSort[0];
186
+ // 记录下需要处理的所有数据
187
+ // TODO: 定义allData 类型
188
+ var _0 = useState({}), allData = _0[0], setAllData = _0[1];
189
+ // 收集修改数据
190
+ var onTrackChange = useMemoizedFn(function (dataType, data) {
191
+ setAllData(function (preAllData) {
192
+ var _a, _b;
193
+ if (preAllData[dataType]) {
194
+ var changeData = preAllData[dataType];
195
+ return __assign(__assign({}, preAllData), (_a = {}, _a[dataType] = __assign(__assign({}, changeData), data), _a));
196
+ }
197
+ return __assign(__assign({}, preAllData), (_b = {}, _b[dataType] = data, _b));
198
+ });
199
+ });
200
+ // 合并数据(数据最终还是要在一个表格中显示)
201
+ var _1 = useMergeRecords({
202
+ allData: allData,
203
+ dataTypeSort: dataTypeSort,
204
+ isDeleteAllFileWhenJustUseQj: isDeleteAllFileWhenJustUseQj,
205
+ isDeletePlaceholderFileData: isDeletePlaceholderFileData,
206
+ isSupportNoAttachQj: isSupportNoAttachQj,
207
+ }), mergeRecords = _1.mergeRecords, isHiddenColumns = _1.isHiddenColumns;
208
+ // 附件归属
209
+ var fileTypeColumns = useFileTypeColumns({
210
+ records: mergeRecords,
211
+ dataTypeSort: dataTypeSort,
212
+ allData: allData,
213
+ fileUploadProps: fileUploadProps,
214
+ isShowFileUpload: isShowFileUpload,
215
+ apiBaseUrl: apiBaseUrl,
216
+ }).fileTypeColumns;
217
+ // 是否需要显示达观配置
218
+ var isNeedDg = allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (item) { return item.needDg + "" === "1"; });
219
+ // 附件相关
220
+ var fileColumns = useFileColumns({
221
+ records: mergeRecords,
222
+ dataTypeSort: dataTypeSort,
223
+ allData: allData,
224
+ fileUploadProps: fileUploadProps,
225
+ isShowFileUpload: isShowFileUpload,
226
+ apiBaseUrl: apiBaseUrl,
227
+ fileBaseUrl: fileBaseUrl,
228
+ firstDataType: firstDataType,
229
+ onValueChange: onValueChange,
230
+ onFileTypeChangeGetItem: onFileTypeChangeGetItem,
231
+ getCreateTimeHand: getCreateTimeHand,
232
+ isSingleQj: isSingleQj,
233
+ justNeedQj: justNeedQj,
234
+ setJustNeedQj: setJustNeedQj,
235
+ isShowFileType: isShowFileType,
236
+ currentIsEditMemo: currentIsEditMemo,
237
+ isDeleteAllFileWhenJustUseQj: isDeleteAllFileWhenJustUseQj,
238
+ isControlNeedQys: isControlNeedQys,
239
+ organizationId: organizationId,
240
+ onFileReplace: onFileReplace,
241
+ isToggleQys: isToggleQys,
242
+ previewUrl: previewUrl,
243
+ request: request,
244
+ isTranslation: isTranslation,
245
+ isNeedDg: !!isNeedDg,
246
+ }).fileColumns;
247
+ // 智能合同比对
248
+ var contractColumns = useContractColumns({
249
+ records: mergeRecords,
250
+ dataTypeSort: dataTypeSort,
251
+ allData: allData,
252
+ lookCompareHandle: lookCompareHandle,
253
+ dgInfoRef: dgInfoRef,
254
+ myCompareHandle: myCompareHandle,
255
+ onCheckedComparison: onCheckedComparison,
256
+ request: request,
257
+ previewUrl: previewUrl,
258
+ isTranslation: isTranslation,
259
+ }).contractColumns;
260
+ // 生成电子印章列数据
261
+ var electronColumns = useElectronColumns({
262
+ request: request,
263
+ records: mergeRecords,
264
+ dataTypeSort: dataTypeSort,
265
+ allData: allData,
266
+ setLoading: setLoading,
267
+ fmsIsElectronicSealLabel: fmsIsElectronicSealLabel,
268
+ fmsIsElectronicSealPushLabel: fmsIsElectronicSealPushLabel,
269
+ openingContractSealLabel: openingContractSealLabel,
270
+ isDeleteAllFileWhenJustUseQj: isDeleteAllFileWhenJustUseQj,
271
+ isShowOpeningContractSeal: isShowOpeningContractSeal,
272
+ isShowOpeningContractSealNotRelyQys: isShowOpeningContractSealNotRelyQys,
273
+ }).electronColumns;
274
+ // 生成群杰物理章列数据
275
+ var qunjColumns = useQunjColumns({
276
+ request: request,
277
+ records: mergeRecords,
278
+ dataTypeSort: dataTypeSort,
279
+ allData: allData,
280
+ setLoading: setLoading,
281
+ contractNumFlowIds: contractNumFlowIds,
282
+ refreshCode: refreshCode,
283
+ isSingleQj: isSingleQj,
284
+ isQjUseModal: isQjUseModal,
285
+ apiBaseUrl: apiBaseUrl,
286
+ caseId: caseId,
287
+ qjVerifyCodeData: qjVerifyCodeData,
288
+ getQjVerifyCodeHandle: getQjVerifyCodeHandle,
289
+ isShowSealApply: isShowSealApply,
290
+ goWorkflowSeal: goWorkflowSeal,
291
+ qunjListRenderFilter: qunjListRenderFilter,
292
+ }).qunjColumns;
293
+ // 翻译组件
294
+ var translateColumns = useTranslateCom({
295
+ request: request,
296
+ records: mergeRecords,
297
+ dataTypeSort: dataTypeSort,
298
+ allData: allData,
299
+ isTranslation: isTranslation,
300
+ previewUrl: previewUrl,
301
+ }).translateColumns;
302
+ // 组装columns
303
+ var columns = [
304
+ {
305
+ title: "序号",
306
+ dataIndex: "index",
307
+ key: "index",
308
+ width: 50,
309
+ align: "center",
310
+ render: function (text, record, index) { return "".concat(index + 1); },
311
+ },
312
+ ];
313
+ // 附件归属类型
314
+ if (isShowFileTypeMerge) {
315
+ columns.push.apply(columns, fileTypeColumns);
316
+ }
317
+ // 附件相关操作
318
+ columns.push.apply(columns, fileColumns);
319
+ // 其他配置
320
+ if (otherColumns) {
321
+ columns.push.apply(columns, otherColumns);
322
+ }
323
+ // 智能合同比对 如果不需要达观 那么肯定不显示
324
+ // 如果设置了 仅需要群杰印章 并且另外一个没有附件
325
+ if (isNeedDg && !isHiddenColumns) {
326
+ columns.push.apply(columns, contractColumns);
327
+ }
328
+ else if (isTranslation) {
329
+ columns.push.apply(columns, translateColumns);
330
+ }
331
+ // 是否需要电子印章配置
332
+ var isNeedQys = allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (item) { return item.needQys + "" === "1"; });
333
+ // 是否有选盖章的附件
334
+ var isShowQys = allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (item) { var _a, _b; return (_b = (_a = item.fileList) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, function (file) { return (file === null || file === void 0 ? void 0 : file.isElectronicSeal) + "" === "1"; }); });
335
+ // 电子印章
336
+ if ((isNeedQys && !isHiddenColumns) || isShowQysWhenNeedNotQys) {
337
+ // 非编辑状态 并且没有印章
338
+ if (allOptions[0].canEdit + "" === "1") {
339
+ columns.push.apply(columns, electronColumns);
340
+ }
341
+ else if (isShowQys) {
342
+ columns.push.apply(columns, electronColumns);
343
+ }
344
+ else if (isShowQysWhenNeedNotQys) {
345
+ columns.push.apply(columns, electronColumns);
346
+ }
347
+ }
348
+ // 是否需要群杰印章配置
349
+ var isNeedQj = allOptions === null || allOptions === void 0 ? void 0 : allOptions.find(function (item) { return item.needQj + "" === "1"; });
350
+ // 群杰印章
351
+ if (isNeedQj) {
352
+ columns.push.apply(columns, qunjColumns);
353
+ }
354
+ var getAllData = useMemoizedFn(function () {
355
+ var resultData = {};
356
+ Object.keys(allData).forEach(function (key) {
357
+ var _a, _b, _c, _d;
358
+ var data = allData[key];
359
+ var records = data.records || [];
360
+ // 是否 过滤掉无用的附件数据 20241014
361
+ var newRecords = isDeletePlaceholderFileData
362
+ ? records.filter(function (record) { return !currentRecordIsOnlyQunj(record); })
363
+ : records.slice();
364
+ resultData[key] = {
365
+ fileList: newRecords,
366
+ qunjSeal: data.currentQunjSeal,
367
+ electronicSealIdList: data.currentCheckedElectronicSealIdList,
368
+ docAttachMap: data.currentDocAttachMap,
369
+ documentIdList: data.currentDocumentIdList,
370
+ contractId: data.currentContractId,
371
+ /** 用印次数是否合理 */
372
+ isTotalSealNumTooMore: countIsValidate(data.currentQunjSeal, false),
373
+ /** 群杰盖章地点 */
374
+ qunjAddress:
375
+ // 选了章子
376
+ ((_a = data.currentQunjSeal) === null || _a === void 0 ? void 0 : _a.details) &&
377
+ ((_c = (_b = data.currentQunjSeal) === null || _b === void 0 ? void 0 : _b.details) === null || _c === void 0 ? void 0 : _c.length) > 0 &&
378
+ // 并且是外部用印
379
+ ((_d = data.currentQunjSeal) === null || _d === void 0 ? void 0 : _d.isTakeOut) + "" === "1"
380
+ ? data.currentQunjAddress
381
+ : null,
382
+ needQys: data.needQys ? 1 : 0,
383
+ };
384
+ });
385
+ return resultData;
386
+ });
387
+ var modalHandleRef = useRef({});
388
+ // 当前未盖章的印章
389
+ var currentUnSealListRef = useRef({});
390
+ var isClickElectronSureRef = useRef(false);
391
+ useImperativeHandle(electronHandleRef, function () {
392
+ return {
393
+ /** 外部调用此方法时,需要传入合同模板ID */
394
+ compareHandle: myCompareHandle,
395
+ /** 获取所有数据 */
396
+ getAllData: function () {
397
+ return getAllData();
398
+ },
399
+ /** 验证组件是否通过校验 */
400
+ validateElectronTable: function (validateInfo) { return __awaiter(void 0, void 0, void 0, function () {
401
+ 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;
402
+ var _d, _e, _f, _g, _h, _j, _k;
403
+ return __generator(this, function (_l) {
404
+ validateAttachType = (validateInfo || {}).validateAttachType;
405
+ resultData = getAllData();
406
+ submitData = resultData[firstDataType];
407
+ currentData = allData[firstDataType];
408
+ _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;
409
+ fileList = submitData.fileList;
410
+ hasElectronicSeal = fileList === null || fileList === void 0 ? void 0 : fileList.some(function (item) { return !!item.isElectronicSeal; });
411
+ 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; });
412
+ hasQunj = fileList === null || fileList === void 0 ? void 0 : fileList.some(function (item) { return !!(item === null || item === void 0 ? void 0 : item[isQunjKey]); });
413
+ electronicSealIdList = submitData.electronicSealIdList || [];
414
+ docAttachMap = {};
415
+ try {
416
+ docAttachMap = submitData.docAttachMap
417
+ ? JSON.parse(submitData.docAttachMap)
418
+ : {};
419
+ }
420
+ catch (err) {
421
+ console.log("解析数据失败!!!!!");
422
+ }
423
+ qunjSeal = submitData.qunjSeal;
424
+ contractId = submitData.contractId;
425
+ isContranctNum = currentData.isContranctNum;
426
+ isEdit = currentData.isEdit;
427
+ needDg = currentData.needDg;
428
+ needQys = currentData.needQys;
429
+ needQj = currentData.needQj;
430
+ preElectronicSealIdList = currentData === null || currentData === void 0 ? void 0 : currentData.clickElectronicSealIdList;
431
+ qunjChecked = currentData.qunjChecked;
432
+ isOnlyQj = fileList.length === 0;
433
+ // 0. 智能合同比对相关验证
434
+ if (isEdit && needDg) {
435
+ if (isChoiseChangeTemplateValid) {
436
+ isValidateAttachTypeIndex = fileList.findIndex(function (item) {
437
+ return (item.attachId &&
438
+ !item.templateAttachId &&
439
+ (validateAttachType
440
+ ? validateAttachType(item)
441
+ : item.attachType === "001"));
442
+ });
443
+ if (isValidateAttachTypeIndex !== -1) {
444
+ msg = "\u7B2C ".concat(isValidateAttachTypeIndex + 1, " \u884C\u6570\u636E\uFF0C\u9644\u4EF6\u7C7B\u578B\u4E3A\u5408\u540C\u672C\u8EAB\uFF0C\u9700\u8981\u6311\u9009\u6BD4\u5BF9\u6A21\u677F\uFF01");
445
+ myMessage.warning(msg);
446
+ return [2 /*return*/, Promise.reject(msg)];
447
+ }
448
+ }
449
+ isValidateDgIndex = fileList.findIndex(function (item) {
450
+ return (item.attachId &&
451
+ item.templateAttachId &&
452
+ !item.taskId &&
453
+ (validateAttachType
454
+ ? validateAttachType(item)
455
+ : item.attachType === "001"));
456
+ });
457
+ if (isValidateDgIndex !== -1) {
458
+ msg = "\u7B2C ".concat(isValidateDgIndex + 1, " \u884C\u6570\u636E\uFF0C\u6CA1\u6709\u751F\u6210\u4EFB\u52A1id\uFF0C\u8BF7\u70B9\u51FB\u5F00\u59CB\u6BD4\u5BF9\u6309\u94AE\uFF01");
459
+ myMessage.warning(msg);
460
+ return [2 /*return*/, Promise.reject(msg)];
461
+ }
462
+ isValidateAttachType = fileList.findIndex(function (item) {
463
+ return !item.attachType;
464
+ });
465
+ if (resetProps.isAllowedPatchFileType &&
466
+ isValidateAttachType !== -1) {
467
+ msg = "\u7B2C ".concat(isValidateAttachType + 1, " \u884C\u6570\u636E\uFF0C\u6CA1\u6709\u9009\u62E9\u9644\u4EF6\u7C7B\u578B\uFF0C\u8BF7\u9009\u62E9\uFF01");
468
+ myMessage.warning(msg);
469
+ return [2 /*return*/, Promise.reject(msg)];
470
+ }
471
+ }
472
+ // 1. 指定盖章位置后,又修改了选中印章信息 并且本次一定手动指定了签署位置
473
+ if (isEdit &&
474
+ needQys &&
475
+ !isClickElectronSureRef.current &&
476
+ !isOnlyQj &&
477
+ preElectronicSealIdList &&
478
+ electronicSealIdList.length !== (preElectronicSealIdList === null || preElectronicSealIdList === void 0 ? void 0 : preElectronicSealIdList.length)) {
479
+ ModalComponent.confirm({
480
+ title: "当前所勾选的电子印章信息与上一次盖章时有差异,请确认是否继续?",
481
+ okText: "是",
482
+ okType: "danger",
483
+ cancelText: "否",
484
+ onOk: function () {
485
+ isClickElectronSureRef.current = true;
486
+ },
487
+ onCancel: function () {
488
+ isClickElectronSureRef.current = false;
489
+ },
490
+ });
491
+ return [2 /*return*/, Promise.reject("当前所勾选的电子印章信息与上一次盖章时有差异,请确认是否继续?")];
492
+ }
493
+ // 2. 给附件勾选了加盖电子印章 但是未选择电子印章列表
494
+ if (isEdit &&
495
+ needQys &&
496
+ electronicSealIdList.length === 0 &&
497
+ hasElectronicSeal &&
498
+ !isOnlyQj) {
499
+ msg = "请勾选加盖电子印章所需要的印章列表!";
500
+ myMessage.warning(msg);
501
+ return [2 /*return*/, Promise.reject(msg)];
502
+ }
503
+ 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); });
504
+ if (isEdit &&
505
+ needQys &&
506
+ contractId &&
507
+ docAttachMap &&
508
+ electronicSealFileList &&
509
+ checkElectron) {
510
+ electronicSealedFileList_1 = [];
511
+ Object.keys(docAttachMap).forEach(function (key) {
512
+ // const value = docAttachMap[key];
513
+ if (electronicSealFileList.find(function (attachId) { return attachId === key; }) ||
514
+ key !== "needYjzrr") {
515
+ // 将当前合同下已经盖章的附件 添加到 已盖章附件列表中
516
+ electronicSealedFileList_1.push(key);
517
+ }
518
+ });
519
+ if (!isEqual(electronicSealFileList.sort(), electronicSealedFileList_1.sort())) {
520
+ myMessage.warning("附件盖章信息有变动,请重新确认盖章信息");
521
+ return [2 /*return*/, Promise.reject("附件盖章信息有变动,请重新确认盖章信息")];
522
+ }
523
+ }
524
+ // 3. 群杰超过4倍 禁止提交审批
525
+ if (isEdit && needQj && isContranctNum) {
526
+ // 单附件都需要选群杰章 校验逻辑
527
+ if (isSingleQj && hasQunj) {
528
+ isMoreQunjCountIndex = fileList.findIndex(function (file) {
529
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
530
+ // 如果没有勾选,不需要验证
531
+ if (!isQunj) {
532
+ return false;
533
+ }
534
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
535
+ var isMoreQunjCount = countIsValidate(qunjSeal, false);
536
+ if (!isMoreQunjCount) {
537
+ return true;
538
+ }
539
+ return false;
540
+ });
541
+ if (isMoreQunjCountIndex !== -1) {
542
+ msg = "\u7B2C".concat(isMoreQunjCountIndex + 1, "\u884C\u6570\u636E\uFF0C\u60A8\u7684\u7FA4\u6770\u7AE0\u7528\u5370\u6B21\u6570\u8FDC\u8FDC\u8D85\u8FC7\u5408\u7406\u6B21\u6570\u8303\u56F4\uFF0C\u8BF7\u4FEE\u6539\u3002");
543
+ myMessage.warning(msg);
544
+ return [2 /*return*/, Promise.reject(msg)];
545
+ }
546
+ }
547
+ // 整体盖群杰章校验逻辑
548
+ if (!isSingleQj) {
549
+ isMoreQunjCount = countIsValidate(qunjSeal, false);
550
+ if (!isMoreQunjCount) {
551
+ msg = "您的群杰章用印次数远远超过合理次数范围,请修改。";
552
+ myMessage.warning(msg);
553
+ return [2 /*return*/, Promise.reject(msg)];
554
+ }
555
+ }
556
+ }
557
+ isCheckTakeOutNoAddress = function (data) {
558
+ if (data &&
559
+ data.qunjSeal &&
560
+ data.qunjSeal.isTakeOut + "" === "1" &&
561
+ (!data.qunjAddress || data.qunjAddress.length === 0)) {
562
+ return true;
563
+ }
564
+ return false;
565
+ };
566
+ if (isEdit && needQj) {
567
+ // 对于那种每个附件都需要选择群杰用印的逻辑
568
+ if (isSingleQj) {
569
+ isCheckTakeOutNoAddressIndex = fileList.findIndex(function (file) {
570
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
571
+ // 如果没有勾选,不需要验证
572
+ if (!isQunj) {
573
+ return false;
574
+ }
575
+ var isCheckTakeOutNoAddressResult = isCheckTakeOutNoAddress(file);
576
+ if (isCheckTakeOutNoAddressResult) {
577
+ return true;
578
+ }
579
+ return false;
580
+ });
581
+ if (isCheckTakeOutNoAddressIndex !== -1) {
582
+ msg = "\u7B2C".concat(isCheckTakeOutNoAddressIndex + 1, "\u884C\u6570\u636E\uFF0C\u60A8\u7684\u7FA4\u6770\u7AE0\u7528\u9009\u4E86\u5916\u90E8\u7528\u5370\uFF0C\u4F46\u662F\u6CA1\u6709\u9009\u62E9\u5916\u90E8\u7528\u5370\u7684\u5730\u5740\uFF01");
583
+ myMessage.warning(msg);
584
+ return [2 /*return*/, Promise.reject(msg)];
585
+ }
586
+ }
587
+ else if (isCheckTakeOutNoAddress(submitData)) {
588
+ msg = "\u60A8\u7684\u7FA4\u6770\u5370\u7AE0\u9009\u4E86\u5916\u90E8\u7528\u5370\uFF0C\u4F46\u662F\u6CA1\u6709\u9009\u62E9\u5916\u90E8\u7528\u5370\u7684\u5730\u5740\uFF01";
589
+ myMessage.warning(msg);
590
+ return [2 /*return*/, Promise.reject(msg)];
591
+ }
592
+ }
593
+ // 4. 没有确认盖章
594
+ if (isEdit &&
595
+ needQys &&
596
+ hasElectronicSeal &&
597
+ !contractId &&
598
+ !isOnlyQj) {
599
+ msg = "请点击指定签署位置按钮,指定签署位置后方可提交!";
600
+ myMessage.warning(msg);
601
+ return [2 /*return*/, Promise.reject(msg)];
602
+ }
603
+ // 5. 合同份数验证
604
+ if (isEdit && needQj) {
605
+ // 单附件都需要选群杰章 校验逻辑
606
+ if (isSingleQj && hasQunj) {
607
+ // 合同份数校验
608
+ if (isContranctNum) {
609
+ hasNoWritContranctNum = fileList.findIndex(function (file) {
610
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
611
+ // 如果没有勾选,不需要验证
612
+ if (!isQunj) {
613
+ return false;
614
+ }
615
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
616
+ if (!qunjSeal.contranctNum) {
617
+ return true;
618
+ }
619
+ return false;
620
+ });
621
+ if (hasNoWritContranctNum !== -1) {
622
+ msg = "\u7B2C".concat(hasNoWritContranctNum + 1, "\u884C\u6570\u636E\uFF0C\u6CA1\u6709\u586B\u5199\u7FA4\u6770\u7AE0\u5408\u540C\u4EFD\u6570\u3002");
623
+ myMessage.warning(msg);
624
+ return [2 /*return*/, Promise.reject(msg)];
625
+ }
626
+ }
627
+ hasNoCheckedQjSeal = fileList.findIndex(function (file) {
628
+ var _a, _b;
629
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
630
+ // 如果没有勾选,不需要验证
631
+ if (!isQunj) {
632
+ return false;
633
+ }
634
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
635
+ if (!((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) ||
636
+ ((_b = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _b === void 0 ? void 0 : _b.length) === 0) {
637
+ return true;
638
+ }
639
+ return false;
640
+ });
641
+ if (hasNoCheckedQjSeal !== -1) {
642
+ msg = "\u7B2C".concat(hasNoCheckedQjSeal + 1, "\u884C\u6570\u636E\uFF0C\u52FE\u9009\u4E86\u76D6\u7FA4\u6770\u7AE0\uFF0C\u4F46\u662F\u6CA1\u6709\u9009\u62E9\u7FA4\u6770\u5370\u7AE0");
643
+ myMessage.warning(msg);
644
+ return [2 /*return*/, Promise.reject(msg)];
645
+ }
646
+ noNumSealName_1 = "";
647
+ hasNoNumCheckedQjSeal = fileList.findIndex(function (file) {
648
+ var _a;
649
+ var isQunj = file === null || file === void 0 ? void 0 : file[isQunjKey];
650
+ // 如果没有勾选,不需要验证
651
+ if (!isQunj) {
652
+ return false;
653
+ }
654
+ var qunjSeal = file === null || file === void 0 ? void 0 : file[qunjSealKey];
655
+ if (Array.isArray(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
656
+ ((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
657
+ var noNumItem = qunjSeal.details.find(function (item) { return !item.sealCount; });
658
+ if (noNumItem) {
659
+ noNumSealName_1 = noNumItem.sealName;
660
+ return true;
661
+ }
662
+ }
663
+ return false;
664
+ });
665
+ if (hasNoNumCheckedQjSeal !== -1) {
666
+ msg = "\u7B2C".concat(hasNoNumCheckedQjSeal + 1, "\u884C\u6570\u636E\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u9009\u4E86\u5370\u7AE0\uFF0C\u4F46\u662F\u6CA1\u586B\u7528\u5370\u6B21\u6570\u7684\u5370\u7AE0\u3002\u5982\uFF1A").concat(noNumSealName_1);
667
+ myMessage.warning(msg);
668
+ return [2 /*return*/, Promise.reject(msg)];
669
+ }
670
+ }
671
+ // 整体盖群杰章校验逻辑
672
+ // 20250424 验证逻辑增加必须选择了群杰印章
673
+ if (!isSingleQj &&
674
+ qunjChecked &&
675
+ (qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
676
+ ((_j = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _j === void 0 ? void 0 : _j.length) > 0) {
677
+ // 合同份数为空
678
+ if (isContranctNum && !qunjSeal.contranctNum) {
679
+ myMessage.warning("请填写合同份数!");
680
+ return [2 /*return*/, Promise.reject("请填写合同份数!")];
681
+ }
682
+ // 勾选了群杰印章 没有填用印次数
683
+ if (((_k = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _k === void 0 ? void 0 : _k.length) > 0) {
684
+ qunjSeal.details.forEach(function (item) {
685
+ if (!item.sealCount) {
686
+ myMessage.warning("\u8BF7\u586B\u5199".concat(item.sealName, " \u7684\u7528\u5370\u6B21\u6570\uFF01"));
687
+ }
688
+ });
689
+ if (qunjSeal.details.filter(function (item) { return !item.sealCount; }).length >
690
+ 0) {
691
+ return [2 /*return*/, Promise.reject("请填写用印次数!")];
692
+ }
693
+ }
694
+ else {
695
+ msg = "请选择群杰用印!";
696
+ myMessage.warning(msg);
697
+ return [2 /*return*/, Promise.reject(msg)];
698
+ }
699
+ }
700
+ }
701
+ // 6. 调接口检测 是否存在未确认盖章位置的印章
702
+ if (needQys &&
703
+ isEdit &&
704
+ hasElectronicSeal &&
705
+ electronicSealIdList.length > 0) {
706
+ setLoading({
707
+ spinning: true,
708
+ tip: "服务器验证中...",
709
+ });
710
+ // 调用接口
711
+ return [2 /*return*/, getNoSealInfoList({
712
+ contractId: contractId,
713
+ sealIdList: electronicSealIdList,
714
+ deptId: resetProps.deptId,
715
+ secondDepId: resetProps.secondDepId,
716
+ needYjzrr: docAttachMap.needYjzrr === "true" ||
717
+ docAttachMap.needYjzrr === true
718
+ ? true
719
+ : false,
720
+ })
721
+ .then(function (res) {
722
+ setLoading({
723
+ spinning: false,
724
+ });
725
+ if (res.length > 0) {
726
+ currentUnSealListRef.current = res;
727
+ modalHandleRef.current.setInfo(true, {
728
+ unSealList: res,
729
+ });
730
+ return Promise.reject("还有印章未通过校验");
731
+ }
732
+ else {
733
+ return Promise.resolve(true);
734
+ }
735
+ })
736
+ .catch(function (err) {
737
+ setLoading({
738
+ spinning: false,
739
+ });
740
+ return Promise.reject(err);
741
+ })];
742
+ }
743
+ return [2 /*return*/, Promise.resolve(true)];
744
+ });
745
+ }); },
746
+ /** 切换部门时,应该清空电子印章相关数据 */
747
+ changeDeptIdClearQysDataHandler: function (dataType) {
748
+ var clearAllElectronDataHandler = allData[firstDataType].clearAllElectronDataHandler;
749
+ clearAllElectronDataHandler && clearAllElectronDataHandler(dataType);
750
+ },
751
+ };
752
+ });
753
+ var myRowSelection = useMemo(function () { return ({
754
+ type: "checkbox",
755
+ onChange: function (selectedRowKeys, selectedRows) {
756
+ selectRows.current = selectedRows.map(function (item) {
757
+ var newItem = __assign({}, item);
758
+ return newItem;
759
+ });
760
+ },
761
+ }); }, []);
762
+ var _2 = allData[firstDataType] || {}, sameTypeRecords = _2.records, setSameTypeRecords = _2.setRecords, parseCurrentUploadFile = _2.parseCurrentUploadFile;
763
+ function addFile(info, callback) {
764
+ var _a;
765
+ var file = info.file;
766
+ if (file.status === "done") {
767
+ var currentData = allData[firstDataType];
768
+ // 附件类型字段对应表
769
+ var _b = ((_a = currentData.fileFieldsNameRef) === null || _a === void 0 ? void 0 : _a.current) || {}, _c = _b.isQunj, isQunjKey_1 = _c === void 0 ? "isQunj" : _c, _d = _b.qunjSeal, qunjSealKey_1 = _d === void 0 ? "qunjSeal" : _d;
770
+ setSameTypeRecords(function (preRecords) {
771
+ var copyRecords = (preRecords === null || preRecords === void 0 ? void 0 : preRecords.slice()) || [];
772
+ copyRecords = copyRecords.filter(function (record) { return !currentRecordIsOnlyQunj(record); });
773
+ // 插入一个给开发操作附件的机会
774
+ var newFile = callback(file);
775
+ newFile.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
776
+ // 每个附件都可以添加群杰时控制
777
+ if (isSingleQj) {
778
+ newFile[isQunjKey_1] = 1;
779
+ newFile[qunjSealKey_1] = { isTakeOut: 0 };
780
+ }
781
+ if (parseCurrentUploadFile) {
782
+ newFile = parseCurrentUploadFile(newFile);
783
+ }
784
+ copyRecords.push(newFile);
785
+ return copyRecords;
786
+ });
787
+ }
788
+ }
789
+ function onFileChange(info) {
790
+ addFile(info, function (file) {
791
+ var _a;
792
+ var _b, _c, _d, _e;
793
+ return _a = {
794
+ attachId: (_c = (_b = file === null || file === void 0 ? void 0 : file.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attachId,
795
+ attachName: (_e = (_d = file === null || file === void 0 ? void 0 : file.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.originalName
796
+ },
797
+ _a[DATA_TYPE_KEY] = firstDataType,
798
+ _a;
799
+ });
800
+ }
801
+ function onFileReplace(info, oldVersionId) {
802
+ addFile(info, function (file) {
803
+ var _a;
804
+ var _b, _c, _d, _e;
805
+ return _a = {
806
+ attachId: (_c = (_b = file === null || file === void 0 ? void 0 : file.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attachId,
807
+ attachName: (_e = (_d = file === null || file === void 0 ? void 0 : file.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.originalName,
808
+ oldVersionId: oldVersionId
809
+ },
810
+ _a[DATA_TYPE_KEY] = firstDataType,
811
+ _a;
812
+ });
813
+ }
814
+ function onBatchDeleteHandle() {
815
+ var _a;
816
+ if (!selectRows.current || selectRows.current.length === 0) {
817
+ myMessage.warning("请选择要删除的附件!");
818
+ return;
819
+ }
820
+ var deleteInfo = {};
821
+ for (var _i = 0, _b = selectRows.current; _i < _b.length; _i++) {
822
+ var item = _b[_i];
823
+ var currentDataType = item === null || item === void 0 ? void 0 : item[DATA_TYPE_KEY];
824
+ var _c = allData[currentDataType] || {}, isEdit = _c.isEdit, records = _c.records, setRecords = _c.setRecords;
825
+ if (beforeBatchDelete) {
826
+ if (!beforeBatchDelete(item)) {
827
+ myMessage.warning("".concat(item.attachName, "\u4E0D\u80FD\u5220\u9664\uFF01"));
828
+ return;
829
+ }
830
+ }
831
+ else if (!isEdit) {
832
+ myMessage.warning("存在不能删除的附件!");
833
+ return;
834
+ }
835
+ if (deleteInfo[currentDataType]) {
836
+ (_a = deleteInfo[currentDataType].deleteList) === null || _a === void 0 ? void 0 : _a.push(item);
837
+ }
838
+ else {
839
+ deleteInfo[currentDataType] = {
840
+ records: records,
841
+ setRecords: setRecords,
842
+ deleteList: [item],
843
+ };
844
+ }
845
+ }
846
+ Object.values(deleteInfo).forEach(function (_a) {
847
+ var records = _a.records, setRecords = _a.setRecords, deleteList = _a.deleteList;
848
+ setRecords(function () {
849
+ return records === null || records === void 0 ? void 0 : records.filter(function (record) {
850
+ return !(deleteList === null || deleteList === void 0 ? void 0 : deleteList.some(function (item) {
851
+ return item.id
852
+ ? item.id === record.id
853
+ : item.attachId === record.attachId;
854
+ }));
855
+ });
856
+ });
857
+ });
858
+ }
859
+ function onBatchPreviewHandle() {
860
+ if (!selectRows.current || selectRows.current.length === 0) {
861
+ myMessage.warning("请选择要预览的附件!");
862
+ return;
863
+ }
864
+ var parseFileList = selectRows.current.map(function (file) {
865
+ var attachId = file.attachId;
866
+ return {
867
+ attachId: attachId,
868
+ attachName: file.attachName,
869
+ };
870
+ });
871
+ var fileObject = {
872
+ title: "\u6279\u91CF\u9884\u89C8-".concat(parseFileList
873
+ .map(function (item) { return item.attachName; })
874
+ .join(",")
875
+ .slice(0, 10)),
876
+ fileList: parseFileList,
877
+ };
878
+ var previewId = Date.now() + "";
879
+ window.sessionStorage.setItem(previewId, JSON.stringify(fileObject));
880
+ window.open("/batchPreview/".concat(previewId, "?hideFrame=1"));
881
+ }
882
+ var defaultContext = useMemo(function () {
883
+ return { isNewQys: isNewQys, isQjVerifyCode: isQjVerifyCode };
884
+ }, [isNewQys, isQjVerifyCode]);
885
+ return (jsxs(ElectronSignaturesContext.Provider, __assign({ value: defaultContext }, { children: [allOptions.map(function (options, index) {
886
+ var mergeOptions = index === 0
887
+ ? __assign(__assign({}, options), { onValueChange: onValueChange }) : __assign(__assign({ deptId: resetProps.deptId, flowId: resetProps.flowId, secondDepId: resetProps.secondDepId }, options), { onValueChange: onValueChange });
888
+ return (jsx(ElectronSignaturesFragment, __assign({ dataType: "".concat(index), onTrackChange: onTrackChange, request: request, isUnControlled: isUnControlled, setLoading: setLoading, apiBaseUrl: apiBaseUrl, fileBaseUrl: fileBaseUrl, isSingleQj: isSingleQj, isSupportNoAttachQj: isSupportNoAttachQj }, mergeOptions), index));
889
+ }), jsxs(ElectronSealBatchDownload, __assign({ request: request, apiBaseUrl: apiBaseUrl, selectRows: selectRows, allData: allData, dataTypeSort: dataTypeSort, isShowElectronBatchBtn: isShowElectronBatchBtn, isShowDownloadBatchBtn: isShowDownloadBatchBtn, isShowDoubleSignedBatchBtn: isShowDoubleSignedBatchBtn, batchDownloadZipName: batchDownloadZipName, firstDataType: firstDataType, organizationId: organizationId, isEdit: currentIsEditMemo, isNeedQys: !!isNeedQys, records: sameTypeRecords, setRecords: setSameTypeRecords, mergeRecords: mergeRecords, onValueChange: onValueChange, isShowBatchUseElectronicSealBtn: isShowBatchUseElectronicSealBtn, isShowBatchUseOpeningContractSealBtn: isShowBatchUseOpeningContractSealBtn, isShowOpeningContractSealNotRelyQys: isShowOpeningContractSealNotRelyQys }, { children: [isShowFileUploadIndependence ||
890
+ (isShowFileUpload && currentIsEditMemo) ? (jsx(FileUpload, __assign({ fileList: sameTypeRecords, apiBaseUrl: apiBaseUrl, onFileChange: onFileChange, multiple: true }, fileUploadProps, { children: "添加附件" }))) : null, customButtons, isShowFileComparisonBtn ? (jsx(FileComparisonBtn, { compareHandle: compareHandle, lookCompareHandle: lookCompareHandle, fileBaseUrl: fileBaseUrl, onCompareClick: function () {
891
+ if (!selectRows.current) {
892
+ myMessage.warning("请选择数据进行比对!");
893
+ return Promise.reject("请选择数据进行比对!");
894
+ }
895
+ // 如果只选择了一条数据,那么可以判断是否有双签件
896
+ // if (selectRows.current.length === 1) {
897
+ // const doubleSignedSealInfoDTOListKey =
898
+ // 'doubleSignedSealInfoDTOList';
899
+ // const record = selectRows.current[0];
900
+ // if (
901
+ // record.doubleSignedSealInfoDTOList &&
902
+ // record.doubleSignedSealInfoDTOList?.length
903
+ // ) {
904
+ // const doubleSignedSealInfoDTOObj =
905
+ // record[doubleSignedSealInfoDTOListKey]?.[0];
906
+ // }
907
+ // } else
908
+ if (selectRows.current.length !== 2) {
909
+ myMessage.warning("请选择两条数据进行比对!");
910
+ return Promise.resolve("请选择两条数据进行比对!");
911
+ }
912
+ // 如果选了两条数据 那么就可以比对
913
+ var data = selectRows.current.map(function (file) {
914
+ var attachId = file.attachId;
915
+ return {
916
+ attachId: attachId,
917
+ attachName: file.attachName,
918
+ };
919
+ });
920
+ return new Promise(function (resolve) {
921
+ resolve(data);
922
+ });
923
+ } })) : null, isShowBatchDeleteBtnIndependence ||
924
+ (isShowBatchDeleteBtn && currentIsEditMemo) ? (jsx(Button, __assign({ type: "default", onClick: onBatchDeleteHandle, style: { marginRight: "10px" } }, { children: "批量删除" }))) : null, isShowBatchPreviewBtn ? (jsx(Button, __assign({ type: "default", onClick: onBatchPreviewHandle, style: { marginRight: "10px" } }, { children: "批量预览" }))) : null] })), jsx(Table, { dataSource: mergeRecords, columns: columns, rowKey: function (record) { return record.id || record.attachId; }, className: "ztxk-table electron-table", bordered: true, pagination: false, loading: loading, rowSelection: myRowSelection, scroll: __assign({ x: "max-content", y: 500 }, tableScroll) }), jsx(LastQysModal, { modalHandleRef: modalHandleRef, appointSignLocation: function (info) {
925
+ // 未盖章的印章id列表
926
+ var needReSealList = info.needReSealList;
927
+ var currentData = allData[firstDataType];
928
+ var currentCheckedElectronicSealIdList = currentData.currentCheckedElectronicSealIdList;
929
+ /** 最开始的未盖章的印章列表 (不是id列表) */
930
+ var currentUnSealListRefValue = currentUnSealListRef.current;
931
+ var currentUnSealIdListValue = currentUnSealListRefValue.map(function (item) { return item.sealId; });
932
+ var appointSignLocation = currentData.appointSignLocation;
933
+ var onElectronicSealIdChange = currentData.onElectronicSealIdChange;
934
+ if (!Array.isArray(needReSealList)) {
935
+ modalHandleRef.current.clear();
936
+ return;
937
+ }
938
+ if (needReSealList.length === 0) {
939
+ var newSealIdList_1 = currentCheckedElectronicSealIdList.filter(function (item) { return !currentUnSealIdListValue.includes(item); });
940
+ onElectronicSealIdChange(newSealIdList_1);
941
+ // modalHandleRef.current.clear();
942
+ // // 如果所有未盖章的都取消了 那么可以认为校验直接通过了
943
+ // isValidateSuccess && isValidateSuccess();
944
+ // 重新调用指定盖章位置
945
+ appointSignLocation === null || appointSignLocation === void 0 ? void 0 : appointSignLocation({
946
+ callback: function (info) {
947
+ modalHandleRef.current.clear();
948
+ // 如果所有未盖章的都取消了 那么可以认为校验直接通过了
949
+ isValidateSuccess && isValidateSuccess();
950
+ },
951
+ isCheckUnStampedSeal: true,
952
+ otherParams: {
953
+ sealIdList: newSealIdList_1,
954
+ },
955
+ });
956
+ return;
957
+ }
958
+ // 计算出最终选中了的印章
959
+ var deleteSealItemList = currentUnSealListRefValue.filter(function (item) { return !needReSealList.includes(item.sealId); });
960
+ var deleteSealIdList = deleteSealItemList.map(function (item) { return item.sealId; });
961
+ var newSealIdList = currentCheckedElectronicSealIdList.filter(function (item) { return !deleteSealIdList.includes(item); });
962
+ appointSignLocation === null || appointSignLocation === void 0 ? void 0 : appointSignLocation({
963
+ callback: function (info) {
964
+ modalHandleRef.current.clear();
965
+ },
966
+ otherParams: {
967
+ sealIdList: newSealIdList,
968
+ },
969
+ });
970
+ } })] })));
971
+ };
972
+ var ElectronSignatures$1 = memo(ElectronSignatures);
973
+
974
+ export { ElectronSignaturesContext, ElectronSignatures$1 as default };