ztxkutils 2.10.56 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,3 +56,5 @@ 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,6 +58,8 @@ var IMPORT_IFRAME_PARENT_ORIGIN = 'iframeParentOrigin';
58
58
  /**
59
59
  * @description 流程实例ID
60
60
  */
61
- var WORKFLOW_PROCESS_INST_ID = 'workflowProcessInstId';
61
+ var WORKFLOW_PROCESS_INST_ID = 'workflowProcessInstId';
62
+ var TOKEN_KEY = 'Cicoms-Auth';
63
+ var BASIC_KEY = 'cicoms';
62
64
 
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 };
65
+ export { BASIC_KEY, IFRAME_LOADED, IMPORT_IFRAME_PARENT_ORIGIN, TOKEN_KEY, 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 };
@@ -1,5 +1,6 @@
1
1
  import { g as getToken } from './authority-7a91cb9f.js';
2
- import { d as dangerouslySetXss } from './tools-16a7fb45.js';
2
+ import { d as dangerouslySetXss } from './tools-09a4d620.js';
3
+ import { BASIC_KEY, TOKEN_KEY } from './constants.js';
3
4
  import './tslib.es6-35653116.js';
4
5
  import 'dayjs';
5
6
 
@@ -23,7 +24,7 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
23
24
  var _apiUrl = apiUrl.endsWith('/')
24
25
  ? apiUrl.slice(0, apiUrl.length - 1)
25
26
  : apiUrl;
26
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
27
+ xhr.open('GET', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token + "&addWaterMark=" + addWaterMark, true);
27
28
  xhr.responseType = 'blob';
28
29
  xhr.onload = function () {
29
30
  if (xhr.status === 200 || xhr.status === 201) {
@@ -48,7 +49,7 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
48
49
  var _apiUrl = apiUrl.endsWith('/')
49
50
  ? apiUrl.slice(0, apiUrl.length - 1)
50
51
  : apiUrl;
51
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
52
+ xhr.open('GET', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token + "&addWaterMark=" + addWaterMark, true);
52
53
  xhr.responseType = 'blob';
53
54
  xhr.onload = function () {
54
55
  if (xhr.status === 200 || xhr.status === 201) {
@@ -83,7 +84,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
83
84
  var _apiUrl = apiUrl.endsWith('/')
84
85
  ? apiUrl.slice(0, apiUrl.length - 1)
85
86
  : apiUrl;
86
- xhr.open('POST', _apiUrl + "/api/zmdms-resource/oss/endpoint/batch-download-file", true);
87
+ xhr.open('POST', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/batch-download-file", true);
87
88
  xhr.responseType = 'blob';
88
89
  xhr.onload = function () {
89
90
  if (xhr.status === 200 || xhr.status === 201) {
@@ -106,7 +107,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
106
107
  xhr.onerror = function (err) {
107
108
  callbackError && callbackError();
108
109
  };
109
- xhr.setRequestHeader('Zmdms-Auth', token || '');
110
+ xhr.setRequestHeader(TOKEN_KEY, token || '');
110
111
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
111
112
  xhr.send("attachIds=" + fileIds + "&fileNames=" + fileNames + "&zipName=" + zipName + "&addWaterMark=" + addWaterMark);
112
113
  }
@@ -122,7 +123,7 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
122
123
  var _apiUrl = apiUrl.endsWith('/')
123
124
  ? apiUrl.slice(0, apiUrl.length - 1)
124
125
  : apiUrl;
125
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId, true);
126
+ xhr.open('GET', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/public/download-file/" + fileId, true);
126
127
  xhr.responseType = 'blob';
127
128
  xhr.onload = function () {
128
129
  if (xhr.status === 200 || xhr.status === 201) {
@@ -157,7 +158,7 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
157
158
  var _apiUrl = apiUrl.endsWith('/')
158
159
  ? apiUrl.slice(0, apiUrl.length - 1)
159
160
  : apiUrl;
160
- return _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
161
+ return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token;
161
162
  }
162
163
  /**
163
164
  * @description 生成文件下载路径
@@ -166,7 +167,7 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
166
167
  */
167
168
  function createDownloadUrlNoBase(fileId, authToken) {
168
169
  var token = getToken() || authToken;
169
- return "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
170
+ return "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token;
170
171
  }
171
172
  /**
172
173
  * @description 生成公共文件下载路径
@@ -177,7 +178,7 @@ function createPublicDownloadUrl(apiUrl, fileId) {
177
178
  var _apiUrl = apiUrl.endsWith('/')
178
179
  ? apiUrl.slice(0, apiUrl.length - 1)
179
180
  : apiUrl;
180
- return _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId;
181
+ return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/public/download-file/" + fileId;
181
182
  }
182
183
  /**
183
184
  * @description 文件预览方法
@@ -201,7 +202,7 @@ function previewFile(fileUrl, fileId, otherOption) {
201
202
  catch (err) {
202
203
  console.log(err);
203
204
  }
204
- var _fileUrl = fileUrl.endsWith('/')
205
+ fileUrl.endsWith('/')
205
206
  ? fileUrl.slice(0, fileUrl.length - 1)
206
207
  : fileUrl;
207
208
  if (titleName) {
@@ -211,10 +212,20 @@ function previewFile(fileUrl, fileId, otherOption) {
211
212
  titleName = suffixTitleName
212
213
  ? preTitleName + "." + suffixTitleName
213
214
  : preTitleName;
214
- window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf");
215
+ // 2023-12-30 修改成数字中心预览
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
+ // );
215
222
  }
216
223
  else {
217
- window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf");
224
+ // 2023-12-30 修改成数字中心预览
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
+ // );
218
229
  }
219
230
  }
220
231
  /**
@@ -239,15 +250,22 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
239
250
  catch (err) {
240
251
  console.log(err);
241
252
  }
242
- var _fileUrl = fileUrl.endsWith('/')
253
+ fileUrl.endsWith('/')
243
254
  ? fileUrl.slice(0, fileUrl.length - 1)
244
255
  : fileUrl;
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
- }
256
+ // 2023-12-30 修改成数字中心预览
257
+ window.open("/api/cicoms-cicohr-org/cicomscicohr/v1/common/filePreview?attachId=" + fileId + "&" + TOKEN_KEY + "=" + token);
258
+ // if (titleName) {
259
+ // window.open(
260
+ // `${_fileUrl}/picturesAttchPreview?attachIds=${fileId}&${TOKEN_KEY}=bearer ${token}&titleName=${encodeURIComponent(
261
+ // titleName
262
+ // )}`
263
+ // );
264
+ // } else {
265
+ // window.open(
266
+ // `${fileUrl}/picturesAttchPreview?attachIds=${fileId}&${TOKEN_KEY}=bearer ${token}`
267
+ // );
268
+ // }
251
269
  }
252
270
  /**
253
271
  * @description 生成原始图片路径
@@ -264,7 +282,7 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
264
282
  catch (err) {
265
283
  console.log(err);
266
284
  }
267
- var _fileUrl = fileUrl.endsWith('/')
285
+ fileUrl.endsWith('/')
268
286
  ? fileUrl.slice(0, fileUrl.length - 1)
269
287
  : fileUrl;
270
288
  if (titleName) {
@@ -274,10 +292,14 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
274
292
  titleName = suffixTitleName
275
293
  ? preTitleName + "." + suffixTitleName
276
294
  : preTitleName;
277
- return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf";
295
+ return "/api/cicoms-cicohr-org/cicomscicohr/v1/common/filePreview?attachId=" + fileId + "&" + TOKEN_KEY + "=" + token;
296
+ // return `${_fileUrl}/attchPreview?attachId=${fileId}&${TOKEN_KEY}=bearer ${token}&titleName=${encodeURIComponent(
297
+ // titleName
298
+ // )}&officePreviewType=pdf`;
278
299
  }
279
300
  else {
280
- return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf";
301
+ return "/api/cicoms-cicohr-org/cicomscicohr/v1/common/filePreview?attachId=" + fileId + "&" + TOKEN_KEY + "=" + token;
302
+ // return `${_fileUrl}/attchPreview?attachId=${fileId}&${TOKEN_KEY}=bearer ${token}&officePreviewType=pdf`;
281
303
  }
282
304
  }
283
305
  /**
@@ -291,7 +313,7 @@ function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
291
313
  ? apiUrl.slice(0, apiUrl.length - 1)
292
314
  : apiUrl;
293
315
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
294
- return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
316
+ return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&" + TOKEN_KEY + "=bearer " + token;
295
317
  }
296
318
 
297
319
  export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, previewFile };
package/dist/hooks.js CHANGED
@@ -5,8 +5,9 @@ import { message } from 'ztxkui';
5
5
  import axios from 'axios';
6
6
  import './fileOperation.js';
7
7
  import './authority-7a91cb9f.js';
8
- import './tools-16a7fb45.js';
8
+ import './tools-09a4d620.js';
9
9
  import 'dayjs';
10
+ import './constants.js';
10
11
 
11
12
  function useTableLinkage(_a) {
12
13
  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-16a7fb45.js';
3
+ export { t as tools } from './tools-09a4d620.js';
4
4
  export { v as validate } from './validate-18e52490.js';
5
- export { r as request } from './request-3c906c2d.js';
5
+ export { r as request } from './request-a6274f1b.js';
6
6
  export { r as reqUrl } from './reqUrl-3792afcd.js';
7
7
  import './tslib.es6-35653116.js';
8
8
  import 'dayjs';
@@ -10,3 +10,4 @@ import 'axios';
10
10
  import 'ztxkui';
11
11
  import './crypto-c481f616.js';
12
12
  import 'crypto';
13
+ import './constants.js';
package/dist/request.js CHANGED
@@ -1,7 +1,8 @@
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-3c906c2d.js';
4
+ export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, b as clearCatch, c as clearNoCompleteRequest, a as default } from './request-a6274f1b.js';
5
5
  import './authority-7a91cb9f.js';
6
6
  import './crypto-c481f616.js';
7
+ import './constants.js';
7
8
  import 'crypto';
@@ -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
- }
1
+ export {};
@@ -1,6 +1,7 @@
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';
4
5
 
5
6
  var StompClient = /** @class */ (function () {
6
7
  function StompClient(connectWsConfig) {
@@ -26,7 +27,7 @@ var StompClient = /** @class */ (function () {
26
27
  this.isInit = true;
27
28
  var token = this.connectWsConfig.token || getToken();
28
29
  // 建立连接对象,还未发起连接
29
- var socket = new SockJS(this.connectWsConfig.baseUrl + "/api/zmdms-csc-ztim/ws?token=" + token + "&system=" + this.connectWsConfig.systemType + "&clientType=" + this.connectWsConfig.clientType);
30
+ var socket = new SockJS(this.connectWsConfig.baseUrl + "/api/" + BASIC_KEY + "-csc-ztim/ws?token=" + token + "&system=" + this.connectWsConfig.systemType + "&clientType=" + this.connectWsConfig.clientType);
30
31
  // 获取 STOMP 子协议的客户端对象
31
32
  this.client = Stomp.over(socket);
32
33
  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-16a7fb45.js';
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-09a4d620.js';
@@ -1,9 +1,10 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { createDownloadUrl } from './fileOperation.js';
3
3
  import './authority-7a91cb9f.js';
4
- import './tools-16a7fb45.js';
4
+ import './tools-09a4d620.js';
5
5
  import './tslib.es6-35653116.js';
6
6
  import 'dayjs';
7
+ import './constants.js';
7
8
 
8
9
  /**
9
10
  * 图片附件id转base64字符串
package/dist/workflow.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from 'react';
2
- import { g as getUrlSearch } from './tools-16a7fb45.js';
2
+ import { g as getUrlSearch } from './tools-09a4d620.js';
3
3
  import { WORKFLOW_HIDEFRAME_KEY } from './constants.js';
4
4
  import './tslib.es6-35653116.js';
5
5
  import 'dayjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.10.56",
3
+ "version": "4.0.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -72,4 +72,4 @@
72
72
  "zt-sockjs-client": ">=0.0.1",
73
73
  "zt-stompjs": ">=1.0.3"
74
74
  }
75
- }
75
+ }