zmdms-webui 1.3.7 → 1.3.8
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/es/electronsignatures/dgcomponents/contract-comparison.js +50 -0
- package/dist/es/electronsignatures/dgcomponents/useContractColumns.js +53 -0
- package/dist/es/electronsignatures/dgcomponents/useDg.js +57 -0
- package/dist/es/electronsignatures/electron-signatures-fragment.js +322 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-batch-download.js +370 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-detail.js +35 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-download.js +74 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-firstLevelPerson.js +17 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-item.js +21 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-list.js +42 -0
- package/dist/es/electronsignatures/electroncomponents/electron-seal-setting.js +12 -0
- package/dist/es/electronsignatures/electroncomponents/last-qys-modal.js +44 -0
- package/dist/es/electronsignatures/electroncomponents/useCheckedSealInfoList.js +43 -0
- package/dist/es/electronsignatures/electroncomponents/useElectronColumns.js +181 -0
- package/dist/es/electronsignatures/electroncomponents/useFetchElectronData.js +118 -0
- package/dist/es/electronsignatures/electroncomponents/useGetDeptInfo.js +37 -0
- package/dist/es/electronsignatures/electroncomponents/utils.js +266 -0
- package/dist/es/electronsignatures/filecomponents/file-operation.js +55 -0
- package/dist/es/electronsignatures/filecomponents/file-type-select.js +11 -0
- package/dist/es/electronsignatures/filecomponents/file-upload.js +130 -0
- package/dist/es/electronsignatures/filecomponents/fileUtils.js +38 -0
- package/dist/es/electronsignatures/filecomponents/useFetchFileTypeData.js +46 -0
- package/dist/es/electronsignatures/filecomponents/useFileColumns.js +178 -0
- package/dist/es/electronsignatures/filecomponents/useFileTypeColumns.js +76 -0
- package/dist/es/electronsignatures/hooks/useMergeRecords.js +51 -0
- package/dist/es/electronsignatures/hooks/useParseElectronListData.js +113 -0
- package/dist/es/electronsignatures/hooks/useParseElectronSetting.js +327 -0
- package/dist/es/electronsignatures/hooks/useParseIsNeedElectronData.js +111 -0
- package/dist/es/electronsignatures/hooks/useParseIsNeedQunjData.js +50 -0
- package/dist/es/electronsignatures/hooks/useParseQunjListData.js +182 -0
- package/dist/es/electronsignatures/hooks/useParseQunjSingleData.js +96 -0
- package/dist/es/electronsignatures/hooks/useParseRecords.js +141 -0
- package/dist/es/electronsignatures/index.css +1 -0
- package/dist/es/electronsignatures/index.d.ts +6 -0
- package/dist/es/electronsignatures/index.js +836 -0
- package/dist/es/electronsignatures/interface.d.ts +500 -0
- package/dist/es/electronsignatures/interface.js +53 -0
- package/dist/es/electronsignatures/qunjcomponents/code-modal.js +111 -0
- package/dist/es/electronsignatures/qunjcomponents/qunj-check.js +15 -0
- package/dist/es/electronsignatures/qunjcomponents/qunj-detail.js +65 -0
- package/dist/es/electronsignatures/qunjcomponents/qunj-list.js +121 -0
- package/dist/es/electronsignatures/qunjcomponents/useFetchQunjData.js +58 -0
- package/dist/es/electronsignatures/qunjcomponents/useQunjColumns.js +251 -0
- package/dist/es/electronsignatures/utils.js +55 -0
- package/dist/index.build.d.ts +1 -0
- package/dist/index.dark.css +1 -1
- package/dist/index.default.css +1 -1
- package/dist/index.es.js +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useMemoizedFn } from 'ahooks';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 电子印章列表选择相关数据 经过处理逻辑后 返回对应数据
|
|
6
|
+
*/
|
|
7
|
+
function useParseElectronListData(options) {
|
|
8
|
+
var isUnControlled = options.isUnControlled, onValueChange = options.onValueChange, dataType = options.dataType, electronicSealIdList = options.electronicSealIdList, isCheckedEconomic = options.isCheckedEconomic, docAttachMap = options.docAttachMap;
|
|
9
|
+
// 当前选中电子印章数据
|
|
10
|
+
var _a = useState(function () {
|
|
11
|
+
return electronicSealIdList;
|
|
12
|
+
}), currentCheckedElectronicSealIdList = _a[0], setCurrentCheckedElectronicSealIdList = _a[1];
|
|
13
|
+
// 电子印章改变时触发
|
|
14
|
+
var onElectronicSealIdChange = useMemoizedFn(function (e, isChange) {
|
|
15
|
+
var _a;
|
|
16
|
+
if (isChange === void 0) { isChange = true; }
|
|
17
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
18
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
19
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
20
|
+
// if (isUnControlled) {
|
|
21
|
+
setCurrentCheckedElectronicSealIdList(e);
|
|
22
|
+
// }
|
|
23
|
+
if (!dataType) {
|
|
24
|
+
console.log("必须传入数据类型");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (isChange) {
|
|
28
|
+
onValueChange &&
|
|
29
|
+
onValueChange((_a = {}, _a[dataType] = { electronicSealIdList: e }, _a));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
// 是否加盖责任人手签章
|
|
33
|
+
var isCheckedEconomicBoolean = isCheckedEconomic + "" === "1"; // 默认是加盖的
|
|
34
|
+
var _b = useState(function () {
|
|
35
|
+
var getEconomicBoolean = getIsCheckedEconomic(docAttachMap);
|
|
36
|
+
return getEconomicBoolean === null
|
|
37
|
+
? isCheckedEconomicBoolean
|
|
38
|
+
: getEconomicBoolean;
|
|
39
|
+
}), currentIsCheckedEconomic = _b[0], setCurrentIsCheckedEconomic = _b[1];
|
|
40
|
+
// 加盖责任人手签章改变时触发
|
|
41
|
+
var onCheckedEconomicChange = useMemoizedFn(function (e) {
|
|
42
|
+
var _a;
|
|
43
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
44
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
45
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
46
|
+
// if (isUnControlled) {
|
|
47
|
+
setCurrentIsCheckedEconomic(e.target.checked);
|
|
48
|
+
// }
|
|
49
|
+
if (!dataType) {
|
|
50
|
+
console.log("必须传入数据类型");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
onValueChange &&
|
|
54
|
+
onValueChange((_a = {},
|
|
55
|
+
_a[dataType] = { isCheckedEconomic: e.target.checked },
|
|
56
|
+
_a));
|
|
57
|
+
});
|
|
58
|
+
// 暴露一个清空内部数据的方法
|
|
59
|
+
var onClearElectronListData = useMemoizedFn(function () {
|
|
60
|
+
// if (isUnControlled) {
|
|
61
|
+
setCurrentCheckedElectronicSealIdList([]);
|
|
62
|
+
setCurrentIsCheckedEconomic(false);
|
|
63
|
+
// }
|
|
64
|
+
return {
|
|
65
|
+
electronicSealIdList: [],
|
|
66
|
+
isCheckedEconomic: false,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
71
|
+
*/
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
// if (!isUnControlled) {
|
|
74
|
+
setCurrentCheckedElectronicSealIdList(electronicSealIdList);
|
|
75
|
+
// }
|
|
76
|
+
}, [isUnControlled, electronicSealIdList]);
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
// if (!isUnControlled) {
|
|
79
|
+
var getEconomicBoolean = getIsCheckedEconomic(docAttachMap);
|
|
80
|
+
setCurrentIsCheckedEconomic(getEconomicBoolean === null
|
|
81
|
+
? isCheckedEconomicBoolean
|
|
82
|
+
: getEconomicBoolean);
|
|
83
|
+
// }
|
|
84
|
+
}, [isUnControlled, isCheckedEconomicBoolean, docAttachMap]);
|
|
85
|
+
return {
|
|
86
|
+
/** 当前选中的电子印章数据 */
|
|
87
|
+
currentCheckedElectronicSealIdList: currentCheckedElectronicSealIdList,
|
|
88
|
+
/** 电子印章更改时触发 */
|
|
89
|
+
onElectronicSealIdChange: onElectronicSealIdChange,
|
|
90
|
+
/** 当前是否需要经济责任人(一级责任人) */
|
|
91
|
+
currentIsCheckedEconomic: currentIsCheckedEconomic,
|
|
92
|
+
setCurrentIsCheckedEconomic: setCurrentIsCheckedEconomic,
|
|
93
|
+
/** 经济责任人(一级责任人)是否选中更改时触发 */
|
|
94
|
+
onCheckedEconomicChange: onCheckedEconomicChange,
|
|
95
|
+
/** 清空内部数据的方法,在某些情况下,可能要清空当前选中的电子印章数据、是否加盖一级责任人数据 */
|
|
96
|
+
onClearElectronListData: onClearElectronListData,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// 解析文档数据 判断是否需要经济责任人(一级责任人)
|
|
100
|
+
function getIsCheckedEconomic(docAttachMap) {
|
|
101
|
+
if (typeof docAttachMap === "string" && docAttachMap.length > 0) {
|
|
102
|
+
var _isEconomic = Object.entries(JSON.parse(docAttachMap)).find(function (_a) {
|
|
103
|
+
var key = _a[0]; _a[1];
|
|
104
|
+
return key === "needYjzrr";
|
|
105
|
+
});
|
|
106
|
+
if (_isEconomic) {
|
|
107
|
+
return _isEconomic[1] === "false" || !_isEconomic[1] ? false : true;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { useParseElectronListData as default };
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { unstable_batchedUpdates } from 'react-dom';
|
|
4
|
+
import { useMemoizedFn } from 'ahooks';
|
|
5
|
+
import { isFlowCompleted } from '../utils.js';
|
|
6
|
+
import { message } from 'antd';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 电子印章设置相关操作
|
|
10
|
+
*/
|
|
11
|
+
function useParseElectronSetting(options) {
|
|
12
|
+
var isUnControlled = options.isUnControlled, onValueChange = options.onValueChange, dataType = options.dataType, request = options.request, setLoading = options.setLoading, records = options.records, deptId = options.deptId, 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;
|
|
13
|
+
// 点击签署位置 实时记录点击时的印章列表
|
|
14
|
+
var _a = useState(), clickElectronicSealIdList = _a[0], setClickElectronicSealIdList = _a[1];
|
|
15
|
+
// 当前合同id数据
|
|
16
|
+
var _b = useState(function () {
|
|
17
|
+
return contractId;
|
|
18
|
+
}), currentContractId = _b[0], setCurrentContractId = _b[1];
|
|
19
|
+
// 当前合同id下 附件与文档的关联关系
|
|
20
|
+
var _c = useState(function () {
|
|
21
|
+
return docAttachMap;
|
|
22
|
+
}), currentDocAttachMap = _c[0], setCurrentDocAttachMap = _c[1];
|
|
23
|
+
// 当前文档列表数据
|
|
24
|
+
var _d = useState(function () {
|
|
25
|
+
return documentIdList;
|
|
26
|
+
}), currentDocumentIdList = _d[0], setCurrentDocumentIdList = _d[1];
|
|
27
|
+
// 未确认盖章位置的印章信息列表
|
|
28
|
+
var _e = useState([]), unElectronicSealList = _e[0], setUnElectronicSealList = _e[1];
|
|
29
|
+
var unElectronicSealIdList = useMemo(function () {
|
|
30
|
+
return unElectronicSealList.map(function (item) { return item.sealId; });
|
|
31
|
+
}, [unElectronicSealList]);
|
|
32
|
+
// 暴露一个清空内部数据的方法
|
|
33
|
+
var onClearElectronSetting = useMemoizedFn(function () {
|
|
34
|
+
// if (isUnControlled) {
|
|
35
|
+
setCurrentContractId(undefined);
|
|
36
|
+
setCurrentDocAttachMap(null);
|
|
37
|
+
setCurrentDocumentIdList([]);
|
|
38
|
+
// }
|
|
39
|
+
return {
|
|
40
|
+
contractId: undefined,
|
|
41
|
+
docAttachMap: null,
|
|
42
|
+
documentIdList: [],
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
// 指定签署位置
|
|
46
|
+
var appointSignLocation = useMemoizedFn(function (options) {
|
|
47
|
+
var _a = options || {}, callback = _a.callback, _b = _a.otherParams, otherParams = _b === void 0 ? {} : _b, isCheckUnStampedSeal = _a.isCheckUnStampedSeal, _c = _a.spinningTip, spinningTip = _c === void 0 ? "指定签署位置中..." : _c;
|
|
48
|
+
// 选出选了盖电子印章的附件数据
|
|
49
|
+
if (!Array.isArray(records)) {
|
|
50
|
+
console.log("没有选中需要盖电子印章的数据!");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// 没有选择印章
|
|
54
|
+
if (!Array.isArray(electronicSealIdList) ||
|
|
55
|
+
(electronicSealIdList === null || electronicSealIdList === void 0 ? void 0 : electronicSealIdList.length) <= 0) {
|
|
56
|
+
console.log("没有选择电子印章!");
|
|
57
|
+
message.error("没有选择需要盖章的电子印章!");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// 找到需要盖章的附件
|
|
61
|
+
var currentCheckedElectronAttachIds = [];
|
|
62
|
+
// 处理一些异常情况。有附件数据 但是没有附件id
|
|
63
|
+
var isError = false;
|
|
64
|
+
records.forEach(function (record, index) {
|
|
65
|
+
if (!record.isElectronicSeal) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!record.attachId && !isError) {
|
|
69
|
+
message.error("\u7B2C".concat(index + 1, "\u884C\u9644\u4EF6\u6CA1\u6709\u9644\u4EF6id\uFF0C\u65E0\u6CD5\u76D6\u7AE0\uFF01"));
|
|
70
|
+
isError = true;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
currentCheckedElectronAttachIds.push(record.attachId);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (isError) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
80
|
+
spinning: true,
|
|
81
|
+
tip: spinningTip,
|
|
82
|
+
});
|
|
83
|
+
var params = __assign({ attachIdList: [], sealIdList: electronicSealIdList, deleteAttachIdList: [], docAttachMap: currentDocAttachMap, deptId: deptId, needYjzrr: isCheckedEconomic }, otherParams);
|
|
84
|
+
// 更新最新的电子印章选中列表
|
|
85
|
+
var newSealIdList = params.sealIdList;
|
|
86
|
+
setClickElectronicSealIdList(newSealIdList);
|
|
87
|
+
// 盖过章的附件列表
|
|
88
|
+
var stampedAttachIdList = getStampedAttachIdListByMap(currentDocAttachMap);
|
|
89
|
+
// 这里参考之前的逻辑处理(不知道为什么这里没有处理印章逻辑 如果前后的印章不一致 应该也要重新勾选才是)
|
|
90
|
+
// (前后印章不同的逻辑 是在提交的时候处理的,会弹出一个模态框)
|
|
91
|
+
// 如果有合同id 传入合同id
|
|
92
|
+
// 有合同id 表明之前已经签署过位置了
|
|
93
|
+
// 需要处理下签署前后的附件数据
|
|
94
|
+
if (currentContractId) {
|
|
95
|
+
params.contractId = currentContractId;
|
|
96
|
+
// 找出此次新增加的附件
|
|
97
|
+
if (stampedAttachIdList.length === 0) {
|
|
98
|
+
params.attachIdList = currentCheckedElectronAttachIds;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
params.attachIdList = currentCheckedElectronAttachIds.filter(function (attachId) { return !stampedAttachIdList.includes(attachId); });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
params.attachIdList = currentCheckedElectronAttachIds;
|
|
106
|
+
}
|
|
107
|
+
// 找到需要删除的附件(之前已经盖了章的附件,但是本次没有选中盖电子印章的按钮)
|
|
108
|
+
// 已盖章的附件id列表中筛选出要删除的附件id列表
|
|
109
|
+
if (Array.isArray(stampedAttachIdList)) {
|
|
110
|
+
stampedAttachIdList.forEach(function (n) {
|
|
111
|
+
if (currentCheckedElectronAttachIds.length !== 0 &&
|
|
112
|
+
!currentCheckedElectronAttachIds.includes(n)) {
|
|
113
|
+
params.deleteAttachIdList.push(n);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
request({
|
|
118
|
+
url: "/api/zmdms-resource/seal/confirm-seal-info",
|
|
119
|
+
method: "POST",
|
|
120
|
+
timeout: 90000,
|
|
121
|
+
data: params,
|
|
122
|
+
})
|
|
123
|
+
.then(function (res) {
|
|
124
|
+
unstable_batchedUpdates(function () {
|
|
125
|
+
var _a;
|
|
126
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
127
|
+
spinning: false,
|
|
128
|
+
});
|
|
129
|
+
if (res.status === 200 &&
|
|
130
|
+
res.data.code === 200 &&
|
|
131
|
+
res.data.data.preSignUrl) {
|
|
132
|
+
// 更新一些数据
|
|
133
|
+
var newContractId = res.data.data.contractId; // 新合同id
|
|
134
|
+
var newDocAttachMap = res.data.data.docAttachMap; // 新文档对应关系(附件:合同id)
|
|
135
|
+
var newDocumentIdList = getDocumentIdListByMap(newDocAttachMap); // 新文档id列表
|
|
136
|
+
// 非受控模式 设置下内部数据
|
|
137
|
+
// 受控模式 会在effect中进行处理
|
|
138
|
+
// if (isUnControlled) {
|
|
139
|
+
setCurrentContractId(newContractId);
|
|
140
|
+
setCurrentDocAttachMap(newDocAttachMap);
|
|
141
|
+
setCurrentDocumentIdList(newDocumentIdList);
|
|
142
|
+
onElectronicSealIdChange(newSealIdList, false);
|
|
143
|
+
// }
|
|
144
|
+
if (otherParams.needYjzrr !== undefined) {
|
|
145
|
+
setCurrentIsCheckedEconomic(otherParams.needYjzrr);
|
|
146
|
+
}
|
|
147
|
+
callback === null || callback === void 0 ? void 0 : callback({
|
|
148
|
+
checkAttachIdList: currentCheckedElectronAttachIds,
|
|
149
|
+
contractId: newContractId,
|
|
150
|
+
docAttachMap: newDocAttachMap,
|
|
151
|
+
documentIdList: newDocumentIdList,
|
|
152
|
+
});
|
|
153
|
+
// 更改当前数据
|
|
154
|
+
if (dataType) {
|
|
155
|
+
onValueChange &&
|
|
156
|
+
onValueChange((_a = {},
|
|
157
|
+
_a[dataType] = {
|
|
158
|
+
checkAttachIdList: currentCheckedElectronAttachIds,
|
|
159
|
+
contractId: newContractId,
|
|
160
|
+
docAttachMap: newDocAttachMap,
|
|
161
|
+
documentIdList: newDocumentIdList,
|
|
162
|
+
// 在这里更改下是否加盖一级责任人数据
|
|
163
|
+
isCheckedEconomic: params.needYjzrr,
|
|
164
|
+
electronicSealIdList: newSealIdList,
|
|
165
|
+
},
|
|
166
|
+
_a));
|
|
167
|
+
}
|
|
168
|
+
// 需要跳转到契约锁重新指定签署位置
|
|
169
|
+
// 如果需要检测是否还有 未确认盖章位置的印章信息列表
|
|
170
|
+
if (isCheckUnStampedSeal) {
|
|
171
|
+
if (unElectronicSealList.length > 0) {
|
|
172
|
+
window.open(res.data.data.preSignUrl);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
window.open(res.data.data.preSignUrl);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
message.error(res.data.msg || "出错了");
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
})
|
|
184
|
+
.catch(function (error) {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading({
|
|
187
|
+
spinning: false,
|
|
188
|
+
});
|
|
189
|
+
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) || "请求失败!");
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
// 预览盖章签署效果
|
|
193
|
+
var viewSignPage = useMemoizedFn(function () {
|
|
194
|
+
if (!currentContractId) {
|
|
195
|
+
message.error("缺少合同id,可能的原因:暂未指定签署位置,请重新指定!");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
request({
|
|
199
|
+
url: "/api/zmdms-resource/seal/view-seal-state",
|
|
200
|
+
// 这里有一个逻辑,后端判断流程是否完结。是flowStatus === '15' 或者 canEdit === '0'
|
|
201
|
+
data: {
|
|
202
|
+
contractId: currentContractId,
|
|
203
|
+
canEdit: canEdit,
|
|
204
|
+
flowStatus: isFlowCompleted(flowStatus) ? flowStatus : "15",
|
|
205
|
+
},
|
|
206
|
+
method: "POST",
|
|
207
|
+
})
|
|
208
|
+
.then(function (res) {
|
|
209
|
+
if (res.status === 200 &&
|
|
210
|
+
res.data.code === 200 &&
|
|
211
|
+
res.data.data.viewUrl) {
|
|
212
|
+
window.open(res.data.data.viewUrl);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
message.error(res.data.msg || "出错了");
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
.catch(function (error) {
|
|
219
|
+
var _a, _b;
|
|
220
|
+
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) || "请求失败!");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
// 查询未确认盖章位置的印章信息列表
|
|
224
|
+
var checkUnStampedSealList = useMemoizedFn(function () {
|
|
225
|
+
return request({
|
|
226
|
+
url: "/api/zmdms-resource/seal/query-unconfirmed-position-seal-list",
|
|
227
|
+
data: {
|
|
228
|
+
contractId: currentContractId,
|
|
229
|
+
sealIdList: electronicSealIdList,
|
|
230
|
+
deptId: deptId,
|
|
231
|
+
needYjzrr: isCheckedEconomic,
|
|
232
|
+
},
|
|
233
|
+
method: "POST",
|
|
234
|
+
})
|
|
235
|
+
.then(function (res) {
|
|
236
|
+
var _a;
|
|
237
|
+
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) {
|
|
238
|
+
var noSealList = res.data.data;
|
|
239
|
+
if (Array.isArray(noSealList) && noSealList.length > 0) {
|
|
240
|
+
setUnElectronicSealList(noSealList);
|
|
241
|
+
return Promise.resolve(false);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return Promise.resolve(true);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
})
|
|
248
|
+
.catch(function (error) {
|
|
249
|
+
var _a, _b;
|
|
250
|
+
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) || "请求失败!");
|
|
251
|
+
return Promise.resolve(false);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
/**
|
|
255
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
256
|
+
*/
|
|
257
|
+
useEffect(function () {
|
|
258
|
+
// if (!isUnControlled) {
|
|
259
|
+
setCurrentContractId(contractId);
|
|
260
|
+
// }
|
|
261
|
+
}, [isUnControlled, contractId]);
|
|
262
|
+
useEffect(function () {
|
|
263
|
+
// if (!isUnControlled) {
|
|
264
|
+
setCurrentDocAttachMap(docAttachMap);
|
|
265
|
+
// }
|
|
266
|
+
}, [isUnControlled, docAttachMap]);
|
|
267
|
+
useEffect(function () {
|
|
268
|
+
// if (!isUnControlled) {
|
|
269
|
+
setCurrentDocumentIdList(documentIdList);
|
|
270
|
+
// }
|
|
271
|
+
}, [isUnControlled, documentIdList]);
|
|
272
|
+
return {
|
|
273
|
+
/** 点击签署位置 实时记录点击时的印章列表 */
|
|
274
|
+
clickElectronicSealIdList: clickElectronicSealIdList,
|
|
275
|
+
/** 当前合同id数据 */
|
|
276
|
+
currentContractId: currentContractId,
|
|
277
|
+
setCurrentContractId: setCurrentContractId,
|
|
278
|
+
/** 当前合同id下 附件与文档的关联关系 */
|
|
279
|
+
currentDocAttachMap: currentDocAttachMap,
|
|
280
|
+
setCurrentDocAttachMap: setCurrentDocAttachMap,
|
|
281
|
+
/** 当前文档列表数据 */
|
|
282
|
+
currentDocumentIdList: currentDocumentIdList,
|
|
283
|
+
setCurrentDocumentIdList: setCurrentDocumentIdList,
|
|
284
|
+
/** 指定签署位置 */
|
|
285
|
+
appointSignLocation: appointSignLocation,
|
|
286
|
+
/** 预览盖章效果 */
|
|
287
|
+
viewSignPage: viewSignPage,
|
|
288
|
+
/** 暴露一个清空数据的方法 */
|
|
289
|
+
onClearElectronSetting: onClearElectronSetting,
|
|
290
|
+
/** 查询未确认盖章位置的印章信息列表 */
|
|
291
|
+
checkUnStampedSealList: checkUnStampedSealList,
|
|
292
|
+
/** 未确认盖章信息的电子印章列表 */
|
|
293
|
+
unElectronicSealList: unElectronicSealList,
|
|
294
|
+
/** 未确认盖章信息的电子印章id列表 */
|
|
295
|
+
unElectronicSealIdList: unElectronicSealIdList,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/** 根据文档 附件对应关系 获取已盖章的附件id列表 */
|
|
299
|
+
function getStampedAttachIdListByMap(currentDocAttachMap) {
|
|
300
|
+
if (currentDocAttachMap) {
|
|
301
|
+
try {
|
|
302
|
+
return Object.keys(JSON.parse(currentDocAttachMap)).filter(function (key) { return key !== "needYjzrr"; });
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return [];
|
|
309
|
+
}
|
|
310
|
+
/** 根据文档 附件对应关系 获取文档id列表 */
|
|
311
|
+
function getDocumentIdListByMap(currentDocAttachMap) {
|
|
312
|
+
if (currentDocAttachMap) {
|
|
313
|
+
try {
|
|
314
|
+
var map_1 = JSON.parse(currentDocAttachMap);
|
|
315
|
+
var keys = Object.keys(map_1).filter(function (key) { return key !== "needYjzrr"; });
|
|
316
|
+
return keys.map(function (key) {
|
|
317
|
+
return map_1[key];
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
return [];
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return [];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export { useParseElectronSetting as default };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { usePrevious, useMemoizedFn } from 'ahooks';
|
|
3
|
+
import { useMemo, useEffect } from 'react';
|
|
4
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 是否需要给附件加盖电子印章
|
|
8
|
+
*/
|
|
9
|
+
function useParseIsNeedElectronData(options) {
|
|
10
|
+
var onValueChange = options.onValueChange, records = options.records, dataType = options.dataType, setRecords = options.setRecords, onClearElectronListData = options.onClearElectronListData, onClearElectronSetting = options.onClearElectronSetting, deptId = options.deptId, electronicSealIdList = options.electronicSealIdList;
|
|
11
|
+
// 20241015: 这里的逻辑是。开发首次从没数据到有数据的过程中。
|
|
12
|
+
// 部门id会发生变化。这里的部门id变化是不需要清空契约锁数据的
|
|
13
|
+
// 这个地方需要组件内部处理下这个逻辑,虽然这个逻辑很奇怪
|
|
14
|
+
var electronicSealIdListPrevious = usePrevious(electronicSealIdList, function () { return true; });
|
|
15
|
+
// 是否加盖电子印章改变时触发
|
|
16
|
+
var onIsStampElectronChange = useMemoizedFn(function (checked, index) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
19
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
20
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
21
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
22
|
+
var item = newRecords[index];
|
|
23
|
+
if (item) {
|
|
24
|
+
item.isElectronicSeal = checked ? 1 : 0;
|
|
25
|
+
// 这里的逻辑是 如果勾选了我们自己的电子印章 那么默认选中外部客户的电子印章平台
|
|
26
|
+
var defaultValue = item.defaultFmsIsElectronicSeal + "" === "1" ||
|
|
27
|
+
item.defaultFmsIsElectronicSeal + "" === "0"
|
|
28
|
+
? item.defaultFmsIsElectronicSeal
|
|
29
|
+
: 1;
|
|
30
|
+
item.fmsIsElectronicSeal = checked ? defaultValue : 0;
|
|
31
|
+
}
|
|
32
|
+
setRecords(newRecords);
|
|
33
|
+
if (!dataType) {
|
|
34
|
+
console.error("必须传入数据类型");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// 如果同类型下的 所有的附件 都没有选择加盖电子印章
|
|
38
|
+
var isStampElectron = newRecords === null || newRecords === void 0 ? void 0 : newRecords.some(function (item) { return item.isElectronicSeal + "" === "1"; });
|
|
39
|
+
if (!isStampElectron) {
|
|
40
|
+
// 那么需要清空相关数据
|
|
41
|
+
// 那么需要清空下当前选中的电子印章数据相关数据
|
|
42
|
+
// 这里会跟电子印章列表产生耦合
|
|
43
|
+
var clearElectronListData = onClearElectronListData === null || onClearElectronListData === void 0 ? void 0 : onClearElectronListData();
|
|
44
|
+
var clearElectronSetting = onClearElectronSetting === null || onClearElectronSetting === void 0 ? void 0 : onClearElectronSetting();
|
|
45
|
+
onValueChange &&
|
|
46
|
+
onValueChange((_a = {},
|
|
47
|
+
_a[dataType] = __assign(__assign({ fileList: newRecords }, clearElectronListData), clearElectronSetting),
|
|
48
|
+
_a));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
onValueChange && onValueChange((_b = {}, _b[dataType] = { fileList: newRecords }, _b));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
// 清空所有盖章数据
|
|
55
|
+
var clearAllElectronDataHandler = useMemoizedFn(function (dataType) {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
58
|
+
newRecords.forEach(function (item) {
|
|
59
|
+
if (item) {
|
|
60
|
+
item.isElectronicSeal = 0;
|
|
61
|
+
item.fmsIsElectronicSeal = 0;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
setRecords(newRecords);
|
|
65
|
+
if (!dataType) {
|
|
66
|
+
console.error("必须传入数据类型");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// 如果同类型下的 所有的附件 都没有选择加盖电子印章
|
|
70
|
+
var isStampElectron = newRecords === null || newRecords === void 0 ? void 0 : newRecords.some(function (item) { return item.isElectronicSeal + "" === "1"; });
|
|
71
|
+
if (!isStampElectron) {
|
|
72
|
+
// 那么需要清空相关数据
|
|
73
|
+
// 那么需要清空下当前选中的电子印章数据相关数据
|
|
74
|
+
// 这里会跟电子印章列表产生耦合
|
|
75
|
+
var clearElectronListData = onClearElectronListData === null || onClearElectronListData === void 0 ? void 0 : onClearElectronListData();
|
|
76
|
+
var clearElectronSetting = onClearElectronSetting === null || onClearElectronSetting === void 0 ? void 0 : onClearElectronSetting();
|
|
77
|
+
onValueChange &&
|
|
78
|
+
onValueChange((_a = {},
|
|
79
|
+
_a[dataType] = __assign(__assign({ fileList: newRecords }, clearElectronListData), clearElectronSetting),
|
|
80
|
+
_a));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
onValueChange && onValueChange((_b = {}, _b[dataType] = { fileList: newRecords }, _b));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
// 当前列表数据中 是否有选择加盖电子印章的数据
|
|
87
|
+
var isStampElectron = useMemo(function () {
|
|
88
|
+
// 找到需要盖章的附件
|
|
89
|
+
return records === null || records === void 0 ? void 0 : records.some(function (item) { return item.isElectronicSeal + "" === "1"; });
|
|
90
|
+
}, [records]);
|
|
91
|
+
// 如果部门发生改变,需要清空契约锁数据
|
|
92
|
+
// 只有当本次更新是的契约锁数据 和上次 更新时的契约锁数据一致时,才更改
|
|
93
|
+
useEffect(function () {
|
|
94
|
+
if (electronicSealIdList &&
|
|
95
|
+
electronicSealIdList === electronicSealIdListPrevious) {
|
|
96
|
+
console.log("-----修改部门id,清空契约锁数据-----");
|
|
97
|
+
clearAllElectronDataHandler(dataType);
|
|
98
|
+
}
|
|
99
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
100
|
+
}, [deptId]);
|
|
101
|
+
return {
|
|
102
|
+
/** 是否加盖电子印章改变时触发 */
|
|
103
|
+
onIsStampElectronChange: onIsStampElectronChange,
|
|
104
|
+
/** 当前列表数据中 是否有选择加盖电子印章的数据 */
|
|
105
|
+
isStampElectron: isStampElectron,
|
|
106
|
+
/** 清空数据 */
|
|
107
|
+
clearAllElectronDataHandler: clearAllElectronDataHandler,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { useParseIsNeedElectronData as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useMemoizedFn } from 'ahooks';
|
|
2
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 是否需要给附件加盖群杰印章
|
|
6
|
+
*/
|
|
7
|
+
function useParseIsNeedQunjData(options) {
|
|
8
|
+
var onValueChange = options.onValueChange, records = options.records, dataType = options.dataType, setRecords = options.setRecords, fileFieldsNameRef = options.fileFieldsNameRef;
|
|
9
|
+
var _a = (fileFieldsNameRef === null || fileFieldsNameRef === void 0 ? void 0 : fileFieldsNameRef.current) || {}, isQunj = _a.isQunj, qunjAddress = _a.qunjAddress, qunjSeal = _a.qunjSeal;
|
|
10
|
+
// 是否加盖群杰印章改变时触发
|
|
11
|
+
var onIsStampQunjChange = useMemoizedFn(function (checked, index) {
|
|
12
|
+
var _a;
|
|
13
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
14
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
15
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
16
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
17
|
+
var item = newRecords[index];
|
|
18
|
+
if (item && isQunj) {
|
|
19
|
+
item[isQunj] = checked ? 1 : 0;
|
|
20
|
+
// 如果不盖群杰印章是否需要,清空已选择的群杰印章信息?
|
|
21
|
+
// 这里如果做简单一点,直接清空就好,不会出错。
|
|
22
|
+
// 最好的做法就是获取数据、提交数据的时候判断需不需要清空。这里简单做法,如果不盖直接清空
|
|
23
|
+
if (!checked && qunjAddress && qunjSeal) {
|
|
24
|
+
item[qunjAddress] = null;
|
|
25
|
+
item[qunjSeal] = null;
|
|
26
|
+
}
|
|
27
|
+
if (checked &&
|
|
28
|
+
qunjSeal &&
|
|
29
|
+
(!item[qunjSeal] || !Reflect.has(item[qunjSeal], "isTakeOut"))) {
|
|
30
|
+
if (!item[qunjSeal]) {
|
|
31
|
+
item[qunjSeal] = {};
|
|
32
|
+
}
|
|
33
|
+
item[qunjSeal].isTakeOut = 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
setRecords(newRecords);
|
|
37
|
+
if (!dataType) {
|
|
38
|
+
console.error("必须传入数据类型");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// 通知数据更新
|
|
42
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
/** 是否加盖群杰印章改变时触发 */
|
|
46
|
+
onIsStampQunjChange: onIsStampQunjChange,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { useParseIsNeedQunjData as default };
|