ztxkutils 4.0.0 → 10.0.0

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.
@@ -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 { 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 };
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 };
@@ -1,6 +1,5 @@
1
1
  import { g as getToken } from './authority-7a91cb9f.js';
2
- import { d as dangerouslySetXss } from './tools-09a4d620.js';
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/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token + "&addWaterMark=" + addWaterMark, true);
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/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token + "&addWaterMark=" + addWaterMark, true);
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/" + BASIC_KEY + "-resource/oss/endpoint/batch-download-file", true);
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(TOKEN_KEY, token || '');
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/" + BASIC_KEY + "-resource/oss/endpoint/public/download-file/" + fileId, true);
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/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token;
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/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token;
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/" + BASIC_KEY + "-resource/oss/endpoint/public/download-file/" + fileId;
180
+ return _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId;
182
181
  }
183
182
  /**
184
183
  * @description 文件预览方法
@@ -212,10 +211,10 @@ function previewFile(fileUrl, fileId, otherOption) {
212
211
  titleName = suffixTitleName
213
212
  ? preTitleName + "." + suffixTitleName
214
213
  : preTitleName;
215
- window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf");
214
+ window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf");
216
215
  }
217
216
  else {
218
- window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&officePreviewType=pdf");
217
+ window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf");
219
218
  }
220
219
  }
221
220
  /**
@@ -244,10 +243,10 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
244
243
  ? fileUrl.slice(0, fileUrl.length - 1)
245
244
  : fileUrl;
246
245
  if (titleName) {
247
- window.open(_fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&titleName=" + encodeURIComponent(titleName));
246
+ window.open(_fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName));
248
247
  }
249
248
  else {
250
- window.open(fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&" + TOKEN_KEY + "=bearer " + token);
249
+ window.open(fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&Zmdms-Auth=bearer " + token);
251
250
  }
252
251
  }
253
252
  /**
@@ -275,10 +274,10 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
275
274
  titleName = suffixTitleName
276
275
  ? preTitleName + "." + suffixTitleName
277
276
  : preTitleName;
278
- return _fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf";
277
+ return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf";
279
278
  }
280
279
  else {
281
- return _fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&officePreviewType=pdf";
280
+ return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf";
282
281
  }
283
282
  }
284
283
  /**
@@ -292,7 +291,7 @@ function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
292
291
  ? apiUrl.slice(0, apiUrl.length - 1)
293
292
  : apiUrl;
294
293
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
295
- return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&" + TOKEN_KEY + "=bearer " + token;
294
+ return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
296
295
  }
297
296
 
298
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-09a4d620.js';
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-09a4d620.js';
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-a6274f1b.js';
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-a6274f1b.js';
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';
@@ -1 +1,36 @@
1
- export {};
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,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/" + BASIC_KEY + "-csc-ztim/ws?token=" + token + "&system=" + this.connectWsConfig.systemType + "&clientType=" + this.connectWsConfig.clientType);
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;
@@ -2408,7 +2408,8 @@ function copyContent(text) {
2408
2408
  */
2409
2409
  function dangerouslySetXss(str) {
2410
2410
  var _a;
2411
- if (!str) {
2411
+ // 兼容str不是字符串的情况,返回原值
2412
+ if (!str || typeof str !== 'string') {
2412
2413
  return str;
2413
2414
  }
2414
2415
  try {
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-09a4d620.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-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-09a4d620.js';
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
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from 'react';
2
- import { g as getUrlSearch } from './tools-09a4d620.js';
2
+ import { g as getUrlSearch } from './tools-16a7fb45.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": "4.0.0",
3
+ "version": "10.0.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",