ztxkutils 4.0.1 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +2 -4
- package/dist/fileOperation.js +23 -45
- package/dist/hooks.js +1 -2
- package/dist/index.js +2 -3
- package/dist/{request-3c906c2d.js → request-9dc2c20d.js} +4 -0
- package/dist/request.js +1 -2
- package/dist/statistic.d.ts +36 -1
- package/dist/stompClient.js +1 -2
- package/dist/tools.js +1 -1
- package/dist/useFileIdToBase64.js +1 -2
- package/dist/workflow.js +1 -1
- package/package.json +1 -1
- package/dist/authority-e6bde99f.js +0 -423
- package/dist/request-1ac889d2.js +0 -2910
- package/dist/request-2c8dff05.js +0 -2903
- package/dist/request-40abfa76.js +0 -2909
- package/dist/request-a6274f1b.js +0 -2915
- package/dist/tools-09a4d620.js +0 -2445
package/dist/constants.d.ts
CHANGED
@@ -56,5 +56,3 @@ export declare const IMPORT_IFRAME_PARENT_ORIGIN = "iframeParentOrigin";
|
|
56
56
|
* @description 流程实例ID
|
57
57
|
*/
|
58
58
|
export declare const WORKFLOW_PROCESS_INST_ID = "workflowProcessInstId";
|
59
|
-
export declare const TOKEN_KEY = "Cicoms-Auth";
|
60
|
-
export declare const BASIC_KEY = "cicoms";
|
package/dist/constants.js
CHANGED
@@ -58,8 +58,6 @@ var IMPORT_IFRAME_PARENT_ORIGIN = 'iframeParentOrigin';
|
|
58
58
|
/**
|
59
59
|
* @description 流程实例ID
|
60
60
|
*/
|
61
|
-
var WORKFLOW_PROCESS_INST_ID = 'workflowProcessInstId';
|
62
|
-
var TOKEN_KEY = 'Cicoms-Auth';
|
63
|
-
var BASIC_KEY = 'cicoms';
|
61
|
+
var WORKFLOW_PROCESS_INST_ID = 'workflowProcessInstId';
|
64
62
|
|
65
|
-
export {
|
63
|
+
export { IFRAME_LOADED, IMPORT_IFRAME_PARENT_ORIGIN, WORKFLOW_EDIT, WORKFLOW_GET_HEIGHT, WORKFLOW_HIDEFRAME_KEY, WORKFLOW_PROCESS_INST_ID, WORKFLOW_RETURN_HEIGHT, WORKFLOW_RETURN_INSTID, WORKFLOW_REVIEW, WORKFLOW_SAVE_HANDLE, WORKFLOW_SAVE_INSTID, WORKFLOW_TOKEN, WORKFLOW_TRANSMIT_HANDLE, clientType, microPortalRoute };
|
package/dist/fileOperation.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { g as getToken } from './authority-7a91cb9f.js';
|
2
|
-
import { d as dangerouslySetXss } from './tools-
|
3
|
-
import { BASIC_KEY, TOKEN_KEY } from './constants.js';
|
2
|
+
import { d as dangerouslySetXss } from './tools-16a7fb45.js';
|
4
3
|
import './tslib.es6-35653116.js';
|
5
4
|
import 'dayjs';
|
6
5
|
|
@@ -24,7 +23,7 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
|
|
24
23
|
var _apiUrl = apiUrl.endsWith('/')
|
25
24
|
? apiUrl.slice(0, apiUrl.length - 1)
|
26
25
|
: apiUrl;
|
27
|
-
xhr.open('GET', _apiUrl + "/api/
|
26
|
+
xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
|
28
27
|
xhr.responseType = 'blob';
|
29
28
|
xhr.onload = function () {
|
30
29
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -49,7 +48,7 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
|
|
49
48
|
var _apiUrl = apiUrl.endsWith('/')
|
50
49
|
? apiUrl.slice(0, apiUrl.length - 1)
|
51
50
|
: apiUrl;
|
52
|
-
xhr.open('GET', _apiUrl + "/api/
|
51
|
+
xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
|
53
52
|
xhr.responseType = 'blob';
|
54
53
|
xhr.onload = function () {
|
55
54
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -84,7 +83,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
|
|
84
83
|
var _apiUrl = apiUrl.endsWith('/')
|
85
84
|
? apiUrl.slice(0, apiUrl.length - 1)
|
86
85
|
: apiUrl;
|
87
|
-
xhr.open('POST', _apiUrl + "/api/
|
86
|
+
xhr.open('POST', _apiUrl + "/api/zmdms-resource/oss/endpoint/batch-download-file", true);
|
88
87
|
xhr.responseType = 'blob';
|
89
88
|
xhr.onload = function () {
|
90
89
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -107,7 +106,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
|
|
107
106
|
xhr.onerror = function (err) {
|
108
107
|
callbackError && callbackError();
|
109
108
|
};
|
110
|
-
xhr.setRequestHeader(
|
109
|
+
xhr.setRequestHeader('Zmdms-Auth', token || '');
|
111
110
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
112
111
|
xhr.send("attachIds=" + fileIds + "&fileNames=" + fileNames + "&zipName=" + zipName + "&addWaterMark=" + addWaterMark);
|
113
112
|
}
|
@@ -123,7 +122,7 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
|
|
123
122
|
var _apiUrl = apiUrl.endsWith('/')
|
124
123
|
? apiUrl.slice(0, apiUrl.length - 1)
|
125
124
|
: apiUrl;
|
126
|
-
xhr.open('GET', _apiUrl + "/api/
|
125
|
+
xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId, true);
|
127
126
|
xhr.responseType = 'blob';
|
128
127
|
xhr.onload = function () {
|
129
128
|
if (xhr.status === 200 || xhr.status === 201) {
|
@@ -158,7 +157,7 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
|
|
158
157
|
var _apiUrl = apiUrl.endsWith('/')
|
159
158
|
? apiUrl.slice(0, apiUrl.length - 1)
|
160
159
|
: apiUrl;
|
161
|
-
return _apiUrl + "/api/
|
160
|
+
return _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
|
162
161
|
}
|
163
162
|
/**
|
164
163
|
* @description 生成文件下载路径
|
@@ -167,7 +166,7 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
|
|
167
166
|
*/
|
168
167
|
function createDownloadUrlNoBase(fileId, authToken) {
|
169
168
|
var token = getToken() || authToken;
|
170
|
-
return "/api/
|
169
|
+
return "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
|
171
170
|
}
|
172
171
|
/**
|
173
172
|
* @description 生成公共文件下载路径
|
@@ -178,7 +177,7 @@ function createPublicDownloadUrl(apiUrl, fileId) {
|
|
178
177
|
var _apiUrl = apiUrl.endsWith('/')
|
179
178
|
? apiUrl.slice(0, apiUrl.length - 1)
|
180
179
|
: apiUrl;
|
181
|
-
return _apiUrl + "/api/
|
180
|
+
return _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId;
|
182
181
|
}
|
183
182
|
/**
|
184
183
|
* @description 文件预览方法
|
@@ -202,7 +201,7 @@ function previewFile(fileUrl, fileId, otherOption) {
|
|
202
201
|
catch (err) {
|
203
202
|
console.log(err);
|
204
203
|
}
|
205
|
-
fileUrl.endsWith('/')
|
204
|
+
var _fileUrl = fileUrl.endsWith('/')
|
206
205
|
? fileUrl.slice(0, fileUrl.length - 1)
|
207
206
|
: fileUrl;
|
208
207
|
if (titleName) {
|
@@ -212,20 +211,10 @@ function previewFile(fileUrl, fileId, otherOption) {
|
|
212
211
|
titleName = suffixTitleName
|
213
212
|
? preTitleName + "." + suffixTitleName
|
214
213
|
: preTitleName;
|
215
|
-
|
216
|
-
window.open("/api/cicoms-cicohr-org/cicomscicohr/v1/common/filePreview?attachId=" + fileId + "&" + TOKEN_KEY + "=" + token);
|
217
|
-
// window.open(
|
218
|
-
// `${_fileUrl}/attchPreview?attachId=${fileId}&${TOKEN_KEY}=bearer ${token}&titleName=${encodeURIComponent(
|
219
|
-
// titleName
|
220
|
-
// )}&officePreviewType=pdf`
|
221
|
-
// );
|
214
|
+
window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf");
|
222
215
|
}
|
223
216
|
else {
|
224
|
-
|
225
|
-
window.open("/api/cicoms-cicohr-org/cicomscicohr/v1/common/filePreview?attachId=" + fileId + "&" + TOKEN_KEY + "=" + token);
|
226
|
-
// window.open(
|
227
|
-
// `${fileUrl}/attchPreview?attachId=${fileId}&${TOKEN_KEY}=bearer ${token}&officePreviewType=pdf`
|
228
|
-
// );
|
217
|
+
window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf");
|
229
218
|
}
|
230
219
|
}
|
231
220
|
/**
|
@@ -250,22 +239,15 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
|
|
250
239
|
catch (err) {
|
251
240
|
console.log(err);
|
252
241
|
}
|
253
|
-
fileUrl.endsWith('/')
|
242
|
+
var _fileUrl = fileUrl.endsWith('/')
|
254
243
|
? fileUrl.slice(0, fileUrl.length - 1)
|
255
244
|
: fileUrl;
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
// )}`
|
263
|
-
// );
|
264
|
-
// } else {
|
265
|
-
// window.open(
|
266
|
-
// `${fileUrl}/picturesAttchPreview?attachIds=${fileId}&${TOKEN_KEY}=bearer ${token}`
|
267
|
-
// );
|
268
|
-
// }
|
245
|
+
if (titleName) {
|
246
|
+
window.open(_fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName));
|
247
|
+
}
|
248
|
+
else {
|
249
|
+
window.open(fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&Zmdms-Auth=bearer " + token);
|
250
|
+
}
|
269
251
|
}
|
270
252
|
/**
|
271
253
|
* @description 生成原始图片路径
|
@@ -282,7 +264,7 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
|
|
282
264
|
catch (err) {
|
283
265
|
console.log(err);
|
284
266
|
}
|
285
|
-
fileUrl.endsWith('/')
|
267
|
+
var _fileUrl = fileUrl.endsWith('/')
|
286
268
|
? fileUrl.slice(0, fileUrl.length - 1)
|
287
269
|
: fileUrl;
|
288
270
|
if (titleName) {
|
@@ -292,14 +274,10 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
|
|
292
274
|
titleName = suffixTitleName
|
293
275
|
? preTitleName + "." + suffixTitleName
|
294
276
|
: preTitleName;
|
295
|
-
return "/
|
296
|
-
// return `${_fileUrl}/attchPreview?attachId=${fileId}&${TOKEN_KEY}=bearer ${token}&titleName=${encodeURIComponent(
|
297
|
-
// titleName
|
298
|
-
// )}&officePreviewType=pdf`;
|
277
|
+
return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf";
|
299
278
|
}
|
300
279
|
else {
|
301
|
-
return "/
|
302
|
-
// return `${_fileUrl}/attchPreview?attachId=${fileId}&${TOKEN_KEY}=bearer ${token}&officePreviewType=pdf`;
|
280
|
+
return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf";
|
303
281
|
}
|
304
282
|
}
|
305
283
|
/**
|
@@ -313,7 +291,7 @@ function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
|
|
313
291
|
? apiUrl.slice(0, apiUrl.length - 1)
|
314
292
|
: apiUrl;
|
315
293
|
var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
|
316
|
-
return _apiUrl + "/api/
|
294
|
+
return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
|
317
295
|
}
|
318
296
|
|
319
297
|
export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, previewFile };
|
package/dist/hooks.js
CHANGED
@@ -5,9 +5,8 @@ import { message } from 'ztxkui';
|
|
5
5
|
import axios from 'axios';
|
6
6
|
import './fileOperation.js';
|
7
7
|
import './authority-7a91cb9f.js';
|
8
|
-
import './tools-
|
8
|
+
import './tools-16a7fb45.js';
|
9
9
|
import 'dayjs';
|
10
|
-
import './constants.js';
|
11
10
|
|
12
11
|
function useTableLinkage(_a) {
|
13
12
|
var records = _a.records, callbackPromise = _a.callbackPromise, dependencies = _a.dependencies, devDependencies = _a.devDependencies;
|
package/dist/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export { d as authority } from './authority-7a91cb9f.js';
|
2
2
|
export { d as dataModel } from './dataModel-1fbaff40.js';
|
3
|
-
export { t as tools } from './tools-
|
3
|
+
export { t as tools } from './tools-16a7fb45.js';
|
4
4
|
export { v as validate } from './validate-18e52490.js';
|
5
|
-
export { r as request } from './request-
|
5
|
+
export { r as request } from './request-9dc2c20d.js';
|
6
6
|
export { r as reqUrl } from './reqUrl-3792afcd.js';
|
7
7
|
import './tslib.es6-35653116.js';
|
8
8
|
import 'dayjs';
|
@@ -10,4 +10,3 @@ import 'axios';
|
|
10
10
|
import 'ztxkui';
|
11
11
|
import './crypto-c481f616.js';
|
12
12
|
import 'crypto';
|
13
|
-
import './constants.js';
|
@@ -2806,6 +2806,10 @@ function request(myOptions, jumpCallback, otherOptions) {
|
|
2806
2806
|
}
|
2807
2807
|
// 将传入配置与默认配置混合
|
2808
2808
|
var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
|
2809
|
+
// 湘钢国贸项目 除了登录接口外 去掉 Authorization认证头部
|
2810
|
+
if (newOptions.url !== '/api/zmdms-auth/oauth/token') {
|
2811
|
+
delete newOptions.headers.Authorization;
|
2812
|
+
}
|
2809
2813
|
// 特殊请求处理
|
2810
2814
|
if (((_e = newOptions.method) === null || _e === void 0 ? void 0 : _e.toUpperCase()) === 'POST' ||
|
2811
2815
|
((_f = newOptions.method) === null || _f === void 0 ? void 0 : _f.toUpperCase()) === 'PUT' ||
|
package/dist/request.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import './tslib.es6-35653116.js';
|
2
2
|
import 'axios';
|
3
3
|
import 'ztxkui';
|
4
|
-
export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, b as clearCatch, c as clearNoCompleteRequest, a as default } from './request-
|
4
|
+
export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, b as clearCatch, c as clearNoCompleteRequest, a as default } from './request-9dc2c20d.js';
|
5
5
|
import './authority-7a91cb9f.js';
|
6
6
|
import './crypto-c481f616.js';
|
7
|
-
import './constants.js';
|
8
7
|
import 'crypto';
|
package/dist/statistic.d.ts
CHANGED
@@ -1 +1,36 @@
|
|
1
|
-
|
1
|
+
declare const PV_URL_SET: Set<unknown>;
|
2
|
+
declare const EVENT_URL = "/api/zmdms-log/web/submit";
|
3
|
+
declare const ERROR_URL = "/api/zmdms-log/web/submit";
|
4
|
+
/**
|
5
|
+
* routeUrl: string
|
6
|
+
* systemId: string
|
7
|
+
* userId: string
|
8
|
+
* navigator: string // 浏览器信息 userAgent
|
9
|
+
* platform: string // 系统信息
|
10
|
+
* memory: string // 内存信息
|
11
|
+
* eventKey: string // 事件名
|
12
|
+
* eventValue: string // 事件值
|
13
|
+
* {
|
14
|
+
* jsHeapSizeLimit: 上下文内可用堆的最大体积,以字节计算。
|
15
|
+
* totalJSHeapSize: 已分配的堆体积,以字节计算。
|
16
|
+
* usedJSHeapSize: 当前 JS 堆活跃段(segment)的体积,以字节计算。
|
17
|
+
* }
|
18
|
+
*/
|
19
|
+
declare function getUserOsInfo(userAgent?: string): "Windows 10" | "Windows 8" | "Windows 7" | "Windows Vista" | "Windows XP" | "Windows 2000" | "Mac/iOS" | "UNIX" | "Linux" | "Other";
|
20
|
+
declare class MyStatistic {
|
21
|
+
private systemId;
|
22
|
+
private userId;
|
23
|
+
private navigator;
|
24
|
+
private platform;
|
25
|
+
constructor(systemId: any, userId: any);
|
26
|
+
private send;
|
27
|
+
private initPerformance;
|
28
|
+
sendPerformance(): void;
|
29
|
+
private errorHandle;
|
30
|
+
private unhandledrejectionHandle;
|
31
|
+
private initError;
|
32
|
+
removeError(): void;
|
33
|
+
pv(): void;
|
34
|
+
event(eventKey: string, eventValue: string): void;
|
35
|
+
error(error: Error, info?: any): void;
|
36
|
+
}
|
package/dist/stompClient.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import Stomp from 'zt-stompjs';
|
2
2
|
import SockJS from 'zt-sockjs-client';
|
3
3
|
import { g as getToken } from './authority-7a91cb9f.js';
|
4
|
-
import { BASIC_KEY } from './constants.js';
|
5
4
|
|
6
5
|
var StompClient = /** @class */ (function () {
|
7
6
|
function StompClient(connectWsConfig) {
|
@@ -27,7 +26,7 @@ var StompClient = /** @class */ (function () {
|
|
27
26
|
this.isInit = true;
|
28
27
|
var token = this.connectWsConfig.token || getToken();
|
29
28
|
// 建立连接对象,还未发起连接
|
30
|
-
var socket = new SockJS(this.connectWsConfig.baseUrl + "/api/
|
29
|
+
var socket = new SockJS(this.connectWsConfig.baseUrl + "/api/zmdms-csc-ztim/ws?token=" + token + "&system=" + this.connectWsConfig.systemType + "&clientType=" + this.connectWsConfig.clientType);
|
31
30
|
// 获取 STOMP 子协议的客户端对象
|
32
31
|
this.client = Stomp.over(socket);
|
33
32
|
this.isClient = false;
|
package/dist/tools.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
import './tslib.es6-35653116.js';
|
2
2
|
import 'dayjs';
|
3
|
-
export { S as SHOWFRAME_KEY, h as clearAssignStr, k as copyContent, d as dangerouslySetXss, c as divide, e as exactRound, g as getUrlSearch, j as isEqualByKey, l as loadFileRename, m as minus, p as plus, s as showFrame, a as timeTransfrom, b as times, f as toThousand, i as transformFileSize } from './tools-
|
3
|
+
export { S as SHOWFRAME_KEY, h as clearAssignStr, k as copyContent, d as dangerouslySetXss, c as divide, e as exactRound, g as getUrlSearch, j as isEqualByKey, l as loadFileRename, m as minus, p as plus, s as showFrame, a as timeTransfrom, b as times, f as toThousand, i as transformFileSize } from './tools-16a7fb45.js';
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { useState, useEffect } from 'react';
|
2
2
|
import { createDownloadUrl } from './fileOperation.js';
|
3
3
|
import './authority-7a91cb9f.js';
|
4
|
-
import './tools-
|
4
|
+
import './tools-16a7fb45.js';
|
5
5
|
import './tslib.es6-35653116.js';
|
6
6
|
import 'dayjs';
|
7
|
-
import './constants.js';
|
8
7
|
|
9
8
|
/**
|
10
9
|
* 图片附件id转base64字符串
|
package/dist/workflow.js
CHANGED