ztxkui 10.0.94 → 10.0.96

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 (158) hide show
  1. package/dist/components/PrintContainer/print-container.js +19 -14
  2. package/dist/components/PrintContainer/sealHooks.js +8 -6
  3. package/dist/components/PrintContainer/service.d.ts +1 -0
  4. package/dist/components/PrintContainer/service.js +2 -2
  5. package/dist/components/TranslationButton/DownFile.d.ts +7 -0
  6. package/dist/components/TranslationButton/DownFile.js +95 -0
  7. package/dist/components/TranslationButton/PreviewFile.d.ts +5 -0
  8. package/dist/components/TranslationButton/PreviewFile.js +73 -0
  9. package/dist/components/TranslationButton/TranslationButton.d.ts +34 -0
  10. package/dist/components/TranslationButton/TranslationButton.js +245 -0
  11. package/dist/components/TranslationButton/demoComponents/index.d.ts +3 -0
  12. package/dist/components/TranslationButton/demoComponents/index.js +9 -0
  13. package/dist/components/TranslationButton/hooks.d.ts +8 -0
  14. package/dist/components/TranslationButton/hooks.js +139 -0
  15. package/dist/components/TranslationButton/index.d.ts +4 -0
  16. package/dist/components/TranslationButton/index.js +4 -0
  17. package/dist/components/Upload/utils.d.ts +9 -2
  18. package/dist/components/Upload/utils.js +62 -8
  19. package/dist/components/UploadCustom/hooks/useDg.d.ts +6 -0
  20. package/dist/components/UploadCustom/hooks/useDg.js +55 -0
  21. package/dist/components/business/Signatures/components/CodeModal.d.ts +3 -0
  22. package/dist/components/business/Signatures/components/CodeModal.js +157 -0
  23. package/dist/components/business/Signatures/components/CompareResult.js +3 -1
  24. package/dist/components/business/Signatures/components/DetailTable.js +5 -4
  25. package/dist/components/business/Signatures/index.js +33 -31
  26. package/dist/components/electron-signatures/content.d.ts +9 -0
  27. package/dist/components/electron-signatures/content.js +1126 -0
  28. package/dist/components/electron-signatures/demoComponents/data.d.ts +58 -0
  29. package/dist/components/electron-signatures/demoComponents/data.js +1307 -0
  30. package/dist/components/electron-signatures/demoComponents/detail.d.ts +6 -0
  31. package/dist/components/electron-signatures/demoComponents/detail.js +283 -0
  32. package/dist/components/electron-signatures/demoComponents/index.d.ts +2 -0
  33. package/dist/components/electron-signatures/demoComponents/index.js +27 -0
  34. package/dist/components/electron-signatures/demoComponents/index_old.d.ts +3 -0
  35. package/dist/components/electron-signatures/demoComponents/index_old.js +502 -0
  36. package/dist/components/electron-signatures/demoComponents/jgqrd.d.ts +6 -0
  37. package/dist/components/electron-signatures/demoComponents/jgqrd.js +135 -0
  38. package/dist/components/electron-signatures/demoComponents/making.d.ts +6 -0
  39. package/dist/components/electron-signatures/demoComponents/making.js +211 -0
  40. package/dist/components/electron-signatures/demoComponents/makingData.d.ts +663 -0
  41. package/dist/components/electron-signatures/demoComponents/makingData.js +1164 -0
  42. package/dist/components/electron-signatures/demoComponents/newDetail.d.ts +6 -0
  43. package/dist/components/electron-signatures/demoComponents/newDetail.js +283 -0
  44. package/dist/components/electron-signatures/demoComponents/preview.d.ts +3 -0
  45. package/dist/components/electron-signatures/demoComponents/preview.js +9 -0
  46. package/dist/components/electron-signatures/demoComponents/singleQjDetail.d.ts +6 -0
  47. package/dist/components/electron-signatures/demoComponents/singleQjDetail.js +530 -0
  48. package/dist/components/electron-signatures/demoComponents/singleQjMaking.d.ts +6 -0
  49. package/dist/components/electron-signatures/demoComponents/singleQjMaking.js +219 -0
  50. package/dist/components/electron-signatures/demoComponents/test.d.ts +6 -0
  51. package/dist/components/electron-signatures/demoComponents/test.js +119 -0
  52. package/dist/components/electron-signatures/dgComponents/contract-comparison.d.ts +39 -0
  53. package/dist/components/electron-signatures/dgComponents/contract-comparison.js +53 -0
  54. package/dist/components/electron-signatures/dgComponents/file-comparison-btn.d.ts +11 -0
  55. package/dist/components/electron-signatures/dgComponents/file-comparison-btn.js +180 -0
  56. package/dist/components/electron-signatures/dgComponents/new-contract-comparison.d.ts +45 -0
  57. package/dist/components/electron-signatures/dgComponents/new-contract-comparison.js +68 -0
  58. package/dist/components/electron-signatures/dgComponents/useContractColumns.d.ts +21 -0
  59. package/dist/components/electron-signatures/dgComponents/useContractColumns.js +171 -0
  60. package/dist/components/electron-signatures/electron-signatures-fragment.d.ts +8 -0
  61. package/dist/components/electron-signatures/electron-signatures-fragment.js +344 -0
  62. package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.d.ts +52 -0
  63. package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.js +513 -0
  64. package/dist/components/electron-signatures/electronComponents/electron-seal-detail.d.ts +8 -0
  65. package/dist/components/electron-signatures/electronComponents/electron-seal-detail.js +59 -0
  66. package/dist/components/electron-signatures/electronComponents/electron-seal-download.d.ts +16 -0
  67. package/dist/components/electron-signatures/electronComponents/electron-seal-download.js +89 -0
  68. package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.d.ts +9 -0
  69. package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.js +16 -0
  70. package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.d.ts +15 -0
  71. package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.js +16 -0
  72. package/dist/components/electron-signatures/electronComponents/electron-seal-item.d.ts +20 -0
  73. package/dist/components/electron-signatures/electronComponents/electron-seal-item.js +47 -0
  74. package/dist/components/electron-signatures/electronComponents/electron-seal-list.d.ts +11 -0
  75. package/dist/components/electron-signatures/electronComponents/electron-seal-list.js +191 -0
  76. package/dist/components/electron-signatures/electronComponents/electron-seal-setting.d.ts +15 -0
  77. package/dist/components/electron-signatures/electronComponents/electron-seal-setting.js +10 -0
  78. package/dist/components/electron-signatures/electronComponents/last-qys-modal.d.ts +7 -0
  79. package/dist/components/electron-signatures/electronComponents/last-qys-modal.js +42 -0
  80. package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.d.ts +3 -0
  81. package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.js +43 -0
  82. package/dist/components/electron-signatures/electronComponents/useElectronColumns.d.ts +30 -0
  83. package/dist/components/electron-signatures/electronComponents/useElectronColumns.js +380 -0
  84. package/dist/components/electron-signatures/electronComponents/useFetchElectronData.d.ts +20 -0
  85. package/dist/components/electron-signatures/electronComponents/useFetchElectronData.js +167 -0
  86. package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.d.ts +3 -0
  87. package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.js +35 -0
  88. package/dist/components/electron-signatures/fileComponents/file-operation.d.ts +7 -0
  89. package/dist/components/electron-signatures/fileComponents/file-operation.js +67 -0
  90. package/dist/components/electron-signatures/fileComponents/file-type-select.d.ts +12 -0
  91. package/dist/components/electron-signatures/fileComponents/file-type-select.js +10 -0
  92. package/dist/components/electron-signatures/fileComponents/file-upload.d.ts +11 -0
  93. package/dist/components/electron-signatures/fileComponents/file-upload.js +146 -0
  94. package/dist/components/electron-signatures/fileComponents/fileUtils.d.ts +17 -0
  95. package/dist/components/electron-signatures/fileComponents/fileUtils.js +36 -0
  96. package/dist/components/electron-signatures/fileComponents/new-file-operation.d.ts +10 -0
  97. package/dist/components/electron-signatures/fileComponents/new-file-operation.js +73 -0
  98. package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.d.ts +13 -0
  99. package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.js +43 -0
  100. package/dist/components/electron-signatures/fileComponents/useFileColumns.d.ts +38 -0
  101. package/dist/components/electron-signatures/fileComponents/useFileColumns.js +329 -0
  102. package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.d.ts +19 -0
  103. package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.js +72 -0
  104. package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.d.ts +30 -0
  105. package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.js +132 -0
  106. package/dist/components/electron-signatures/hooks/useMergeRecords.d.ts +17 -0
  107. package/dist/components/electron-signatures/hooks/useMergeRecords.js +49 -0
  108. package/dist/components/electron-signatures/hooks/useParseElectronListData.d.ts +49 -0
  109. package/dist/components/electron-signatures/hooks/useParseElectronListData.js +111 -0
  110. package/dist/components/electron-signatures/hooks/useParseElectronSetting.d.ts +102 -0
  111. package/dist/components/electron-signatures/hooks/useParseElectronSetting.js +363 -0
  112. package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.d.ts +40 -0
  113. package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.js +139 -0
  114. package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.d.ts +36 -0
  115. package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.js +48 -0
  116. package/dist/components/electron-signatures/hooks/useParseQunjListData.d.ts +56 -0
  117. package/dist/components/electron-signatures/hooks/useParseQunjListData.js +204 -0
  118. package/dist/components/electron-signatures/hooks/useParseQunjSingleData.d.ts +34 -0
  119. package/dist/components/electron-signatures/hooks/useParseQunjSingleData.js +110 -0
  120. package/dist/components/electron-signatures/hooks/useParseRecords.d.ts +65 -0
  121. package/dist/components/electron-signatures/hooks/useParseRecords.js +165 -0
  122. package/dist/components/electron-signatures/index.d.ts +13 -0
  123. package/dist/components/electron-signatures/index.js +54 -0
  124. package/dist/components/electron-signatures/index_old.d.ts +9 -0
  125. package/dist/components/electron-signatures/index_old.js +966 -0
  126. package/dist/components/electron-signatures/interface.d.ts +849 -0
  127. package/dist/components/electron-signatures/interface.js +57 -0
  128. package/dist/components/electron-signatures/qunjComponents/qunj-apply.d.ts +6 -0
  129. package/dist/components/electron-signatures/qunjComponents/qunj-apply.js +8 -0
  130. package/dist/components/electron-signatures/qunjComponents/qunj-check.d.ts +21 -0
  131. package/dist/components/electron-signatures/qunjComponents/qunj-check.js +41 -0
  132. package/dist/components/electron-signatures/qunjComponents/qunj-detail.d.ts +35 -0
  133. package/dist/components/electron-signatures/qunjComponents/qunj-detail.js +267 -0
  134. package/dist/components/electron-signatures/qunjComponents/qunj-list.d.ts +24 -0
  135. package/dist/components/electron-signatures/qunjComponents/qunj-list.js +346 -0
  136. package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.d.ts +20 -0
  137. package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.js +61 -0
  138. package/dist/components/electron-signatures/qunjComponents/useQunjColumns.d.ts +36 -0
  139. package/dist/components/electron-signatures/qunjComponents/useQunjColumns.js +321 -0
  140. package/dist/components/electron-signatures/translateComponents/TranslateButton.d.ts +10 -0
  141. package/dist/components/electron-signatures/translateComponents/TranslateButton.js +44 -0
  142. package/dist/components/electron-signatures/translateComponents/useTranslateCom.d.ts +22 -0
  143. package/dist/components/electron-signatures/translateComponents/useTranslateCom.js +50 -0
  144. package/dist/components/electron-signatures/utils.d.ts +26 -0
  145. package/dist/components/electron-signatures/utils.js +67 -0
  146. package/dist/components/utils/ZtxkContext.d.ts +18 -0
  147. package/dist/components/utils/ZtxkContext.js +5 -0
  148. package/dist/components/utils/useMemoizedFn.d.ts +6 -0
  149. package/dist/components/utils/useMemoizedFn.js +22 -0
  150. package/dist/components/utils/usePrevious.d.ts +3 -0
  151. package/dist/components/utils/usePrevious.js +13 -0
  152. package/dist/hooks/useServiceName.d.ts +1 -0
  153. package/dist/index.css +686 -0
  154. package/dist/index.css.map +1 -1
  155. package/dist/index.d.ts +3 -0
  156. package/dist/index.js +105 -87
  157. package/dist/request.js +1 -1
  158. package/package.json +4 -3
@@ -85,19 +85,20 @@ var EXPORT_PDF_PAGEFORMATL = [841.89, 595.28]; // [595.28, 641.89]
85
85
  var PrintContainer = function (_a) {
86
86
  var children = _a.children, waterText = _a.waterText, onFonsizeChange = _a.onFonsizeChange, hiddenClassName = _a.hiddenClassName, _b = _a.isAddExportPage, isAddExportPage = _b === void 0 ? false : _b, _c = _a.loading, loading = _c === void 0 ? false : _c, _d = _a.pdfName, pdfName = _d === void 0 ? 'pdf文件' : _d, request = _a.request, sealIdList = _a.sealIdList, _e = _a.showHandSeal, showHandSeal = _e === void 0 ? true : _e, _f = _a.showAutoSeal, showAutoSeal = _f === void 0 ? true : _f, _g = _a.needWatermark, needWatermark = _g === void 0 ? 0 : _g, fileId = _a.fileId, deptId = _a.deptId, flowId = _a.flowId, imgWaterBg = _a.imgWaterBg, onPrintCallback = _a.onPrintCallback, showPrintMessage = _a.showPrintMessage, onPrintBeforeCallback = _a.onPrintBeforeCallback, _h = _a.showPrintBtn, showPrintBtn = _h === void 0 ? true : _h, _j = _a.showPluginPrintBtn, showPluginPrintBtn = _j === void 0 ? true : _j, isUseXy = _a.isUseXy, localKey = _a.localKey, _k = _a.showExportBtn, showExportBtn = _k === void 0 ? true : _k, showSetFontBtn = _a.showSetFontBtn, isSetPosition = _a.isSetPosition, // 默认不需要偏移
87
87
  showAddSeal = _a.showAddSeal, apiUrl = _a.apiUrl, defaultAddWater = _a.defaultAddWater, fileBaseUrl = _a.fileBaseUrl, ecPrintFn = _a.ecPrintFn, ecPrintCreatePdfHandleAfter = _a.ecPrintCreatePdfHandleAfter, clickCreatePdfHandlePre = _a.clickCreatePdfHandlePre, clickCreatePdfHandleNext = _a.clickCreatePdfHandleNext, handleRef = _a.handleRef, showAboutExport = _a.showAboutExport, isAboutExportSeal = _a.isAboutExportSeal, onAboutExportBeforeCallback = _a.onAboutExportBeforeCallback, showAboutExportMessage = _a.showAboutExportMessage, onAboutExportCallback = _a.onAboutExportCallback, aboutExportZipName = _a.aboutExportZipName, aboutExportAddWater = _a.aboutExportAddWater, buttonRender = _a.buttonRender, isPhone = _a.isPhone, showWaterBtn = _a.showWaterBtn, isNeedSeal = _a.isNeedSeal;
88
- var printContainer = React.useContext(ZtxkContext).printContainer;
88
+ var _l = React.useContext(ZtxkContext), printContainer = _l.printContainer, serviceNames = _l.serviceNames;
89
+ var _m = (serviceNames || {}).scmServiceName, scmServiceName = _m === void 0 ? '/zmdms-scm-system' : _m;
89
90
  if (!(printContainer === null || printContainer === void 0 ? void 0 : printContainer.print)) {
90
91
  showHandSeal = false;
91
92
  showAutoSeal = false;
92
93
  }
93
- var _l = useState(false), showWater = _l[0], setShowWater = _l[1];
94
+ var _o = useState(false), showWater = _o[0], setShowWater = _o[1];
94
95
  var containerRef = useRef();
95
96
  var allDomRef = useRef();
96
- var _m = useState(false), spinning = _m[0], setSpinning = _m[1];
97
+ var _p = useState(false), spinning = _p[0], setSpinning = _p[1];
97
98
  // 确认盖章后,会得到一个合同id 这个之后盖章要用
98
- var _o = useState(), currentContractId = _o[0], setCurrentContractId = _o[1];
99
+ var _q = useState(), currentContractId = _q[0], setCurrentContractId = _q[1];
99
100
  // 盖章后会得到一个预览地址,这个地址耀保存,同一个合同id,不能重复盖章接口
100
- var _p = useState(), currentViewUrl = _p[0], setCurrentViewUrl = _p[1];
101
+ var _r = useState(), currentViewUrl = _r[0], setCurrentViewUrl = _r[1];
101
102
  var onMouseDown = useMoveImg(containerRef).onMouseDown;
102
103
  useEffect(function () {
103
104
  try {
@@ -112,12 +113,12 @@ var PrintContainer = function (_a) {
112
113
  console.log(err);
113
114
  }
114
115
  }, [isPhone]);
115
- var _q = useGetSealList(request, { deptId: deptId, flowId: flowId },
116
+ var _s = useGetSealList(request, { deptId: deptId, flowId: flowId },
116
117
  // 这里是否发请求获取印章列表信息逻辑做下改动。
117
118
  // 之前只要有自动盖章按钮、手动盖章按钮的时候才发送请求获取印章信息
118
119
  // 这里多添加一个条件 如果添加盖章按钮时,也获取印章信息
119
- { sealIdList: sealIdList, isFetch: showAutoSeal || showHandSeal || isNeedSeal }), loadSealPromise = _q.loadSealPromise, _sealIdList = _q._sealIdList, autoSealList = _q.autoSealList, sealFileIdList = _q.sealFileIdList, isAutoSeal = _q.isAutoSeal;
120
- var _r = useAddSealImg(loadSealPromise, sealFileIdList, apiUrl, onMouseDown), showSeal = _r.showSeal, onAddSeal = _r.onAddSeal, removeSealHandle = _r.removeSealHandle;
120
+ { sealIdList: sealIdList, isFetch: showAutoSeal || showHandSeal || isNeedSeal }), loadSealPromise = _s.loadSealPromise, _sealIdList = _s._sealIdList, autoSealList = _s.autoSealList, sealFileIdList = _s.sealFileIdList, isAutoSeal = _s.isAutoSeal;
121
+ var _t = useAddSealImg(loadSealPromise, sealFileIdList, apiUrl, onMouseDown), showSeal = _t.showSeal, onAddSeal = _t.onAddSeal, removeSealHandle = _t.removeSealHandle;
121
122
  var fontLoadHandle = useFont(showHandSeal || showAutoSeal || showAboutExport).fontLoadHandle;
122
123
  // 关联导出
123
124
  var onAboutExportHandle = useAboutExport(isAutoSeal, {
@@ -209,6 +210,7 @@ var PrintContainer = function (_a) {
209
210
  errorCallback: function () {
210
211
  setSpinning(false);
211
212
  },
213
+ scmServiceName: scmServiceName,
212
214
  });
213
215
  }
214
216
  else {
@@ -267,11 +269,11 @@ var PrintContainer = function (_a) {
267
269
  });
268
270
  }); };
269
271
  // 边距调整相关
270
- var _s = useState(false), visible = _s[0], setVisible = _s[1];
271
- var _t = useState({
272
+ var _u = useState(false), visible = _u[0], setVisible = _u[1];
273
+ var _v = useState({
272
274
  top: 0,
273
275
  left: 0,
274
- }), value = _t[0], setValue = _t[1];
276
+ }), value = _v[0], setValue = _v[1];
275
277
  useNeedLodop();
276
278
  useInitSetPostion();
277
279
  var initDomPosition = useCallback(function () {
@@ -825,7 +827,7 @@ var PrintContainer = function (_a) {
825
827
  formData.append('deptId', deptId);
826
828
  }
827
829
  request({
828
- url: '/api/zmdms-scm-system/seal/confirm-seal-position',
830
+ url: "/api" + scmServiceName + "/seal/confirm-seal-position",
829
831
  method: 'POST',
830
832
  data: formData,
831
833
  timeout: 300000,
@@ -872,7 +874,7 @@ var PrintContainer = function (_a) {
872
874
  }
873
875
  setSpinning(true);
874
876
  request({
875
- url: '/api/zmdms-scm-system/seal/final-seal',
877
+ url: "/api" + scmServiceName + "/seal/final-seal",
876
878
  method: 'POST',
877
879
  data: {
878
880
  contractId: currentContractId,
@@ -969,7 +971,7 @@ var PrintContainer = function (_a) {
969
971
  });
970
972
  }
971
973
  request({
972
- url: '/api/zmdms-scm-system/seal/auto-seal',
974
+ url: "/api" + scmServiceName + "/seal/auto-seal",
973
975
  method: 'POST',
974
976
  data: formData,
975
977
  headers: {
@@ -1208,6 +1210,7 @@ var PrintContainer = function (_a) {
1208
1210
  newStatusArr[i] = 'rejected';
1209
1211
  resultHandle(i);
1210
1212
  },
1213
+ scmServiceName: scmServiceName,
1211
1214
  });
1212
1215
  });
1213
1216
  }
@@ -1250,6 +1253,7 @@ var PrintContainer = function (_a) {
1250
1253
  isPhone: isPhone,
1251
1254
  fileName: pdfName,
1252
1255
  apiUrl: apiUrl,
1256
+ scmServiceName: scmServiceName,
1253
1257
  });
1254
1258
  }
1255
1259
  else {
@@ -1290,6 +1294,7 @@ var PrintContainer = function (_a) {
1290
1294
  errorCallback: function () {
1291
1295
  setSpinning(false);
1292
1296
  },
1297
+ scmServiceName: scmServiceName,
1293
1298
  });
1294
1299
  }
1295
1300
  else {
@@ -14,20 +14,22 @@ import { useState, useEffect, useRef, useMemo } from 'react';
14
14
  import { createDownloadUrl } from 'ztxkutils/dist/fileOperation';
15
15
  import { getCurrentPosition } from './hooks';
16
16
  import { message } from '../../index';
17
+ import useServiceName from '../../hooks/useServiceName';
17
18
  // 获取印章id方法
18
19
  export function useGetSealList(request, params, otherOptions) {
19
20
  var deptId = params.deptId, flowId = params.flowId;
20
21
  var sealIdList = otherOptions.sealIdList, isFetch = otherOptions.isFetch;
22
+ var _a = (useServiceName() || {}).scmServiceName, scmServiceName = _a === void 0 ? '/zmdms-scm-system' : _a;
21
23
  // 接口请求ref
22
24
  var loadSealPromise = useRef(null);
23
25
  // 收到盖章-印章列表
24
- var _a = useState(), _sealIdList = _a[0], setSealIdList = _a[1];
26
+ var _b = useState(), _sealIdList = _b[0], setSealIdList = _b[1];
25
27
  // 自动盖章-印章列表
26
- var _b = useState(), autoSealList = _b[0], setAutoSealList = _b[1];
28
+ var _c = useState(), autoSealList = _c[0], setAutoSealList = _c[1];
27
29
  // 印章id
28
- var _c = useState(), sealFileIdList = _c[0], setSealFileIdList = _c[1];
30
+ var _d = useState(), sealFileIdList = _d[0], setSealFileIdList = _d[1];
29
31
  // 是否拥有印章
30
- var _d = useState(false), hasSeal = _d[0], setHasSeal = _d[1];
32
+ var _e = useState(false), hasSeal = _e[0], setHasSeal = _e[1];
31
33
  // 根据传入参数设置印章 关键字
32
34
  useEffect(function () {
33
35
  if (sealIdList) {
@@ -38,7 +40,7 @@ export function useGetSealList(request, params, otherOptions) {
38
40
  useEffect(function () {
39
41
  if (deptId && flowId && request && isFetch) {
40
42
  loadSealPromise.current = request({
41
- url: '/api/zmdms-scm-system/flowdeptseal/select-seal-info-list',
43
+ url: "/api" + scmServiceName + "/flowdeptseal/select-seal-info-list",
42
44
  method: 'GET',
43
45
  params: {
44
46
  size: 200,
@@ -80,7 +82,7 @@ export function useGetSealList(request, params, otherOptions) {
80
82
  message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || '获取印章失败!');
81
83
  });
82
84
  }
83
- }, [request, deptId, flowId, isFetch]);
85
+ }, [request, deptId, flowId, isFetch, scmServiceName]);
84
86
  // 是否能自动盖章
85
87
  var isAutoSeal = useMemo(function () {
86
88
  // 如果没有传入 流程id 那么说明也不需要盖章
@@ -11,6 +11,7 @@ export declare function autoSealThenDownloadFilesHandle(request: any, formData:
11
11
  isPhone?: boolean;
12
12
  fileName?: string;
13
13
  apiUrl?: string;
14
+ scmServiceName?: string;
14
15
  }): any;
15
16
  /**
16
17
  * 自动盖章下载盖章件
@@ -57,9 +57,9 @@ function createDownloadUrl(apiUrl, fileId, otherOptions) {
57
57
  * @params formData: any 请求参数
58
58
  */
59
59
  export function autoSealThenDownloadFilesHandle(request, formData, options) {
60
- var sucessCallback = options.sucessCallback, errorCallback = options.errorCallback, loadingCallback = options.loadingCallback, isPhone = options.isPhone, _a = options.apiUrl, apiUrl = _a === void 0 ? window.location.origin : _a, kkFileName = options.fileName;
60
+ var sucessCallback = options.sucessCallback, errorCallback = options.errorCallback, loadingCallback = options.loadingCallback, isPhone = options.isPhone, _a = options.apiUrl, apiUrl = _a === void 0 ? window.location.origin : _a, kkFileName = options.fileName, _b = options.scmServiceName, scmServiceName = _b === void 0 ? '/zmdms-scm-system' : _b;
61
61
  return request({
62
- url: '/api/zmdms-scm-system/seal/auto-seal-then-download-files',
62
+ url: "/api" + scmServiceName + "/seal/auto-seal-then-download-files",
63
63
  method: 'POST',
64
64
  data: formData,
65
65
  headers: {
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const DownFile: ({ request, tid, fileName }: {
3
+ request: any;
4
+ tid: any;
5
+ fileName: any;
6
+ }) => JSX.Element;
7
+ export default DownFile;
@@ -0,0 +1,95 @@
1
+ import i18next from 'ztxkutils/dist/i18next';
2
+ import React, { useState, useCallback, useEffect } from 'react';
3
+ import { DownloadOutlined } from '@ant-design/icons';
4
+ import { Button, Dropdown, Menu, message } from '../../index';
5
+ var DownFile = function (_a) {
6
+ var request = _a.request, tid = _a.tid, fileName = _a.fileName;
7
+ // 下载类型选择
8
+ var _b = useState([]), downloadTypeDict = _b[0], setDownloadTypeDict = _b[1];
9
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
10
+ // 获取下载类型字典
11
+ var getDownloadTypeDict = useCallback(function () {
12
+ return request === null || request === void 0 ? void 0 : request({
13
+ url: "/api/zmdms-system/dict/dictionary",
14
+ method: 'GET',
15
+ params: {
16
+ code: 'fy_file_type',
17
+ },
18
+ }).then(function (res) {
19
+ var _a;
20
+ if (res.status === 200 && res.data.data) {
21
+ setDownloadTypeDict((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data);
22
+ }
23
+ });
24
+ }, [request]);
25
+ useEffect(function () {
26
+ getDownloadTypeDict();
27
+ }, [getDownloadTypeDict]);
28
+ var download = function (dType) {
29
+ setLoading(true);
30
+ request({
31
+ url: "/api/zmdms-resource/fanyi/download-trans-file",
32
+ method: 'GET',
33
+ responseType: 'blob',
34
+ params: {
35
+ dtype: dType,
36
+ tid: tid,
37
+ fileName: fileName,
38
+ },
39
+ })
40
+ .then(function (res) {
41
+ try {
42
+ var blob = new Blob([res.data], {
43
+ type: 'application/vnd.ms-excel',
44
+ });
45
+ if (blob.size < 1) {
46
+ message.warning(i18next.t('下载失败,下载的内容为空!'));
47
+ return;
48
+ }
49
+ var aLink = document.createElement('a');
50
+ aLink.style.display = 'none';
51
+ var href = window.URL.createObjectURL(blob);
52
+ aLink.href = href;
53
+ aLink.download = fileName;
54
+ document.body.appendChild(aLink);
55
+ aLink.click();
56
+ document.body.removeChild(aLink);
57
+ window.URL.revokeObjectURL(href);
58
+ return new File([blob], fileName);
59
+ }
60
+ catch (err) {
61
+ console.error(err);
62
+ }
63
+ })
64
+ .catch(function (err) {
65
+ var _a, _b, _c;
66
+ console.log(err);
67
+ try {
68
+ var blobData = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data;
69
+ blobData
70
+ .text()
71
+ .then(function (data) {
72
+ var result = JSON.parse(data);
73
+ message.error((result === null || result === void 0 ? void 0 : result.msg) || i18next.t('接口调用失败!'));
74
+ })
75
+ .catch(function () {
76
+ var _a, _b;
77
+ message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || i18next.t('接口调用失败!'));
78
+ });
79
+ }
80
+ catch (e) {
81
+ message.error(((_c = (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.msg) || i18next.t('接口调用失败!'));
82
+ }
83
+ })
84
+ .finally(function () {
85
+ setLoading(false);
86
+ });
87
+ };
88
+ return (React.createElement(Dropdown, { overlay: function () { return (React.createElement(Menu, { onClick: function (e) {
89
+ download(e.key);
90
+ } }, downloadTypeDict.map(function (item) {
91
+ return React.createElement(Menu.Item, { key: item.dictKey }, item.dictValue);
92
+ }))); }, placement: "bottomLeft" },
93
+ React.createElement(Button, { type: "primary", shape: "circle", icon: React.createElement(DownloadOutlined, null), size: 'small', loading: loading })));
94
+ };
95
+ export default DownFile;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const PreviewFile: ({ request }: {
3
+ request: any;
4
+ }) => JSX.Element;
5
+ export default PreviewFile;
@@ -0,0 +1,73 @@
1
+ import i18next from 'ztxkutils/dist/i18next';
2
+ import React from 'react';
3
+ import { createOriginalUrl } from 'ztxkutils/dist/fileOperation';
4
+ import { dangerouslySetXss } from 'ztxkutils/dist/tools';
5
+ import { ZtxkContext } from '../../index';
6
+ import DownFile from './DownFile';
7
+ var PreviewFile = function (_a) {
8
+ var request = _a.request;
9
+ var fileBaseUrl = React.useContext(ZtxkContext).fileBaseUrl;
10
+ var params = new URLSearchParams(window.location.search);
11
+ var oldId = params.get('oldId');
12
+ var tid = params.get('tid');
13
+ var fileName = params.get('fileName') || '';
14
+ try {
15
+ fileName = decodeURIComponent(fileName);
16
+ }
17
+ catch (error) {
18
+ fileName = dangerouslySetXss(fileName);
19
+ console.error(i18next.t('解码文件名失败:'), error);
20
+ }
21
+ var _b = React.useState(''), translatedUrl = _b[0], setTranslatedUrl = _b[1];
22
+ var oldUrl = React.useMemo(function () {
23
+ if (oldId) {
24
+ return createOriginalUrl(fileBaseUrl, oldId, {
25
+ titleName: dangerouslySetXss(fileName || ''),
26
+ });
27
+ }
28
+ return '';
29
+ }, [fileBaseUrl, oldId, fileName]);
30
+ React.useEffect(function () {
31
+ if (tid) {
32
+ request({
33
+ url: "/api/zmdms-resource/fanyi/download-trans-file-id",
34
+ method: 'get',
35
+ params: {
36
+ tid: tid,
37
+ dtype: 3,
38
+ fileName: fileName,
39
+ },
40
+ })
41
+ .then(function (res) {
42
+ setTranslatedUrl(createOriginalUrl(fileBaseUrl, res.data.data.attachId, {
43
+ titleName: res.data.data.originalName,
44
+ }));
45
+ })
46
+ .catch(function (error) {
47
+ console.error(i18next.t('获取翻译文件失败:'), error);
48
+ });
49
+ }
50
+ }, [tid, fileBaseUrl, fileName, request]);
51
+ return (React.createElement("div", { style: {
52
+ display: 'flex',
53
+ width: '100%',
54
+ height: '100vh',
55
+ justifyContent: 'space-between',
56
+ overflow: 'hidden',
57
+ } },
58
+ React.createElement("iframe", { style: { width: '100%', height: '100%', border: '2px solid #333' }, src: oldUrl, title: i18next.t('原文档') }),
59
+ React.createElement("div", { style: { width: '5px', height: '100px' } }),
60
+ React.createElement("div", { style: {
61
+ position: 'relative',
62
+ width: '100%',
63
+ border: '2px solid #333',
64
+ } },
65
+ React.createElement("iframe", { style: { width: '100%', height: '100%' }, src: translatedUrl, title: i18next.t('翻译文档') }),
66
+ React.createElement("div", { style: {
67
+ position: 'absolute',
68
+ right: '20px',
69
+ bottom: '50%',
70
+ } },
71
+ React.createElement(DownFile, { request: request, tid: tid, fileName: fileName })))));
72
+ };
73
+ export default PreviewFile;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from 'antd/lib/button';
3
+ export interface IProps extends ButtonProps {
4
+ /**
5
+ * 附件id 需要翻译的附件id
6
+ */
7
+ attachId?: string;
8
+ /**
9
+ * 附件名 需要翻译的附件名
10
+ */
11
+ attachName?: string;
12
+ /**
13
+ * 翻译后的任务ID 用来检测翻译是否完成 用来获取翻译后的文件
14
+ */
15
+ tid?: string;
16
+ /**
17
+ * 请求方法
18
+ */
19
+ request?: any;
20
+ /**
21
+ * 开始翻译的其他参数
22
+ */
23
+ translationParams?: any;
24
+ /**
25
+ * tid改变
26
+ */
27
+ tidChange?: (tid: string) => void;
28
+ /**
29
+ * 文件预览路径
30
+ */
31
+ previewUrl: string;
32
+ }
33
+ declare const TranslationButton: React.FC<IProps>;
34
+ export default TranslationButton;
@@ -0,0 +1,245 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import i18next from 'ztxkutils/dist/i18next';
49
+ import React, { useState, useMemo } from 'react';
50
+ import { unstable_batchedUpdates } from 'react-dom';
51
+ import { Button, message, Dropdown, Menu, Progress } from '../../index';
52
+ import { usePercent } from './hooks';
53
+ import { useQuery } from 'react-query';
54
+ var translationTypeList = [
55
+ { dictKey: '2', dictValue: i18next.t('英文转中文') },
56
+ { dictKey: '1', dictValue: i18next.t('中文转英文') },
57
+ ];
58
+ var TranslationButton = function (props) {
59
+ var attachId = props.attachId, tid = props.tid, request = props.request, translationParams = props.translationParams, tidChange = props.tidChange;
60
+ var _a = useState(), translationTid = _a[0], setTranslationTid = _a[1];
61
+ var _b = useState(false), loading = _b[0], setLoading = _b[1];
62
+ var res = useQuery({
63
+ queryKey: ['translationTypeList'],
64
+ queryFn: function () {
65
+ return request({
66
+ url: "/api/zmdms-mdm-data/dict-biz/dictionary",
67
+ method: 'GET',
68
+ params: { code: 'zsk_term_library_id' },
69
+ });
70
+ },
71
+ }).data;
72
+ var libraryMap = useMemo(function () {
73
+ var _a;
74
+ return (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) || []).reduce(function (acc, item) {
75
+ acc[item.dictKey] = item.dictValue;
76
+ return acc;
77
+ }, {});
78
+ }, [res]);
79
+ // 翻译状态 当没有tid的时候 是 开始状态 start
80
+ // 有tid的时候 调用接口判断是否 是翻译中 然后下载
81
+ var currentTid = useMemo(function () {
82
+ return translationTid || tid;
83
+ }, [translationTid, tid]);
84
+ var translationStatus = useMemo(function () {
85
+ return currentTid ? 'pending' : 'start';
86
+ }, [currentTid]);
87
+ var _c = usePercent({
88
+ currentTid: currentTid,
89
+ request: request,
90
+ }), percent = _c.percent, isTranslating = _c.isTranslating, startTranslate = _c.startTranslate;
91
+ /**
92
+ * @param translationType 翻译转换规则
93
+ */
94
+ var handleStartTranslation = function (translationType) {
95
+ var translationResultType = {
96
+ from: 'zh',
97
+ to: 'en',
98
+ };
99
+ switch (translationType) {
100
+ case '1':
101
+ translationResultType = {
102
+ from: 'zh',
103
+ to: 'en',
104
+ };
105
+ break;
106
+ case '2':
107
+ translationResultType = {
108
+ from: 'en',
109
+ to: 'zh',
110
+ };
111
+ break;
112
+ }
113
+ setLoading(true);
114
+ // 翻译文件
115
+ request({
116
+ url: "/api/zmdms-resource/fanyi/upload-orgin-files",
117
+ method: 'POST',
118
+ data: __assign(__assign({ attachId: attachId, bilingualControl: 0, termLibraryId: (translationParams === null || translationParams === void 0 ? void 0 : translationParams.termLibraryKey)
119
+ ? libraryMap[translationParams === null || translationParams === void 0 ? void 0 : translationParams.termLibraryKey]
120
+ : libraryMap['DEFAULT'] }, translationParams), translationResultType),
121
+ })
122
+ .then(function (res) {
123
+ if (res.status === 200) {
124
+ unstable_batchedUpdates(function () {
125
+ var _a, _b, _c, _d;
126
+ setLoading(false);
127
+ setTranslationTid((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.tid);
128
+ tidChange === null || tidChange === void 0 ? void 0 : tidChange((_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.tid);
129
+ startTranslate();
130
+ });
131
+ }
132
+ else {
133
+ setLoading(false);
134
+ }
135
+ })
136
+ .catch(function (err) {
137
+ var _a, _b;
138
+ message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || i18next.t('接口调用失败!'));
139
+ setLoading(false);
140
+ });
141
+ };
142
+ var handleDownloadTranslation = function () {
143
+ // 翻译前 先判断下是否翻译完成
144
+ setLoading(true);
145
+ if (currentTid) {
146
+ loopProgress();
147
+ }
148
+ else {
149
+ message.info(i18next.t('没有 找到任务id!'));
150
+ setLoading(false);
151
+ }
152
+ function loopProgress() {
153
+ return __awaiter(this, void 0, void 0, function () {
154
+ var _a, flag, percent_1, title, docType, fileName, err_1;
155
+ return __generator(this, function (_b) {
156
+ switch (_b.label) {
157
+ case 0:
158
+ _b.trys.push([0, 2, , 3]);
159
+ return [4 /*yield*/, getTranslateProgress()];
160
+ case 1:
161
+ _a = _b.sent(), flag = _a.flag, percent_1 = _a.percent, title = _a.title, docType = _a.docType;
162
+ if (flag) {
163
+ setLoading(false);
164
+ fileName = encodeURIComponent(title + '.' + docType);
165
+ window.open(props.previewUrl + "?hideFrame=true&tid=" + currentTid + "&oldId=" + attachId + "&fileName=" + fileName);
166
+ // download(dType);
167
+ }
168
+ else {
169
+ message.warning(i18next.t('当前翻译进度{{percent}}%', { percent: percent_1 }));
170
+ setLoading(false);
171
+ }
172
+ return [3 /*break*/, 3];
173
+ case 2:
174
+ err_1 = _b.sent();
175
+ setLoading(false);
176
+ return [3 /*break*/, 3];
177
+ case 3: return [2 /*return*/];
178
+ }
179
+ });
180
+ });
181
+ }
182
+ function getTranslateProgress() {
183
+ return request === null || request === void 0 ? void 0 : request({
184
+ url: "/api/zmdms-resource/fanyi/query-trans-progress/" + currentTid,
185
+ method: 'GET',
186
+ }).then(function (res) {
187
+ var _a, _b, _c, _d, _e;
188
+ if (res.status === 200) {
189
+ var status_1 = (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.status;
190
+ if (status_1 === 314) {
191
+ return Promise.resolve(__assign({ flag: true }, (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.data));
192
+ }
193
+ }
194
+ return Promise.resolve({
195
+ flag: false,
196
+ percent: Number((_e = (_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.percent),
197
+ });
198
+ }).catch(function (err) {
199
+ var _a, _b;
200
+ message.error(((_b = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || i18next.t('接口调用失败!'));
201
+ return Promise.reject(false);
202
+ });
203
+ }
204
+ };
205
+ var renderTranslationDropdown = function (title) {
206
+ return (React.createElement(Dropdown, { overlay: function () { return (React.createElement(Menu, { onClick: function (e) {
207
+ handleStartTranslation(e.key);
208
+ } }, translationTypeList.map(function (item) { return (React.createElement(Menu.Item, { key: item.dictKey }, item.dictValue)); }))); }, placement: "bottomLeft" },
209
+ React.createElement(Button, { type: "link", loading: loading }, title)));
210
+ };
211
+ switch (translationStatus) {
212
+ case 'start':
213
+ return renderTranslationDropdown(i18next.t('翻译文件'));
214
+ case 'pending':
215
+ return (React.createElement(React.Fragment, null,
216
+ React.createElement(Button, { type: "link", loading: loading, onClick: handleDownloadTranslation, disabled: isTranslating }, i18next.t('查看译文')),
217
+ isTranslating && (React.createElement(Progress, { type: "circle", percent: percent, width: 35 })),
218
+ !isTranslating && renderTranslationDropdown(i18next.t('重译'))));
219
+ // case 'down':
220
+ // return (
221
+ // <Dropdown
222
+ // overlay={() => (
223
+ // <Menu
224
+ // onClick={(e) => {
225
+ // handleDownloadTranslation(e.key);
226
+ // }}
227
+ // >
228
+ // {downloadTypeDict.map((item) => {
229
+ // return (
230
+ // <Menu.Item key={item.dictKey}>{item.dictValue}</Menu.Item>
231
+ // );
232
+ // })}
233
+ // </Menu>
234
+ // )}
235
+ // placement="bottomLeft"
236
+ // >
237
+ // <Button type="link" loading={loading}>
238
+ // 下载
239
+ // </Button>
240
+ // </Dropdown>
241
+ // );
242
+ }
243
+ return React.createElement(React.Fragment, null);
244
+ };
245
+ export default TranslationButton;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const Demo: React.FC;
3
+ export default Demo;