ztxkui 3.6.2 → 3.6.3
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.
|
@@ -29,7 +29,7 @@ function request(options) {
|
|
|
29
29
|
return axios({
|
|
30
30
|
baseURL: options.baseURL ? options.baseURL : 'http://192.168.0.83:8000',
|
|
31
31
|
url: options.url,
|
|
32
|
-
headers: __assign({ 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
32
|
+
headers: __assign({ 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6bnVsbCwicmVhbF9uYW1lIjoi6ZmI5Lqa6ZuEIiwiY2xpZW50X3R5cGUiOiJ3ZWIiLCJkYXRhX3JvbGVfaWQiOiIxMzQ1OTc4NTA1MzAyMDU2OTYyLDE0NjgwMzUzNTE2MjUyODU2MzQsMTU0MjA3NjMwODU3ODAyNTQ3NCIsImNsaWVudF9pZCI6InN3b3JkIiwidXNlcl90eXBlIjoid2ViIiwicm9sZV9pZCI6IjExMjM1OTg4MTY3Mzg2NzUyMDEsMTQ2NzAxNTk3NTQ4NDc2MDA2NiwxNDY4MDM0NDM3MTU3OTYxNzI5LDE0ODA4MjkzMzc5MzkxMzI0MTciLCJwb3N0X25hbWUiOm51bGwsInNjb3BlIjpbImFsbCJdLCJpbnRlcnZpZXdfaWQiOm51bGwsImV4cCI6MTY2MjUzNjc4Niwib3JnX25hbWUiOm51bGwsImp0aSI6IjBjY2VlZTI0LWQ0OWItNDdjZS1iZTUxLWRkN2MzYjdlNjRlMiIsIm1lbWJlcl9pZCI6MSwiY29tcGFueV9pZCI6bnVsbCwic3lzdGVtX2lkIjpudWxsLCJkZXB0X25hbWUiOm51bGwsImF2YXRhciI6IiIsImRhdGFfcm9sZV9uYW1lIjoiYWRtaW4sYWRtaW4sYWRtaW4iLCJhdXRob3JpdGllcyI6WyJhZG1pbiIsInVzZXIiLCJhZG1pbmlzdHJhdG9yIl0sInJvbGVfbmFtZSI6ImFkbWluaXN0cmF0b3IsdXNlcixhZG1pbixhZG1pbiIsInJlc3VtZV90ZW1wbGF0ZSI6bnVsbCwibGljZW5zZSI6InBvd2VyZWQgYnkgem1kbXMiLCJwb3N0X2lkIjoiIiwidXNlcl9pZCI6IjE0MTI5NTM4MDQzMzM1NTU3MTQiLCJvcmdfaWQiOm51bGwsIm5pY2tfbmFtZSI6IumZiOS6mumbhCIsImNvbXBhbnlfbmFtZSI6bnVsbCwiZGVwdF9pZCI6IiIsImhhbmRsZV9ocl9uYW1lIjpudWxsLCJhY2NvdW50IjoiY2hlbnl4IiwicmVzdW1lX2lkIjpudWxsfQ.hSebS1p4veDHvxHJKo5WIyHRnaw6WrP0zCf0mt3_HyA' }, options.headers),
|
|
33
33
|
method: options.method,
|
|
34
34
|
data: options.data,
|
|
35
35
|
params: options.params,
|
|
@@ -91,7 +91,7 @@ var PrintContainerDemo = function () {
|
|
|
91
91
|
var _c = useState(''), base64Img = _c[0], setBase64Img = _c[1];
|
|
92
92
|
useEffect(function () {
|
|
93
93
|
var xhr = new XMLHttpRequest();
|
|
94
|
-
var token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
94
|
+
var token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOm51bGwsImVtcF9udW1iZXIiOm51bGwsImltdF9pZCI6bnVsbCwicmVhbF9uYW1lIjoi6ZmI5Lqa6ZuEIiwiY2xpZW50X3R5cGUiOiJ3ZWIiLCJkYXRhX3JvbGVfaWQiOiIxMzQ1OTc4NTA1MzAyMDU2OTYyLDE0NjgwMzUzNTE2MjUyODU2MzQsMTU0MjA3NjMwODU3ODAyNTQ3NCIsImNsaWVudF9pZCI6InN3b3JkIiwidXNlcl90eXBlIjoid2ViIiwicm9sZV9pZCI6IjExMjM1OTg4MTY3Mzg2NzUyMDEsMTQ2NzAxNTk3NTQ4NDc2MDA2NiwxNDY4MDM0NDM3MTU3OTYxNzI5LDE0ODA4MjkzMzc5MzkxMzI0MTciLCJwb3N0X25hbWUiOm51bGwsInNjb3BlIjpbImFsbCJdLCJpbnRlcnZpZXdfaWQiOm51bGwsImV4cCI6MTY2MjUzNjc4Niwib3JnX25hbWUiOm51bGwsImp0aSI6IjBjY2VlZTI0LWQ0OWItNDdjZS1iZTUxLWRkN2MzYjdlNjRlMiIsIm1lbWJlcl9pZCI6MSwiY29tcGFueV9pZCI6bnVsbCwic3lzdGVtX2lkIjpudWxsLCJkZXB0X25hbWUiOm51bGwsImF2YXRhciI6IiIsImRhdGFfcm9sZV9uYW1lIjoiYWRtaW4sYWRtaW4sYWRtaW4iLCJhdXRob3JpdGllcyI6WyJhZG1pbiIsInVzZXIiLCJhZG1pbmlzdHJhdG9yIl0sInJvbGVfbmFtZSI6ImFkbWluaXN0cmF0b3IsdXNlcixhZG1pbixhZG1pbiIsInJlc3VtZV90ZW1wbGF0ZSI6bnVsbCwibGljZW5zZSI6InBvd2VyZWQgYnkgem1kbXMiLCJwb3N0X2lkIjoiIiwidXNlcl9pZCI6IjE0MTI5NTM4MDQzMzM1NTU3MTQiLCJvcmdfaWQiOm51bGwsIm5pY2tfbmFtZSI6IumZiOS6mumbhCIsImNvbXBhbnlfbmFtZSI6bnVsbCwiZGVwdF9pZCI6IiIsImhhbmRsZV9ocl9uYW1lIjpudWxsLCJhY2NvdW50IjoiY2hlbnl4IiwicmVzdW1lX2lkIjpudWxsfQ.hSebS1p4veDHvxHJKo5WIyHRnaw6WrP0zCf0mt3_HyA';
|
|
95
95
|
xhr.open('GET', "http://192.168.0.83:8000/api/zmdms-resource/oss/endpoint/download-file/1559472632642387969?Zmdms-Auth=bearer " + token, true);
|
|
96
96
|
xhr.responseType = 'blob';
|
|
97
97
|
xhr.onload = function () {
|
|
@@ -240,128 +240,6 @@ var PrintContainerDemo = function () {
|
|
|
240
240
|
React.createElement("td", { colSpan: 2 }, "\u91CD\u5E86\u4E2D\u62D3-\u7535\u5546\u90E8"),
|
|
241
241
|
React.createElement("td", null, "\u4E1A\u52A1\u4EE3\u8868"),
|
|
242
242
|
React.createElement("td", { colSpan: 2 }, "\u80E1\u4F1F\u534E"))))),
|
|
243
|
-
React.createElement("div", { className: "pt_bottom" },
|
|
244
|
-
React.createElement("div", { className: "ant-row", style: { rowGap: '0px' } },
|
|
245
|
-
React.createElement("div", { className: "ant-col ant-col-17", style: { paddingLeft: '0px' } },
|
|
246
|
-
React.createElement("div", { className: "ant-row", style: { rowGap: '0px' } }, "1\u3001\u672C\u63D0\u5355\u5728\u4E0A\u8FF0\u6709\u6548\u671F\u5185\u6709\u6548\uFF0C\u8FC7\u671F\u4F5C\u5E9F\uFF1B"),
|
|
247
|
-
React.createElement("div", { className: "ant-row", style: { rowGap: '0px' } }, "2\u3001\u672C\u63D0\u8D27\u5355\u4F4D\u7ECF\u8D22\u52A1\u6536\u6B3E\u76D6\u7AE0\u540E\u63D0\u8D27\uFF1B\u6B64\u63D0\u8D27\u5355\u9057\u5931\uFF0C\u63D0\u8D27\u5355\u4F4D\u8D23\u4EFB\u81EA\u8D1F\uFF1B\u51ED\u6B64\u63D0\u8D27\u5355\u4EA4\u4ED8\u8D27\u7269\u540E\uFF0C\u8D27\u7269\u6240\u6709\u98CE\u9669\u8F6C\u79FB\u5230\u63D0\u8D27\u5355\u4F4D\u3002"),
|
|
248
|
-
React.createElement("div", { className: "ant-row", style: { rowGap: '0px' } })),
|
|
249
|
-
React.createElement("div", { className: "ant-col ant-col-7", style: { paddingRight: '0px' } },
|
|
250
|
-
React.createElement("div", { className: "ant-row", style: { justifyContent: 'flex-end', rowGap: '0px' } },
|
|
251
|
-
React.createElement("span", null, "\u6253\u5370\u65F6\u95F4\uFF1A"),
|
|
252
|
-
React.createElement("span", null, "2022-08-12 14:45:57")),
|
|
253
|
-
React.createElement("div", { className: "ant-row", style: { justifyContent: 'flex-end', rowGap: '0px' } },
|
|
254
|
-
React.createElement("span", null, "\u6253\u5370\u4EBA\uFF1A"),
|
|
255
|
-
React.createElement("span", null, "chenyx"))))))),
|
|
256
|
-
React.createElement("div", { className: "html2canvas-container-page simple-print" },
|
|
257
|
-
React.createElement("div", { className: "print-header" },
|
|
258
|
-
React.createElement("img", { src: base64Img, alt: "" }),
|
|
259
|
-
React.createElement("h3", { className: "print-title" }, "\u63D0\u8D27\u5355"),
|
|
260
|
-
React.createElement("div", { className: "right-info" },
|
|
261
|
-
React.createElement("div", { className: "info-item" },
|
|
262
|
-
React.createElement("span", null, "\u63D0\u8D27\u5355\u53F7\uFF1A"),
|
|
263
|
-
React.createElement("span", null, "8000000399")),
|
|
264
|
-
React.createElement("div", { className: "info-item" },
|
|
265
|
-
React.createElement("span", null, "\u5F00\u5355\u65F6\u95F4\uFF1A"),
|
|
266
|
-
React.createElement("span", null, "2022-08-03")),
|
|
267
|
-
React.createElement("div", { className: "info-item" },
|
|
268
|
-
React.createElement("span", null, "\u5BA1\u6838\u65F6\u95F4\uFF1A"),
|
|
269
|
-
React.createElement("span", null, "2022-08-06")))),
|
|
270
|
-
React.createElement("div", { className: "purchaseIn-print-box" },
|
|
271
|
-
React.createElement("div", { className: "pt10" },
|
|
272
|
-
React.createElement("table", null,
|
|
273
|
-
React.createElement("tbody", null,
|
|
274
|
-
React.createElement("tr", null,
|
|
275
|
-
React.createElement("td", null, "\u63D0\u8D27\u5355\u4F4D"),
|
|
276
|
-
React.createElement("td", { colSpan: 3 }, "\u4E2D\u94C1\u4E8C\u5341\u4E8C\u5C40\u96C6\u56E2\u6709\u9650,\u516C\u53F8"),
|
|
277
|
-
React.createElement("td", null, "\u5F00\u6237\u94F6\u884C\u53CA\u8D26\u53F7"),
|
|
278
|
-
React.createElement("td", { colSpan: 3 }),
|
|
279
|
-
React.createElement("td", { width: "100px" }, "\u7269\u6D41\u6307\u4EE4\u5355\u53F7"),
|
|
280
|
-
React.createElement("td", { colSpan: 3 })),
|
|
281
|
-
React.createElement("tr", null,
|
|
282
|
-
React.createElement("td", null, "\u7A0E\u53F7"),
|
|
283
|
-
React.createElement("td", { colSpan: 3 }, "9111000071092227XH"),
|
|
284
|
-
React.createElement("td", null, "\u5730\u5740\u53CA\u7535\u8BDD"),
|
|
285
|
-
React.createElement("td", { colSpan: 3 }, "\u5317\u4EAC\u5E02\u77F3\u666F\u5C71\u533A\u77F3\u666F\u5C71\u8DEF35\u53F7"),
|
|
286
|
-
React.createElement("td", { width: "100px" }, "\u9500\u552E\u5408\u540C\u53F7"),
|
|
287
|
-
React.createElement("td", { colSpan: 3 }, "SC2208010002")),
|
|
288
|
-
React.createElement("tr", null,
|
|
289
|
-
React.createElement("td", null, "\u63D0\u8D27\u4ED3\u5E93"),
|
|
290
|
-
React.createElement("td", { colSpan: 2 }, "\u7269\u4EA7\u7269\u6D41\u6B23\u987A\u7F8E\u5E93"),
|
|
291
|
-
React.createElement("td", null, "\u4ED3\u5E93\u5730\u5740"),
|
|
292
|
-
React.createElement("td", { colSpan: 2 }),
|
|
293
|
-
React.createElement("td", null, "\u4ED3\u5E93\u8054\u7CFB\u4EBA"),
|
|
294
|
-
React.createElement("td", { colSpan: 2 }),
|
|
295
|
-
React.createElement("td", null, "\u4ED3\u5E93\u7535\u8BDD"),
|
|
296
|
-
React.createElement("td", { colSpan: 2 })),
|
|
297
|
-
React.createElement("tr", null,
|
|
298
|
-
React.createElement("td", { rowSpan: 2, colSpan: 4 }, "\u5546\u54C1\u540D\u79F0"),
|
|
299
|
-
React.createElement("td", { width: "100px", rowSpan: 2 }, "\u6279\u6B21\u53F7"),
|
|
300
|
-
React.createElement("td", { colSpan: 2, width: "150px" }, "\u5F00\u5355\u6570\u91CF"),
|
|
301
|
-
React.createElement("td", { colSpan: 2, width: "150px" }, "\u5B9E\u53D1\u6570\u91CF"),
|
|
302
|
-
React.createElement("td", { rowSpan: 2 }, "\u5355\u4EF7(\u542B\u7A0E)"),
|
|
303
|
-
React.createElement("td", { width: "56px", rowSpan: 2 }, "\u662F\u5426\u542B\u8FD0\u8F93\u8D39"),
|
|
304
|
-
React.createElement("td", { width: "56px", rowSpan: 2 }, "\u662F\u5426\u542B\u51FA\u5E93\u8D39")),
|
|
305
|
-
React.createElement("tr", null,
|
|
306
|
-
React.createElement("td", { width: "50px" }, "\u4EF6"),
|
|
307
|
-
React.createElement("td", { width: "100px" }, "\u91CD\u91CF(\u5428)"),
|
|
308
|
-
React.createElement("td", { width: "50px" }, "\u4EF6"),
|
|
309
|
-
React.createElement("td", { width: "100px" }, "\u91CD\u91CF(\u5428)")),
|
|
310
|
-
React.createElement("tr", null,
|
|
311
|
-
React.createElement("td", { colSpan: 4 }, "\u91CD\u8F68 50MN \u6CB3\u5317\u6C38\u6D0B"),
|
|
312
|
-
React.createElement("td", null, "BN2207210002"),
|
|
313
|
-
React.createElement("td", null, "0"),
|
|
314
|
-
React.createElement("td", null, "1.000000"),
|
|
315
|
-
React.createElement("td", null, "0"),
|
|
316
|
-
React.createElement("td", null, "0.000000"),
|
|
317
|
-
React.createElement("td", null, "12.00"),
|
|
318
|
-
React.createElement("td", null, "\u5426"),
|
|
319
|
-
React.createElement("td", null, "\u5426")),
|
|
320
|
-
React.createElement("tr", null,
|
|
321
|
-
React.createElement("td", { colSpan: 4 }, "\u91CD\u8F68 50MN \u6CB3\u5317\u6C38\u6D0B"),
|
|
322
|
-
React.createElement("td", null, "BN2207140002"),
|
|
323
|
-
React.createElement("td", null, "0"),
|
|
324
|
-
React.createElement("td", null, "10.000000"),
|
|
325
|
-
React.createElement("td", null, "0"),
|
|
326
|
-
React.createElement("td", null, "0.000000"),
|
|
327
|
-
React.createElement("td", null, "12.00"),
|
|
328
|
-
React.createElement("td", null, "\u5426"),
|
|
329
|
-
React.createElement("td", null, "\u5426")),
|
|
330
|
-
React.createElement("tr", null,
|
|
331
|
-
React.createElement("td", { colSpan: 4, align: "left", style: { padding: '0px 30px' } }, "\u5408\u8BA1"),
|
|
332
|
-
React.createElement("td", null),
|
|
333
|
-
React.createElement("td", null, "0"),
|
|
334
|
-
React.createElement("td", null, "11.000000"),
|
|
335
|
-
React.createElement("td", null, "0"),
|
|
336
|
-
React.createElement("td", null, "0.000000"),
|
|
337
|
-
React.createElement("td", null),
|
|
338
|
-
React.createElement("td", null),
|
|
339
|
-
React.createElement("td", null)),
|
|
340
|
-
React.createElement("tr", null,
|
|
341
|
-
React.createElement("td", null, "\u5907\u6CE8"),
|
|
342
|
-
React.createElement("td", { colSpan: 5 }),
|
|
343
|
-
React.createElement("td", null, "\u63D0\u5355\u6709\u6548\u671F"),
|
|
344
|
-
React.createElement("td", { colSpan: 2 }, "24"),
|
|
345
|
-
React.createElement("td", null, "\u51FA\u5E93\u65B9\u5F0F"),
|
|
346
|
-
React.createElement("td", { colSpan: 2 }, "\u5BA2\u6237\u81EA\u63D0")),
|
|
347
|
-
React.createElement("tr", null,
|
|
348
|
-
React.createElement("td", null, "\u63D0\u8D27\u4EBA"),
|
|
349
|
-
React.createElement("td", { colSpan: 2 }),
|
|
350
|
-
React.createElement("td", null, "\u63D0\u8D27\u8F66\u724C"),
|
|
351
|
-
React.createElement("td", { colSpan: 2 }),
|
|
352
|
-
React.createElement("td", null, "\u6253\u5370\u6B21\u6570"),
|
|
353
|
-
React.createElement("td", { colSpan: 2 }),
|
|
354
|
-
React.createElement("td", null, "\u5B58\u8D27\u5355\u4F4D"),
|
|
355
|
-
React.createElement("td", { colSpan: 2 }, "\u91CD\u5E86\u4E2D\u62D3-\u7535\u5546\u90E8")),
|
|
356
|
-
React.createElement("tr", null,
|
|
357
|
-
React.createElement("td", null, "\u53D1\u8D27\u4EBA"),
|
|
358
|
-
React.createElement("td", { colSpan: 2 }),
|
|
359
|
-
React.createElement("td", null, "\u5236\u5355\u4EBA"),
|
|
360
|
-
React.createElement("td", { colSpan: 2 }, "\u9EC4\u667A\u575A"),
|
|
361
|
-
React.createElement("td", null, "\u90E8\u95E8"),
|
|
362
|
-
React.createElement("td", { colSpan: 2 }, "\u91CD\u5E86\u4E2D\u62D3-\u7535\u5546\u90E8"),
|
|
363
|
-
React.createElement("td", null, "\u4E1A\u52A1\u4EE3\u8868"),
|
|
364
|
-
React.createElement("td", { colSpan: 2 }, "\u80E1\u4F1F\u534E"))))),
|
|
365
243
|
React.createElement("div", { className: "pt_bottom" },
|
|
366
244
|
React.createElement("div", { className: "ant-row", style: { rowGap: '0px' } },
|
|
367
245
|
React.createElement("div", { className: "ant-col ant-col-17", style: { paddingLeft: '0px' } },
|
|
@@ -39,3 +39,16 @@ export declare function htmlToPdfNoCanvas({ pageClassName, dom, isShowPage, file
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function setPositionLocal(value: any, localKey?: string): void;
|
|
41
41
|
export declare function getPositionLocal(localKey?: string): any;
|
|
42
|
+
/**
|
|
43
|
+
* @author 陈亚雄
|
|
44
|
+
* @description 设置标签位置
|
|
45
|
+
*/
|
|
46
|
+
export declare function setPositionDom(value: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* @author 陈亚雄
|
|
49
|
+
* @description 设置打印pdf偏移量
|
|
50
|
+
*/
|
|
51
|
+
export declare function setPositionDeviation(value: any): {
|
|
52
|
+
top: number;
|
|
53
|
+
left: number;
|
|
54
|
+
};
|
|
@@ -39,6 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
39
39
|
* @description 一些工具方法
|
|
40
40
|
*/
|
|
41
41
|
import jsPDF from 'jspdf';
|
|
42
|
+
import { plus } from 'ztxkutils/dist/tools';
|
|
42
43
|
/**
|
|
43
44
|
* 图片转base64
|
|
44
45
|
*/
|
|
@@ -276,3 +277,24 @@ export function getPositionLocal(localKey) {
|
|
|
276
277
|
}
|
|
277
278
|
return v;
|
|
278
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* @author 陈亚雄
|
|
282
|
+
* @description 设置标签位置
|
|
283
|
+
*/
|
|
284
|
+
export function setPositionDom(value) {
|
|
285
|
+
var printDom = document.querySelectorAll('.html2canvas-container-page');
|
|
286
|
+
for (var i = 0; i < printDom.length; i++) {
|
|
287
|
+
var item = printDom[i];
|
|
288
|
+
item.setAttribute('style', "padding-top: " + (value === null || value === void 0 ? void 0 : value.top) + "px; padding-left: " + (value === null || value === void 0 ? void 0 : value.left) + "px");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* @author 陈亚雄
|
|
293
|
+
* @description 设置打印pdf偏移量
|
|
294
|
+
*/
|
|
295
|
+
export function setPositionDeviation(value) {
|
|
296
|
+
return {
|
|
297
|
+
top: plus((value === null || value === void 0 ? void 0 : value.top) || 0, 25.03),
|
|
298
|
+
left: plus((value === null || value === void 0 ? void 0 : value.left) || 0, 49.72),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
@@ -67,7 +67,7 @@ import { printCurrentDom, htmlToPdfNoCanvas, htmlToPdf, } from 'ztxkutils/dist/p
|
|
|
67
67
|
import { createDownloadUrlNoBase } from 'ztxkutils/dist/fileOperation';
|
|
68
68
|
import { dataURLtoFile,
|
|
69
69
|
// image2Base64,
|
|
70
|
-
setPositionLocal, getPositionLocal, } from './handle';
|
|
70
|
+
setPositionLocal, getPositionLocal, setPositionDom, setPositionDeviation, } from './handle';
|
|
71
71
|
import { createTask } from './lodop';
|
|
72
72
|
import { setWater, removeWater } from './printUtils';
|
|
73
73
|
var fontTTF = {
|
|
@@ -76,6 +76,7 @@ var fontTTF = {
|
|
|
76
76
|
var loadFontTTFPromise = null;
|
|
77
77
|
var loadFontTTFMaxNum = 3;
|
|
78
78
|
var loadFontTTFNum = 0;
|
|
79
|
+
var PAGEFORMAT = [1050, 1050];
|
|
79
80
|
// 字体文件下载
|
|
80
81
|
function downloadFontTTF(_a) {
|
|
81
82
|
var fileId = _a.fileId, request = _a.request;
|
|
@@ -115,11 +116,7 @@ var PrintContainer = function (_a) {
|
|
|
115
116
|
useEffect(function () {
|
|
116
117
|
var v = getPositionLocal(localKey);
|
|
117
118
|
setValue(v);
|
|
118
|
-
|
|
119
|
-
for (var i = 0; i < printDom.length; i++) {
|
|
120
|
-
var item = printDom[i];
|
|
121
|
-
item.setAttribute('style', "padding-top: " + (v === null || v === void 0 ? void 0 : v.top) + "px; padding-left: " + (v === null || v === void 0 ? void 0 : v.left) + "px");
|
|
122
|
-
}
|
|
119
|
+
setPositionDom(v);
|
|
123
120
|
}, [localKey]);
|
|
124
121
|
// 根据传入参数设置印章 关键字
|
|
125
122
|
useEffect(function () {
|
|
@@ -227,34 +224,13 @@ var PrintContainer = function (_a) {
|
|
|
227
224
|
var img = document.createElement('img');
|
|
228
225
|
img.src = imgWaterBg;
|
|
229
226
|
if (!showWater) {
|
|
230
|
-
// if (isAddExportPage) {
|
|
231
|
-
// const html2canvasDom = containerRef.current.querySelectorAll(
|
|
232
|
-
// '.html2canvas-container-page'
|
|
233
|
-
// );
|
|
234
|
-
// // 通过背景图添加水印
|
|
235
|
-
// // html2canvasDom.forEach((item) => item.classList.add('bg-water'));
|
|
236
|
-
// setWater(imgWaterBg, html2canvasDom);
|
|
237
|
-
// } else {
|
|
238
|
-
// // 通过背景图添加水印
|
|
239
|
-
// containerRef.current.classList.add('bg-water');
|
|
240
|
-
// }
|
|
241
227
|
var html2canvasDom = containerRef.current.querySelectorAll('.html2canvas-container-page');
|
|
242
|
-
// 通过背景图添加水印
|
|
243
|
-
// html2canvasDom.forEach((item) => item.classList.add('bg-water'));
|
|
244
228
|
setWater(imgWaterBg, html2canvasDom);
|
|
245
229
|
setShowWater(true);
|
|
246
230
|
}
|
|
247
231
|
else {
|
|
248
232
|
var html2canvasDom = containerRef.current.querySelectorAll('.html2canvas-container-page');
|
|
249
233
|
removeWater(html2canvasDom);
|
|
250
|
-
// if (isAddExportPage) {
|
|
251
|
-
// const html2canvasDom = containerRef.current.querySelectorAll(
|
|
252
|
-
// '.html2canvas-container-page'
|
|
253
|
-
// );
|
|
254
|
-
// html2canvasDom.forEach((item) => item.classList.remove('bg-water'));
|
|
255
|
-
// } else {
|
|
256
|
-
// containerRef.current.classList.remove('bg-water');
|
|
257
|
-
// }
|
|
258
234
|
setShowWater(false);
|
|
259
235
|
}
|
|
260
236
|
};
|
|
@@ -456,19 +432,9 @@ var PrintContainer = function (_a) {
|
|
|
456
432
|
}
|
|
457
433
|
// 生成pdf
|
|
458
434
|
var onPdfHandle = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
459
|
-
var html2canvasDom;
|
|
460
435
|
return __generator(this, function (_a) {
|
|
461
436
|
setSpinning(true);
|
|
462
437
|
if (fileId) {
|
|
463
|
-
if (showWater) {
|
|
464
|
-
if (isAddExportPage) {
|
|
465
|
-
html2canvasDom = containerRef.current.querySelectorAll('.html2canvas-container-page');
|
|
466
|
-
html2canvasDom.forEach(function (item) { return item.classList.remove('bg-water'); });
|
|
467
|
-
}
|
|
468
|
-
else {
|
|
469
|
-
containerRef.current.classList.remove('bg-water');
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
438
|
// 文件还在加载中
|
|
473
439
|
if (!fontTTF.data) {
|
|
474
440
|
loadFontTTFPromise
|
|
@@ -521,6 +487,7 @@ var PrintContainer = function (_a) {
|
|
|
521
487
|
}); };
|
|
522
488
|
function createPdf() {
|
|
523
489
|
setTimeout(function () {
|
|
490
|
+
setPositionDom(setPositionDeviation(value));
|
|
524
491
|
htmlToPdfNoCanvas({
|
|
525
492
|
dom: containerRef.current,
|
|
526
493
|
fileBinary: fontTTF,
|
|
@@ -529,79 +496,23 @@ var PrintContainer = function (_a) {
|
|
|
529
496
|
// isAddWater: showWater,
|
|
530
497
|
isDownload: true,
|
|
531
498
|
pdfOption: {
|
|
532
|
-
pageFormat:
|
|
499
|
+
pageFormat: PAGEFORMAT,
|
|
533
500
|
// 因为生成的pdf需要打印,所以边距需要去掉
|
|
534
501
|
pageMarginX: 0,
|
|
535
502
|
pageMarginY: 0,
|
|
536
503
|
},
|
|
537
504
|
})
|
|
538
505
|
.then(function () {
|
|
506
|
+
setPositionDom(value);
|
|
539
507
|
setSpinning(false);
|
|
540
508
|
setShowWater(false);
|
|
541
509
|
})
|
|
542
510
|
.catch(function () {
|
|
511
|
+
setPositionDom(value);
|
|
543
512
|
setSpinning(false);
|
|
544
513
|
setShowWater(false);
|
|
545
514
|
});
|
|
546
515
|
});
|
|
547
|
-
// if (imgWaterBg) {
|
|
548
|
-
// setTimeout(() => {
|
|
549
|
-
// let waterBase64 = '';
|
|
550
|
-
// const img = new Image();
|
|
551
|
-
// img.src = imgWaterBg;
|
|
552
|
-
// img.setAttribute('crossOrigin', 'Anonymous');
|
|
553
|
-
// img.onload = function () {
|
|
554
|
-
// waterBase64 = image2Base64(img);
|
|
555
|
-
// htmlToPdfNoCanvas({
|
|
556
|
-
// dom: containerRef.current,
|
|
557
|
-
// fileBinary: fontTTF,
|
|
558
|
-
// isShowPage: isAddExportPage,
|
|
559
|
-
// pdfName,
|
|
560
|
-
// isAddWater: showWater,
|
|
561
|
-
// waterBase64,
|
|
562
|
-
// imgWidth: img.width,
|
|
563
|
-
// imgHeight: img.height,
|
|
564
|
-
// isDownload: true,
|
|
565
|
-
// pdfOption: {
|
|
566
|
-
// pageFormat: [1000, 1000] as any,
|
|
567
|
-
// },
|
|
568
|
-
// })
|
|
569
|
-
// .then(() => {
|
|
570
|
-
// setSpinning(false);
|
|
571
|
-
// setShowWater(false);
|
|
572
|
-
// })
|
|
573
|
-
// .catch(() => {
|
|
574
|
-
// setSpinning(false);
|
|
575
|
-
// setShowWater(false);
|
|
576
|
-
// });
|
|
577
|
-
// };
|
|
578
|
-
// img.onerror = function () {
|
|
579
|
-
// console.log('img error', '加载失败!');
|
|
580
|
-
// };
|
|
581
|
-
// });
|
|
582
|
-
// } else {
|
|
583
|
-
// setTimeout(() => {
|
|
584
|
-
// htmlToPdfNoCanvas({
|
|
585
|
-
// dom: containerRef.current,
|
|
586
|
-
// fileBinary: fontTTF,
|
|
587
|
-
// isShowPage: isAddExportPage,
|
|
588
|
-
// pdfName,
|
|
589
|
-
// // isAddWater: showWater,
|
|
590
|
-
// isDownload: true,
|
|
591
|
-
// pdfOption: {
|
|
592
|
-
// pageFormat: [1000, 1000] as any,
|
|
593
|
-
// },
|
|
594
|
-
// })
|
|
595
|
-
// .then(() => {
|
|
596
|
-
// setSpinning(false);
|
|
597
|
-
// setShowWater(false);
|
|
598
|
-
// })
|
|
599
|
-
// .catch(() => {
|
|
600
|
-
// setSpinning(false);
|
|
601
|
-
// setShowWater(false);
|
|
602
|
-
// });
|
|
603
|
-
// });
|
|
604
|
-
// }
|
|
605
516
|
}
|
|
606
517
|
// 关闭
|
|
607
518
|
var onCloseHandle = function () {
|
|
@@ -613,16 +524,6 @@ var PrintContainer = function (_a) {
|
|
|
613
524
|
message.info("\u5F53\u524D\u90E8\u95E8\u3001\u6D41\u7A0B\u4E0B\u672A\u914D\u7F6E\u5370\u7AE0\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u914D\u7F6E!");
|
|
614
525
|
return;
|
|
615
526
|
}
|
|
616
|
-
if (showWater) {
|
|
617
|
-
if (isAddExportPage) {
|
|
618
|
-
var html2canvasDom = containerRef.current.querySelectorAll('.html2canvas-container-page');
|
|
619
|
-
html2canvasDom.forEach(function (item) { return item.classList.remove('bg-water'); });
|
|
620
|
-
}
|
|
621
|
-
else {
|
|
622
|
-
containerRef.current.classList.remove('bg-water');
|
|
623
|
-
}
|
|
624
|
-
setShowWater(false);
|
|
625
|
-
}
|
|
626
527
|
setSpinning(true);
|
|
627
528
|
// 文件还在加载中
|
|
628
529
|
if (!fontTTF.data) {
|
|
@@ -660,18 +561,20 @@ var PrintContainer = function (_a) {
|
|
|
660
561
|
};
|
|
661
562
|
function surePdfLoad() {
|
|
662
563
|
setTimeout(function () {
|
|
564
|
+
setPositionDom(setPositionDeviation(value));
|
|
663
565
|
htmlToPdfNoCanvas({
|
|
664
566
|
dom: containerRef.current,
|
|
665
567
|
isShowPage: isAddExportPage,
|
|
666
568
|
fileBinary: fontTTF,
|
|
667
569
|
pdfOption: {
|
|
668
|
-
pageFormat:
|
|
570
|
+
pageFormat: PAGEFORMAT,
|
|
669
571
|
// 因为生成的pdf需要打印,所以边距需要去掉
|
|
670
572
|
pageMarginX: 0,
|
|
671
573
|
pageMarginY: 0,
|
|
672
574
|
},
|
|
673
575
|
})
|
|
674
576
|
.then(function (option) {
|
|
577
|
+
setPositionDom(value);
|
|
675
578
|
var pdfBase64 = option.pdfBase64;
|
|
676
579
|
var files = Array.isArray(pdfBase64)
|
|
677
580
|
? pdfBase64.map(function (base64) { return dataURLtoFile(base64, pdfName + ".pdf"); })
|
|
@@ -696,7 +599,6 @@ var PrintContainer = function (_a) {
|
|
|
696
599
|
.then(function (res) {
|
|
697
600
|
var _a;
|
|
698
601
|
setSpinning(false);
|
|
699
|
-
console.log(res);
|
|
700
602
|
if (res.status === 200 && res.data.code === 200) {
|
|
701
603
|
var data = (res.data || {}).data;
|
|
702
604
|
setCurrentContractId(data === null || data === void 0 ? void 0 : data.contractId);
|
|
@@ -720,6 +622,7 @@ var PrintContainer = function (_a) {
|
|
|
720
622
|
});
|
|
721
623
|
})
|
|
722
624
|
.catch(function () {
|
|
625
|
+
setPositionDom(value);
|
|
723
626
|
setSpinning(false);
|
|
724
627
|
});
|
|
725
628
|
});
|
|
@@ -773,16 +676,6 @@ var PrintContainer = function (_a) {
|
|
|
773
676
|
message.info("\u5F53\u524D\u90E8\u95E8\u3001\u6D41\u7A0B\u4E0B\u672A\u914D\u7F6E\u81EA\u52A8\u76D6\u7AE0\u76F8\u5173\u5370\u7AE0\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u914D\u7F6E!");
|
|
774
677
|
return;
|
|
775
678
|
}
|
|
776
|
-
if (showWater) {
|
|
777
|
-
if (isAddExportPage) {
|
|
778
|
-
var html2canvasDom = containerRef.current.querySelectorAll('.html2canvas-container-page');
|
|
779
|
-
html2canvasDom.forEach(function (item) { return item.classList.remove('bg-water'); });
|
|
780
|
-
}
|
|
781
|
-
else {
|
|
782
|
-
containerRef.current.classList.remove('bg-water');
|
|
783
|
-
}
|
|
784
|
-
setShowWater(false);
|
|
785
|
-
}
|
|
786
679
|
setSpinning(true);
|
|
787
680
|
// 文件还在加载中
|
|
788
681
|
if (!fontTTF.data) {
|
|
@@ -820,18 +713,20 @@ var PrintContainer = function (_a) {
|
|
|
820
713
|
};
|
|
821
714
|
function pdfLoad() {
|
|
822
715
|
setTimeout(function () {
|
|
716
|
+
setPositionDom(setPositionDeviation(value));
|
|
823
717
|
htmlToPdfNoCanvas({
|
|
824
718
|
dom: containerRef.current,
|
|
825
719
|
isShowPage: isAddExportPage,
|
|
826
720
|
fileBinary: fontTTF,
|
|
827
721
|
pdfOption: {
|
|
828
|
-
pageFormat:
|
|
722
|
+
pageFormat: PAGEFORMAT,
|
|
829
723
|
// 因为生成的pdf需要打印,所以边距需要去掉
|
|
830
724
|
pageMarginX: 0,
|
|
831
725
|
pageMarginY: 0,
|
|
832
726
|
},
|
|
833
727
|
})
|
|
834
728
|
.then(function (option) {
|
|
729
|
+
setPositionDom(value);
|
|
835
730
|
var pdfBase64 = option.pdfBase64;
|
|
836
731
|
var files = Array.isArray(pdfBase64)
|
|
837
732
|
? pdfBase64.map(function (base64) { return dataURLtoFile(base64, pdfName + ".pdf"); })
|
|
@@ -889,6 +784,7 @@ var PrintContainer = function (_a) {
|
|
|
889
784
|
});
|
|
890
785
|
})
|
|
891
786
|
.catch(function () {
|
|
787
|
+
setPositionDom(value);
|
|
892
788
|
setSpinning(false);
|
|
893
789
|
});
|
|
894
790
|
});
|
|
@@ -914,11 +810,7 @@ var PrintContainer = function (_a) {
|
|
|
914
810
|
setValue(value);
|
|
915
811
|
setPositionLocal(value, localKey);
|
|
916
812
|
setVisible(false);
|
|
917
|
-
|
|
918
|
-
for (var i = 0; i < printDom.length; i++) {
|
|
919
|
-
var item = printDom[i];
|
|
920
|
-
item.setAttribute('style', "padding-top: " + (value === null || value === void 0 ? void 0 : value.top) + "px; padding-left: " + (value === null || value === void 0 ? void 0 : value.left) + "px");
|
|
921
|
-
}
|
|
813
|
+
setPositionDom(value);
|
|
922
814
|
} })));
|
|
923
815
|
};
|
|
924
816
|
export default PrintContainer;
|