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
@@ -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, {
@@ -2480,6 +2481,7 @@ var isNotFound = false; // 404弹框
2480
2481
  var isOffSite = false; // 501异地登录
2481
2482
  var isExpiration = false; // 401登录过期
2482
2483
  var catchPromiseObj = []; // 缓存当前宏任务下的缓存
2484
+ var autonomousCatchingPromiseObj = {}; // 自主缓存。可以自主清空。每个url只对应一个请求
2483
2485
  var __isTimeoutMessage = false; // 是否需要默认展示超时弹框
2484
2486
  var isFirstSet = false; // 首次初始化
2485
2487
  // 'Basic em1kbXM6em1kbXNfc2VjcmV0' 新的auth
@@ -2504,14 +2506,16 @@ function loginRequest(params, InnerAuthorization) {
2504
2506
  });
2505
2507
  }
2506
2508
  function checkStatus(response, jumpCallback, otherOptions) {
2507
- var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2509
+ var _a = otherOptions || {}, InnerAuthorization = _a.InnerAuthorization, refreshTokenCallback = _a.refreshTokenCallback;
2508
2510
  if ((response === null || response === void 0 ? void 0 : response.status) === 401) {
2509
2511
  if (isRefreshing) {
2510
2512
  if (Date.now() - requestTokenEndTime > reqTokenTimeInterval) {
2511
- refreshTokenRequst(jumpCallback, InnerAuthorization);
2513
+ refreshTokenRequst(jumpCallback, InnerAuthorization, {
2514
+ refreshTokenCallback: refreshTokenCallback,
2515
+ });
2512
2516
  }
2513
2517
  else {
2514
- 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);
2515
2519
  requestTokenEndTime = 0;
2516
2520
  }
2517
2521
  }
@@ -2545,7 +2549,8 @@ function checkStatus(response, jumpCallback, otherOptions) {
2545
2549
  // return retryOriginalRequest;
2546
2550
  }
2547
2551
  }
2548
- function refreshTokenRequst(jumpCallback, Authorization) {
2552
+ function refreshTokenRequst(jumpCallback, Authorization, otherOptions) {
2553
+ var refreshTokenCallback = (otherOptions || {}).refreshTokenCallback;
2549
2554
  loginRequest({
2550
2555
  tenantId: '000000',
2551
2556
  grant_type: 'refresh_token',
@@ -2559,7 +2564,11 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2559
2564
  // 刷新成功 重置token 重置refresh-token
2560
2565
  setToken(data === null || data === void 0 ? void 0 : data.access_token);
2561
2566
  setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
2567
+ message.info(instance.t('token已经刷新成功,请重新提交!', {}));
2568
+ // 设置一个本地存储,用来告知这是刷新token 而不是被挤下线。
2569
+ localStorage.setItem('__unWsNeedReconnect__', 'true');
2562
2570
  onAccessTokenFetched();
2571
+ refreshTokenCallback === null || refreshTokenCallback === void 0 ? void 0 : refreshTokenCallback();
2563
2572
  isRefreshing = true;
2564
2573
  }
2565
2574
  else {
@@ -2572,7 +2581,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2572
2581
  jumpCallback(401);
2573
2582
  }
2574
2583
  else {
2575
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2584
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2576
2585
  isExpiration = false;
2577
2586
  });
2578
2587
  window.location.href = '/login';
@@ -2588,7 +2597,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2588
2597
  jumpCallback(401);
2589
2598
  }
2590
2599
  else {
2591
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2600
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2592
2601
  isExpiration = false;
2593
2602
  });
2594
2603
  window.location.href = '/login';
@@ -2605,7 +2614,7 @@ function onAccessTokenFetched() {
2605
2614
  }
2606
2615
  function setInterceptorsResponse(jumpCallback, otherOptions) {
2607
2616
  // 拦截器,拦截响应头信息
2608
- var isRefreshToken = (otherOptions || {}).isRefreshToken;
2617
+ var _a = otherOptions || {}, isRefreshToken = _a.isRefreshToken; _a.refreshTokenCallback;
2609
2618
  axios.interceptors.response.use(function (response) {
2610
2619
  var _a, _b, _c;
2611
2620
  // catchPromiseObj = [];
@@ -2633,7 +2642,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2633
2642
  return Promise.reject(response);
2634
2643
  }
2635
2644
  }, function (error) {
2636
- var _a, _b, _c, _d, _e;
2645
+ var _a, _b, _c, _d, _e, _f;
2637
2646
  // catchPromiseObj = [];
2638
2647
  console.error(error);
2639
2648
  var errRes = error === null || error === void 0 ? void 0 : error.response;
@@ -2647,19 +2656,28 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2647
2656
  params: error === null || error === void 0 ? void 0 : error.config.params,
2648
2657
  });
2649
2658
  });
2659
+ /** 如果接口出错了,清理掉这个错误的接口缓存 */
2660
+ 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);
2661
+ if (autonomousCatchingPromiseObj[autonomousCatchingKey]) {
2662
+ autonomousCatchingPromiseObj[autonomousCatchingKey] = undefined;
2663
+ }
2650
2664
  if (item !== -1) {
2651
2665
  catchPromiseObj.splice(item, 1);
2652
2666
  }
2653
- console.log(error === null || error === void 0 ? void 0 : error.config, catchPromiseObj);
2667
+ // console.log(error?.config, catchPromiseObj);
2654
2668
  /** 如果接口出错了,那么清理掉这个错误的接口 */
2655
2669
  // 超时异常统一处理,超时的异常没有response值,只能通过toString处理
2656
2670
  if (!errRes && error.toString().indexOf(timeoutNum + "ms") !== -1) {
2657
2671
  if (!isMessage) {
2658
- 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' &&
2672
+ 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' &&
2659
2673
  __isTimeoutMessage) {
2660
2674
  isMessage = true;
2661
2675
  Modal.confirm({
2662
- 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),
2676
+ title: instance.t('请求超时,请稍后再试,请去列表确认数据是否插入成功,请勿重复提交! 接口地址:{{slot0}} 请求方式:{{slot1}} 请求超时时间:{{slot2}}', {
2677
+ slot0: (_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.url,
2678
+ slot1: (_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.method,
2679
+ slot2: (_f = error === null || error === void 0 ? void 0 : error.config) === null || _f === void 0 ? void 0 : _f.timeout,
2680
+ }),
2663
2681
  okCancel: false,
2664
2682
  onOk: function () {
2665
2683
  isMessage = false;
@@ -2673,7 +2691,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2673
2691
  if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 404) {
2674
2692
  if (!isNotFound) {
2675
2693
  isNotFound = true;
2676
- message.info("\u63A5\u53E3: " + errRes.config.url + " \u672A\u627E\u5230\uFF01", 3.5, function () {
2694
+ message.info(instance.t('接口: {{slot0}} 未找到!', { slot0: errRes.config.url }), 3.5, function () {
2677
2695
  isNotFound = false;
2678
2696
  });
2679
2697
  }
@@ -2689,7 +2707,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2689
2707
  jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2690
2708
  }
2691
2709
  else {
2692
- message.info("\u4F60\u7684\u8D26\u53F7\u5DF2\u5728\u5176\u4ED6\u5730\u65B9\u767B\u5F55\uFF01", 3.5, function () {
2710
+ message.info(instance.t('你的账号已在其他地方登录!', {}), 3.5, function () {
2693
2711
  isOffSite = false;
2694
2712
  });
2695
2713
  window.location.href = '/login';
@@ -2707,7 +2725,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2707
2725
  jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2708
2726
  }
2709
2727
  else {
2710
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2728
+ message.info(instance.t('登录过期!', {}), 3.5, function () {
2711
2729
  isExpiration = false;
2712
2730
  });
2713
2731
  window.location.href = '/login';
@@ -2766,14 +2784,14 @@ function transformObj(obj) {
2766
2784
  return obj;
2767
2785
  }
2768
2786
  function request(myOptions, jumpCallback, otherOptions) {
2769
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2787
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2770
2788
  var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2771
2789
  if (!isFirstSet) {
2772
2790
  setInterceptorsRequest();
2773
2791
  setInterceptorsResponse(jumpCallback, otherOptions);
2774
2792
  isFirstSet = true;
2775
2793
  }
2776
- var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, _k = myOptions.noCatchUrl, noCatchUrl = _k === void 0 ? [] : _k, isCatch = myOptions.isCatch, mustCatch = myOptions.mustCatch, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest", "noCatchUrl", "isCatch", "mustCatch"]);
2794
+ 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"]);
2777
2795
  timeoutNum =
2778
2796
  typeof myOptions.timeout === 'number' ? myOptions.timeout : timeoutNum;
2779
2797
  __isTimeoutMessage = isTimeoutMessage;
@@ -2787,6 +2805,8 @@ function request(myOptions, jumpCallback, otherOptions) {
2787
2805
  'Zmdms-Auth': "bearer " + token,
2788
2806
  'Tenant-Id': '000000',
2789
2807
  Authorization: InnerAuthorization ? InnerAuthorization : Authorization,
2808
+ // 设置语言包请求头
2809
+ 'Zmdms-Lang': window.localStorage.getItem('languageType') || 'zh_CN',
2790
2810
  },
2791
2811
  };
2792
2812
  if ((_a = options.baseURL) === null || _a === void 0 ? void 0 : _a.endsWith('/')) {
@@ -2805,7 +2825,7 @@ function request(myOptions, jumpCallback, otherOptions) {
2805
2825
  options.params = transformObj(options.params);
2806
2826
  }
2807
2827
  // 将传入配置与默认配置混合
2808
- var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
2828
+ var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { autonomousKey: autonomousKey, headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
2809
2829
  // 特殊请求处理
2810
2830
  if (((_e = newOptions.method) === null || _e === void 0 ? void 0 : _e.toUpperCase()) === 'POST' ||
2811
2831
  ((_f = newOptions.method) === null || _f === void 0 ? void 0 : _f.toUpperCase()) === 'PUT' ||
@@ -2849,13 +2869,64 @@ function request(myOptions, jumpCallback, otherOptions) {
2849
2869
  };
2850
2870
  }
2851
2871
  }
2872
+ // 自主缓存请求。默认这个缓存只会针对一个url缓存一次请求
2873
+ if (isAutonomousCatch) {
2874
+ var autonomousCatchingKey = autonomousKey || newOptions.url;
2875
+ var item = autonomousCatchingPromiseObj[autonomousCatchingKey];
2876
+ // 如果当前接口没有缓存 缓存住,并且返回接口结果
2877
+ if (!item || !Array.isArray(item)) {
2878
+ var result = axios(newOptions);
2879
+ autonomousCatchingPromiseObj[autonomousCatchingKey] = [
2880
+ {
2881
+ params: newOptions.params,
2882
+ promiseObj: result,
2883
+ method: (_h = newOptions.method) === null || _h === void 0 ? void 0 : _h.toUpperCase(),
2884
+ },
2885
+ ];
2886
+ return result;
2887
+ }
2888
+ // 如果当前接口有缓存
2889
+ // 判断当前参数是否命中
2890
+ var index = item.findIndex(function (itemChild) {
2891
+ var _a, _b;
2892
+ return isEqual_1({
2893
+ method: (_a = itemChild.method) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
2894
+ params: itemChild.params,
2895
+ }, {
2896
+ method: (_b = newOptions.method) === null || _b === void 0 ? void 0 : _b.toUpperCase(),
2897
+ params: newOptions.params,
2898
+ });
2899
+ });
2900
+ // 如果缓存命中
2901
+ if (index !== -1) {
2902
+ // 最近使用优先
2903
+ var result = item[index];
2904
+ item.splice(index, 1);
2905
+ item.push(result);
2906
+ return result === null || result === void 0 ? void 0 : result.promiseObj;
2907
+ }
2908
+ else {
2909
+ var result = axios(newOptions);
2910
+ // 当前接口可以缓存几个结果 如果超过最大缓存数量 删除第一位
2911
+ if (item.length >= autonomousCount) {
2912
+ item.shift();
2913
+ }
2914
+ item.push({
2915
+ params: newOptions.params,
2916
+ promiseObj: result,
2917
+ method: (_j = newOptions.method) === null || _j === void 0 ? void 0 : _j.toUpperCase(),
2918
+ });
2919
+ return result;
2920
+ }
2921
+ }
2852
2922
  // 缓存本次宏任务下的GET请求,并且不是以/page结尾的列表分页接口
2853
2923
  // 并且不是强制请求,强制请求需要
2854
- if ((((_h = newOptions.method) === null || _h === void 0 ? void 0 : _h.toUpperCase()) === 'GET' &&
2855
- !((_j = newOptions.url) === null || _j === void 0 ? void 0 : _j.endsWith('/page')) &&
2924
+ if (((((_k = newOptions.method) === null || _k === void 0 ? void 0 : _k.toUpperCase()) === 'GET' &&
2925
+ !((_l = newOptions.url) === null || _l === void 0 ? void 0 : _l.endsWith('/page')) &&
2856
2926
  !noCatchUrl.find(function (item) { var _a; return (_a = newOptions.url) === null || _a === void 0 ? void 0 : _a.endsWith(item); }) &&
2857
2927
  isCatch) ||
2858
- mustCatch) {
2928
+ mustCatch) &&
2929
+ !isAutonomousCatch) {
2859
2930
  // 能不能找到,url与参数都一样得数据
2860
2931
  var index = catchPromiseObj.findIndex(function (item) {
2861
2932
  return isEqual_1({
@@ -2899,6 +2970,9 @@ function clearNoCompleteRequest() {
2899
2970
  }
2900
2971
  function clearCatch() {
2901
2972
  catchPromiseObj = [];
2973
+ }
2974
+ function clearAutonomousCatch(url) {
2975
+ autonomousCatchingPromiseObj[url] = undefined;
2902
2976
  }
2903
2977
 
2904
2978
  var request$1 = /*#__PURE__*/Object.freeze({
@@ -2907,7 +2981,8 @@ var request$1 = /*#__PURE__*/Object.freeze({
2907
2981
  NEW_AUTHORIZATION: NEW_AUTHORIZATION,
2908
2982
  'default': request,
2909
2983
  clearNoCompleteRequest: clearNoCompleteRequest,
2910
- clearCatch: clearCatch
2984
+ clearCatch: clearCatch,
2985
+ clearAutonomousCatch: clearAutonomousCatch
2911
2986
  });
2912
2987
 
2913
- export { NEW_AUTHORIZATION as N, OLD_AUTHORIZATION as O, request as a, clearCatch as b, clearNoCompleteRequest as c, request$1 as r };
2988
+ export { NEW_AUTHORIZATION as N, OLD_AUTHORIZATION as O, request as a, clearCatch as b, clearNoCompleteRequest as c, clearAutonomousCatch as d, request$1 as r };
package/dist/request.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import './tslib.es6-35653116.js';
2
+ import './i18next.js';
2
3
  import 'axios';
3
4
  import 'ztxkui';
4
- export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, d as clearAutonomousCatch, b as clearCatch, c as clearNoCompleteRequest, a as default } from './request-87d93572.js';
5
+ export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, d as clearAutonomousCatch, b as clearCatch, c as clearNoCompleteRequest, a as default } from './request-e147d640.js';
5
6
  import './authority-7a91cb9f.js';
6
7
  import './crypto-c481f616.js';
7
8
  import 'crypto';
@@ -1,3 +1,4 @@
1
+ import instance from './i18next.js';
1
2
  import Stomp from 'zt-stompjs';
2
3
  import SockJS from 'zt-sockjs-client';
3
4
  import { g as getToken } from './authority-7a91cb9f.js';
@@ -58,18 +59,22 @@ var StompClient = /** @class */ (function () {
58
59
  this.clearIsClient = setTimeout(function () {
59
60
  _this.clearIsClient = null;
60
61
  if (!_this.isClient) {
61
- console.log("\u8FDE\u63A5\u5DF2\u53D1\u8D77\uFF0C\u4F46\u662F10\u79D2\u540E\u672A\u6210\u529F\u5EFA\u7ACB\u8FDE\u63A5\uFF0C\u624B\u52A8\u65AD\u5F00\u91CD\u8FDE!system=" + _this.connectWsConfig.systemType);
62
+ console.log(instance.t('连接已发起,但是10秒后未成功建立连接,手动断开重连!system={{slot0}}', { slot0: _this.connectWsConfig.systemType }));
62
63
  try {
63
64
  _this.client.disconnect(function () {
64
65
  _this.client = null;
65
66
  });
66
67
  }
67
68
  catch (err) {
68
- console.log('---连接未建立的关闭出错---', err);
69
+ console.log(instance.t('---连接未建立的关闭出错---'), err);
69
70
  }
70
71
  _this.reconnectionNum++;
71
72
  var timeInterval = _this.getReconnectionTime();
72
- console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01time=" + Date.now() + "system=" + _this.connectWsConfig.systemType + "---");
73
+ console.log(instance.t('---第{{slot0}}次重连!time={{slot1}}system={{slot2}}---', {
74
+ slot0: _this.reconnectionNum,
75
+ slot1: Date.now(),
76
+ slot2: _this.connectWsConfig.systemType,
77
+ }));
73
78
  if (_this.clearIsClientNo) {
74
79
  clearTimeout(_this.clearIsClientNo);
75
80
  _this.clearIsClientNo = null;
@@ -112,7 +117,11 @@ var StompClient = /** @class */ (function () {
112
117
  _this.clearIsClientYes = null;
113
118
  }
114
119
  _this.reconnectionNum = 0;
115
- console.log("---------\u8FDE\u63A5\u6210\u529F time=" + Date.now() + " system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
120
+ console.log(instance.t('---------连接成功 time={{slot0}} system={{slot1}} time={{slot2}}--------', {
121
+ slot0: Date.now(),
122
+ slot1: _this.connectWsConfig.systemType,
123
+ slot2: Date.now(),
124
+ }));
116
125
  // 连接成功后,将当前已注册的,未执行的 连接通道 连接
117
126
  var subscriptionsFnKeys = Object.keys(_this.subscriptionsFn);
118
127
  if (Array.isArray(subscriptionsFnKeys)) {
@@ -145,7 +154,7 @@ var StompClient = /** @class */ (function () {
145
154
  },
146
155
  // 连接失败回调
147
156
  function (err) {
148
- console.log("---------\u8FDE\u63A5\u5931\u8D25 system=" + _this.connectWsConfig.systemType + " time=" + Date.now() + "--------");
157
+ console.log(instance.t('---------连接失败 system={{slot0}} time={{slot1}}--------', { slot0: _this.connectWsConfig.systemType, slot1: Date.now() }));
149
158
  console.log(err);
150
159
  if (_this.userClose) {
151
160
  _this.userClose = false; // 重新初始化 重新计算
@@ -161,7 +170,7 @@ var StompClient = /** @class */ (function () {
161
170
  clearTimeout(_this.clearIsClientYes);
162
171
  _this.clearIsClientYes = null;
163
172
  }
164
- console.log('用户主动关闭');
173
+ console.log(instance.t('用户主动关闭'));
165
174
  return;
166
175
  }
167
176
  _this.isClient = true;
@@ -211,14 +220,18 @@ var StompClient = /** @class */ (function () {
211
220
  });
212
221
  }
213
222
  catch (err) {
214
- console.log("---\u8FDE\u63A5\u5DF2\u5EFA\u7ACB\u7684\u5173\u95ED\u51FA\u9519 time=" + Date.now() + "system=" + _this.connectWsConfig.systemType + "---", err);
223
+ console.log(instance.t('---连接已建立的关闭出错 time={{slot0}}system={{slot1}}---', { slot0: Date.now(), slot1: _this.connectWsConfig.systemType }), err);
215
224
  }
216
225
  _this.reconnectionNum++;
217
226
  // const timeInterval =
218
227
  // Math.ceil(this.reconnectionNum / 5) *
219
228
  // (this.connectWsConfig.reconnectionTime ?? 3000);
220
229
  var timeInterval = _this.getReconnectionTime();
221
- console.log("---\u7B2C" + _this.reconnectionNum + "\u6B21\u91CD\u8FDE\uFF01time=" + Date.now() + "system=" + _this.connectWsConfig.systemType);
230
+ console.log(instance.t('---第{{slot0}}次重连!time={{slot1}}system={{slot2}}', {
231
+ slot0: _this.reconnectionNum,
232
+ slot1: Date.now(),
233
+ slot2: _this.connectWsConfig.systemType,
234
+ }));
222
235
  _this.clearIsClientYes = setTimeout(function () {
223
236
  _this.init();
224
237
  }, timeInterval > _this.maxReconnectiontime
@@ -2208,7 +2208,7 @@ function divide(num1, num2) {
2208
2208
  /**
2209
2209
  * @description 精确四舍五入后保留几位小数
2210
2210
  */
2211
- function exactRound(num, ratio) {
2211
+ function _exactRound(num, ratio) {
2212
2212
  var typeNum = typeof num;
2213
2213
  if (typeNum !== 'number' && typeNum !== 'string') {
2214
2214
  return num;
@@ -2222,6 +2222,58 @@ function exactRound(num, ratio) {
2222
2222
  return num;
2223
2223
  }
2224
2224
  }
2225
+ function exactRound(num, ratio) {
2226
+ var typeNum = typeof num;
2227
+ if (typeNum !== 'number' && typeNum !== 'string') {
2228
+ return num;
2229
+ }
2230
+ var value = _exactRound(num, ratio);
2231
+ /** 如果传入的是3位小数,那么最大小数位是4位,最小小数位是3位 */
2232
+ if (ratio === 3) {
2233
+ return excessZero(value, { maxRatio: 4, minRatio: 3 });
2234
+ }
2235
+ // 最大、最小小数位
2236
+ function excessZero(value, option) {
2237
+ var _a = option || {}, _b = _a.maxRatio, maxRatio = _b === void 0 ? 4 : _b, _c = _a.minRatio, minRatio = _c === void 0 ? 3 : _c;
2238
+ try {
2239
+ var newValue = Number(value);
2240
+ // 获取小数位数
2241
+ var decimal = newValue.toString().split('.')[1];
2242
+ if (!decimal || (decimal === null || decimal === void 0 ? void 0 : decimal.length) <= minRatio) {
2243
+ return _exactRound(newValue, minRatio);
2244
+ }
2245
+ return _exactRound(newValue, maxRatio);
2246
+ }
2247
+ catch (err) {
2248
+ console.log(err);
2249
+ return _exactRound(value, maxRatio);
2250
+ }
2251
+ }
2252
+ /**特殊处理单价的小数位,有6位的只显示2位0 */
2253
+ if (ratio === 6) {
2254
+ return repairZero(String(Number(value)));
2255
+ }
2256
+ return value;
2257
+ function repairZero(value) {
2258
+ try {
2259
+ var arr = value.split('.');
2260
+ if (arr.length === 2) {
2261
+ var decimal = arr[1];
2262
+ if (decimal.length < 2) {
2263
+ return _exactRound(value, 2);
2264
+ }
2265
+ }
2266
+ else if (arr.length === 1) {
2267
+ return _exactRound(value, 2);
2268
+ }
2269
+ return value;
2270
+ }
2271
+ catch (err) {
2272
+ console.log(err);
2273
+ return value;
2274
+ }
2275
+ }
2276
+ }
2225
2277
  /**
2226
2278
  * @description 添加千分符符号
2227
2279
  */
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-390e3466.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-47b9bee7.js';
@@ -1,7 +1,7 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { createDownloadUrl } from './fileOperation.js';
3
3
  import './authority-7a91cb9f.js';
4
- import './tools-390e3466.js';
4
+ import './tools-47b9bee7.js';
5
5
  import './tslib.es6-35653116.js';
6
6
  import 'dayjs';
7
7
  import './crypto-c481f616.js';
@@ -126,6 +126,13 @@ function setSession(name, value) {
126
126
  sessionStorage.setItem(name, value);
127
127
  }
128
128
  function getSession(name) {
129
+ // 这里有两种场景需要处理:
130
+ // 1. 从统一门户单点到流程中心,流程中心嵌入的表单是不需要权限控制的。
131
+ // 因为这里认为,既然待办到了某人那里,那么这个路由的不管某人是否有权限,都需要能够查看。
132
+ // 2. 第二种情况,就是到了流程这里后,再跳转到其他页面的权限控制。
133
+ // 这里认为,跟流程表单关联的页面都不应该做权限控制。因为是跟流程相关的。
134
+ // 处理第一个问题的解决方案是:流程中心会通过iframe传递一个标识给子应用,子应用来设置一些逻辑。
135
+ // 处理第二个问题的解决方案是:通过opener来获取来源地址,来源地址如果是正确的,那么也应该权限通过。
129
136
  if (window.opener && Object.getOwnPropertyNames(window.opener).length > 0) {
130
137
  // let v = ROUTER_FILTER_RULES_VALUE;
131
138
  // try {
@@ -1,3 +1,5 @@
1
+ import instance from './i18next.js';
2
+
1
3
  /**
2
4
  * @description 常用正则表达式
3
5
  */
@@ -23,7 +25,10 @@ var validate = {
23
25
  */
24
26
  // phoneValidate: /^1(3\d|4\d|5\d|6\d|7\d|8\d|9\d)\d{8}$/,
25
27
  // 数字 横线 长度 0 - 15位/^([0-9])|(\-)*$/
28
+ // /^[0-9\-]{0,15}$/ 老版
29
+ // /^(?:\+?\d{1,20})$/g
26
30
  phoneValidate: /^[0-9\-]{0,15}$/,
31
+ abroadPhoneValidate: /^(?:\+?\d{1,20})$/g,
27
32
  /**
28
33
  * @description 短信验证码 接受11位手机号
29
34
  */
@@ -50,26 +55,26 @@ var validate = {
50
55
  var commonMessage = {
51
56
  smallLenMessage: function (type) {
52
57
  if (type === void 0) { type = ''; }
53
- return type + "\u8D85\u8FC7\u6700\u5927\u5B57\u7B26\u957F\u5EA6200";
58
+ return instance.t('{{type}}超过最大字符长度200', { type: type });
54
59
  },
55
60
  middleLenMessage: function (type) {
56
61
  if (type === void 0) { type = ''; }
57
- return type + "\u8D85\u8FC7\u6700\u5927\u5B57\u7B26\u957F\u5EA6400";
62
+ return instance.t('{{type}}超过最大字符长度400', { type: type });
58
63
  },
59
64
  largeLenMessage: function (type) {
60
65
  if (type === void 0) { type = ''; }
61
- return type + "\u8D85\u8FC7\u6700\u5927\u5B57\u7B26\u957F\u5EA6600";
66
+ return instance.t('{{type}}超过最大字符长度600', { type: type });
62
67
  },
63
68
  maxlargeLenValidate: function (type) {
64
69
  if (type === void 0) { type = ''; }
65
- return type + "\u8D85\u8FC7\u6700\u5927\u5B57\u7B26\u957F\u5EA65000";
70
+ return instance.t('{{type}}超过最大字符长度5000', { type: type });
66
71
  },
67
- phoneMessage: '请输入正确的手机号',
68
- idCardMessage: '请输入正确的身份证',
69
- emailMessage: '请输入正确的邮箱',
72
+ phoneMessage: instance.t('请输入正确的手机号'),
73
+ idCardMessage: instance.t('请输入正确的身份证'),
74
+ emailMessage: instance.t('请输入正确的邮箱'),
70
75
  // passwordMessage: '密码由8-16位的字母+数字,字母+特殊字符,数字+特殊字符组成',
71
- passwordMessage: '密码必须包含大小写字母、数字、特殊字符且最小长度为8,且不能出现连续数字或字符,不能出现相同字符,且禁止使用用户账号作为密码',
72
- spaceMessage: '请勿输入空格',
76
+ passwordMessage: instance.t('密码必须包含大小写字母、数字、特殊字符且最小长度为8,且不能出现连续数字或字符,不能出现相同字符,且禁止使用用户账号作为密码'),
77
+ spaceMessage: instance.t('请勿输入空格'),
73
78
  };
74
79
  var alphabet1 = [
75
80
  'abcdefghijklmnopqrstuvwxyz',
@@ -98,14 +103,14 @@ function validatePassword(password, username) {
98
103
  if (!regex.test(password)) {
99
104
  return {
100
105
  result: false,
101
- message: '密码中必须包含大小写字母、数字、特殊字符,且长度必须大于8个字符!',
106
+ message: instance.t('密码中必须包含大小写字母、数字、特殊字符,且长度必须大于8个字符!'),
102
107
  };
103
108
  }
104
109
  // 检查密码是否与用户名相同
105
110
  if (password === username) {
106
111
  return {
107
112
  result: false,
108
- message: '密码与用户名相同!',
113
+ message: instance.t('密码与用户名相同!'),
109
114
  };
110
115
  }
111
116
  // 检查密码中是否有相同且连续的字符 超过三次
@@ -116,7 +121,7 @@ function validatePassword(password, username) {
116
121
  if (count1 >= 2) {
117
122
  return {
118
123
  result: false,
119
- message: '密码中有相同且连续超过三次的字符!',
124
+ message: instance.t('密码中有相同且连续超过三次的字符!'),
120
125
  };
121
126
  }
122
127
  }
@@ -146,7 +151,10 @@ function validatePassword(password, username) {
146
151
  // 密码中不应含有连续的字母或数字
147
152
  return {
148
153
  result: false,
149
- message: "\u4ECE\u7B2C" + (startChart + 1) + "\u4E2A\u5B57\u7B26\u5F00\u59CB\uFF0C\u6709\u8FDE\u7EED" + (currentConsecutiveCount === 1 ? '递减' : '递增') + "\u8D85\u8FC7\u4E09\u4F4D\u7684\u5B57\u6BCD\u6216\u6570\u5B57!",
154
+ message: instance.t('从第{{slot0}}个字符开始,有连续{{slot1}}超过三位的字母或数字!', {
155
+ slot0: startChart + 1,
156
+ slot1: currentConsecutiveCount === 1 ? '递减' : '递增',
157
+ }),
150
158
  };
151
159
  }
152
160
  }
@@ -181,7 +189,10 @@ function validatePassword(password, username) {
181
189
  // 密码中不应含有连续的字母或数字
182
190
  return {
183
191
  result: false,
184
- message: "\u4ECE\u7B2C" + (startChart + 1) + "\u4E2A\u5B57\u7B26\u5F00\u59CB\uFF0C\u6709\u6309\u952E\u76D8\u6A2A\u5411\u8FDE\u7EED" + (currentConsecutiveCount === 1 ? '递减' : '递增') + "\u8D85\u8FC7\u4E09\u4F4D\u7684\u5B57\u6BCD!",
192
+ message: instance.t('从第{{slot0}}个字符开始,有按键盘横向连续{{slot1}}超过三位的字母!', {
193
+ slot0: startChart + 1,
194
+ slot1: currentConsecutiveCount === 1 ? '递减' : '递增',
195
+ }),
185
196
  };
186
197
  }
187
198
  }
@@ -216,7 +227,10 @@ function validatePassword(password, username) {
216
227
  // 密码中不应含有连续的字母或数字
217
228
  return {
218
229
  result: false,
219
- message: "\u4ECE\u7B2C" + (startChart + 1) + "\u4E2A\u5B57\u7B26\u5F00\u59CB\uFF0C\u6709\u6309\u952E\u76D8\u7AD6\u5411\u8FDE\u7EED" + (currentConsecutiveCount === 1 ? '递减' : '递增') + "\u8D85\u8FC7\u4E09\u4F4D\u7684\u5B57\u6BCD\u6216\u6570\u5B57!",
230
+ message: instance.t('从第{{slot0}}个字符开始,有按键盘竖向连续{{slot1}}超过三位的字母或数字!', {
231
+ slot0: startChart + 1,
232
+ slot1: currentConsecutiveCount === 1 ? '递减' : '递增',
233
+ }),
220
234
  };
221
235
  }
222
236
  }
@@ -22,6 +22,7 @@ declare const validate: {
22
22
  * @description 电话号码验证
23
23
  */
24
24
  phoneValidate: RegExp;
25
+ abroadPhoneValidate: RegExp;
25
26
  /**
26
27
  * @description 短信验证码 接受11位手机号
27
28
  */
package/dist/validate.js CHANGED
@@ -1 +1,2 @@
1
- export { c as commonMessage, b as validate, a as validatePassword } from './validate-18e52490.js';
1
+ import './i18next.js';
2
+ export { c as commonMessage, b as validate, a as validatePassword } from './validate-2138d94a.js';
package/dist/workflow.js CHANGED
@@ -1,12 +1,10 @@
1
+ import instance from './i18next.js';
1
2
  import { useEffect } from 'react';
2
- import { g as getUrlSearch } from './tools-390e3466.js';
3
+ import { g as getUrlSearch } from './tools-47b9bee7.js';
3
4
  import { WORKFLOW_HIDEFRAME_KEY } from './constants.js';
4
5
  import './tslib.es6-35653116.js';
5
6
  import 'dayjs';
6
7
 
7
- /**
8
- * @description 审批工作流相关操作
9
- */
10
8
  /**
11
9
  * @description 通过iframe双向通信逻辑
12
10
  */
@@ -14,7 +12,7 @@ function useOnmessage(messageFn, isDebugger) {
14
12
  useEffect(function () {
15
13
  var messageHandle = function (e) {
16
14
  if (isDebugger) {
17
- console.log('父页面传递过来的消息', e);
15
+ console.log(instance.t('父页面传递过来的消息'), e);
18
16
  }
19
17
  var messageData = {};
20
18
  try {
@@ -22,7 +20,7 @@ function useOnmessage(messageFn, isDebugger) {
22
20
  }
23
21
  catch (err) {
24
22
  if (isDebugger) {
25
- console.log('父页面传递过来的消息解析报错', err);
23
+ console.log(instance.t('父页面传递过来的消息解析报错'), err);
26
24
  }
27
25
  }
28
26
  messageFn && messageFn(messageData);