zmdms-webui 1.3.7 → 1.3.9
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/es/table/components/EnhanceBodyCell.js +3 -1
- 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,182 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
3
|
+
import { useMemoizedFn, usePrevious } from 'ahooks';
|
|
4
|
+
import { FLOW_IDS } from '../utils.js';
|
|
5
|
+
import { message } from 'antd';
|
|
6
|
+
|
|
7
|
+
function useParseQunjListData(options) {
|
|
8
|
+
var isUnControlled = options.isUnControlled, onValueChange = options.onValueChange, dataType = options.dataType, qunjSeal = options.qunjSeal, 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;
|
|
9
|
+
/**
|
|
10
|
+
* 当前是否显示合同份数
|
|
11
|
+
* 采购合同 销售合同 双边合同 部门间交易合同 需要展示合同份数 其他的不需要
|
|
12
|
+
*/
|
|
13
|
+
var isContranctNum = useMemo(function () {
|
|
14
|
+
return contractNumFlowIds.includes("".concat(flowId));
|
|
15
|
+
}, [contractNumFlowIds, flowId]);
|
|
16
|
+
/**
|
|
17
|
+
* 当前盖章地点选择
|
|
18
|
+
*/
|
|
19
|
+
var _c = useState(function () {
|
|
20
|
+
return qunjAddress;
|
|
21
|
+
}), currentQunjAddress = _c[0], setCurrentQunjAddress = _c[1];
|
|
22
|
+
// 盖章地点改变
|
|
23
|
+
var onQunjAddressChange = useMemoizedFn(function (info, option) {
|
|
24
|
+
var _a;
|
|
25
|
+
// if (isUnControlled) {
|
|
26
|
+
setCurrentQunjAddress(info);
|
|
27
|
+
// }
|
|
28
|
+
if (!dataType) {
|
|
29
|
+
console.log("必须传入数据类型");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var _b = (option || {}).qunjSeal, qunjSeal = _b === void 0 ? {} : _b;
|
|
33
|
+
onValueChange &&
|
|
34
|
+
onValueChange((_a = {},
|
|
35
|
+
_a[dataType] = {
|
|
36
|
+
qunjAddress: info,
|
|
37
|
+
qunjSeal: __assign(__assign({}, currentQunjSeal), qunjSeal),
|
|
38
|
+
},
|
|
39
|
+
_a));
|
|
40
|
+
});
|
|
41
|
+
// 当前选中的群杰物理章相关数据
|
|
42
|
+
var _d = useState(function () {
|
|
43
|
+
// 群杰默认选中内部用印 20241014
|
|
44
|
+
return qunjSeal ? qunjSeal : isDefaultQunj ? { isTakeOut: 0 } : qunjSeal;
|
|
45
|
+
}), currentQunjSeal = _d[0], setCurrentQunjSeal = _d[1];
|
|
46
|
+
// 当前是否勾选了群杰印章-用印申请
|
|
47
|
+
var _e = useState(function () {
|
|
48
|
+
return isDefaultQunj;
|
|
49
|
+
}), qunjChecked = _e[0], _setQunjChecked = _e[1];
|
|
50
|
+
// 手动切换群杰印章-用印申请
|
|
51
|
+
var setQunjChecked = useMemoizedFn(function (checked) {
|
|
52
|
+
var qunjProps = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
53
|
+
if (!checked) {
|
|
54
|
+
qunjProps.contranctNum = null;
|
|
55
|
+
}
|
|
56
|
+
_setQunjChecked(checked);
|
|
57
|
+
onQunjSealChange(qunjProps);
|
|
58
|
+
});
|
|
59
|
+
// 群杰物理章改变时触发
|
|
60
|
+
var onQunjSealChange = useMemoizedFn(function (info) {
|
|
61
|
+
var _a;
|
|
62
|
+
// 大多数情况下 当 onChange 触发时,需要判断
|
|
63
|
+
// 1. 非受控模式。那么组件内部应该直接进行控件 value 值的切换
|
|
64
|
+
// 2. 受控模式。那么组件内部的值应该由外部的 props 中的 value 决定而不应该自主切换。
|
|
65
|
+
var newQunjSeal = __assign(__assign({}, currentQunjSeal), info);
|
|
66
|
+
// 判断用印次数 是否合理
|
|
67
|
+
var qunjCountIsValidate = true;
|
|
68
|
+
if (isContranctNum) {
|
|
69
|
+
qunjCountIsValidate = countIsValidate(newQunjSeal);
|
|
70
|
+
}
|
|
71
|
+
// if (isUnControlled) {
|
|
72
|
+
setCurrentQunjSeal(newQunjSeal);
|
|
73
|
+
// }
|
|
74
|
+
if (!dataType) {
|
|
75
|
+
console.log("必须传入数据类型");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
var newData = { qunjSeal: newQunjSeal, qunjCountIsValidate: qunjCountIsValidate };
|
|
79
|
+
// 如果是内部用印,那清楚选中的盖章地点数据
|
|
80
|
+
if (newQunjSeal.isTakeOut + "" === "0") {
|
|
81
|
+
newData.qunjAddress = null;
|
|
82
|
+
}
|
|
83
|
+
onValueChange &&
|
|
84
|
+
onValueChange((_a = {},
|
|
85
|
+
_a[dataType] = newData,
|
|
86
|
+
_a));
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
90
|
+
*/
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
var _a;
|
|
93
|
+
// if (!isUnControlled) {
|
|
94
|
+
// 群杰默认选中内部用印 20241014
|
|
95
|
+
var newQunjSeal = qunjSeal
|
|
96
|
+
? qunjSeal
|
|
97
|
+
: isDefaultQunj
|
|
98
|
+
? { isTakeOut: 0 }
|
|
99
|
+
: qunjSeal;
|
|
100
|
+
setCurrentQunjSeal(newQunjSeal);
|
|
101
|
+
// 如果数据源中,群杰数据有值,那么需要默认勾选群杰章
|
|
102
|
+
// 这里去掉qunjSeal?.details 的逻辑会导致报错 不太理解为什么
|
|
103
|
+
if (Array.isArray(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
|
|
104
|
+
(qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) &&
|
|
105
|
+
((_a = qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
106
|
+
_setQunjChecked(true);
|
|
107
|
+
}
|
|
108
|
+
// }
|
|
109
|
+
}, [isUnControlled, qunjSeal, isDefaultQunj]);
|
|
110
|
+
/**
|
|
111
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
112
|
+
*/
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
// if (!isUnControlled) {
|
|
115
|
+
setCurrentQunjAddress(qunjAddress);
|
|
116
|
+
// }
|
|
117
|
+
}, [isUnControlled, qunjAddress]);
|
|
118
|
+
// 监听是否选中群杰印章-用印申请 做一些数据处理
|
|
119
|
+
useEffect(function () {
|
|
120
|
+
}, [qunjChecked]);
|
|
121
|
+
// 20241015: 这里的逻辑是。开发首次从没数据到有数据的过程中。
|
|
122
|
+
// 部门id会发生变化。这里的部门id变化是不需要清空契约锁数据的
|
|
123
|
+
// 这个地方需要组件内部处理下这个逻辑,虽然这个逻辑很奇怪
|
|
124
|
+
var qunjSealPrevious = usePrevious(qunjSeal, function () { return true; });
|
|
125
|
+
// 监听流程id改变时,清空群杰印章信息
|
|
126
|
+
// 只有当本次更新的群杰数据 和上次 更新时的群杰数据一致时,才更改
|
|
127
|
+
useEffect(function () {
|
|
128
|
+
if (!isSingleQj && qunjSeal && qunjSeal === qunjSealPrevious) {
|
|
129
|
+
console.log("-----修改流程id,清空契约锁数据-----");
|
|
130
|
+
var qunjProps = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
131
|
+
onQunjSealChange(qunjProps);
|
|
132
|
+
}
|
|
133
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
+
}, [flowId]);
|
|
135
|
+
return {
|
|
136
|
+
currentQunjSeal: currentQunjSeal,
|
|
137
|
+
onQunjSealChange: onQunjSealChange,
|
|
138
|
+
/** 当前是否显示合同份数 */
|
|
139
|
+
isContranctNum: isContranctNum,
|
|
140
|
+
qunjChecked: qunjChecked,
|
|
141
|
+
setQunjChecked: setQunjChecked,
|
|
142
|
+
currentQunjAddress: currentQunjAddress,
|
|
143
|
+
onQunjAddressChange: onQunjAddressChange,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 用印次数是否合理
|
|
148
|
+
* 返回 true 合理 返回false 不合理
|
|
149
|
+
*/
|
|
150
|
+
function countIsValidate(qunjSeal, isAlert) {
|
|
151
|
+
var _a;
|
|
152
|
+
if (isAlert === void 0) { isAlert = true; }
|
|
153
|
+
if (!qunjSeal) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
var contractNum = (qunjSeal === null || qunjSeal === void 0 ? void 0 : qunjSeal.contranctNum) || 1; // 总份数
|
|
157
|
+
var totalSealNum = 0; // 使用份数
|
|
158
|
+
(_a = qunjSeal.details) === null || _a === void 0 ? void 0 : _a.forEach(function (detail) {
|
|
159
|
+
totalSealNum += detail.sealCount || 0;
|
|
160
|
+
});
|
|
161
|
+
if (totalSealNum > contractNum * 4) {
|
|
162
|
+
if (isAlert) {
|
|
163
|
+
message.error("您的用印次数远超超过合理次数范围,请修改。");
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (totalSealNum > contractNum * 3) {
|
|
168
|
+
if (isAlert) {
|
|
169
|
+
message.error("您的用印次数超过合理次数范围,请慎重确认!");
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
if (totalSealNum > contractNum * 2) {
|
|
174
|
+
if (isAlert) {
|
|
175
|
+
message.error("您的用印次数已超过2倍合同数量,请确认用印数量是否正确。");
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { countIsValidate, useParseQunjListData as default };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { countIsValidate } from './useParseQunjListData.js';
|
|
3
|
+
import { useMemoizedFn, usePrevious } from 'ahooks';
|
|
4
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
function useParseQunjSingleData(options) {
|
|
8
|
+
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;
|
|
9
|
+
// 字段的key值
|
|
10
|
+
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;
|
|
11
|
+
/**
|
|
12
|
+
* 群杰盖章地点的改变
|
|
13
|
+
* @param data 修改的信息
|
|
14
|
+
* @param index 修改的数据索引
|
|
15
|
+
*/
|
|
16
|
+
var onQunjAddressSingleChange = useMemoizedFn(function (data, index, qunjSeal) {
|
|
17
|
+
var _a;
|
|
18
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
19
|
+
var item = newRecords[index];
|
|
20
|
+
// 更新群杰信息
|
|
21
|
+
if (item && qunjAddressKey) {
|
|
22
|
+
item[qunjAddressKey] = data;
|
|
23
|
+
item[qunjSealKey] = __assign(__assign({}, item[qunjSealKey]), qunjSeal);
|
|
24
|
+
}
|
|
25
|
+
setRecords(newRecords);
|
|
26
|
+
if (!dataType) {
|
|
27
|
+
console.log("必须传入数据类型");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// 通知数据更新
|
|
31
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* 群杰章信息改变
|
|
35
|
+
* 章子的信息、合同份数、用印类型等
|
|
36
|
+
*/
|
|
37
|
+
var onQunjSealSingleChange = useMemoizedFn(function (info, index) {
|
|
38
|
+
var _a;
|
|
39
|
+
var _b;
|
|
40
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
41
|
+
var item = newRecords[index];
|
|
42
|
+
if (!item) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
item[qunjSealKey] = __assign(__assign({}, item[qunjSealKey]), info);
|
|
46
|
+
// 判断用印次数 是否合理
|
|
47
|
+
var qunjCountIsValidate = true;
|
|
48
|
+
if (isContranctNum) {
|
|
49
|
+
qunjCountIsValidate = countIsValidate(item[qunjSealKey]);
|
|
50
|
+
}
|
|
51
|
+
item.qunjCountIsValidate = qunjCountIsValidate;
|
|
52
|
+
if (!dataType) {
|
|
53
|
+
console.log("必须传入数据类型");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// 如果是内部用印,那清除选中的盖章地点数据
|
|
57
|
+
if (((_b = item[qunjSealKey]) === null || _b === void 0 ? void 0 : _b.isTakeOut) + "" === "0") {
|
|
58
|
+
item[qunjAddressKey] = null;
|
|
59
|
+
}
|
|
60
|
+
setRecords(newRecords);
|
|
61
|
+
// 通知数据更新
|
|
62
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
63
|
+
});
|
|
64
|
+
// 20241015: 这里的逻辑是。开发首次从没数据到有数据的过程中。
|
|
65
|
+
// 部门id会发生变化。这里的部门id变化是不需要清空契约锁数据的
|
|
66
|
+
// 这个地方需要组件内部处理下这个逻辑,虽然这个逻辑很奇怪
|
|
67
|
+
var recordsPrevious = usePrevious(records, function () { return true; });
|
|
68
|
+
// 监听流程id改变时,清空群杰印章信息
|
|
69
|
+
// 只有当本次更新的群杰数据 和上次 更新时的群杰数据一致时,才更改
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
var _a;
|
|
72
|
+
if (isSingleQj && records && records === recordsPrevious) {
|
|
73
|
+
console.log("-----修改流程id,清空契约锁数据-----");
|
|
74
|
+
var newRecords = cloneDeep((records === null || records === void 0 ? void 0 : records.slice()) || []);
|
|
75
|
+
newRecords.map(function (item) {
|
|
76
|
+
item[qunjSealKey] = __assign(__assign({ isTakeOut: 0 }, (isContranctNum ? { contranctNum: 1 } : {})), { details: [] });
|
|
77
|
+
item[qunjAddressKey] = null;
|
|
78
|
+
return item;
|
|
79
|
+
});
|
|
80
|
+
if (!dataType) {
|
|
81
|
+
console.log("必须传入数据类型");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setRecords(newRecords);
|
|
85
|
+
// 通知数据更新
|
|
86
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
87
|
+
}
|
|
88
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
|
+
}, [flowId]);
|
|
90
|
+
return {
|
|
91
|
+
onQunjAddressSingleChange: onQunjAddressSingleChange,
|
|
92
|
+
onQunjSealSingleChange: onQunjSealSingleChange,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { useParseQunjSingleData as default };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { __assign } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { useMemoizedFn } from 'ahooks';
|
|
4
|
+
import { onlyQunjAttachId, detailOnlyQunjAttachId } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 内部用来区分当前附件所属类型的KEY值
|
|
8
|
+
*/
|
|
9
|
+
var DATA_TYPE_KEY = "__DATA_TYPE_KEY";
|
|
10
|
+
// 记录合并规则 返回数据类型 和 行合并规则
|
|
11
|
+
function getColumnMergeProp(options) {
|
|
12
|
+
var record = options.record, records = options.records, dataTypeSort = options.dataTypeSort, index = options.index;
|
|
13
|
+
// 获取当前项的类型
|
|
14
|
+
var currentDataType = record === null || record === void 0 ? void 0 : record[DATA_TYPE_KEY];
|
|
15
|
+
// 找到当前项类型 对应的 类型排序位置
|
|
16
|
+
var currentDataTypeIndex = dataTypeSort === null || dataTypeSort === void 0 ? void 0 : dataTypeSort.findIndex(function (type) { return type === currentDataType; });
|
|
17
|
+
// 找到数据中是当前类型的数据
|
|
18
|
+
var dataTypeRecords = records === null || records === void 0 ? void 0 : records.filter(function (record) { return (record === null || record === void 0 ? void 0 : record[DATA_TYPE_KEY]) === currentDataType; });
|
|
19
|
+
// 数据中当前类型数据的长度
|
|
20
|
+
var currentDataTypeRecordsLength = dataTypeRecords.length;
|
|
21
|
+
// 当前项之前的匹配项
|
|
22
|
+
var preDataType = dataTypeSort.slice(0, currentDataTypeIndex);
|
|
23
|
+
// 所有之前数据的长度
|
|
24
|
+
var preDataTypeRecordsLength = 0;
|
|
25
|
+
preDataType.forEach(function (preDataType) {
|
|
26
|
+
var preDataTypeRecords = records === null || records === void 0 ? void 0 : records.filter(function (record) { return (record === null || record === void 0 ? void 0 : record[DATA_TYPE_KEY]) === preDataType; });
|
|
27
|
+
preDataTypeRecordsLength += preDataTypeRecords.length || 0;
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
/** 当前的数据类型 */
|
|
31
|
+
currentDataType: currentDataType,
|
|
32
|
+
/** 合并规则 */
|
|
33
|
+
props: {
|
|
34
|
+
rowSpan: index === preDataTypeRecordsLength ? currentDataTypeRecordsLength : 0,
|
|
35
|
+
},
|
|
36
|
+
/** 当前数据类型之前的数据长度 */
|
|
37
|
+
preDataTypeRecordsLength: preDataTypeRecordsLength,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 附件数据处理
|
|
42
|
+
*/
|
|
43
|
+
function useParseRecords(options) {
|
|
44
|
+
var isUnControlled = options.isUnControlled, onValueChange = options.onValueChange, dataType = options.dataType, fileList = options.fileList, fileSplitRules = options.fileSplitRules, fileSplitStringRules = options.fileSplitStringRules, isSingleQj = options.isSingleQj;
|
|
45
|
+
var fileSplitRulesRef = useRef(fileSplitRules);
|
|
46
|
+
fileSplitRulesRef.current = fileSplitRules;
|
|
47
|
+
var fileSplitStringRulesRef = useRef(fileSplitStringRules);
|
|
48
|
+
fileSplitStringRulesRef.current = fileSplitStringRules;
|
|
49
|
+
var _a = useState(function () {
|
|
50
|
+
return fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item, index) {
|
|
51
|
+
var _a;
|
|
52
|
+
return __assign(__assign({}, item), (_a = {}, _a[DATA_TYPE_KEY] = dataType, _a));
|
|
53
|
+
});
|
|
54
|
+
}), _records = _a[0], _setRecords = _a[1];
|
|
55
|
+
// 代理records
|
|
56
|
+
var records = useMemo(function () {
|
|
57
|
+
var _a;
|
|
58
|
+
// 这里可能外部没有传入_records 没有传入_records时,也要显示占位符数据
|
|
59
|
+
if ((Array.isArray(_records) && _records.length === 0) || !_records) {
|
|
60
|
+
if (isSingleQj) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return [
|
|
64
|
+
(_a = {
|
|
65
|
+
attachId: detailOnlyQunjAttachId
|
|
66
|
+
},
|
|
67
|
+
_a[DATA_TYPE_KEY] = dataType,
|
|
68
|
+
_a),
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(_records) && fileSplitRulesRef.current) {
|
|
72
|
+
var newRecords_1 = [];
|
|
73
|
+
if (fileSplitStringRulesRef.current) {
|
|
74
|
+
fileSplitStringRulesRef.current.forEach(function (key) {
|
|
75
|
+
var keyRecords = _records.filter(function (record) { return fileSplitRulesRef.current(record).key === key; });
|
|
76
|
+
newRecords_1 = newRecords_1.concat(keyRecords);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
var recordMap_1 = {};
|
|
81
|
+
_records.forEach(function (record) {
|
|
82
|
+
var key = fileSplitRulesRef.current(record).key;
|
|
83
|
+
if (!Array.isArray(recordMap_1[key])) {
|
|
84
|
+
recordMap_1[key] = [record];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
recordMap_1[key].push(record);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.keys(recordMap_1).forEach(function (key) {
|
|
91
|
+
newRecords_1 = newRecords_1.concat(recordMap_1[key]);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return newRecords_1;
|
|
95
|
+
}
|
|
96
|
+
return _records;
|
|
97
|
+
}, [_records, dataType, isSingleQj]);
|
|
98
|
+
// 代理下set 触发onChange方法
|
|
99
|
+
var setRecords = useMemoizedFn(function (info) {
|
|
100
|
+
var _a;
|
|
101
|
+
var newRecords = typeof info === "function" ? info(records) : info;
|
|
102
|
+
// if (isUnControlled) {
|
|
103
|
+
_setRecords(newRecords);
|
|
104
|
+
// }
|
|
105
|
+
if (!dataType) {
|
|
106
|
+
console.log("必须传入数据类型");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// 如果数据仅剩下这个数据 那么交给调用方处理
|
|
110
|
+
if (newRecords.length === 1 &&
|
|
111
|
+
newRecords[0].attachId + "" === onlyQunjAttachId) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// 如果清空附件 触发外部行为也需要外部处理
|
|
115
|
+
if (newRecords.length === 0) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
onValueChange && onValueChange((_a = {}, _a[dataType] = { fileList: newRecords }, _a));
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* 如果是受控模式的话,直接将props的值 赋值给 内部变量
|
|
122
|
+
*/
|
|
123
|
+
useEffect(function () {
|
|
124
|
+
// if (!isUnControlled) {
|
|
125
|
+
_setRecords(fileList === null || fileList === void 0 ? void 0 : fileList.map(function (item, index) {
|
|
126
|
+
var _a;
|
|
127
|
+
return __assign(__assign({}, item), (_a = {}, _a[DATA_TYPE_KEY] = dataType, _a));
|
|
128
|
+
}));
|
|
129
|
+
// }
|
|
130
|
+
}, [isUnControlled, fileList, dataType]);
|
|
131
|
+
return {
|
|
132
|
+
/** 当前的附件列表数据 */
|
|
133
|
+
records: records,
|
|
134
|
+
/** 设置当前附件列表数据 调用这个方法 回触发onValueChange回调 */
|
|
135
|
+
setRecords: setRecords,
|
|
136
|
+
/** 修改内部数据 只是修改数据 并不会触发onValueChange回调 需要自己手动触发 */
|
|
137
|
+
innerSetRecords: _setRecords,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { DATA_TYPE_KEY, useParseRecords as default, getColumnMergeProp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.electron-table{background-color:red}.electron-table .ant-table-tbody>tr>td:nth-child(3){padding:0}.electron-table .electron-seal-list--wrap{height:90%;height:calc(100% - 70px);margin-bottom:8px;min-height:150px;text-align:left;width:100%}.electron-table .electron-seal-list--wrap>*{font-size:13px}.electron-table .electron-seal-list--wrap .zt-collapse .ant-collapse-item .ant-collapse-content-box{padding-left:8px}.electron-table .electron-seal-list--wrap .zt-collapse .ant-collapse-header{background-color:#ebf3fe}.electron-table .electron-seal-list--wrap .ant-collapse-content-box{display:flex;flex-direction:column}.electron-table .electron-seal-list--wrap .ant-checkbox-wrapper{font-size:13px;margin-left:0}.electron-table .electron-seal--first-level-person{border-bottom:1px solid #ebebeb;margin-bottom:5px;max-height:70px;overflow:hidden;padding-left:8px;text-align:left}.electron-table .electron-seal--first-level-person .ant-checkbox-wrapper{font-size:13px;max-height:70px}.electron-table .electron-seal--first-level-person .ant-checkbox-wrapper>span:last-child{display:block;overflow:hidden;text-overflow:ellipsis}.electron-table .electron-seal-detail--wrap{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;padding:5px 0}.electron-table .electron-seal-detail--wrap .electron-seal-detail--wrap__item{margin-bottom:8px;width:100%}.electron-table .electron-seal-detail--wrap .electron-seal-detail--wrap__item:last-child{margin-bottom:2px}.electron-table .electron-seal-setting--wrap{display:flex;flex-direction:column;font-size:13px;height:100%;padding-top:10px;position:sticky;top:20px}.electron-table .electron-seal--any{font-size:13px;margin-top:6px;text-align:left}.electron-table .electron-seal--any .ant-checkbox-wrapper{font-size:13px}.electron-table .electron-seal--any .ant-checkbox-wrapper+.ant-checkbox-wrapper{margin-left:0}.electron-table .file-title{align-items:center;display:flex;justify-content:space-between}.electron-table .file-title .file-label{flex:1;text-align:center}.electron-table .file-title .file-add--isOnlyQunj,.electron-table .file-title .file-upload button{font-size:13px}.electron-table .file-title .electron-seal-setting--wrap{flex-direction:row;padding-top:0;position:relative;top:0}.electron-table .qunj-list--wrap{height:100%;min-height:150px;padding:8px 0;text-align:left;width:100%}.electron-table .qunj-list--wrap>*{font-size:13px}.electron-table .qunj-list--wrap .qunj-list--need{background:#c5cdd9;display:flex;height:36px;justify-content:space-between;line-height:36px;margin-bottom:4px;padding:0 10px;text-align:center}.electron-table .qunj-list--wrap .qunj-list--area{align-items:center;background-color:#f5f9fe;border:1px solid #cdd9e6;border-radius:4px;display:flex;height:32px;justify-content:center;margin-top:2px}.electron-table .qunj-list--wrap .qunj-list--area>label{align-items:center;display:flex;height:30px;justify-content:center;padding-left:4px}.electron-table .qunj-list--wrap .qunj-list--area>label>span{color:#ff4d4f;height:30px;margin-right:2px}.electron-table .qunj-list--wrap .qunj-list--area>.ant-select .ant-select-selector{background-color:#f5f9fe;border:none;height:30px;line-height:30px}.electron-table .qunj-list--wrap .qunj-list--area>.ant-select .ant-select-selector input{height:30px!important;line-height:30px;outline:none}.electron-table .qunj-list--wrap .qunj-list--area>.ant-select .ant-select-selector .ant-select-selection-item{height:30px!important;line-height:30px}.electron-table .qunj-list--wrap .qunj-list--title{align-items:center;border-bottom:1px solid #ebebeb;display:flex;flex-direction:row;justify-content:space-between;padding-bottom:5px}.electron-table .qunj-list--wrap .qunj-list--title .ant-radio-wrapper{font-size:13px}.electron-table .qunj-list--wrap .qunj-list--contract{text-align:right;width:110px}.electron-table .qunj-list--wrap .qunj-list--contract.count{width:130px}.electron-table .qunj-list--wrap .qunj-list--contract>span{font-size:14px}.electron-table .qunj-list--wrap .qunj-list--contract .ant-input-number{width:60px}.electron-table .qunj-list--wrap .qunj-list{margin-top:5px}.electron-table .qunj-list--wrap .qunj-list .qunj-list--item{align-items:center;display:flex;flex-direction:row;justify-content:space-between;line-height:32px}.electron-table .qunj-list--wrap .qunj-list .qunj-list--item .ant-checkbox-wrapper{flex:1;font-size:13px;line-height:22px}.electron-table .qunj-detail--wrap{height:100%;min-height:150px;padding:8px 0;text-align:left;width:100%}.electron-table .qunj-detail--wrap .qunj-detail--title{align-items:center;border-bottom:1px solid #ebebeb;display:flex;flex-direction:row;justify-content:flex-start;padding-bottom:5px}.electron-table .qunj-detail--wrap .qunj-detail--title .qunj-detail--code{background:#fcecc8;border-radius:4px;height:32px;line-height:32px;margin-right:10px;padding:0 10px;width:160px}.electron-table .qunj-detail--wrap .qunj-detail--info{border-bottom:1px solid #ebebeb;color:#888;font-size:13px;margin-bottom:5px;padding-bottom:5px}.electron-table .qunj-detail--wrap .qunj-detail--info span{color:#333}.electron-table .qunj-detail--wrap .qunj-detail--info .qunj-detail--address{align-items:center;display:flex;flex-direction:row;justify-content:flex-start}.electron-table .qunj-detail--wrap .qunj-detail--info .qunj-detail--address .qunj-detail--type{margin-right:20px}.electron-table .qunj-detail--wrap .qunj-detail--list .qunj-detail--item{align-items:center;display:flex;flex-direction:row;justify-content:space-between;line-height:28px}.electron-table .qunj-detail--wrap .qunj-detail--list .qunj-detail--item span{padding:0 4px}.electron-table .qunj-detail--wrap .qunj-detail--list .qunj-detail--item>div:first-child{flex:1;line-height:22px}.electron-table .qunj-detail--wrap .qunj-detail--list .qunj-detail--item>div:last-child{text-align:right;width:80px}.electron-table .file-add--wrap{height:100%;position:relative;width:100%}.electron-table .file-add--wrap .file-add--btn{position:sticky;top:20px}.electron-table .file-add--wrap .file-add--fragment{height:20px}.electron-table .file-operation--wrap{padding:4px}.electron-table .file-operation--wrap .file-operation--list,.electron-table .file-operation--wrap .file-operation--list>button{font-size:13px}.electron-table .file-operation--wrap .file-operation--title{margin-bottom:0}.electron-table .file-operation--wrap .file-operation--isWater .ant-checkbox-wrapper{font-size:13px}.electron-table .contract-comparison--wrap{align-items:center;display:flex;flex-direction:column;justify-content:center}.electron-table .contract-comparison--wrap .ant-checkbox-wrapper,.electron-table .contract-comparison--wrap>button{font-size:13px}.batch-download--container>span.electron-file-upload{margin-right:10px}
|