ztxkui 10.0.95 → 10.0.97
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/TranslationButton/DownFile.d.ts +7 -0
- package/dist/components/TranslationButton/DownFile.js +97 -0
- package/dist/components/TranslationButton/PreviewFile.d.ts +5 -0
- package/dist/components/TranslationButton/PreviewFile.js +75 -0
- package/dist/components/TranslationButton/TranslationButton.d.ts +34 -0
- package/dist/components/TranslationButton/TranslationButton.js +247 -0
- package/dist/components/TranslationButton/demoComponents/index.d.ts +3 -0
- package/dist/components/TranslationButton/demoComponents/index.js +9 -0
- package/dist/components/TranslationButton/hooks.d.ts +8 -0
- package/dist/components/TranslationButton/hooks.js +143 -0
- package/dist/components/TranslationButton/index.d.ts +4 -0
- package/dist/components/TranslationButton/index.js +4 -0
- package/dist/components/Upload/utils.d.ts +8 -1
- package/dist/components/Upload/utils.js +56 -4
- package/dist/components/UploadCustom/hooks/useDg.d.ts +6 -0
- package/dist/components/UploadCustom/hooks/useDg.js +57 -0
- package/dist/components/business/Signatures/components/CodeModal.d.ts +3 -0
- package/dist/components/business/Signatures/components/CodeModal.js +159 -0
- package/dist/components/electron-signatures/content.d.ts +9 -0
- package/dist/components/electron-signatures/content.js +1126 -0
- package/dist/components/electron-signatures/demoComponents/data.d.ts +58 -0
- package/dist/components/electron-signatures/demoComponents/data.js +1307 -0
- package/dist/components/electron-signatures/demoComponents/detail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/detail.js +283 -0
- package/dist/components/electron-signatures/demoComponents/index.d.ts +2 -0
- package/dist/components/electron-signatures/demoComponents/index.js +27 -0
- package/dist/components/electron-signatures/demoComponents/index_old.d.ts +3 -0
- package/dist/components/electron-signatures/demoComponents/index_old.js +502 -0
- package/dist/components/electron-signatures/demoComponents/jgqrd.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/jgqrd.js +135 -0
- package/dist/components/electron-signatures/demoComponents/making.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/making.js +211 -0
- package/dist/components/electron-signatures/demoComponents/makingData.d.ts +663 -0
- package/dist/components/electron-signatures/demoComponents/makingData.js +1164 -0
- package/dist/components/electron-signatures/demoComponents/newDetail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/newDetail.js +283 -0
- package/dist/components/electron-signatures/demoComponents/preview.d.ts +3 -0
- package/dist/components/electron-signatures/demoComponents/preview.js +9 -0
- package/dist/components/electron-signatures/demoComponents/singleQjDetail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/singleQjDetail.js +530 -0
- package/dist/components/electron-signatures/demoComponents/singleQjMaking.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/singleQjMaking.js +219 -0
- package/dist/components/electron-signatures/demoComponents/test.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/test.js +119 -0
- package/dist/components/electron-signatures/dgComponents/contract-comparison.d.ts +39 -0
- package/dist/components/electron-signatures/dgComponents/contract-comparison.js +53 -0
- package/dist/components/electron-signatures/dgComponents/file-comparison-btn.d.ts +11 -0
- package/dist/components/electron-signatures/dgComponents/file-comparison-btn.js +180 -0
- package/dist/components/electron-signatures/dgComponents/new-contract-comparison.d.ts +45 -0
- package/dist/components/electron-signatures/dgComponents/new-contract-comparison.js +68 -0
- package/dist/components/electron-signatures/dgComponents/useContractColumns.d.ts +21 -0
- package/dist/components/electron-signatures/dgComponents/useContractColumns.js +171 -0
- package/dist/components/electron-signatures/electron-signatures-fragment.d.ts +8 -0
- package/dist/components/electron-signatures/electron-signatures-fragment.js +344 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.d.ts +52 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.js +513 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-detail.d.ts +8 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-detail.js +59 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-download.d.ts +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-download.js +89 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.d.ts +9 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.js +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.d.ts +15 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.js +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item.d.ts +20 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item.js +47 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-list.d.ts +11 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-list.js +191 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-setting.d.ts +15 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-setting.js +10 -0
- package/dist/components/electron-signatures/electronComponents/last-qys-modal.d.ts +7 -0
- package/dist/components/electron-signatures/electronComponents/last-qys-modal.js +42 -0
- package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.d.ts +3 -0
- package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.js +45 -0
- package/dist/components/electron-signatures/electronComponents/useElectronColumns.d.ts +30 -0
- package/dist/components/electron-signatures/electronComponents/useElectronColumns.js +380 -0
- package/dist/components/electron-signatures/electronComponents/useFetchElectronData.d.ts +20 -0
- package/dist/components/electron-signatures/electronComponents/useFetchElectronData.js +169 -0
- package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.d.ts +3 -0
- package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.js +38 -0
- package/dist/components/electron-signatures/fileComponents/file-operation.d.ts +7 -0
- package/dist/components/electron-signatures/fileComponents/file-operation.js +67 -0
- package/dist/components/electron-signatures/fileComponents/file-type-select.d.ts +12 -0
- package/dist/components/electron-signatures/fileComponents/file-type-select.js +10 -0
- package/dist/components/electron-signatures/fileComponents/file-upload.d.ts +11 -0
- package/dist/components/electron-signatures/fileComponents/file-upload.js +146 -0
- package/dist/components/electron-signatures/fileComponents/fileUtils.d.ts +17 -0
- package/dist/components/electron-signatures/fileComponents/fileUtils.js +36 -0
- package/dist/components/electron-signatures/fileComponents/new-file-operation.d.ts +10 -0
- package/dist/components/electron-signatures/fileComponents/new-file-operation.js +73 -0
- package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.d.ts +13 -0
- package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.js +45 -0
- package/dist/components/electron-signatures/fileComponents/useFileColumns.d.ts +38 -0
- package/dist/components/electron-signatures/fileComponents/useFileColumns.js +329 -0
- package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.d.ts +19 -0
- package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.js +72 -0
- package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.d.ts +30 -0
- package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.js +134 -0
- package/dist/components/electron-signatures/hooks/useMergeRecords.d.ts +17 -0
- package/dist/components/electron-signatures/hooks/useMergeRecords.js +49 -0
- package/dist/components/electron-signatures/hooks/useParseElectronListData.d.ts +49 -0
- package/dist/components/electron-signatures/hooks/useParseElectronListData.js +111 -0
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.d.ts +102 -0
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.js +365 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.d.ts +40 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.js +139 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.d.ts +36 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.js +48 -0
- package/dist/components/electron-signatures/hooks/useParseQunjListData.d.ts +56 -0
- package/dist/components/electron-signatures/hooks/useParseQunjListData.js +204 -0
- package/dist/components/electron-signatures/hooks/useParseQunjSingleData.d.ts +34 -0
- package/dist/components/electron-signatures/hooks/useParseQunjSingleData.js +110 -0
- package/dist/components/electron-signatures/hooks/useParseRecords.d.ts +65 -0
- package/dist/components/electron-signatures/hooks/useParseRecords.js +165 -0
- package/dist/components/electron-signatures/index.d.ts +13 -0
- package/dist/components/electron-signatures/index.js +54 -0
- package/dist/components/electron-signatures/index_old.d.ts +9 -0
- package/dist/components/electron-signatures/index_old.js +966 -0
- package/dist/components/electron-signatures/interface.d.ts +849 -0
- package/dist/components/electron-signatures/interface.js +57 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-apply.d.ts +6 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-apply.js +8 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-check.d.ts +21 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-check.js +41 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-detail.d.ts +35 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-detail.js +267 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-list.d.ts +24 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-list.js +346 -0
- package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.d.ts +20 -0
- package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.js +63 -0
- package/dist/components/electron-signatures/qunjComponents/useQunjColumns.d.ts +36 -0
- package/dist/components/electron-signatures/qunjComponents/useQunjColumns.js +321 -0
- package/dist/components/electron-signatures/translateComponents/TranslateButton.d.ts +10 -0
- package/dist/components/electron-signatures/translateComponents/TranslateButton.js +44 -0
- package/dist/components/electron-signatures/translateComponents/useTranslateCom.d.ts +22 -0
- package/dist/components/electron-signatures/translateComponents/useTranslateCom.js +50 -0
- package/dist/components/electron-signatures/utils.d.ts +26 -0
- package/dist/components/electron-signatures/utils.js +67 -0
- package/dist/components/utils/ZtxkContext.d.ts +16 -0
- package/dist/components/utils/ZtxkContext.js +4 -0
- package/dist/components/utils/useMemoizedFn.d.ts +6 -0
- package/dist/components/utils/useMemoizedFn.js +22 -0
- package/dist/components/utils/usePrevious.d.ts +3 -0
- package/dist/components/utils/usePrevious.js +13 -0
- package/dist/index.css +686 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +105 -87
- package/dist/request.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
13
|
+
import useMemoizedFn from '../../utils/useMemoizedFn';
|
|
14
|
+
import usePrevious from '../../utils/usePrevious';
|
|
15
|
+
import { useEffect, useMemo } from 'react';
|
|
16
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
17
|
+
/**
|
|
18
|
+
* 是否需要给附件加盖电子印章
|
|
19
|
+
*/
|
|
20
|
+
export default function useParseIsNeedElectronData(options) {
|
|
21
|
+
var onValueChange = options.onValueChange, records = options.records, dataType = options.dataType, setRecords = options.setRecords, onClearElectronListData = options.onClearElectronListData, onClearElectronSetting = options.onClearElectronSetting, deptId = options.deptId, secondDepId = options.secondDepId, electronicSealIdList = options.electronicSealIdList;
|
|
22
|
+
// 20241015: 这里的逻辑是。开发首次从没数据到有数据的过程中。
|
|
23
|
+
// 部门id会发生变化。这里的部门id变化是不需要清空契约锁数据的
|
|
24
|
+
// 这个地方需要组件内部处理下这个逻辑,虽然这个逻辑很奇怪
|
|
25
|
+
var electronicSealIdListPrevious = usePrevious(electronicSealIdList, function () { return true; });
|
|
26
|
+
// 是否加盖电子印章改变时触发
|
|
27
|
+
var onIsStampElectronChange = useMemoizedFn(function (checked, index) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
30
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
31
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
32
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
33
|
+
var item = newRecords[index];
|
|
34
|
+
if (item) {
|
|
35
|
+
item.isElectronicSeal = checked ? 1 : 0;
|
|
36
|
+
// 这里的逻辑是 如果勾选了我们自己的电子印章 那么默认选中外部客户的电子印章平台
|
|
37
|
+
var defaultValue = item.defaultFmsIsElectronicSeal + '' === '1' ||
|
|
38
|
+
item.defaultFmsIsElectronicSeal + '' === '0'
|
|
39
|
+
? item.defaultFmsIsElectronicSeal
|
|
40
|
+
: 1;
|
|
41
|
+
item.fmsIsElectronicSeal = checked ? defaultValue : 0;
|
|
42
|
+
// 20250422 盖户用合同章的逻辑与盖电子印章的逻辑互斥。
|
|
43
|
+
// 这里的逻辑是 如果勾选了我们自己的电子印章 那么默认不选中盖户用合同章
|
|
44
|
+
// const defaultOpeningContractSealValue =
|
|
45
|
+
// item.defaultOpeningContractSeal + '' === '1' ||
|
|
46
|
+
// item.defaultOpeningContractSeal + '' === '0'
|
|
47
|
+
// ? item.defaultOpeningContractSeal
|
|
48
|
+
// : 0;
|
|
49
|
+
// item.openingContractSeal = checked ? defaultOpeningContractSealValue : 0;
|
|
50
|
+
if (checked) {
|
|
51
|
+
item.openingContractSeal = 0;
|
|
52
|
+
}
|
|
53
|
+
// 这里的逻辑是 如果勾选了我们自己的电子印章 那么默认不选中推送银行
|
|
54
|
+
var defaultFmsIsPushBankValue = item.defaultFmsIsPushBank + '' === '1' ||
|
|
55
|
+
item.defaultFmsIsPushBank + '' === '0'
|
|
56
|
+
? item.defaultFmsIsPushBank
|
|
57
|
+
: 0;
|
|
58
|
+
item.fmsIsPushBank = checked ? defaultFmsIsPushBankValue : 0;
|
|
59
|
+
}
|
|
60
|
+
setRecords(newRecords);
|
|
61
|
+
if (!dataType) {
|
|
62
|
+
console.error(i18next.t('必须传入数据类型'));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// 如果同类型下的 所有的附件 都没有选择加盖电子印章
|
|
66
|
+
var isStampElectron = newRecords === null || newRecords === void 0 ? void 0 : newRecords.some(function (item) { return item.isElectronicSeal + '' === '1'; });
|
|
67
|
+
if (!isStampElectron) {
|
|
68
|
+
// 那么需要清空相关数据
|
|
69
|
+
// 那么需要清空下当前选中的电子印章数据相关数据
|
|
70
|
+
// 这里会跟电子印章列表产生耦合
|
|
71
|
+
var clearElectronListData = onClearElectronListData === null || onClearElectronListData === void 0 ? void 0 : onClearElectronListData();
|
|
72
|
+
var clearElectronSetting = onClearElectronSetting === null || onClearElectronSetting === void 0 ? void 0 : onClearElectronSetting();
|
|
73
|
+
onValueChange &&
|
|
74
|
+
onValueChange((_a = {},
|
|
75
|
+
_a[dataType] = __assign(__assign({ fileList: newRecords }, clearElectronListData), clearElectronSetting),
|
|
76
|
+
_a));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
onValueChange && onValueChange((_b = {}, _b[dataType] = { fileList: newRecords }, _b));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// 清空所有盖章数据
|
|
83
|
+
var clearAllElectronDataHandler = useMemoizedFn(function (dataType) {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
86
|
+
newRecords.forEach(function (item) {
|
|
87
|
+
if (item) {
|
|
88
|
+
item.isElectronicSeal = 0;
|
|
89
|
+
item.fmsIsElectronicSeal = 0;
|
|
90
|
+
item.openingContractSeal = 0;
|
|
91
|
+
item.fmsIsPushBank = 0;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
setRecords(newRecords);
|
|
95
|
+
if (!dataType) {
|
|
96
|
+
console.error(i18next.t('必须传入数据类型'));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// 如果同类型下的 所有的附件 都没有选择加盖电子印章
|
|
100
|
+
var isStampElectron = newRecords === null || newRecords === void 0 ? void 0 : newRecords.some(function (item) { return item.isElectronicSeal + '' === '1'; });
|
|
101
|
+
if (!isStampElectron) {
|
|
102
|
+
// 那么需要清空相关数据
|
|
103
|
+
// 那么需要清空下当前选中的电子印章数据相关数据
|
|
104
|
+
// 这里会跟电子印章列表产生耦合
|
|
105
|
+
var clearElectronListData = onClearElectronListData === null || onClearElectronListData === void 0 ? void 0 : onClearElectronListData();
|
|
106
|
+
var clearElectronSetting = onClearElectronSetting === null || onClearElectronSetting === void 0 ? void 0 : onClearElectronSetting();
|
|
107
|
+
onValueChange &&
|
|
108
|
+
onValueChange((_a = {},
|
|
109
|
+
_a[dataType] = __assign(__assign({ fileList: newRecords }, clearElectronListData), clearElectronSetting),
|
|
110
|
+
_a));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
onValueChange && onValueChange((_b = {}, _b[dataType] = { fileList: newRecords }, _b));
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
// 当前列表数据中 是否有选择加盖电子印章的数据
|
|
117
|
+
var isStampElectron = useMemo(function () {
|
|
118
|
+
// 找到需要盖章的附件
|
|
119
|
+
return records === null || records === void 0 ? void 0 : records.some(function (item) { return item.isElectronicSeal + '' === '1'; });
|
|
120
|
+
}, [records]);
|
|
121
|
+
// 如果部门发生改变,需要清空契约锁数据
|
|
122
|
+
// 只有当本次更新是的契约锁数据 和上次 更新时的契约锁数据一致时,才更改
|
|
123
|
+
useEffect(function () {
|
|
124
|
+
if (electronicSealIdList &&
|
|
125
|
+
electronicSealIdList === electronicSealIdListPrevious) {
|
|
126
|
+
console.log(i18next.t('-----修改部门id,清空契约锁数据-----'));
|
|
127
|
+
clearAllElectronDataHandler(dataType);
|
|
128
|
+
}
|
|
129
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
+
}, [deptId, secondDepId]);
|
|
131
|
+
return {
|
|
132
|
+
/** 是否加盖电子印章改变时触发 */
|
|
133
|
+
onIsStampElectronChange: onIsStampElectronChange,
|
|
134
|
+
/** 当前列表数据中 是否有选择加盖电子印章的数据 */
|
|
135
|
+
isStampElectron: isStampElectron,
|
|
136
|
+
/** 清空数据 */
|
|
137
|
+
clearAllElectronDataHandler: clearAllElectronDataHandler,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 群杰印章单体逻辑
|
|
3
|
+
*/
|
|
4
|
+
import { IElectronSignaturesProps, IElectronSignaturesItem, IFileFieldsName } from '../interface';
|
|
5
|
+
interface IOptions {
|
|
6
|
+
/**
|
|
7
|
+
* 是否开启非受控模式
|
|
8
|
+
* 非受控模式开启后,数值的改变交由内部控制。外部只需要在合适的时机 获取数据即可
|
|
9
|
+
*/
|
|
10
|
+
isUnControlled?: IElectronSignaturesProps['isUnControlled'];
|
|
11
|
+
/**
|
|
12
|
+
* 触发外部onChange事件
|
|
13
|
+
*/
|
|
14
|
+
onValueChange?: IElectronSignaturesItem['onValueChange'];
|
|
15
|
+
/**
|
|
16
|
+
* 当前数据类型
|
|
17
|
+
*/
|
|
18
|
+
dataType?: IElectronSignaturesItem['dataType'];
|
|
19
|
+
/**
|
|
20
|
+
* 新附件
|
|
21
|
+
*/
|
|
22
|
+
records?: IElectronSignaturesItem['fileList'];
|
|
23
|
+
setRecords?: any;
|
|
24
|
+
/** 字段列表 */
|
|
25
|
+
fileFieldsNameRef: {
|
|
26
|
+
current: IFileFieldsName;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 是否需要给附件加盖群杰印章
|
|
31
|
+
*/
|
|
32
|
+
export default function useParseIsNeedQunjData(options: IOptions): {
|
|
33
|
+
/** 是否加盖群杰印章改变时触发 */
|
|
34
|
+
onIsStampQunjChange: (this: any, checked: any, index: any) => void;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
2
|
+
import useMemoizedFn from '../../utils/useMemoizedFn';
|
|
3
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
4
|
+
/**
|
|
5
|
+
* 是否需要给附件加盖群杰印章
|
|
6
|
+
*/
|
|
7
|
+
export default 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(i18next.t('必须传入数据类型'));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// 通知数据更新
|
|
42
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
/** 是否加盖群杰印章改变时触发 */
|
|
46
|
+
onIsStampQunjChange: onIsStampQunjChange,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IElectronSignaturesProps, IElectronSignaturesItem, IQunjProps, IElectronSignaturesItemPublic } from '../interface';
|
|
2
|
+
interface IOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 是否开启非受控模式
|
|
5
|
+
* 非受控模式开启后,数值的改变交由内部控制。外部只需要在合适的时机 获取数据即可
|
|
6
|
+
*/
|
|
7
|
+
isUnControlled?: IElectronSignaturesProps['isUnControlled'];
|
|
8
|
+
/**
|
|
9
|
+
* 触发外部onChange事件
|
|
10
|
+
*/
|
|
11
|
+
onValueChange?: IElectronSignaturesItem['onValueChange'];
|
|
12
|
+
/**
|
|
13
|
+
* 当前数据类型
|
|
14
|
+
*/
|
|
15
|
+
dataType?: IElectronSignaturesItem['dataType'];
|
|
16
|
+
/**
|
|
17
|
+
* 当前选中的群杰物理章相关数据
|
|
18
|
+
*/
|
|
19
|
+
qunjSeal?: IElectronSignaturesItem['qunjSeal'];
|
|
20
|
+
/**
|
|
21
|
+
* 当前选中的群杰印章盖章地址
|
|
22
|
+
*/
|
|
23
|
+
qunjAddress?: IElectronSignaturesItem['qunjAddress'];
|
|
24
|
+
/**
|
|
25
|
+
* 部门id
|
|
26
|
+
*/
|
|
27
|
+
deptId?: IElectronSignaturesItem['deptId'];
|
|
28
|
+
/**
|
|
29
|
+
* 流程id
|
|
30
|
+
*/
|
|
31
|
+
flowId?: IElectronSignaturesItem['flowId'];
|
|
32
|
+
/**
|
|
33
|
+
* 需要显示合同份数的流程id列表
|
|
34
|
+
* 群杰物理章那里 是否需要计算每个印章的用印次数 不能大于合同总份数的 多少倍
|
|
35
|
+
*/
|
|
36
|
+
contractNumFlowIds?: IElectronSignaturesProps['contractNumFlowIds'];
|
|
37
|
+
/** 默认是否勾选群杰印章-用印申请 */
|
|
38
|
+
isDefaultQunj?: IElectronSignaturesItem['isDefaultQunj'];
|
|
39
|
+
isSingleQj?: IElectronSignaturesItemPublic['isSingleQj'];
|
|
40
|
+
}
|
|
41
|
+
export default function useParseQunjListData(options: IOptions): {
|
|
42
|
+
currentQunjSeal: IQunjProps;
|
|
43
|
+
onQunjSealChange: (info: IQunjProps) => void;
|
|
44
|
+
/** 当前是否显示合同份数 */
|
|
45
|
+
isContranctNum: boolean;
|
|
46
|
+
qunjChecked: boolean;
|
|
47
|
+
setQunjChecked: (checked: boolean) => void;
|
|
48
|
+
currentQunjAddress: any;
|
|
49
|
+
onQunjAddressChange: (info: any, option?: any) => void;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 用印次数是否合理
|
|
53
|
+
* 返回 true 合理 返回false 不合理
|
|
54
|
+
*/
|
|
55
|
+
export declare function countIsValidate(qunjSeal: IQunjProps, isAlert?: boolean): boolean;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
13
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
14
|
+
import { message } from '../../../index';
|
|
15
|
+
import useMemoizedFn from '../../utils/useMemoizedFn';
|
|
16
|
+
import usePrevious from '../../utils/usePrevious';
|
|
17
|
+
import { FLOW_IDS } from '../utils';
|
|
18
|
+
export default function useParseQunjListData(options) {
|
|
19
|
+
var isUnControlled = options.isUnControlled, onValueChange = options.onValueChange, dataType = options.dataType, qunjSeal = options.qunjSeal, deptId = options.deptId, flowId = options.flowId, _a = options.contractNumFlowIds, contractNumFlowIds = _a === void 0 ? FLOW_IDS : _a, _b = options.isDefaultQunj, isDefaultQunj = _b === void 0 ? true : _b, qunjAddress = options.qunjAddress, isSingleQj = options.isSingleQj;
|
|
20
|
+
/**
|
|
21
|
+
* 当前是否显示合同份数
|
|
22
|
+
* 采购合同 销售合同 双边合同 部门间交易合同 需要展示合同份数 其他的不需要
|
|
23
|
+
*/
|
|
24
|
+
var isContranctNum = useMemo(function () {
|
|
25
|
+
return contractNumFlowIds.includes("" + flowId);
|
|
26
|
+
}, [contractNumFlowIds, flowId]);
|
|
27
|
+
/**
|
|
28
|
+
* 当前盖章地点选择
|
|
29
|
+
*/
|
|
30
|
+
var _c = useState(function () {
|
|
31
|
+
return qunjAddress;
|
|
32
|
+
}), currentQunjAddress = _c[0], setCurrentQunjAddress = _c[1];
|
|
33
|
+
// 盖章地点改变
|
|
34
|
+
var onQunjAddressChange = useMemoizedFn(function (info, option) {
|
|
35
|
+
var _a;
|
|
36
|
+
// if (isUnControlled) {
|
|
37
|
+
setCurrentQunjAddress(info);
|
|
38
|
+
// }
|
|
39
|
+
if (!dataType) {
|
|
40
|
+
console.log(i18next.t('必须传入数据类型'));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
var _b = (option || {}).qunjSeal, qunjSeal = _b === void 0 ? {} : _b;
|
|
44
|
+
onValueChange &&
|
|
45
|
+
onValueChange((_a = {},
|
|
46
|
+
_a[dataType] = {
|
|
47
|
+
qunjAddress: info,
|
|
48
|
+
qunjSeal: __assign(__assign({}, currentQunjSeal), qunjSeal),
|
|
49
|
+
},
|
|
50
|
+
_a));
|
|
51
|
+
});
|
|
52
|
+
// 当前选中的群杰物理章相关数据
|
|
53
|
+
var _d = useState(function () {
|
|
54
|
+
// 群杰默认选中内部用印 20241014
|
|
55
|
+
return qunjSeal ? qunjSeal : isDefaultQunj ? { isTakeOut: 0 } : qunjSeal;
|
|
56
|
+
}), currentQunjSeal = _d[0], setCurrentQunjSeal = _d[1];
|
|
57
|
+
// 当前是否勾选了群杰印章-用印申请
|
|
58
|
+
var _e = useState(function () {
|
|
59
|
+
return isDefaultQunj;
|
|
60
|
+
}), qunjChecked = _e[0], _setQunjChecked = _e[1];
|
|
61
|
+
// 手动切换群杰印章-用印申请
|
|
62
|
+
var setQunjChecked = useMemoizedFn(function (checked) {
|
|
63
|
+
var qunjProps = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
64
|
+
if (!checked) {
|
|
65
|
+
qunjProps.contranctNum = null;
|
|
66
|
+
}
|
|
67
|
+
_setQunjChecked(checked);
|
|
68
|
+
onQunjSealChange(qunjProps);
|
|
69
|
+
});
|
|
70
|
+
// 群杰物理章改变时触发
|
|
71
|
+
var onQunjSealChange = useMemoizedFn(function (info) {
|
|
72
|
+
var _a;
|
|
73
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
74
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
75
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
76
|
+
var newQunjSeal = __assign(__assign({}, currentQunjSeal), info);
|
|
77
|
+
// 判断用印次数 是否合理
|
|
78
|
+
var qunjCountIsValidate = true;
|
|
79
|
+
if (isContranctNum) {
|
|
80
|
+
qunjCountIsValidate = countIsValidate(newQunjSeal);
|
|
81
|
+
}
|
|
82
|
+
// if (isUnControlled) {
|
|
83
|
+
setCurrentQunjSeal(newQunjSeal);
|
|
84
|
+
// }
|
|
85
|
+
if (!dataType) {
|
|
86
|
+
console.log(i18next.t('必须传入数据类型'));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var newData = { qunjSeal: newQunjSeal, qunjCountIsValidate: qunjCountIsValidate };
|
|
90
|
+
// 如果是内部用印,那清楚选中的盖章地点数据
|
|
91
|
+
if (newQunjSeal.isTakeOut + '' === '0') {
|
|
92
|
+
newData.qunjAddress = null;
|
|
93
|
+
}
|
|
94
|
+
onValueChange &&
|
|
95
|
+
onValueChange((_a = {},
|
|
96
|
+
_a[dataType] = newData,
|
|
97
|
+
_a));
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
101
|
+
*/
|
|
102
|
+
useEffect(function () {
|
|
103
|
+
var _a;
|
|
104
|
+
// if (!isUnControlled) {
|
|
105
|
+
// 群杰默认选中内部用印 20241014
|
|
106
|
+
var newQunjSeal = qunjSeal
|
|
107
|
+
? qunjSeal
|
|
108
|
+
: isDefaultQunj
|
|
109
|
+
? { isTakeOut: 0 }
|
|
110
|
+
: qunjSeal;
|
|
111
|
+
setCurrentQunjSeal(newQunjSeal);
|
|
112
|
+
// 如果数据源中,群杰数据有值,那么需要默认勾选群杰章
|
|
113
|
+
// 这里去掉qunjSeal?.details 的逻辑会导致报错 不太理解为什么
|
|
114
|
+
if (Array.isArray(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
|
|
115
|
+
(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
|
|
116
|
+
((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
117
|
+
_setQunjChecked(true);
|
|
118
|
+
}
|
|
119
|
+
// }
|
|
120
|
+
}, [isUnControlled, qunjSeal, isDefaultQunj]);
|
|
121
|
+
/**
|
|
122
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
123
|
+
*/
|
|
124
|
+
useEffect(function () {
|
|
125
|
+
// if (!isUnControlled) {
|
|
126
|
+
setCurrentQunjAddress(qunjAddress);
|
|
127
|
+
// }
|
|
128
|
+
}, [isUnControlled, qunjAddress]);
|
|
129
|
+
// 监听是否选中群杰印章-用印申请 做一些数据处理
|
|
130
|
+
useEffect(function () {
|
|
131
|
+
if (!qunjChecked) {
|
|
132
|
+
// 需要把印章相关信息清空掉
|
|
133
|
+
}
|
|
134
|
+
}, [qunjChecked]);
|
|
135
|
+
// 20241015: 这里的逻辑是。开发首次从没数据到有数据的过程中。
|
|
136
|
+
// 部门id会发生变化。这里的部门id变化是不需要清空契约锁数据的
|
|
137
|
+
// 这个地方需要组件内部处理下这个逻辑,虽然这个逻辑很奇怪
|
|
138
|
+
var qunjSealPrevious = usePrevious(qunjSeal, function () { return true; });
|
|
139
|
+
// 监听流程id改变时,清空群杰印章信息
|
|
140
|
+
// 只有当本次更新的群杰数据 和上次 更新时的群杰数据一致时,才更改
|
|
141
|
+
useEffect(function () {
|
|
142
|
+
if (!isSingleQj && qunjSeal && qunjSeal === qunjSealPrevious) {
|
|
143
|
+
console.log(i18next.t('-----修改流程id,清空契约锁数据-----'));
|
|
144
|
+
var qunjProps = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
145
|
+
onQunjSealChange(qunjProps);
|
|
146
|
+
}
|
|
147
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
148
|
+
}, [flowId]);
|
|
149
|
+
// 监听部门id改变时,清空群杰印章信息(部门变了 印章列表会重新拉取 已选的群杰章需要一并清空)
|
|
150
|
+
// 只有当本次更新的群杰数据 和上次 更新时的群杰数据一致时,才更改
|
|
151
|
+
useEffect(function () {
|
|
152
|
+
if (!isSingleQj && qunjSeal && qunjSeal === qunjSealPrevious) {
|
|
153
|
+
console.log(i18next.t('-----修改部门id,清空群杰印章数据-----'));
|
|
154
|
+
var qunjProps = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
155
|
+
onQunjSealChange(qunjProps);
|
|
156
|
+
}
|
|
157
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
158
|
+
}, [deptId]);
|
|
159
|
+
return {
|
|
160
|
+
currentQunjSeal: currentQunjSeal,
|
|
161
|
+
onQunjSealChange: onQunjSealChange,
|
|
162
|
+
/** 当前是否显示合同份数 */
|
|
163
|
+
isContranctNum: isContranctNum,
|
|
164
|
+
qunjChecked: qunjChecked,
|
|
165
|
+
setQunjChecked: setQunjChecked,
|
|
166
|
+
currentQunjAddress: currentQunjAddress,
|
|
167
|
+
onQunjAddressChange: onQunjAddressChange,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 用印次数是否合理
|
|
172
|
+
* 返回 true 合理 返回false 不合理
|
|
173
|
+
*/
|
|
174
|
+
export function countIsValidate(qunjSeal, isAlert) {
|
|
175
|
+
var _a;
|
|
176
|
+
if (isAlert === void 0) { isAlert = true; }
|
|
177
|
+
if (!qunjSeal) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
var contractNum = (qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.contranctNum) || 1; // 总份数
|
|
181
|
+
var totalSealNum = 0; // 使用份数
|
|
182
|
+
(_a = qunjSeal.details) === null || _a === void 0 ? void 0 : _a.forEach(function (detail) {
|
|
183
|
+
totalSealNum += detail.sealCount || 0;
|
|
184
|
+
});
|
|
185
|
+
if (totalSealNum > contractNum * 4) {
|
|
186
|
+
if (isAlert) {
|
|
187
|
+
message.error(i18next.t('您的用印次数远超超过合理次数范围,请修改。'));
|
|
188
|
+
}
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
if (totalSealNum > contractNum * 3) {
|
|
192
|
+
if (isAlert) {
|
|
193
|
+
message.error(i18next.t('您的用印次数超过合理次数范围,请慎重确认!'));
|
|
194
|
+
}
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
if (totalSealNum > contractNum * 2) {
|
|
198
|
+
if (isAlert) {
|
|
199
|
+
message.error(i18next.t('您的用印次数已超过2倍合同数量,请确认用印数量是否正确。'));
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 单个附件的群杰操作逻辑
|
|
3
|
+
*/
|
|
4
|
+
import { IElectronSignaturesItem, IQunjProps, IFileFieldsName, IElectronSignaturesItemPublic } from '../interface';
|
|
5
|
+
interface IOptions {
|
|
6
|
+
/**
|
|
7
|
+
* 触发外部onChange事件
|
|
8
|
+
*/
|
|
9
|
+
onValueChange?: IElectronSignaturesItem['onValueChange'];
|
|
10
|
+
/**
|
|
11
|
+
* 当前数据类型
|
|
12
|
+
*/
|
|
13
|
+
dataType?: IElectronSignaturesItem['dataType'];
|
|
14
|
+
/**
|
|
15
|
+
* 新附件
|
|
16
|
+
*/
|
|
17
|
+
records?: IElectronSignaturesItem['fileList'];
|
|
18
|
+
setRecords?: any;
|
|
19
|
+
/** 字段列表 */
|
|
20
|
+
fileFieldsNameRef: {
|
|
21
|
+
current: IFileFieldsName;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 是否显示合同份数
|
|
25
|
+
*/
|
|
26
|
+
isContranctNum?: boolean;
|
|
27
|
+
isSingleQj?: IElectronSignaturesItemPublic['isSingleQj'];
|
|
28
|
+
flowId?: string;
|
|
29
|
+
}
|
|
30
|
+
export default function useParseQunjSingleData(options: IOptions): {
|
|
31
|
+
onQunjAddressSingleChange: (data: any, index: number, qunjSeal?: any) => void;
|
|
32
|
+
onQunjSealSingleChange: (info: IQunjProps, index: number) => void;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
13
|
+
import { countIsValidate } from './useParseQunjListData';
|
|
14
|
+
import useMemoizedFn from '../../utils/useMemoizedFn';
|
|
15
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
16
|
+
import usePrevious from '../../utils/usePrevious';
|
|
17
|
+
import { useEffect } from 'react';
|
|
18
|
+
export default function useParseQunjSingleData(options) {
|
|
19
|
+
var onValueChange = options.onValueChange, dataType = options.dataType, records = options.records, setRecords = options.setRecords, fileFieldsNameRef = options.fileFieldsNameRef, isContranctNum = options.isContranctNum, isSingleQj = options.isSingleQj, flowId = options.flowId;
|
|
20
|
+
// 字段的key值
|
|
21
|
+
var _a = (fileFieldsNameRef === null || fileFieldsNameRef === void 0 ? void 0 : fileFieldsNameRef.current) || {}, _b = _a.qunjAddress, qunjAddressKey = _b === void 0 ? 'qunjAddress' : _b, _c = _a.qunjSeal, qunjSealKey = _c === void 0 ? 'qunjSeal' : _c;
|
|
22
|
+
/**
|
|
23
|
+
* 群杰盖章地点的改变
|
|
24
|
+
* @param data 修改的信息
|
|
25
|
+
* @param index 修改的数据索引
|
|
26
|
+
*/
|
|
27
|
+
var onQunjAddressSingleChange = useMemoizedFn(function (data, index, qunjSeal) {
|
|
28
|
+
var _a;
|
|
29
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
30
|
+
var item = newRecords[index];
|
|
31
|
+
// 更新群杰信息
|
|
32
|
+
if (item && qunjAddressKey) {
|
|
33
|
+
item[qunjAddressKey] = data;
|
|
34
|
+
item[qunjSealKey] = __assign(__assign({}, item[qunjSealKey]), qunjSeal);
|
|
35
|
+
}
|
|
36
|
+
setRecords(newRecords);
|
|
37
|
+
if (!dataType) {
|
|
38
|
+
console.log(i18next.t('必须传入数据类型'));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// 通知数据更新
|
|
42
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* 群杰章信息改变
|
|
46
|
+
* 章子的信息、合同份数、用印类型等
|
|
47
|
+
*/
|
|
48
|
+
var onQunjSealSingleChange = useMemoizedFn(function (info, index) {
|
|
49
|
+
var _a;
|
|
50
|
+
var _b;
|
|
51
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
52
|
+
var item = newRecords[index];
|
|
53
|
+
if (!item) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
item[qunjSealKey] = __assign(__assign({}, item[qunjSealKey]), info);
|
|
57
|
+
// 判断用印次数 是否合理
|
|
58
|
+
var qunjCountIsValidate = true;
|
|
59
|
+
if (isContranctNum) {
|
|
60
|
+
qunjCountIsValidate = countIsValidate(item[qunjSealKey]);
|
|
61
|
+
}
|
|
62
|
+
item.qunjCountIsValidate = qunjCountIsValidate;
|
|
63
|
+
if (!dataType) {
|
|
64
|
+
console.log(i18next.t('必须传入数据类型'));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// 如果是内部用印,那清除选中的盖章地点数据
|
|
68
|
+
if (((_b = item[qunjSealKey]) === null || _b === void 0 ? void 0 : _b.isTakeOut) + '' === '0') {
|
|
69
|
+
item[qunjAddressKey] = null;
|
|
70
|
+
}
|
|
71
|
+
setRecords(newRecords);
|
|
72
|
+
// 通知数据更新
|
|
73
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
74
|
+
});
|
|
75
|
+
// 20241015: 这里的逻辑是。开发首次从没数据到有数据的过程中。
|
|
76
|
+
// 部门id会发生变化。这里的部门id变化是不需要清空契约锁数据的
|
|
77
|
+
// 这个地方需要组件内部处理下这个逻辑,虽然这个逻辑很奇怪
|
|
78
|
+
var recordsPrevious = usePrevious(records, function () { return true; });
|
|
79
|
+
// 监听流程id改变时,清空群杰印章信息
|
|
80
|
+
// 只有当本次更新的群杰数据 和上次 更新时的群杰数据一致时,才更改
|
|
81
|
+
useEffect(function () {
|
|
82
|
+
var _a;
|
|
83
|
+
if (isSingleQj &&
|
|
84
|
+
records &&
|
|
85
|
+
// 这里尝试修复一个bug。流程id和fileList同时设置时,records是通过setState设置的。会滞后
|
|
86
|
+
// 这里取到的records数据会不是最新的
|
|
87
|
+
records.length > 0 &&
|
|
88
|
+
records === recordsPrevious) {
|
|
89
|
+
console.log(i18next.t('-----修改流程id,清空契约锁数据-----'));
|
|
90
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
91
|
+
newRecords.map(function (item) {
|
|
92
|
+
item[qunjSealKey] = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
93
|
+
item[qunjAddressKey] = null;
|
|
94
|
+
return item;
|
|
95
|
+
});
|
|
96
|
+
if (!dataType) {
|
|
97
|
+
console.log(i18next.t('必须传入数据类型'));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
setRecords(newRecords);
|
|
101
|
+
// 通知数据更新
|
|
102
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
103
|
+
}
|
|
104
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
105
|
+
}, [flowId]);
|
|
106
|
+
return {
|
|
107
|
+
onQunjAddressSingleChange: onQunjAddressSingleChange,
|
|
108
|
+
onQunjSealSingleChange: onQunjSealSingleChange,
|
|
109
|
+
};
|
|
110
|
+
}
|