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.
- package/dist/components/business/Signatures/index.js +130 -142
- package/dist/components/electron-signatures/content.js +353 -340
- package/dist/components/electron-signatures/electron-signatures-fragment.js +21 -18
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.d.ts +10 -4
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.js +231 -165
- package/dist/components/utils/checkSealCoUse.d.ts +16 -0
- package/dist/components/utils/checkSealCoUse.js +83 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.css +1 -0
- package/dist/index.css.map +1 -1
- package/dist/main.js +2 -2
- package/package.json +2 -2
|
@@ -87,8 +87,22 @@ var ElectronSignaturesFragment = function (props) {
|
|
|
87
87
|
isCheckedEconomic: isCheckedEconomic,
|
|
88
88
|
docAttachMap: docAttachMap,
|
|
89
89
|
}), currentCheckedElectronicSealIdList = _f.currentCheckedElectronicSealIdList, onElectronicSealIdChange = _f.onElectronicSealIdChange, currentIsCheckedEconomic = _f.currentIsCheckedEconomic, setCurrentIsCheckedEconomic = _f.setCurrentIsCheckedEconomic, onCheckedEconomicChange = _f.onCheckedEconomicChange, onClearElectronListData = _f.onClearElectronListData;
|
|
90
|
+
// 这个是整体逻辑。如果每个附件都需要选择是否盖群杰印章,走其他逻辑
|
|
91
|
+
// 群杰物理章切换数据相关逻辑
|
|
92
|
+
var _g = useParseQunjListData({
|
|
93
|
+
isUnControlled: isUnControlled,
|
|
94
|
+
onValueChange: onValueChange,
|
|
95
|
+
dataType: dataType,
|
|
96
|
+
qunjSeal: qunjSeal,
|
|
97
|
+
contractNumFlowIds: contractNumFlowIds,
|
|
98
|
+
deptId: deptId,
|
|
99
|
+
flowId: flowId,
|
|
100
|
+
isDefaultQunj: isDefaultQunj,
|
|
101
|
+
qunjAddress: qunjAddress,
|
|
102
|
+
isSingleQj: isSingleQj,
|
|
103
|
+
}), currentQunjSeal = _g.currentQunjSeal, onQunjSealChange = _g.onQunjSealChange, isContranctNum = _g.isContranctNum, qunjChecked = _g.qunjChecked, setQunjChecked = _g.setQunjChecked, currentQunjAddress = _g.currentQunjAddress, onQunjAddressChange = _g.onQunjAddressChange;
|
|
90
104
|
// 电子印章设置相关逻辑
|
|
91
|
-
var
|
|
105
|
+
var _h = useParseElectronSetting({
|
|
92
106
|
isUnControlled: isUnControlled,
|
|
93
107
|
onValueChange: onValueChange,
|
|
94
108
|
request: request,
|
|
@@ -106,10 +120,11 @@ var ElectronSignaturesFragment = function (props) {
|
|
|
106
120
|
deptId: deptId,
|
|
107
121
|
secondDepId: secondDepId,
|
|
108
122
|
onElectronicSealIdChange: onElectronicSealIdChange,
|
|
109
|
-
|
|
110
|
-
|
|
123
|
+
qunjSeal: currentQunjSeal,
|
|
124
|
+
fileFieldsNameRef: fileFieldsNameRef,
|
|
125
|
+
}), currentContractId = _h.currentContractId, currentDocAttachMap = _h.currentDocAttachMap, currentDocumentIdList = _h.currentDocumentIdList, appointSignLocation = _h.appointSignLocation, viewSignPage = _h.viewSignPage, checkUnStampedSealList = _h.checkUnStampedSealList, unElectronicSealList = _h.unElectronicSealList, unElectronicSealIdList = _h.unElectronicSealIdList, onClearElectronSetting = _h.onClearElectronSetting, clickElectronicSealIdList = _h.clickElectronicSealIdList;
|
|
111
126
|
// 盖电子印章相关逻辑
|
|
112
|
-
var
|
|
127
|
+
var _j = useParseIsNeedElectronData({
|
|
113
128
|
isUnControlled: isUnControlled,
|
|
114
129
|
onValueChange: onValueChange,
|
|
115
130
|
dataType: dataType,
|
|
@@ -120,21 +135,9 @@ var ElectronSignaturesFragment = function (props) {
|
|
|
120
135
|
deptId: deptId,
|
|
121
136
|
secondDepId: secondDepId,
|
|
122
137
|
electronicSealIdList: electronicSealIdList,
|
|
123
|
-
}), onIsStampElectronChange =
|
|
138
|
+
}), onIsStampElectronChange = _j.onIsStampElectronChange, isStampElectron = _j.isStampElectron, clearAllElectronDataHandler = _j.clearAllElectronDataHandler;
|
|
124
139
|
// 这个是整体逻辑。如果每个附件都需要选择是否盖群杰印章,走其他逻辑
|
|
125
|
-
//
|
|
126
|
-
var _j = useParseQunjListData({
|
|
127
|
-
isUnControlled: isUnControlled,
|
|
128
|
-
onValueChange: onValueChange,
|
|
129
|
-
dataType: dataType,
|
|
130
|
-
qunjSeal: qunjSeal,
|
|
131
|
-
contractNumFlowIds: contractNumFlowIds,
|
|
132
|
-
deptId: deptId,
|
|
133
|
-
flowId: flowId,
|
|
134
|
-
isDefaultQunj: isDefaultQunj,
|
|
135
|
-
qunjAddress: qunjAddress,
|
|
136
|
-
isSingleQj: isSingleQj,
|
|
137
|
-
}), currentQunjSeal = _j.currentQunjSeal, onQunjSealChange = _j.onQunjSealChange, isContranctNum = _j.isContranctNum, qunjChecked = _j.qunjChecked, setQunjChecked = _j.setQunjChecked, currentQunjAddress = _j.currentQunjAddress, onQunjAddressChange = _j.onQunjAddressChange;
|
|
140
|
+
// 群杰物理章切换数据相关逻辑(已提前到 useParseElectronSetting 之前调用)
|
|
138
141
|
// 是否盖群杰章相关逻辑
|
|
139
142
|
var onIsStampQunjChange = useParseIsNeedQunjData({
|
|
140
143
|
isUnControlled: isUnControlled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IElectronSignaturesProps, IElectronSignaturesItem, IAppointSignLocationOptions } from '../interface';
|
|
2
|
+
import { IElectronSignaturesProps, IElectronSignaturesItem, IAppointSignLocationOptions, IFileFieldsName, IQunjProps } from '../interface';
|
|
3
3
|
import type { SpinProps } from 'antd/es/spin';
|
|
4
4
|
interface IOptions {
|
|
5
5
|
/**
|
|
@@ -63,9 +63,15 @@ interface IOptions {
|
|
|
63
63
|
flowStatus?: IElectronSignaturesItem['flowStatus'];
|
|
64
64
|
onElectronicSealIdChange?: any;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* 当前选中的群杰印章数据(用于校验必须共同使用逻辑)
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
qunjSeal?: IQunjProps;
|
|
69
|
+
/**
|
|
70
|
+
* 字段对应表(用于从附件数据中收集单附件群杰印章编号)
|
|
71
|
+
*/
|
|
72
|
+
fileFieldsNameRef?: {
|
|
73
|
+
current: IFileFieldsName;
|
|
74
|
+
};
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
71
77
|
* 电子印章设置相关操作
|
|
@@ -83,7 +89,7 @@ export default function useParseElectronSetting(options: IOptions): {
|
|
|
83
89
|
currentDocumentIdList: any;
|
|
84
90
|
setCurrentDocumentIdList: React.Dispatch<any>;
|
|
85
91
|
/** 指定签署位置 */
|
|
86
|
-
appointSignLocation: (options?: IAppointSignLocationOptions) => void
|
|
92
|
+
appointSignLocation: (options?: IAppointSignLocationOptions) => Promise<void>;
|
|
87
93
|
/** 预览盖章效果 */
|
|
88
94
|
viewSignPage: () => void;
|
|
89
95
|
/** 暴露一个清空数据的方法 */
|
|
@@ -9,17 +9,60 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
49
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
50
|
+
to[j] = from[i];
|
|
51
|
+
return to;
|
|
52
|
+
};
|
|
12
53
|
import i18next from 'ztxkutils/dist/i18next';
|
|
13
54
|
import { useEffect, useMemo, useState } from 'react';
|
|
14
55
|
import { unstable_batchedUpdates } from 'react-dom';
|
|
15
56
|
import { message } from '../../../index.build';
|
|
16
57
|
import useMemoizedFn from '../../utils/useMemoizedFn';
|
|
58
|
+
import checkSealCoUse from '../../utils/checkSealCoUse';
|
|
17
59
|
import { isFlowCompleted } from '../utils';
|
|
18
60
|
/**
|
|
19
61
|
* 电子印章设置相关操作
|
|
20
62
|
*/
|
|
21
63
|
export default function useParseElectronSetting(options) {
|
|
22
|
-
var
|
|
64
|
+
var _this = this;
|
|
65
|
+
var isUnControlled = options.isUnControlled, onValueChange = options.onValueChange, dataType = options.dataType, request = options.request, setLoading = options.setLoading, records = options.records, deptId = options.deptId, secondDepId = options.secondDepId, contractId = options.contractId, docAttachMap = options.docAttachMap, documentIdList = options.documentIdList, electronicSealIdList = options.electronicSealIdList, isCheckedEconomic = options.isCheckedEconomic, setCurrentIsCheckedEconomic = options.setCurrentIsCheckedEconomic, canEdit = options.canEdit, flowStatus = options.flowStatus, onElectronicSealIdChange = options.onElectronicSealIdChange, qunjSeal = options.qunjSeal, fileFieldsNameRef = options.fileFieldsNameRef;
|
|
23
66
|
// 点击签署位置 实时记录点击时的印章列表
|
|
24
67
|
var _a = useState(), clickElectronicSealIdList = _a[0], setClickElectronicSealIdList = _a[1];
|
|
25
68
|
// 当前合同id数据
|
|
@@ -53,179 +96,176 @@ export default function useParseElectronSetting(options) {
|
|
|
53
96
|
};
|
|
54
97
|
});
|
|
55
98
|
// 指定签署位置
|
|
56
|
-
var appointSignLocation = useMemoizedFn(function (options) {
|
|
57
|
-
var _a
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.log(i18next.t('没有选择电子印章!'));
|
|
67
|
-
message.error(i18next.t('没有选择需要盖章的电子印章!'));
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
// 校验带有"必须共同使用"标识的印章(mustUseWithOthers + useWithSealIds)
|
|
71
|
-
if (Array.isArray(electronList) && electronicSealIdList.length > 0) {
|
|
72
|
-
var selectedSealIds_1 = new Set(electronicSealIdList.map(function (id) { return id + ''; }));
|
|
73
|
-
for (var _i = 0, electronList_1 = electronList; _i < electronList_1.length; _i++) {
|
|
74
|
-
var seal = electronList_1[_i];
|
|
75
|
-
if (selectedSealIds_1.has(seal.sealId + '') &&
|
|
76
|
-
seal.mustUseWithOthers &&
|
|
77
|
-
seal.useWithSealIds) {
|
|
78
|
-
var requiredIds = seal.useWithSealIds
|
|
79
|
-
.split(',')
|
|
80
|
-
.map(function (id) { return id.trim(); })
|
|
81
|
-
.filter(Boolean);
|
|
82
|
-
var hasMatch = requiredIds.some(function (id) { return selectedSealIds_1.has(id); });
|
|
83
|
-
if (!hasMatch) {
|
|
84
|
-
var msg = i18next.t('当前所选的{{sealName}},要求必须和{{requiredSealNames}}其中之一一起使用,请重新勾选印章。', {
|
|
85
|
-
sealName: seal.sealName,
|
|
86
|
-
requiredSealNames: seal.useWithSealNames,
|
|
87
|
-
});
|
|
88
|
-
message.warning(msg);
|
|
89
|
-
return;
|
|
99
|
+
var appointSignLocation = useMemoizedFn(function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
100
|
+
var _a, callback, _b, otherParams, isCheckUnStampedSeal, _c, spinningTip, isCoUsePass, currentCheckedElectronAttachIds, isError, params, newSealIdList, stampedAttachIdList;
|
|
101
|
+
return __generator(this, function (_d) {
|
|
102
|
+
switch (_d.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
_a = options || {}, callback = _a.callback, _b = _a.otherParams, otherParams = _b === void 0 ? {} : _b, isCheckUnStampedSeal = _a.isCheckUnStampedSeal, _c = _a.spinningTip, spinningTip = _c === void 0 ? i18next.t('指定签署位置中...') : _c;
|
|
105
|
+
// 选出选了盖电子印章的附件数据
|
|
106
|
+
if (!Array.isArray(records)) {
|
|
107
|
+
console.log(i18next.t('没有选中需要盖电子印章的数据!'));
|
|
108
|
+
return [2 /*return*/];
|
|
90
109
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var isError = false;
|
|
98
|
-
records.forEach(function (record, index) {
|
|
99
|
-
if (!record.isElectronicSeal) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (!record.attachId && !isError) {
|
|
103
|
-
message.error(i18next.t('第{{slot0}}行附件没有附件id,无法盖章!', {
|
|
104
|
-
slot0: index + 1,
|
|
105
|
-
}));
|
|
106
|
-
isError = true;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
currentCheckedElectronAttachIds.push(record.attachId);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
if (isError) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
116
|
-
spinning: true,
|
|
117
|
-
tip: spinningTip,
|
|
118
|
-
});
|
|
119
|
-
var params = __assign({ attachIdList: [], sealIdList: electronicSealIdList, deleteAttachIdList: [], docAttachMap: currentDocAttachMap, deptId: deptId,
|
|
120
|
-
secondDepId: secondDepId, needYjzrr: isCheckedEconomic }, otherParams);
|
|
121
|
-
// 更新最新的电子印章选中列表
|
|
122
|
-
var newSealIdList = params.sealIdList;
|
|
123
|
-
setClickElectronicSealIdList(newSealIdList);
|
|
124
|
-
// 盖过章的附件列表
|
|
125
|
-
var stampedAttachIdList = getStampedAttachIdListByMap(currentDocAttachMap);
|
|
126
|
-
// 这里参考之前的逻辑处理(不知道为什么这里没有处理印章逻辑 如果前后的印章不一致 应该也要重新勾选才是)
|
|
127
|
-
// (前后印章不同的逻辑 是在提交的时候处理的,会弹出一个模态框)
|
|
128
|
-
// 如果有合同id 传入合同id
|
|
129
|
-
// 有合同id 表明之前已经签署过位置了
|
|
130
|
-
// 需要处理下签署前后的附件数据
|
|
131
|
-
if (currentContractId) {
|
|
132
|
-
params.contractId = currentContractId;
|
|
133
|
-
// 找出此次新增加的附件
|
|
134
|
-
if (stampedAttachIdList.length === 0) {
|
|
135
|
-
params.attachIdList = currentCheckedElectronAttachIds;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
params.attachIdList = currentCheckedElectronAttachIds.filter(function (attachId) { return !stampedAttachIdList.includes(attachId); });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
params.attachIdList = currentCheckedElectronAttachIds;
|
|
143
|
-
}
|
|
144
|
-
// 找到需要删除的附件(之前已经盖了章的附件,但是本次没有选中盖电子印章的按钮)
|
|
145
|
-
// 已盖章的附件id列表中筛选出要删除的附件id列表
|
|
146
|
-
if (Array.isArray(stampedAttachIdList)) {
|
|
147
|
-
stampedAttachIdList.forEach(function (n) {
|
|
148
|
-
if (currentCheckedElectronAttachIds.length !== 0 &&
|
|
149
|
-
!currentCheckedElectronAttachIds.includes(n)) {
|
|
150
|
-
params.deleteAttachIdList.push(n);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
request({
|
|
155
|
-
url: '/api/zmdms-resource/seal/confirm-seal-info',
|
|
156
|
-
method: 'POST',
|
|
157
|
-
timeout: 90000,
|
|
158
|
-
data: params,
|
|
159
|
-
})
|
|
160
|
-
.then(function (res) {
|
|
161
|
-
unstable_batchedUpdates(function () {
|
|
162
|
-
var _a;
|
|
163
|
-
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
164
|
-
spinning: false,
|
|
165
|
-
});
|
|
166
|
-
if (res.status === 200 &&
|
|
167
|
-
res.data.code === 200 &&
|
|
168
|
-
res.data.data.preSignUrl) {
|
|
169
|
-
// 更新一些数据
|
|
170
|
-
var newContractId = res.data.data.contractId; // 新合同id
|
|
171
|
-
var newDocAttachMap = res.data.data.docAttachMap; // 新文档对应关系(附件:合同id)
|
|
172
|
-
var newDocumentIdList = getDocumentIdListByMap(newDocAttachMap); // 新文档id列表
|
|
173
|
-
// 非受控模式 设置下内部数据
|
|
174
|
-
// 受控模式 会在effect中进行处理
|
|
175
|
-
// if (isUnControlled) {
|
|
176
|
-
setCurrentContractId(newContractId);
|
|
177
|
-
setCurrentDocAttachMap(newDocAttachMap);
|
|
178
|
-
setCurrentDocumentIdList(newDocumentIdList);
|
|
179
|
-
onElectronicSealIdChange(newSealIdList, false);
|
|
180
|
-
// }
|
|
181
|
-
if (otherParams.needYjzrr !== undefined) {
|
|
182
|
-
setCurrentIsCheckedEconomic(otherParams.needYjzrr);
|
|
110
|
+
// 没有选择印章
|
|
111
|
+
if (!Array.isArray(electronicSealIdList) ||
|
|
112
|
+
(electronicSealIdList === null || electronicSealIdList === void 0 ? void 0 : electronicSealIdList.length) <= 0) {
|
|
113
|
+
console.log(i18next.t('没有选择电子印章!'));
|
|
114
|
+
message.error(i18next.t('没有选择需要盖章的电子印章!'));
|
|
115
|
+
return [2 /*return*/];
|
|
183
116
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
documentIdList: newDocumentIdList,
|
|
117
|
+
// 校验印章"必须共同使用"的约束(后端接口统一校验)
|
|
118
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
119
|
+
spinning: true,
|
|
120
|
+
tip: spinningTip,
|
|
189
121
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
122
|
+
return [4 /*yield*/, checkSealCoUse({
|
|
123
|
+
request: request,
|
|
124
|
+
qysSealIds: electronicSealIdList,
|
|
125
|
+
qjSealNos: collectQjSealNos(qunjSeal, records, fileFieldsNameRef),
|
|
126
|
+
})];
|
|
127
|
+
case 1:
|
|
128
|
+
isCoUsePass = _d.sent();
|
|
129
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
130
|
+
spinning: false,
|
|
131
|
+
});
|
|
132
|
+
if (!isCoUsePass) {
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
currentCheckedElectronAttachIds = [];
|
|
136
|
+
isError = false;
|
|
137
|
+
records.forEach(function (record, index) {
|
|
138
|
+
if (!record.isElectronicSeal) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!record.attachId && !isError) {
|
|
142
|
+
message.error(i18next.t('第{{slot0}}行附件没有附件id,无法盖章!', {
|
|
143
|
+
slot0: index + 1,
|
|
144
|
+
}));
|
|
145
|
+
isError = true;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
currentCheckedElectronAttachIds.push(record.attachId);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
if (isError) {
|
|
152
|
+
return [2 /*return*/];
|
|
204
153
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
154
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
155
|
+
spinning: true,
|
|
156
|
+
tip: spinningTip,
|
|
157
|
+
});
|
|
158
|
+
params = __assign({ attachIdList: [], sealIdList: electronicSealIdList, deleteAttachIdList: [], docAttachMap: currentDocAttachMap, deptId: deptId,
|
|
159
|
+
secondDepId: secondDepId, needYjzrr: isCheckedEconomic }, otherParams);
|
|
160
|
+
newSealIdList = params.sealIdList;
|
|
161
|
+
setClickElectronicSealIdList(newSealIdList);
|
|
162
|
+
stampedAttachIdList = getStampedAttachIdListByMap(currentDocAttachMap);
|
|
163
|
+
// 这里参考之前的逻辑处理(不知道为什么这里没有处理印章逻辑 如果前后的印章不一致 应该也要重新勾选才是)
|
|
164
|
+
// (前后印章不同的逻辑 是在提交的时候处理的,会弹出一个模态框)
|
|
165
|
+
// 如果有合同id 传入合同id
|
|
166
|
+
// 有合同id 表明之前已经签署过位置了
|
|
167
|
+
// 需要处理下签署前后的附件数据
|
|
168
|
+
if (currentContractId) {
|
|
169
|
+
params.contractId = currentContractId;
|
|
170
|
+
// 找出此次新增加的附件
|
|
171
|
+
if (stampedAttachIdList.length === 0) {
|
|
172
|
+
params.attachIdList = currentCheckedElectronAttachIds;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
params.attachIdList = currentCheckedElectronAttachIds.filter(function (attachId) { return !stampedAttachIdList.includes(attachId); });
|
|
210
176
|
}
|
|
211
177
|
}
|
|
212
178
|
else {
|
|
213
|
-
|
|
179
|
+
params.attachIdList = currentCheckedElectronAttachIds;
|
|
214
180
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
181
|
+
// 找到需要删除的附件(之前已经盖了章的附件,但是本次没有选中盖电子印章的按钮)
|
|
182
|
+
// 已盖章的附件id列表中筛选出要删除的附件id列表
|
|
183
|
+
if (Array.isArray(stampedAttachIdList)) {
|
|
184
|
+
stampedAttachIdList.forEach(function (n) {
|
|
185
|
+
if (currentCheckedElectronAttachIds.length !== 0 &&
|
|
186
|
+
!currentCheckedElectronAttachIds.includes(n)) {
|
|
187
|
+
params.deleteAttachIdList.push(n);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
request({
|
|
192
|
+
url: '/api/zmdms-resource/seal/confirm-seal-info',
|
|
193
|
+
method: 'POST',
|
|
194
|
+
timeout: 90000,
|
|
195
|
+
data: params,
|
|
196
|
+
})
|
|
197
|
+
.then(function (res) {
|
|
198
|
+
unstable_batchedUpdates(function () {
|
|
199
|
+
var _a;
|
|
200
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
201
|
+
spinning: false,
|
|
202
|
+
});
|
|
203
|
+
if (res.status === 200 &&
|
|
204
|
+
res.data.code === 200 &&
|
|
205
|
+
res.data.data.preSignUrl) {
|
|
206
|
+
// 更新一些数据
|
|
207
|
+
var newContractId = res.data.data.contractId; // 新合同id
|
|
208
|
+
var newDocAttachMap = res.data.data.docAttachMap; // 新文档对应关系(附件:合同id)
|
|
209
|
+
var newDocumentIdList = getDocumentIdListByMap(newDocAttachMap); // 新文档id列表
|
|
210
|
+
// 非受控模式 设置下内部数据
|
|
211
|
+
// 受控模式 会在effect中进行处理
|
|
212
|
+
// if (isUnControlled) {
|
|
213
|
+
setCurrentContractId(newContractId);
|
|
214
|
+
setCurrentDocAttachMap(newDocAttachMap);
|
|
215
|
+
setCurrentDocumentIdList(newDocumentIdList);
|
|
216
|
+
onElectronicSealIdChange(newSealIdList, false);
|
|
217
|
+
// }
|
|
218
|
+
if (otherParams.needYjzrr !== undefined) {
|
|
219
|
+
setCurrentIsCheckedEconomic(otherParams.needYjzrr);
|
|
220
|
+
}
|
|
221
|
+
callback === null || callback === void 0 ? void 0 : callback({
|
|
222
|
+
checkAttachIdList: currentCheckedElectronAttachIds,
|
|
223
|
+
contractId: newContractId,
|
|
224
|
+
docAttachMap: newDocAttachMap,
|
|
225
|
+
documentIdList: newDocumentIdList,
|
|
226
|
+
});
|
|
227
|
+
// 更改当前数据
|
|
228
|
+
if (dataType) {
|
|
229
|
+
onValueChange &&
|
|
230
|
+
onValueChange((_a = {},
|
|
231
|
+
_a[dataType] = {
|
|
232
|
+
checkAttachIdList: currentCheckedElectronAttachIds,
|
|
233
|
+
contractId: newContractId,
|
|
234
|
+
docAttachMap: newDocAttachMap,
|
|
235
|
+
documentIdList: newDocumentIdList,
|
|
236
|
+
// 在这里更改下是否加盖一级责任人数据
|
|
237
|
+
isCheckedEconomic: params.needYjzrr,
|
|
238
|
+
electronicSealIdList: newSealIdList,
|
|
239
|
+
},
|
|
240
|
+
_a));
|
|
241
|
+
}
|
|
242
|
+
// 需要跳转到契约锁重新指定签署位置
|
|
243
|
+
// 如果需要检测是否还有 未确认盖章位置的印章信息列表
|
|
244
|
+
if (isCheckUnStampedSeal) {
|
|
245
|
+
if (unElectronicSealList.length > 0) {
|
|
246
|
+
window.open(res.data.data.preSignUrl);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
window.open(res.data.data.preSignUrl);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
message.error(res.data.msg || i18next.t('出错了'));
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
})
|
|
258
|
+
.catch(function (error) {
|
|
259
|
+
var _a, _b;
|
|
260
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
261
|
+
spinning: false,
|
|
262
|
+
});
|
|
263
|
+
message.error(((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || i18next.t('请求失败!'));
|
|
264
|
+
});
|
|
265
|
+
return [2 /*return*/];
|
|
266
|
+
}
|
|
227
267
|
});
|
|
228
|
-
});
|
|
268
|
+
}); });
|
|
229
269
|
// 预览盖章签署效果
|
|
230
270
|
var viewSignPage = useMemoizedFn(function () {
|
|
231
271
|
if (!currentContractId) {
|
|
@@ -333,6 +373,32 @@ export default function useParseElectronSetting(options) {
|
|
|
333
373
|
unElectronicSealIdList: unElectronicSealIdList,
|
|
334
374
|
};
|
|
335
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* 收集当前已选的群杰印章编号
|
|
378
|
+
* 包含整体选择的群杰印章 和 单附件模式下各附件选择的群杰印章
|
|
379
|
+
*/
|
|
380
|
+
function collectQjSealNos(qunjSeal, records, fileFieldsNameRef) {
|
|
381
|
+
var _a;
|
|
382
|
+
var sealNos = new Set();
|
|
383
|
+
// 整体选择的群杰印章
|
|
384
|
+
((qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) || []).forEach(function (item) {
|
|
385
|
+
if (item === null || item === void 0 ? void 0 : item.sealNo) {
|
|
386
|
+
sealNos.add(item.sealNo + '');
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
// 单附件模式下 各附件选择的群杰印章
|
|
390
|
+
var qunjSealKey = ((_a = fileFieldsNameRef === null || fileFieldsNameRef === void 0 ? void 0 : fileFieldsNameRef.current) === null || _a === void 0 ? void 0 : _a.qunjSeal) || 'qunjSeal';
|
|
391
|
+
(records || []).forEach(function (record) {
|
|
392
|
+
var _a, _b;
|
|
393
|
+
var details = (_b = (_a = record) === null || _a === void 0 ? void 0 : _a[qunjSealKey]) === null || _b === void 0 ? void 0 : _b.details;
|
|
394
|
+
(Array.isArray(details) ? details : []).forEach(function (item) {
|
|
395
|
+
if (item === null || item === void 0 ? void 0 : item.sealNo) {
|
|
396
|
+
sealNos.add(item.sealNo + '');
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
return __spreadArray([], sealNos);
|
|
401
|
+
}
|
|
336
402
|
/** 根据文档 附件对应关系 获取已盖章的附件id列表 */
|
|
337
403
|
function getStampedAttachIdListByMap(currentDocAttachMap) {
|
|
338
404
|
if (currentDocAttachMap) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ICheckSealCoUseOptions {
|
|
2
|
+
/** 请求方法 */
|
|
3
|
+
request?: (config: any) => Promise<any>;
|
|
4
|
+
/** 已选电子印章id列表 */
|
|
5
|
+
qysSealIds?: (string | number)[];
|
|
6
|
+
/** 已选群杰印章编号列表 */
|
|
7
|
+
qjSealNos?: (string | number)[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 印章共用校验
|
|
11
|
+
* 校验当前所选的电子印章、群杰印章是否满足"必须共同使用"的要求
|
|
12
|
+
* 后端根据印章上配置的 必须共同使用的电子印章/群杰印章 统一校验
|
|
13
|
+
* @returns true 校验通过;false 校验不通过或请求失败(已有提示)
|
|
14
|
+
*/
|
|
15
|
+
export default function checkSealCoUse(options: ICheckSealCoUseOptions): Promise<boolean>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
38
|
+
import message from '../basic/message';
|
|
39
|
+
/**
|
|
40
|
+
* 印章共用校验
|
|
41
|
+
* 校验当前所选的电子印章、群杰印章是否满足"必须共同使用"的要求
|
|
42
|
+
* 后端根据印章上配置的 必须共同使用的电子印章/群杰印章 统一校验
|
|
43
|
+
* @returns true 校验通过;false 校验不通过或请求失败(已有提示)
|
|
44
|
+
*/
|
|
45
|
+
export default function checkSealCoUse(options) {
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
var _e, request, _f, qysSealIds, _g, qjSealNos, res, error_1;
|
|
49
|
+
return __generator(this, function (_h) {
|
|
50
|
+
switch (_h.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
_e = options || {}, request = _e.request, _f = _e.qysSealIds, qysSealIds = _f === void 0 ? [] : _f, _g = _e.qjSealNos, qjSealNos = _g === void 0 ? [] : _g;
|
|
53
|
+
// 没有选择任何印章时 不需要校验
|
|
54
|
+
if (qysSealIds.length === 0 && qjSealNos.length === 0) {
|
|
55
|
+
return [2 /*return*/, true];
|
|
56
|
+
}
|
|
57
|
+
_h.label = 1;
|
|
58
|
+
case 1:
|
|
59
|
+
_h.trys.push([1, 3, , 4]);
|
|
60
|
+
return [4 /*yield*/, request({
|
|
61
|
+
url: '/api/zmdms-resource/seal/check-seal-co-use',
|
|
62
|
+
method: 'POST',
|
|
63
|
+
data: {
|
|
64
|
+
qysSealIds: qysSealIds,
|
|
65
|
+
qjSealNos: qjSealNos,
|
|
66
|
+
},
|
|
67
|
+
})];
|
|
68
|
+
case 2:
|
|
69
|
+
res = _h.sent();
|
|
70
|
+
if ((res === null || res === void 0 ? void 0 : res.status) === 200 && ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.code) === 200) {
|
|
71
|
+
return [2 /*return*/, true];
|
|
72
|
+
}
|
|
73
|
+
message.warning(((_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.msg) || i18next.t('印章共同使用校验未通过!'));
|
|
74
|
+
return [2 /*return*/, false];
|
|
75
|
+
case 3:
|
|
76
|
+
error_1 = _h.sent();
|
|
77
|
+
message.error(((_d = (_c = error_1 === null || error_1 === void 0 ? void 0 : error_1.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.msg) || i18next.t('请求失败!'));
|
|
78
|
+
return [2 /*return*/, false];
|
|
79
|
+
case 4: return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|