ztxkutils 2.10.66-4 → 2.10.66-40

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.
Files changed (65) hide show
  1. package/dist/businessTools.js +4 -3
  2. package/dist/{dataModel-1fbaff40.js → dataModel-f1ef06bc.js} +4 -2
  3. package/dist/dataModel.js +2 -1
  4. package/dist/fileOperation.d.ts +19 -0
  5. package/dist/fileOperation.js +55 -17
  6. package/dist/hooks.js +35 -23
  7. package/dist/i18next.d.ts +2 -0
  8. package/dist/i18next.js +2401 -0
  9. package/dist/index.js +6 -5
  10. package/dist/myIndexDb.d.ts +1 -1
  11. package/dist/print.d.ts +2 -4
  12. package/dist/print.js +60 -12
  13. package/dist/{reqUrl-22b880a4.js → reqUrl-ea7ef876.js} +3 -2
  14. package/dist/reqUrl.js +1 -1
  15. package/dist/{request-87d93572.js → request-40e9ca7b.js} +16 -8
  16. package/dist/{request-dc69f021.js → request-7bcf02f4.js} +34 -20
  17. package/dist/{request-3c906c2d.js → request-e147d640.js} +98 -23
  18. package/dist/request.js +2 -1
  19. package/dist/stompClient.js +21 -8
  20. package/dist/{tools-16a7fb45.js → tools-47b9bee7.js} +53 -1
  21. package/dist/tools.js +1 -1
  22. package/dist/useFileIdToBase64.js +1 -1
  23. package/dist/useHistory.js +7 -0
  24. package/dist/{validate-18e52490.js → validate-2138d94a.js} +29 -15
  25. package/dist/validate.d.ts +1 -0
  26. package/dist/validate.js +2 -1
  27. package/dist/workflow.js +4 -6
  28. package/locales/en-US.json +64 -0
  29. package/locales/zh-CN.json +64 -0
  30. package/package.json +41 -4
  31. package/zti18n-cli/bin/index.js +3 -0
  32. package/zti18n-cli/index.js +23 -0
  33. package/zti18n-cli/src/command/collect.js +353 -0
  34. package/zti18n-cli/src/command/convert.js +17 -0
  35. package/zti18n-cli/src/command/convert2.js +35 -0
  36. package/zti18n-cli/src/command/initFileConf.js +133 -0
  37. package/zti18n-cli/src/command/publish.js +24 -0
  38. package/zti18n-cli/src/conf/BaseConf.js +21 -0
  39. package/zti18n-cli/src/conf/FileConf.js +116 -0
  40. package/zti18n-cli/src/index.js +75 -0
  41. package/zti18n-cli/src/translate/google.js +87 -0
  42. package/zti18n-cli/src/utils/isChinese.js +3 -0
  43. package/zti18n-cli/src/utils/log.js +8 -0
  44. package/zti18n-cli/src/utils/mergeOptions.js +45 -0
  45. package/zti18n-cli/src/utils/reactOptions.js +73 -0
  46. package/zti18n-cli/src/utils/vueOptions.js +69 -0
  47. package/zti18n-core/index.js +1 -0
  48. package/zti18n-core/src/index.js +5 -0
  49. package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -0
  50. package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -0
  51. package/zti18n-core/src/transform/defaultPkMap.js +79 -0
  52. package/zti18n-core/src/transform/transformHtml.js +271 -0
  53. package/zti18n-core/src/transform/transformJs.js +489 -0
  54. package/zti18n-core/src/transform/transformPug.js +272 -0
  55. package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -0
  56. package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -0
  57. package/zti18n-core/src/transform/transformToDi18n.js +22 -0
  58. package/zti18n-core/src/transform/transformTs.js +41 -0
  59. package/zti18n-core/src/transform/transformVue.js +126 -0
  60. package/zti18n-core/src/transform/transformZeroToDi18n.js +105 -0
  61. package/zti18n-core/src/translate/google.js +6 -0
  62. package/zti18n-core/src/utils/constants.js +3 -0
  63. package/zti18n-core/src/utils/getIgnoreLines.js +14 -0
  64. package/zti18n-core/src/utils/isChinese.js +3 -0
  65. package/zti18n-core/src/utils/log.js +8 -0
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  export { d as authority } from './authority-7a91cb9f.js';
2
- export { d as dataModel } from './dataModel-1fbaff40.js';
3
- export { t as tools } from './tools-390e3466.js';
4
- export { v as validate } from './validate-18e52490.js';
5
- export { r as request } from './request-87d93572.js';
6
- export { r as reqUrl } from './reqUrl-22b880a4.js';
2
+ export { d as dataModel } from './dataModel-f1ef06bc.js';
3
+ export { t as tools } from './tools-47b9bee7.js';
4
+ export { v as validate } from './validate-2138d94a.js';
5
+ export { r as request } from './request-e147d640.js';
6
+ export { r as reqUrl } from './reqUrl-ea7ef876.js';
7
+ import './i18next.js';
7
8
  import './tslib.es6-35653116.js';
8
9
  import 'dayjs';
9
10
  import 'axios';
@@ -1 +1 @@
1
- declare function openDB(dbName: string, version?: number): Promise<unknown>;
1
+ export {};
package/dist/print.d.ts CHANGED
@@ -66,10 +66,8 @@ export declare function htmlToPdfNoCanvas({ pageClassName, dom, isShowPage, file
66
66
  pdfName?: string;
67
67
  isDownload?: boolean;
68
68
  pdfOption?: IPdfOption;
69
- /** 是否添加水印 */
70
- isAddWater?: boolean;
71
- /** 水印base 64字符串 */
72
- waterBase64?: string;
69
+ /** 是否添加水印 */ isAddWater?: boolean;
70
+ /** 水印base 64字符串 */ waterBase64?: string;
73
71
  imgWidth?: number;
74
72
  imgHeight?: number;
75
73
  isCompress?: boolean;
package/dist/print.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { d as __spreadArray, _ as __assign, b as __awaiter, c as __generator } from './tslib.es6-35653116.js';
2
+ import instance from './i18next.js';
2
3
  import { jsPDF } from 'jspdf';
3
4
  import html2canvas from 'html2canvas';
4
5
 
@@ -57,6 +58,40 @@ function printCurrentDom(_a) {
57
58
  document.head.appendChild(styleDom);
58
59
  window.print();
59
60
  }
61
+ function getTextDimensions(text, fontSize) {
62
+ var width, height;
63
+ try {
64
+ // 创建一个临时元素
65
+ var tempElement = document.createElement('div');
66
+ // 设置元素内容为传入的文本
67
+ tempElement.textContent = text;
68
+ // 设置样式使其不可见且不影响页面布局
69
+ tempElement.style.position = 'absolute';
70
+ tempElement.style.visibility = 'hidden'; // 元素不可见但仍占据空间
71
+ tempElement.style.opacity = '0'; // 完全透明
72
+ tempElement.style.pointerEvents = 'none'; // 不响应鼠标事件
73
+ tempElement.style.whiteSpace = 'nowrap'; // 防止文本换行影响宽度测量
74
+ tempElement.style.fontSize = fontSize;
75
+ tempElement.style.fontFamily = '微软雅黑';
76
+ tempElement.style.padding = '50px 10px';
77
+ // 插入到body中
78
+ document.body.appendChild(tempElement);
79
+ // 获取元素的宽高
80
+ width = tempElement.offsetWidth;
81
+ height = tempElement.offsetHeight;
82
+ // 从DOM中移除元素
83
+ document.body.removeChild(tempElement);
84
+ }
85
+ catch (err) {
86
+ width = text.length * 22;
87
+ height = text.length * 9;
88
+ }
89
+ // 返回测量结果
90
+ return {
91
+ width: width > 520 ? 520 : width < 240 ? 240 : width,
92
+ height: height > 200 ? 200 : height < 100 ? 100 : height,
93
+ };
94
+ }
60
95
  /**
61
96
  * 创建文本水印图片
62
97
  * @param waterText 水印文本
@@ -74,17 +109,21 @@ function createWaterHandle(obj) {
74
109
  // console.log(err);
75
110
  // }
76
111
  // }
77
- var defaultWaterText = '浙商中拓';
112
+ var defaultWaterText = instance.t('浙商中拓');
78
113
  var _a = obj || {}, waterText = _a.waterText, opacity = _a.opacity, fontSize = _a.fontSize, cavansWidth = _a.cavansWidth, cavansHeight = _a.cavansHeight;
79
114
  var canvas = document.createElement('canvas');
115
+ // 如何计算水印的大小。创建一个元素插入到body中,获取到宽高后移除
116
+ var _b = getTextDimensions(waterText, fontSize || '18px'), textWidth = _b.width, textHeight = _b.height;
117
+ // 之前的宽度是文本长度 * 22
80
118
  var defaultCanvasWidth = waterText
81
119
  ? waterText.length > 10
82
- ? waterText.length * 22
120
+ ? textWidth
83
121
  : 240
84
122
  : 240;
123
+ // 之前的高度是文本长度 * 9
85
124
  var defaultCanvasHeight = waterText
86
125
  ? waterText.length > 10
87
- ? waterText.length * 9
126
+ ? textHeight
88
127
  : 100
89
128
  : 100;
90
129
  canvas.width = cavansWidth || defaultCanvasWidth;
@@ -92,7 +131,7 @@ function createWaterHandle(obj) {
92
131
  var ctx = canvas.getContext('2d');
93
132
  if (ctx) {
94
133
  ctx.rotate((-10 * Math.PI) / 180); // 水印旋转角度
95
- ctx.font = (fontSize || '18px') + " \u5FAE\u8F6F\u96C5\u9ED1";
134
+ ctx.font = instance.t('{{slot0}} 微软雅黑', { slot0: fontSize || '18px' });
96
135
  ctx.fillStyle = "rgba(0,0,0," + (opacity ? opacity : '0.07') + ")";
97
136
  ctx.textAlign = 'center';
98
137
  ctx.textBaseline = 'middle';
@@ -395,11 +434,16 @@ function htmlToPdfNoCanvas(_a) {
395
434
  windowWidth: pageWidth,
396
435
  callback: function (res) {
397
436
  // 添加呈现的HTML所需的页面(从第2页开始)
398
- for (var i_1 = 2, j = res.internal.getNumberOfPages(); i_1 <= j; i_1++) {
399
- pdf.addPage(pageFormat, pageOrient);
400
- }
401
- for (var i_2 = 1, j = res.internal.getNumberOfPages(); i_2 <= j; i_2++) {
402
- pdf.setPage(i_2);
437
+ // 注释掉这里导致多出一页空白页
438
+ // for (
439
+ // let i = 2, j = (res as any).internal.getNumberOfPages();
440
+ // i <= j;
441
+ // i++
442
+ // ) {
443
+ // pdf.addPage(pageFormat, pageOrient);
444
+ // }
445
+ for (var i_1 = 1, j = res.internal.getNumberOfPages(); i_1 <= j; i_1++) {
446
+ pdf.setPage(i_1);
403
447
  // 添加水印
404
448
  if (isAddWater) {
405
449
  setPdfWater(pdf, waterBase64, imgWidth, imgHeight);
@@ -497,9 +541,13 @@ function htmlToPdfNoCanvas(_a) {
497
541
  windowWidth: pageWidth_1,
498
542
  callback: function (res) {
499
543
  // 添加呈现的HTML所需的页面(从第2页开始)
500
- for (var i = 2, j = res.internal.getNumberOfPages(); i <= j; i++) {
501
- pdf_3.addPage(pageFormat, pageOrient);
502
- }
544
+ // for (
545
+ // let i = 2, j = (res as any).internal.getNumberOfPages();
546
+ // i <= j;
547
+ // i++
548
+ // ) {
549
+ // pdf.addPage(pageFormat, pageOrient);
550
+ // }
503
551
  for (var i = 1, j = res.internal.getNumberOfPages(); i <= j; i++) {
504
552
  pdf_3.setPage(i);
505
553
  // 添加水印
@@ -14,9 +14,10 @@ function getReqUrl(processObj) {
14
14
  'https://nportal.zmd.com.cn:18998'; // 生产环境外网api地址 https://m-portal.zmd.com.cn:18998 http://dz.zmd.com.cn:48000
15
15
  // 文件服务器
16
16
  var ZT_FILE_PREVIEW_DEV = processObj.REACT_APP_ZT_FILE_PREVIEW_DEV || 'http://192.168.0.83:88'; // 开发环境
17
- var ZT_FILE_PREVIEW_TEST = processObj.REACT_APP_ZT_FILE_PREVIEW_TEST || 'http://172.55.5.101:33013'; // 测试环境 https://192.168.0.135:18012
17
+ var ZT_FILE_PREVIEW_TEST = processObj.REACT_APP_ZT_FILE_PREVIEW_TEST ||
18
+ 'http://preview-test.zmdms.com.cn:30079'; // 测试环境 http://172.55.5.101:33013
18
19
  var ZT_FILE_PREVIEW_STAGE = processObj.REACT_APP_ZT_FILE_PREVIEW_STAGE ||
19
- 'https://dzfile-prod.zmd.com.cn/'; // 阶段性环境 http://192.168.0.134:8012
20
+ 'http://preview-stage.zmdms.com.cn:30079'; // 阶段性环境 https://dzfile-prod.zmd.com.cn/
20
21
  var ZT_FILE_PREVIEW_SIM = processObj.REACT_APP_ZT_FILE_PREVIEW_SIM ||
21
22
  'https://dzfile-data.zmd.com.cn/'; // 阶段性环境 http://192.168.0.134:8012
22
23
  var ZT_FILE_PREVIEW_PRODUCT = processObj.REACT_APP_ZT_FILE_PREVIEW_PRODUCT ||
package/dist/reqUrl.js CHANGED
@@ -1 +1 @@
1
- export { g as getReqUrl } from './reqUrl-22b880a4.js';
1
+ export { g as getReqUrl } from './reqUrl-ea7ef876.js';
@@ -1,4 +1,5 @@
1
1
  import { a as __rest, _ as __assign } from './tslib.es6-35653116.js';
2
+ import instance from './i18next.js';
2
3
  import axios from 'axios';
3
4
  import { Modal, message } from 'ztxkui';
4
5
  import { c as commonjsGlobal, a as crypto } from './crypto-c481f616.js';
@@ -2452,7 +2453,7 @@ var AxiosCancel = /** @class */ (function () {
2452
2453
  // 将token挂载到当前接口的请求头里面
2453
2454
  config.cancelToken = cancelTokenObj.token;
2454
2455
  if (this.pendingRequests.has(key)) {
2455
- this.pendingRequests.get(key).cancel('拦截重复请求');
2456
+ this.pendingRequests.get(key).cancel(instance.t('拦截重复请求'));
2456
2457
  this.pendingRequests.delete(key);
2457
2458
  }
2458
2459
  this.pendingRequests.set(key, {
@@ -2512,7 +2513,7 @@ function checkStatus(response, jumpCallback, otherOptions) {
2512
2513
  refreshTokenRequst(jumpCallback, InnerAuthorization);
2513
2514
  }
2514
2515
  else {
2515
- message.info("\u5237\u65B0token\u906D\u5230\u9891\u7E41\u8C03\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u67E5\u770B\u662F\u5426\u63A5\u53E3\u6743\u9650\u51FA\u73B0\u95EE\u9898\uFF0C\u53EF\u80FD\u662F" + (response === null || response === void 0 ? void 0 : response.config.url) + "\u63A5\u53E3\u51FA\u73B0\u95EE\u9898", 5);
2516
+ message.info(instance.t('刷新token遭到频繁调用,请联系管理员查看是否接口权限出现问题,可能是{{slot0}}接口出现问题', { slot0: response === null || response === void 0 ? void 0 : response.config.url }), 5);
2516
2517
  requestTokenEndTime = 0;
2517
2518
  }
2518
2519
  }
@@ -2560,6 +2561,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2560
2561
  // 刷新成功 重置token 重置refresh-token
2561
2562
  setToken(data === null || data === void 0 ? void 0 : data.access_token);
2562
2563
  setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
2564
+ message.info(instance.t('token已经刷新成功,请重新提交!', {}));
2563
2565
  onAccessTokenFetched();
2564
2566
  isRefreshing = true;
2565
2567
  }
@@ -2573,7 +2575,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2573
2575
  jumpCallback(401);
2574
2576
  }
2575
2577
  else {
2576
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2578
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2577
2579
  isExpiration = false;
2578
2580
  });
2579
2581
  window.location.href = '/login';
@@ -2589,7 +2591,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2589
2591
  jumpCallback(401);
2590
2592
  }
2591
2593
  else {
2592
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2594
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2593
2595
  isExpiration = false;
2594
2596
  });
2595
2597
  window.location.href = '/login';
@@ -2665,7 +2667,11 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2665
2667
  __isTimeoutMessage) {
2666
2668
  isMessage = true;
2667
2669
  Modal.confirm({
2668
- title: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF0C\u8BF7\u53BB\u5217\u8868\u786E\u8BA4\u6570\u636E\u662F\u5426\u63D2\u5165\u6210\u529F\uFF0C\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4\uFF01\n\u63A5\u53E3\u5730\u5740:" + ((_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.url) + "\n\u8BF7\u6C42\u65B9\u5F0F:" + ((_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.method) + "\n\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4:" + ((_f = error === null || error === void 0 ? void 0 : error.config) === null || _f === void 0 ? void 0 : _f.timeout),
2670
+ title: instance.t('请求超时,请稍后再试,请去列表确认数据是否插入成功,请勿重复提交! 接口地址:{{slot0}} 请求方式:{{slot1}} 请求超时时间:{{slot2}}', {
2671
+ slot0: (_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.url,
2672
+ slot1: (_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.method,
2673
+ slot2: (_f = error === null || error === void 0 ? void 0 : error.config) === null || _f === void 0 ? void 0 : _f.timeout,
2674
+ }),
2669
2675
  okCancel: false,
2670
2676
  onOk: function () {
2671
2677
  isMessage = false;
@@ -2679,7 +2685,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2679
2685
  if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 404) {
2680
2686
  if (!isNotFound) {
2681
2687
  isNotFound = true;
2682
- message.info("\u63A5\u53E3: " + errRes.config.url + " \u672A\u627E\u5230\uFF01", 3.5, function () {
2688
+ message.info(instance.t('接口: {{slot0}} 未找到!', { slot0: errRes.config.url }), 3.5, function () {
2683
2689
  isNotFound = false;
2684
2690
  });
2685
2691
  }
@@ -2695,7 +2701,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2695
2701
  jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2696
2702
  }
2697
2703
  else {
2698
- message.info("\u4F60\u7684\u8D26\u53F7\u5DF2\u5728\u5176\u4ED6\u5730\u65B9\u767B\u5F55\uFF01", 3.5, function () {
2704
+ message.info(instance.t('你的账号已在其他地方登录!', {}), 3.5, function () {
2699
2705
  isOffSite = false;
2700
2706
  });
2701
2707
  window.location.href = '/login';
@@ -2713,7 +2719,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2713
2719
  jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2714
2720
  }
2715
2721
  else {
2716
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2722
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2717
2723
  isExpiration = false;
2718
2724
  });
2719
2725
  window.location.href = '/login';
@@ -2793,6 +2799,8 @@ function request(myOptions, jumpCallback, otherOptions) {
2793
2799
  'Zmdms-Auth': "bearer " + token,
2794
2800
  'Tenant-Id': '000000',
2795
2801
  Authorization: InnerAuthorization ? InnerAuthorization : Authorization,
2802
+ // 设置语言包请求头
2803
+ 'Zmdms-Lang': window.localStorage.getItem('languageType') || 'zh_CN',
2796
2804
  },
2797
2805
  };
2798
2806
  if ((_a = options.baseURL) === null || _a === void 0 ? void 0 : _a.endsWith('/')) {
@@ -1,4 +1,5 @@
1
1
  import { a as __rest, _ as __assign } from './tslib.es6-35653116.js';
2
+ import instance from './i18next.js';
2
3
  import axios from 'axios';
3
4
  import { Modal, message } from 'ztxkui';
4
5
  import { c as commonjsGlobal, a as crypto } from './crypto-c481f616.js';
@@ -2452,7 +2453,7 @@ var AxiosCancel = /** @class */ (function () {
2452
2453
  // 将token挂载到当前接口的请求头里面
2453
2454
  config.cancelToken = cancelTokenObj.token;
2454
2455
  if (this.pendingRequests.has(key)) {
2455
- this.pendingRequests.get(key).cancel('拦截重复请求');
2456
+ this.pendingRequests.get(key).cancel(instance.t('拦截重复请求'));
2456
2457
  this.pendingRequests.delete(key);
2457
2458
  }
2458
2459
  this.pendingRequests.set(key, {
@@ -2505,14 +2506,16 @@ function loginRequest(params, InnerAuthorization) {
2505
2506
  });
2506
2507
  }
2507
2508
  function checkStatus(response, jumpCallback, otherOptions) {
2508
- var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2509
+ var _a = otherOptions || {}, InnerAuthorization = _a.InnerAuthorization, refreshTokenCallback = _a.refreshTokenCallback;
2509
2510
  if ((response === null || response === void 0 ? void 0 : response.status) === 401) {
2510
2511
  if (isRefreshing) {
2511
2512
  if (Date.now() - requestTokenEndTime > reqTokenTimeInterval) {
2512
- refreshTokenRequst(jumpCallback, InnerAuthorization);
2513
+ refreshTokenRequst(jumpCallback, InnerAuthorization, {
2514
+ refreshTokenCallback: refreshTokenCallback,
2515
+ });
2513
2516
  }
2514
2517
  else {
2515
- message.info("\u5237\u65B0token\u906D\u5230\u9891\u7E41\u8C03\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u67E5\u770B\u662F\u5426\u63A5\u53E3\u6743\u9650\u51FA\u73B0\u95EE\u9898\uFF0C\u53EF\u80FD\u662F" + (response === null || response === void 0 ? void 0 : response.config.url) + "\u63A5\u53E3\u51FA\u73B0\u95EE\u9898", 5);
2518
+ message.info(instance.t('刷新token遭到频繁调用,请联系管理员查看是否接口权限出现问题,可能是{{slot0}}接口出现问题', { slot0: response === null || response === void 0 ? void 0 : response.config.url }), 5);
2516
2519
  requestTokenEndTime = 0;
2517
2520
  }
2518
2521
  }
@@ -2546,7 +2549,8 @@ function checkStatus(response, jumpCallback, otherOptions) {
2546
2549
  // return retryOriginalRequest;
2547
2550
  }
2548
2551
  }
2549
- function refreshTokenRequst(jumpCallback, Authorization) {
2552
+ function refreshTokenRequst(jumpCallback, Authorization, otherOptions) {
2553
+ var refreshTokenCallback = (otherOptions || {}).refreshTokenCallback;
2550
2554
  loginRequest({
2551
2555
  tenantId: '000000',
2552
2556
  grant_type: 'refresh_token',
@@ -2560,7 +2564,9 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2560
2564
  // 刷新成功 重置token 重置refresh-token
2561
2565
  setToken(data === null || data === void 0 ? void 0 : data.access_token);
2562
2566
  setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
2567
+ message.info(instance.t('token已经刷新成功,请重新提交!', {}));
2563
2568
  onAccessTokenFetched();
2569
+ refreshTokenCallback === null || refreshTokenCallback === void 0 ? void 0 : refreshTokenCallback();
2564
2570
  isRefreshing = true;
2565
2571
  }
2566
2572
  else {
@@ -2573,7 +2579,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2573
2579
  jumpCallback(401);
2574
2580
  }
2575
2581
  else {
2576
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2582
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2577
2583
  isExpiration = false;
2578
2584
  });
2579
2585
  window.location.href = '/login';
@@ -2589,7 +2595,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2589
2595
  jumpCallback(401);
2590
2596
  }
2591
2597
  else {
2592
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2598
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2593
2599
  isExpiration = false;
2594
2600
  });
2595
2601
  window.location.href = '/login';
@@ -2606,7 +2612,7 @@ function onAccessTokenFetched() {
2606
2612
  }
2607
2613
  function setInterceptorsResponse(jumpCallback, otherOptions) {
2608
2614
  // 拦截器,拦截响应头信息
2609
- var isRefreshToken = (otherOptions || {}).isRefreshToken;
2615
+ var _a = otherOptions || {}, isRefreshToken = _a.isRefreshToken; _a.refreshTokenCallback;
2610
2616
  axios.interceptors.response.use(function (response) {
2611
2617
  var _a, _b, _c;
2612
2618
  // catchPromiseObj = [];
@@ -2634,7 +2640,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2634
2640
  return Promise.reject(response);
2635
2641
  }
2636
2642
  }, function (error) {
2637
- var _a, _b, _c, _d, _e;
2643
+ var _a, _b, _c, _d, _e, _f;
2638
2644
  // catchPromiseObj = [];
2639
2645
  console.error(error);
2640
2646
  var errRes = error === null || error === void 0 ? void 0 : error.response;
@@ -2649,8 +2655,9 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2649
2655
  });
2650
2656
  });
2651
2657
  /** 如果接口出错了,清理掉这个错误的接口缓存 */
2652
- if (autonomousCatchingPromiseObj[error === null || error === void 0 ? void 0 : error.config.url]) {
2653
- autonomousCatchingPromiseObj[error === null || error === void 0 ? void 0 : error.config.url] = undefined;
2658
+ var autonomousCatchingKey = ((_a = error === null || error === void 0 ? void 0 : error.config) === null || _a === void 0 ? void 0 : _a.autonomousKey) || (error === null || error === void 0 ? void 0 : error.config.url);
2659
+ if (autonomousCatchingPromiseObj[autonomousCatchingKey]) {
2660
+ autonomousCatchingPromiseObj[autonomousCatchingKey] = undefined;
2654
2661
  }
2655
2662
  if (item !== -1) {
2656
2663
  catchPromiseObj.splice(item, 1);
@@ -2660,11 +2667,15 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2660
2667
  // 超时异常统一处理,超时的异常没有response值,只能通过toString处理
2661
2668
  if (!errRes && error.toString().indexOf(timeoutNum + "ms") !== -1) {
2662
2669
  if (!isMessage) {
2663
- if (((_b = (_a = error === null || error === void 0 ? void 0 : error.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'POST' &&
2670
+ if (((_c = (_b = error === null || error === void 0 ? void 0 : error.config) === null || _b === void 0 ? void 0 : _b.method) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === 'POST' &&
2664
2671
  __isTimeoutMessage) {
2665
2672
  isMessage = true;
2666
2673
  Modal.confirm({
2667
- title: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF0C\u8BF7\u53BB\u5217\u8868\u786E\u8BA4\u6570\u636E\u662F\u5426\u63D2\u5165\u6210\u529F\uFF0C\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4\uFF01\n\u63A5\u53E3\u5730\u5740:" + ((_c = error === null || error === void 0 ? void 0 : error.config) === null || _c === void 0 ? void 0 : _c.url) + "\n\u8BF7\u6C42\u65B9\u5F0F:" + ((_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.method) + "\n\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4:" + ((_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.timeout),
2674
+ title: instance.t('请求超时,请稍后再试,请去列表确认数据是否插入成功,请勿重复提交! 接口地址:{{slot0}} 请求方式:{{slot1}} 请求超时时间:{{slot2}}', {
2675
+ slot0: (_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.url,
2676
+ slot1: (_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.method,
2677
+ slot2: (_f = error === null || error === void 0 ? void 0 : error.config) === null || _f === void 0 ? void 0 : _f.timeout,
2678
+ }),
2668
2679
  okCancel: false,
2669
2680
  onOk: function () {
2670
2681
  isMessage = false;
@@ -2678,7 +2689,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2678
2689
  if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 404) {
2679
2690
  if (!isNotFound) {
2680
2691
  isNotFound = true;
2681
- message.info("\u63A5\u53E3: " + errRes.config.url + " \u672A\u627E\u5230\uFF01", 3.5, function () {
2692
+ message.info(instance.t('接口: {{slot0}} 未找到!', { slot0: errRes.config.url }), 3.5, function () {
2682
2693
  isNotFound = false;
2683
2694
  });
2684
2695
  }
@@ -2694,7 +2705,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2694
2705
  jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2695
2706
  }
2696
2707
  else {
2697
- message.info("\u4F60\u7684\u8D26\u53F7\u5DF2\u5728\u5176\u4ED6\u5730\u65B9\u767B\u5F55\uFF01", 3.5, function () {
2708
+ message.info(instance.t('你的账号已在其他地方登录!', {}), 3.5, function () {
2698
2709
  isOffSite = false;
2699
2710
  });
2700
2711
  window.location.href = '/login';
@@ -2712,7 +2723,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2712
2723
  jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2713
2724
  }
2714
2725
  else {
2715
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2726
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2716
2727
  isExpiration = false;
2717
2728
  });
2718
2729
  window.location.href = '/login';
@@ -2778,7 +2789,7 @@ function request(myOptions, jumpCallback, otherOptions) {
2778
2789
  setInterceptorsResponse(jumpCallback, otherOptions);
2779
2790
  isFirstSet = true;
2780
2791
  }
2781
- var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, _m = myOptions.noCatchUrl, noCatchUrl = _m === void 0 ? [] : _m, isCatch = myOptions.isCatch, mustCatch = myOptions.mustCatch, isAutonomousCatch = myOptions.isAutonomousCatch, _o = myOptions.autonomousCount, autonomousCount = _o === void 0 ? 1 : _o, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest", "noCatchUrl", "isCatch", "mustCatch", "isAutonomousCatch", "autonomousCount"]);
2792
+ var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, _m = myOptions.noCatchUrl, noCatchUrl = _m === void 0 ? [] : _m, isCatch = myOptions.isCatch, mustCatch = myOptions.mustCatch, isAutonomousCatch = myOptions.isAutonomousCatch, _o = myOptions.autonomousCount, autonomousCount = _o === void 0 ? 1 : _o, autonomousKey = myOptions.autonomousKey, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest", "noCatchUrl", "isCatch", "mustCatch", "isAutonomousCatch", "autonomousCount", "autonomousKey"]);
2782
2793
  timeoutNum =
2783
2794
  typeof myOptions.timeout === 'number' ? myOptions.timeout : timeoutNum;
2784
2795
  __isTimeoutMessage = isTimeoutMessage;
@@ -2792,6 +2803,8 @@ function request(myOptions, jumpCallback, otherOptions) {
2792
2803
  'Zmdms-Auth': "bearer " + token,
2793
2804
  'Tenant-Id': '000000',
2794
2805
  Authorization: InnerAuthorization ? InnerAuthorization : Authorization,
2806
+ // 设置语言包请求头
2807
+ 'Zmdms-Lang': window.localStorage.getItem('languageType') || 'zh_CN',
2795
2808
  },
2796
2809
  };
2797
2810
  if ((_a = options.baseURL) === null || _a === void 0 ? void 0 : _a.endsWith('/')) {
@@ -2810,7 +2823,7 @@ function request(myOptions, jumpCallback, otherOptions) {
2810
2823
  options.params = transformObj(options.params);
2811
2824
  }
2812
2825
  // 将传入配置与默认配置混合
2813
- var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
2826
+ var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { autonomousKey: autonomousKey, headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
2814
2827
  // 特殊请求处理
2815
2828
  if (((_e = newOptions.method) === null || _e === void 0 ? void 0 : _e.toUpperCase()) === 'POST' ||
2816
2829
  ((_f = newOptions.method) === null || _f === void 0 ? void 0 : _f.toUpperCase()) === 'PUT' ||
@@ -2856,11 +2869,12 @@ function request(myOptions, jumpCallback, otherOptions) {
2856
2869
  }
2857
2870
  // 自主缓存请求。默认这个缓存只会针对一个url缓存一次请求
2858
2871
  if (isAutonomousCatch) {
2859
- var item = autonomousCatchingPromiseObj[newOptions.url];
2872
+ var autonomousCatchingKey = autonomousKey || newOptions.url;
2873
+ var item = autonomousCatchingPromiseObj[autonomousCatchingKey];
2860
2874
  // 如果当前接口没有缓存 缓存住,并且返回接口结果
2861
2875
  if (!item || !Array.isArray(item)) {
2862
2876
  var result = axios(newOptions);
2863
- autonomousCatchingPromiseObj[newOptions.url] = [
2877
+ autonomousCatchingPromiseObj[autonomousCatchingKey] = [
2864
2878
  {
2865
2879
  params: newOptions.params,
2866
2880
  promiseObj: result,