ztxkui 3.4.13 → 3.4.16
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/PrintContainer/print-container.d.ts +4 -0
- package/dist/components/PrintContainer/print-container.js +33 -7
- package/dist/components/business/Signatures/components/DetailTable.js +1 -1
- package/dist/components/business/Signatures/hooks.js +9 -0
- package/dist/components/business/Signatures/index.js +3 -2
- package/dist/hooks/useFormatter.js +35 -3
- package/package.json +1 -1
|
@@ -38,6 +38,10 @@ export interface IProps {
|
|
|
38
38
|
flowId?: string;
|
|
39
39
|
/** 水印图片 */
|
|
40
40
|
imgWaterBg?: string;
|
|
41
|
+
/** 点击打印的回调函数 */
|
|
42
|
+
onPrintCallback?: () => void;
|
|
43
|
+
/** 是否添加点击打印提示 */
|
|
44
|
+
showPrintMessage?: boolean;
|
|
41
45
|
}
|
|
42
46
|
declare const PrintContainer: React.FC<IProps>;
|
|
43
47
|
export default PrintContainer;
|
|
@@ -46,7 +46,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
46
46
|
import React, { useEffect, useRef, useState } from 'react';
|
|
47
47
|
// redux
|
|
48
48
|
// ztxkui公共组件
|
|
49
|
-
import { Button, Spin, message } from '../../index';
|
|
49
|
+
import { Button, Spin, message, Modal } from '../../index';
|
|
50
50
|
// 路由配置
|
|
51
51
|
// store
|
|
52
52
|
// 自定义组件
|
|
@@ -75,7 +75,7 @@ function downloadFontTTF(_a) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
var PrintContainer = function (_a) {
|
|
78
|
-
var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, autoSealIdList = _a.autoSealIdList, keywordList = _a.keywordList, _e = _a.showHandSeal, showHandSeal = _e === void 0 ? true : _e, _f = _a.showAutoSeal, showAutoSeal = _f === void 0 ? true : _f, _g = _a.needWatermark, needWatermark = _g === void 0 ? 0 : _g, fileId = _a.fileId, deptId = _a.deptId, flowId = _a.flowId, imgWaterBg = _a.imgWaterBg;
|
|
78
|
+
var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, autoSealIdList = _a.autoSealIdList, keywordList = _a.keywordList, _e = _a.showHandSeal, showHandSeal = _e === void 0 ? true : _e, _f = _a.showAutoSeal, showAutoSeal = _f === void 0 ? true : _f, _g = _a.needWatermark, needWatermark = _g === void 0 ? 0 : _g, fileId = _a.fileId, deptId = _a.deptId, flowId = _a.flowId, imgWaterBg = _a.imgWaterBg, onPrintCallback = _a.onPrintCallback, showPrintMessage = _a.showPrintMessage;
|
|
79
79
|
var _h = useState(false), showWater = _h[0], setShowWater = _h[1];
|
|
80
80
|
var containerRef = useRef();
|
|
81
81
|
var allDomRef = useRef();
|
|
@@ -231,11 +231,37 @@ var PrintContainer = function (_a) {
|
|
|
231
231
|
};
|
|
232
232
|
// 打印
|
|
233
233
|
var onPrintHandle = function () {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
if (showPrintMessage) {
|
|
235
|
+
var isOkSure_1 = false;
|
|
236
|
+
Modal.confirm({
|
|
237
|
+
title: '打印提示',
|
|
238
|
+
content: '点击确认按钮后,将作为一次成功的打印,并记录到系统!你确认要打印吗?',
|
|
239
|
+
okText: '确认',
|
|
240
|
+
onOk: function () {
|
|
241
|
+
isOkSure_1 = true;
|
|
242
|
+
onPrintCallback && onPrintCallback();
|
|
243
|
+
},
|
|
244
|
+
afterClose: function () {
|
|
245
|
+
if (isOkSure_1) {
|
|
246
|
+
setTimeout(function () {
|
|
247
|
+
printCurrentDom({
|
|
248
|
+
hiddenClassNames: __spreadArray([
|
|
249
|
+
'.print-container--header'
|
|
250
|
+
], (hiddenClassName || [])),
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
onPrintCallback && onPrintCallback();
|
|
259
|
+
printCurrentDom({
|
|
260
|
+
hiddenClassNames: __spreadArray([
|
|
261
|
+
'.print-container--header'
|
|
262
|
+
], (hiddenClassName || [])),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
239
265
|
};
|
|
240
266
|
// 生成pdf
|
|
241
267
|
var onPdfHandle = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -92,7 +92,7 @@ var DetailTable = function (_a) {
|
|
|
92
92
|
viewSealPageFn && viewSealPageFn();
|
|
93
93
|
} }, "\u9884\u89C8\u76D6\u7AE0\u6548\u679C"),
|
|
94
94
|
(electronicList || [])
|
|
95
|
-
.filter(function (item) { return electronicSeal.includes(item.sealId); })
|
|
95
|
+
.filter(function (item) { return electronicSeal === null || electronicSeal === void 0 ? void 0 : electronicSeal.includes(item.sealId); })
|
|
96
96
|
.map(function (n) { return (React.createElement("div", { style: { padding: '3px 0' }, key: n.sealId }, n.sealName || '')); }))),
|
|
97
97
|
props: {},
|
|
98
98
|
};
|
|
@@ -8,6 +8,9 @@ export function useRecords(fileList) {
|
|
|
8
8
|
if (Array.isArray(fileList)) {
|
|
9
9
|
setRecords(fileList);
|
|
10
10
|
}
|
|
11
|
+
else {
|
|
12
|
+
setRecords([]);
|
|
13
|
+
}
|
|
11
14
|
}, [fileList]);
|
|
12
15
|
return {
|
|
13
16
|
records: records,
|
|
@@ -20,6 +23,9 @@ export function useQunjData(data) {
|
|
|
20
23
|
if (typeof data === 'object') {
|
|
21
24
|
setQunjSeal(data);
|
|
22
25
|
}
|
|
26
|
+
else {
|
|
27
|
+
setQunjSeal({});
|
|
28
|
+
}
|
|
23
29
|
}, [data]);
|
|
24
30
|
return {
|
|
25
31
|
qunjSeal: qunjSeal,
|
|
@@ -32,6 +38,9 @@ export function useElectronicData(data) {
|
|
|
32
38
|
if (Array.isArray(data)) {
|
|
33
39
|
setElectronicSeal(data);
|
|
34
40
|
}
|
|
41
|
+
else {
|
|
42
|
+
setElectronicSeal([]);
|
|
43
|
+
}
|
|
35
44
|
}, [data]);
|
|
36
45
|
return {
|
|
37
46
|
electronicSeal: electronicSeal,
|
|
@@ -254,11 +254,12 @@ var Sinatures = function (_a) {
|
|
|
254
254
|
data: params,
|
|
255
255
|
})
|
|
256
256
|
.then(function (res) {
|
|
257
|
+
var _a;
|
|
257
258
|
if (res.status === 200 &&
|
|
258
259
|
res.data.code === 200 &&
|
|
259
260
|
res.data.data.preSignUrl) {
|
|
260
261
|
for (var i = sealedIds.length; i--; i >= 0) {
|
|
261
|
-
if (res.data.data.deleteAttachIdList.includes(sealedIds[i])) {
|
|
262
|
+
if ((_a = res.data.data.deleteAttachIdList) === null || _a === void 0 ? void 0 : _a.includes(sealedIds[i])) {
|
|
262
263
|
sealedIds.splice(i, 1);
|
|
263
264
|
}
|
|
264
265
|
}
|
|
@@ -603,7 +604,7 @@ var Sinatures = function (_a) {
|
|
|
603
604
|
var hasElectronicSeal = records === null || records === void 0 ? void 0 : records.some(function (item) { return !!item.isElectronicSeal; });
|
|
604
605
|
// 勾选加盖电子印章时未勾选电子印章
|
|
605
606
|
if ((innerElectronicSeal === null || innerElectronicSeal === void 0 ? void 0 : innerElectronicSeal.length) === 0 && hasElectronicSeal) {
|
|
606
|
-
message.warning('
|
|
607
|
+
message.warning('请勾选加盖电子印章所需要的印章列表!');
|
|
607
608
|
return false;
|
|
608
609
|
}
|
|
609
610
|
// 超过4倍禁止提交审批
|
|
@@ -64,12 +64,44 @@ function useFormatter(formatterType, currencySymbol) {
|
|
|
64
64
|
precision: precision,
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
+
function formatCurrency(n) {
|
|
68
|
+
if (n != null) {
|
|
69
|
+
var _n = n.toString();
|
|
70
|
+
var pointIndex = _n.indexOf('.');
|
|
71
|
+
var pointAfterNum = '';
|
|
72
|
+
if (pointIndex !== -1) {
|
|
73
|
+
n = _n.slice(0, pointIndex);
|
|
74
|
+
pointAfterNum = _n.slice(pointIndex);
|
|
75
|
+
}
|
|
76
|
+
var res = '';
|
|
77
|
+
var s = n.toString();
|
|
78
|
+
var length_1 = s.length;
|
|
79
|
+
for (var i = length_1 - 1; i >= 0; i--) {
|
|
80
|
+
var j = length_1 - i;
|
|
81
|
+
if (j % 3 === 0) {
|
|
82
|
+
if (i === 0) {
|
|
83
|
+
res = s[i] + res;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
res = ',' + s[i] + res;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
res = s[i] + res;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return res + pointAfterNum;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return n;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
67
99
|
export function getFormatter(formatterType, currencySymbol) {
|
|
68
100
|
if (currencySymbol === void 0) { currencySymbol = '$'; }
|
|
69
101
|
if (formatterType === 'currency') {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
102
|
+
// let formatterFn: IFormatterFuc = (value) =>
|
|
103
|
+
// `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
104
|
+
var formatterFn = function (value) { return formatCurrency(value); };
|
|
73
105
|
var parserFn = function (value) { return value.replace(/(,*)/g, ''); };
|
|
74
106
|
return {
|
|
75
107
|
formatter: formatterFn,
|