ztxkui 10.0.85 → 10.0.87
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.
|
@@ -32,20 +32,27 @@ var DetailTable = function (_a) {
|
|
|
32
32
|
var authToken = token || '';
|
|
33
33
|
var isOnlyQj = "" + ((_b = records === null || records === void 0 ? void 0 : records[0]) === null || _b === void 0 ? void 0 : _b.attachId) === '123456789';
|
|
34
34
|
var selectRows = useRef(null);
|
|
35
|
-
var
|
|
35
|
+
var downWaterConfig = React.useContext(ZtxkContext).downWaterConfig;
|
|
36
36
|
/** 下载水印附件 */
|
|
37
37
|
var downFileFn = function (_record) {
|
|
38
38
|
try {
|
|
39
39
|
var xhr_1 = new XMLHttpRequest();
|
|
40
|
-
var apiUrl =
|
|
41
|
-
|
|
40
|
+
var apiUrl = "/zmdms-scm-system/seal/download-watermark-attach/" + (_record === null || _record === void 0 ? void 0 : _record.attachId) + "?Zmdms-Auth=bearer " + token;
|
|
41
|
+
if (downWaterConfig === null || downWaterConfig === void 0 ? void 0 : downWaterConfig.api) {
|
|
42
|
+
apiUrl = (downWaterConfig === null || downWaterConfig === void 0 ? void 0 : downWaterConfig.api) + "/" + (_record === null || _record === void 0 ? void 0 : _record.attachId) + "?Zmdms-Auth=bearer " + token + "&addWaterMark=true&watermarkOrganizationType=12&watermarkOrganizationId=" + organizationId;
|
|
43
|
+
}
|
|
44
|
+
xhr_1.open('GET', ZT_API_BASEURL + "/api" + apiUrl, true);
|
|
42
45
|
xhr_1.responseType = 'blob';
|
|
43
46
|
xhr_1.onload = function () {
|
|
44
47
|
var _a;
|
|
45
48
|
if (xhr_1.status === 200 || xhr_1.status === 201) {
|
|
46
49
|
var link = document.createElement('a');
|
|
47
50
|
link.href = window.URL.createObjectURL(xhr_1.response);
|
|
48
|
-
|
|
51
|
+
var attachNameArr = (_a = _record === null || _record === void 0 ? void 0 : _record.attachName) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
52
|
+
link.download =
|
|
53
|
+
(downWaterConfig === null || downWaterConfig === void 0 ? void 0 : downWaterConfig.isPdf) || !downWaterConfig
|
|
54
|
+
? (attachNameArr === null || attachNameArr === void 0 ? void 0 : attachNameArr[0]) + ".pdf"
|
|
55
|
+
: _record === null || _record === void 0 ? void 0 : _record.attachName;
|
|
49
56
|
// fix Firefox
|
|
50
57
|
link.style.display = 'none';
|
|
51
58
|
document.body.appendChild(link);
|
|
@@ -14,8 +14,11 @@ export interface IZtxkConfig {
|
|
|
14
14
|
price: number;
|
|
15
15
|
amount: number;
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
downWaterConfig?: {
|
|
18
|
+
/** 下载水印版接口地址 /zmdms-scm-system/seal/download-watermark-attach */
|
|
19
|
+
api: string;
|
|
20
|
+
isPdf?: boolean /** 是否转为pdf格式 */;
|
|
21
|
+
};
|
|
19
22
|
}
|
|
20
23
|
declare const ZtxkContext: React.Context<IZtxkConfig>;
|
|
21
24
|
export default ZtxkContext;
|
|
@@ -13,7 +13,10 @@ var ztxkConfig = {
|
|
|
13
13
|
price: 2,
|
|
14
14
|
amount: 2,
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
downWaterConfig: {
|
|
17
|
+
api: '/zmdms-scm-system/seal/download-watermark-attach',
|
|
18
|
+
isPdf: true,
|
|
19
|
+
},
|
|
17
20
|
};
|
|
18
21
|
var ZtxkContext = React.createContext(ztxkConfig);
|
|
19
22
|
export default ZtxkContext;
|