ztxkui 4.2.18-21 → 4.2.18-220
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.
- package/dist/App.js +315 -291
- package/dist/Demo.js +64 -43
- package/dist/DemoCom/BasicDemo.js +57 -56
- package/dist/DemoCom/CodeQueryDemo.js +3 -2
- package/dist/DemoCom/CollapseDemo.js +28 -27
- package/dist/DemoCom/DragSort.js +11 -10
- package/dist/DemoCom/FormDemo.js +36 -30
- package/dist/DemoCom/PrintContainerDemo.js +151 -150
- package/dist/DemoCom/PrintDemo.js +15 -14
- package/dist/DemoCom/SinaturesDemo.js +9 -8
- package/dist/DemoCom/SyhDemo.js +21 -20
- package/dist/DemoCom/TableAnalyse.js +34 -33
- package/dist/DemoCom/TableDemo.js +73 -69
- package/dist/DemoCom/TableDemo1.js +84 -34
- package/dist/DemoCom/TableDetail.d.ts +9 -0
- package/dist/DemoCom/TableDetail.js +259 -0
- package/dist/DemoCom/TestCom.js +22 -19
- package/dist/DemoCom/data.d.ts +110 -0
- package/dist/DemoCom/data.js +2308 -0
- package/dist/TableDemo/BasicTable.js +225 -25
- package/dist/TableDemo/EditableTable.js +146 -72
- package/dist/TableDemo/ModalTable.js +25 -24
- package/dist/TableDemo/ProEditableTable.js +30 -29
- package/dist/TableDemo/data.d.ts +34 -0
- package/dist/TableDemo/data.js +387 -10
- package/dist/TableDemo/index.js +3 -3
- package/dist/TreeDemo.js +8 -7
- package/dist/TreeSelectDemo.js +12 -8
- package/dist/UI/Form/index.d.ts +3 -0
- package/dist/UI/Form/index.js +347 -0
- package/dist/UI/Input/index.d.ts +17 -0
- package/dist/UI/Input/index.js +74 -0
- package/dist/UI/InputNumber/index.d.ts +3 -0
- package/dist/UI/InputNumber/index.js +45 -0
- package/dist/UI/OldForm/index.d.ts +9 -0
- package/dist/UI/OldForm/index.js +302 -0
- package/dist/UI/Select/EmpForQuitDemo.d.ts +15 -0
- package/dist/UI/Select/EmpForQuitDemo.js +120 -0
- package/dist/UI/Select/index.d.ts +10 -0
- package/dist/UI/Select/index.js +207 -0
- package/dist/UI/Table/BusinessListDemo.d.ts +15 -0
- package/dist/UI/Table/BusinessListDemo.js +227 -0
- package/dist/UI/Table/BusinessMemberDemo.d.ts +18 -0
- package/dist/UI/Table/BusinessMemberDemo.js +181 -0
- package/dist/UI/Table/index.d.ts +10 -0
- package/dist/UI/Table/index.js +850 -0
- package/dist/UI/TreeSelect/index.d.ts +3 -0
- package/dist/UI/TreeSelect/index.js +120 -0
- package/dist/UI/index.d.ts +2 -0
- package/dist/UI/index.js +34 -0
- package/dist/UploadDemo.js +27 -23
- package/dist/components/Button/button.d.ts +6 -0
- package/dist/components/Button/button.js +11 -4
- package/dist/components/Collapse/collapse.js +2 -1
- package/dist/components/DatePicker/data-picker.d.ts +3 -1
- package/dist/components/EnhanceSelect/index.d.ts +11 -1
- package/dist/components/EnhanceSelect/index.js +231 -49
- package/dist/components/EnhanceTree/index.js +4 -3
- package/dist/components/EnhanceTreeSelect/index.d.ts +5 -1
- package/dist/components/EnhanceTreeSelect/index.js +57 -7
- package/dist/components/Export/export.js +5 -4
- package/dist/components/Form/form.d.ts +11 -1
- package/dist/components/Form/form.js +5 -3
- package/dist/components/Input/input.d.ts +5 -3
- package/dist/components/Input/input.js +72 -3
- package/dist/components/InputNumber/input-number.js +3 -2
- package/dist/components/Layout/layout.d.ts +4 -4
- package/dist/components/Menu/menu.d.ts +1 -1
- package/dist/components/NumberCase/index.js +9 -7
- package/dist/components/Print/print.js +4 -3
- package/dist/components/PrintContainer/AttachPreviewModal.js +3 -2
- package/dist/components/PrintContainer/PrintModal.js +4 -3
- package/dist/components/PrintContainer/handle.d.ts +2 -4
- package/dist/components/PrintContainer/handle.js +3 -2
- package/dist/components/PrintContainer/lodop.js +2 -1
- package/dist/components/PrintContainer/print-container.js +74 -73
- package/dist/components/PrintContainer/service.js +5 -4
- package/dist/components/ProForm/hooks.d.ts +23 -0
- package/dist/components/ProForm/hooks.js +209 -0
- package/dist/components/ProForm/index.d.ts +9 -0
- package/dist/components/ProForm/index.js +168 -0
- package/dist/components/ProForm/interface.d.ts +200 -0
- package/dist/components/ProForm/interface.js +1 -0
- package/dist/components/ProForm/item.d.ts +13 -0
- package/dist/components/ProForm/item.js +222 -0
- package/dist/components/ProForm/items.d.ts +5 -0
- package/dist/components/ProForm/items.js +36 -0
- package/dist/components/ProForm/record-common-list.d.ts +18 -0
- package/dist/components/ProForm/record-common-list.js +83 -0
- package/dist/components/ProForm/search-drawer.d.ts +14 -0
- package/dist/components/ProForm/search-drawer.js +237 -0
- package/dist/components/ProForm/setting.d.ts +5 -0
- package/dist/components/ProForm/setting.js +12 -0
- package/dist/components/ProForm/useCommonSearch.d.ts +35 -0
- package/dist/components/ProForm/useCommonSearch.js +352 -0
- package/dist/components/ProFormList/index.d.ts +12 -0
- package/dist/components/ProFormList/index.js +34 -0
- package/dist/components/RangePicker/range-picker.js +5 -2
- package/dist/components/SortableCancel/sortable-cancel.d.ts +1 -0
- package/dist/components/SortableCancel/sortable-cancel.js +2 -2
- package/dist/components/Table/components/FillDown.js +2 -1
- package/dist/components/Table/components/FilterDropdown.d.ts +1 -0
- package/dist/components/Table/components/FilterDropdown.js +36 -12
- package/dist/components/Table/hooks/useColumns.d.ts +5 -0
- package/dist/components/Table/hooks/useColumns.js +396 -22
- package/dist/components/Table/hooks/useDropRef.js +2 -1
- package/dist/components/Table/hooks/useScuRfresh.d.ts +3 -0
- package/dist/components/Table/hooks/useScuRfresh.js +22 -0
- package/dist/components/Table/hooks/useSelectSubtotal.js +5 -1
- package/dist/components/Table/hooks/useVituralScrollBar.d.ts +10 -0
- package/dist/components/Table/hooks/useVituralScrollBar.js +234 -0
- package/dist/components/Table/index.d.ts +4 -0
- package/dist/components/Table/table-adddel-column.js +4 -3
- package/dist/components/Table/table-dynamic.d.ts +1 -0
- package/dist/components/Table/table-dynamic.js +447 -60
- package/dist/components/Table/table-enhance-cell.d.ts +3 -0
- package/dist/components/Table/table-enhance-cell.js +28 -8
- package/dist/components/Table/table-menu.d.ts +7 -0
- package/dist/components/Table/table-menu.js +359 -0
- package/dist/components/Table/table-resizable-title.js +1 -0
- package/dist/components/Table/table-sort.js +4 -3
- package/dist/components/Table/table.d.ts +16 -0
- package/dist/components/Table/table.js +241 -65
- package/dist/components/Table/utils/dom.js +2 -1
- package/dist/components/Table/utils/filterHandle.d.ts +1 -1
- package/dist/components/Table/utils/filterHandle.js +27 -12
- package/dist/components/Table/utils/getSummaryData.d.ts +1 -1
- package/dist/components/Table/utils/getSummaryData.js +279 -24
- package/dist/components/Table/utils/shallowEqual.js +2 -1
- package/dist/components/Table/utils/validate.js +25 -6
- package/dist/components/Tabs/tabs.d.ts +2 -0
- package/dist/components/Tabs/tabs.js +3 -1
- package/dist/components/TranslationButton/DownFile.d.ts +7 -0
- package/dist/components/TranslationButton/DownFile.js +95 -0
- package/dist/components/TranslationButton/PreviewFile.d.ts +5 -0
- package/dist/components/TranslationButton/PreviewFile.js +73 -0
- package/dist/components/TranslationButton/TranslationButton.d.ts +34 -0
- package/dist/components/TranslationButton/TranslationButton.js +245 -0
- package/dist/components/TranslationButton/hooks.d.ts +8 -0
- package/dist/components/TranslationButton/hooks.js +139 -0
- package/dist/components/TranslationButton/index.d.ts +4 -0
- package/dist/components/TranslationButton/index.js +4 -0
- package/dist/components/TreeSelect/index.d.ts +19 -0
- package/dist/components/TreeSelect/index.js +88 -0
- package/dist/components/Upload/upload-table.js +31 -26
- package/dist/components/Upload/upload.d.ts +20 -1
- package/dist/components/Upload/upload.js +172 -27
- package/dist/components/Upload/utils.d.ts +9 -2
- package/dist/components/Upload/utils.js +153 -38
- package/dist/components/UploadCustom/hooks/useDg.d.ts +6 -0
- package/dist/components/UploadCustom/hooks/useDg.js +55 -0
- package/dist/components/UploadSingle/upload-single.js +5 -4
- package/dist/components/Watermark/index.d.ts +2 -0
- package/dist/components/Watermark/index.js +2 -0
- package/dist/components/Watermark/interface.d.ts +20 -0
- package/dist/components/Watermark/interface.js +1 -0
- package/dist/components/Watermark/utils.d.ts +1 -0
- package/dist/components/Watermark/utils.js +70 -0
- package/dist/components/Watermark/water.d.ts +50 -0
- package/dist/components/Watermark/water.js +66 -0
- package/dist/components/Watermark/watermark-div.d.ts +4 -0
- package/dist/components/Watermark/watermark-div.js +41 -0
- package/dist/components/Watermark/watermark-shadow.d.ts +6 -0
- package/dist/components/Watermark/watermark-shadow.js +116 -0
- package/dist/components/Watermark/watermark.d.ts +3 -0
- package/dist/components/Watermark/watermark.js +102 -0
- package/dist/components/WorkflowPrintContainer/component/Gragh/Gragh.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/Gragh/Gragh.js +63 -0
- package/dist/components/WorkflowPrintContainer/component/Header.d.ts +12 -0
- package/dist/components/WorkflowPrintContainer/component/Header.js +109 -0
- package/dist/components/WorkflowPrintContainer/component/ProcessDetail.d.ts +18 -0
- package/dist/components/WorkflowPrintContainer/component/ProcessDetail.js +243 -0
- package/dist/components/WorkflowPrintContainer/component/Upload/index.d.ts +20 -0
- package/dist/components/WorkflowPrintContainer/component/Upload/index.js +59 -0
- package/dist/components/WorkflowPrintContainer/component/association/component/TableList.d.ts +10 -0
- package/dist/components/WorkflowPrintContainer/component/association/component/TableList.js +75 -0
- package/dist/components/WorkflowPrintContainer/component/association/index.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/association/index.js +92 -0
- package/dist/components/WorkflowPrintContainer/component/attention/component/TableList.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/attention/component/TableList.js +38 -0
- package/dist/components/WorkflowPrintContainer/component/attention/index.d.ts +10 -0
- package/dist/components/WorkflowPrintContainer/component/attention/index.js +95 -0
- package/dist/components/WorkflowPrintContainer/component/audit/component/TableList.d.ts +8 -0
- package/dist/components/WorkflowPrintContainer/component/audit/component/TableList.js +53 -0
- package/dist/components/WorkflowPrintContainer/component/audit/index.d.ts +7 -0
- package/dist/components/WorkflowPrintContainer/component/audit/index.js +88 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/component/TableList.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/component/TableList.js +53 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/index.d.ts +11 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/index.js +60 -0
- package/dist/components/WorkflowPrintContainer/component/send/component/TableList.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/send/component/TableList.js +50 -0
- package/dist/components/WorkflowPrintContainer/component/send/index.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/send/index.js +92 -0
- package/dist/components/WorkflowPrintContainer/component/trail/component/TableList.d.ts +12 -0
- package/dist/components/WorkflowPrintContainer/component/trail/component/TableList.js +282 -0
- package/dist/components/WorkflowPrintContainer/component/trail/index.d.ts +11 -0
- package/dist/components/WorkflowPrintContainer/component/trail/index.js +56 -0
- package/dist/components/WorkflowPrintContainer/images.d.ts +2 -0
- package/dist/components/WorkflowPrintContainer/images.js +2 -0
- package/dist/components/WorkflowPrintContainer/index.d.ts +2 -0
- package/dist/components/WorkflowPrintContainer/index.js +2 -0
- package/dist/components/WorkflowPrintContainer/service.d.ts +14 -0
- package/dist/components/WorkflowPrintContainer/service.js +101 -0
- package/dist/components/WorkflowPrintContainer/usePagination.d.ts +14 -0
- package/dist/components/WorkflowPrintContainer/usePagination.js +22 -0
- package/dist/components/WorkflowPrintContainer/workflow-print-container.d.ts +100 -0
- package/dist/components/WorkflowPrintContainer/workflow-print-container.js +236 -0
- package/dist/components/ZtIcon/index.js +2 -0
- package/dist/components/business/Analyse/index.js +12 -11
- package/dist/components/business/CodeQuery/component/SearchForm.js +3 -2
- package/dist/components/business/CodeQuery/component/TableList.js +5 -4
- package/dist/components/business/CodeQuery/hooks.js +2 -1
- package/dist/components/business/CodeQuery/index.js +2 -1
- package/dist/components/business/Common/UserForgetPassword/index.js +36 -28
- package/dist/components/business/Common/UserInfo/component/MakingForm.js +11 -10
- package/dist/components/business/Common/UserInfo/index.js +5 -4
- package/dist/components/business/Common/UserPassword/index.js +14 -11
- package/dist/components/business/Common/validatePassword.d.ts +1 -1
- package/dist/components/business/Common/validatePassword.js +17 -7
- package/dist/components/business/DetailCard/index.js +7 -6
- package/dist/components/business/DetailHeader/index.js +7 -6
- package/dist/components/business/DetailList/index.js +5 -4
- package/dist/components/business/DgColumns/index.js +12 -11
- package/dist/components/business/ExportButton/index.js +6 -5
- package/dist/components/business/Footer/index.js +4 -1
- package/dist/components/business/GridList/item.d.ts +1 -1
- package/dist/components/business/List/item.d.ts +1 -1
- package/dist/components/business/NewList/item.d.ts +1 -1
- package/dist/components/business/NewList/item.js +1 -1
- package/dist/components/business/OperationBtnGroup/index.js +17 -16
- package/dist/components/business/SearchContainer/hooks/useDynamic.d.ts +2 -1
- package/dist/components/business/SearchContainer/hooks/useDynamic.js +6 -3
- package/dist/components/business/SearchContainer/hooks/useToggle.d.ts +1 -1
- package/dist/components/business/SearchContainer/hooks/useToggle.js +31 -12
- package/dist/components/business/SearchContainer/record-common-item.d.ts +14 -0
- package/dist/components/business/SearchContainer/record-common-item.js +83 -0
- package/dist/components/business/SearchContainer/record-common-list.d.ts +3 -0
- package/dist/components/business/SearchContainer/record-common-list.js +95 -0
- package/dist/components/business/SearchContainer/search-container.d.ts +22 -0
- package/dist/components/business/SearchContainer/search-container.js +66 -3
- package/dist/components/business/SearchContainer/search-drawer.d.ts +1 -0
- package/dist/components/business/SearchContainer/search-drawer.js +167 -13
- package/dist/components/business/SearchContainer/search-item.js +48 -5
- package/dist/components/business/SearchContainer/search-left.d.ts +8 -0
- package/dist/components/business/SearchContainer/search-left.js +105 -68
- package/dist/components/business/SearchContainer/search-right.d.ts +4 -0
- package/dist/components/business/SearchContainer/search-right.js +62 -5
- package/dist/components/business/SearchContainer/useRecordCommonInit.d.ts +18 -0
- package/dist/components/business/SearchContainer/useRecordCommonInit.js +258 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearch.d.ts +8 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearch.js +145 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearchContext.d.ts +37 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearchContext.js +8 -0
- package/dist/components/business/SearchContainer/useTemplate.d.ts +20 -0
- package/dist/components/business/SearchContainer/useTemplate.js +347 -0
- package/dist/components/business/Signatures/components/AttachOperation.js +7 -6
- package/dist/components/business/Signatures/components/CodeModal.d.ts +3 -0
- package/dist/components/business/Signatures/components/CodeModal.js +157 -0
- package/dist/components/business/Signatures/components/CompareResult.js +7 -6
- package/dist/components/business/Signatures/components/DetailTable.js +37 -34
- package/dist/components/business/Signatures/components/QunjSeal.js +5 -4
- package/dist/components/business/Signatures/components/SealCheckbox.js +3 -2
- package/dist/components/business/Signatures/components/TemplateAttach.js +2 -1
- package/dist/components/business/Signatures/index.js +64 -53
- package/dist/components/business/SortList/sort-drawer.js +5 -4
- package/dist/components/business/Template/index.js +11 -10
- package/dist/components/electron-signatures/content.d.ts +9 -0
- package/dist/components/electron-signatures/content.js +1146 -0
- package/dist/components/electron-signatures/demoComponents/coUseDetail.d.ts +8 -0
- package/dist/components/electron-signatures/demoComponents/coUseDetail.js +255 -0
- package/dist/components/electron-signatures/demoComponents/data.d.ts +58 -0
- package/dist/components/electron-signatures/demoComponents/data.js +1307 -0
- package/dist/components/electron-signatures/demoComponents/detail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/detail.js +283 -0
- package/dist/components/electron-signatures/demoComponents/index.d.ts +2 -0
- package/dist/components/electron-signatures/demoComponents/index.js +30 -0
- package/dist/components/electron-signatures/demoComponents/jgqrd.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/jgqrd.js +135 -0
- package/dist/components/electron-signatures/demoComponents/making.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/making.js +211 -0
- package/dist/components/electron-signatures/demoComponents/makingData.d.ts +675 -0
- package/dist/components/electron-signatures/demoComponents/makingData.js +1178 -0
- package/dist/components/electron-signatures/demoComponents/newDetail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/newDetail.js +283 -0
- package/dist/components/electron-signatures/demoComponents/preview.d.ts +3 -0
- package/dist/components/electron-signatures/demoComponents/preview.js +9 -0
- package/dist/components/electron-signatures/demoComponents/singleQjDetail.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/singleQjDetail.js +530 -0
- package/dist/components/electron-signatures/demoComponents/singleQjMaking.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/singleQjMaking.js +219 -0
- package/dist/components/electron-signatures/demoComponents/test.d.ts +6 -0
- package/dist/components/electron-signatures/demoComponents/test.js +119 -0
- package/dist/components/electron-signatures/dgComponents/contract-comparison.d.ts +39 -0
- package/dist/components/electron-signatures/dgComponents/contract-comparison.js +53 -0
- package/dist/components/electron-signatures/dgComponents/file-comparison-btn.d.ts +11 -0
- package/dist/components/electron-signatures/dgComponents/file-comparison-btn.js +180 -0
- package/dist/components/electron-signatures/dgComponents/new-contract-comparison.d.ts +45 -0
- package/dist/components/electron-signatures/dgComponents/new-contract-comparison.js +68 -0
- package/dist/components/electron-signatures/dgComponents/useContractColumns.d.ts +21 -0
- package/dist/components/electron-signatures/dgComponents/useContractColumns.js +171 -0
- package/dist/components/electron-signatures/electron-signatures-fragment.d.ts +8 -0
- package/dist/components/electron-signatures/electron-signatures-fragment.js +392 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.d.ts +52 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-batch-download.js +509 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-detail.d.ts +8 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-detail.js +59 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-download.d.ts +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-download.js +85 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.d.ts +9 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-firstLevelPerson.js +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.d.ts +15 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item-detail.js +16 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item.d.ts +20 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-item.js +47 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-list.d.ts +11 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-list.js +191 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-personal-sign.d.ts +35 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-personal-sign.js +39 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-setting.d.ts +15 -0
- package/dist/components/electron-signatures/electronComponents/electron-seal-setting.js +10 -0
- package/dist/components/electron-signatures/electronComponents/last-qys-modal.d.ts +7 -0
- package/dist/components/electron-signatures/electronComponents/last-qys-modal.js +42 -0
- package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.d.ts +3 -0
- package/dist/components/electron-signatures/electronComponents/useCheckedSealInfoList.js +43 -0
- package/dist/components/electron-signatures/electronComponents/useElectronColumns.d.ts +30 -0
- package/dist/components/electron-signatures/electronComponents/useElectronColumns.js +398 -0
- package/dist/components/electron-signatures/electronComponents/useFetchElectronData.d.ts +24 -0
- package/dist/components/electron-signatures/electronComponents/useFetchElectronData.js +254 -0
- package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.d.ts +3 -0
- package/dist/components/electron-signatures/electronComponents/useGetDeptInfo.js +35 -0
- package/dist/components/electron-signatures/fileComponents/file-operation.d.ts +7 -0
- package/dist/components/electron-signatures/fileComponents/file-operation.js +67 -0
- package/dist/components/electron-signatures/fileComponents/file-type-select.d.ts +12 -0
- package/dist/components/electron-signatures/fileComponents/file-type-select.js +10 -0
- package/dist/components/electron-signatures/fileComponents/file-upload.d.ts +11 -0
- package/dist/components/electron-signatures/fileComponents/file-upload.js +146 -0
- package/dist/components/electron-signatures/fileComponents/fileUtils.d.ts +17 -0
- package/dist/components/electron-signatures/fileComponents/fileUtils.js +36 -0
- package/dist/components/electron-signatures/fileComponents/new-file-operation.d.ts +10 -0
- package/dist/components/electron-signatures/fileComponents/new-file-operation.js +73 -0
- package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.d.ts +13 -0
- package/dist/components/electron-signatures/fileComponents/useFetchFileTypeData.js +43 -0
- package/dist/components/electron-signatures/fileComponents/useFileColumns.d.ts +38 -0
- package/dist/components/electron-signatures/fileComponents/useFileColumns.js +329 -0
- package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.d.ts +19 -0
- package/dist/components/electron-signatures/fileComponents/useFileTypeColumns.js +72 -0
- package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.d.ts +30 -0
- package/dist/components/electron-signatures/hooks/useGetQjVerifyCode.js +132 -0
- package/dist/components/electron-signatures/hooks/useMergeRecords.d.ts +17 -0
- package/dist/components/electron-signatures/hooks/useMergeRecords.js +49 -0
- package/dist/components/electron-signatures/hooks/useParseElectronListData.d.ts +49 -0
- package/dist/components/electron-signatures/hooks/useParseElectronListData.js +111 -0
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.d.ts +111 -0
- package/dist/components/electron-signatures/hooks/useParseElectronSetting.js +436 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.d.ts +40 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedElectronData.js +139 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.d.ts +36 -0
- package/dist/components/electron-signatures/hooks/useParseIsNeedQunjData.js +48 -0
- package/dist/components/electron-signatures/hooks/useParseQunjListData.d.ts +56 -0
- package/dist/components/electron-signatures/hooks/useParseQunjListData.js +204 -0
- package/dist/components/electron-signatures/hooks/useParseQunjSingleData.d.ts +34 -0
- package/dist/components/electron-signatures/hooks/useParseQunjSingleData.js +110 -0
- package/dist/components/electron-signatures/hooks/useParseRecords.d.ts +65 -0
- package/dist/components/electron-signatures/hooks/useParseRecords.js +165 -0
- package/dist/components/electron-signatures/index.d.ts +15 -0
- package/dist/components/electron-signatures/index.js +63 -0
- package/dist/components/electron-signatures/interface.d.ts +865 -0
- package/dist/components/electron-signatures/interface.js +57 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-apply.d.ts +6 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-apply.js +8 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-check.d.ts +21 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-check.js +41 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-detail.d.ts +35 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-detail.js +267 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-list.d.ts +24 -0
- package/dist/components/electron-signatures/qunjComponents/qunj-list.js +355 -0
- package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.d.ts +20 -0
- package/dist/components/electron-signatures/qunjComponents/useFetchQunjData.js +66 -0
- package/dist/components/electron-signatures/qunjComponents/useQunjColumns.d.ts +36 -0
- package/dist/components/electron-signatures/qunjComponents/useQunjColumns.js +321 -0
- package/dist/components/electron-signatures/translateComponents/TranslateButton.d.ts +10 -0
- package/dist/components/electron-signatures/translateComponents/TranslateButton.js +44 -0
- package/dist/components/electron-signatures/translateComponents/useTranslateCom.d.ts +22 -0
- package/dist/components/electron-signatures/translateComponents/useTranslateCom.js +50 -0
- package/dist/components/electron-signatures/utils.d.ts +26 -0
- package/dist/components/electron-signatures/utils.js +67 -0
- package/dist/components/utils/MyStorage.d.ts +36 -0
- package/dist/components/utils/MyStorage.js +120 -0
- package/dist/components/utils/ZtxkContext.d.ts +67 -0
- package/dist/components/utils/ZtxkContext.js +20 -0
- package/dist/components/utils/checkSealCoUse.d.ts +16 -0
- package/dist/components/utils/checkSealCoUse.js +83 -0
- package/dist/components/utils/fetch.d.ts +10 -0
- package/dist/components/utils/fetch.js +119 -0
- package/dist/components/utils/index.d.ts +9 -0
- package/dist/components/utils/index.js +11 -0
- package/dist/components/utils/processNumber.d.ts +12 -0
- package/dist/components/utils/processNumber.js +106 -0
- package/dist/components/utils/upload.js +6 -3
- package/dist/components/utils/useBaseContext.d.ts +23 -0
- package/dist/components/utils/useBaseContext.js +31 -0
- package/dist/components/utils/useMemoizedFn.d.ts +4 -0
- package/dist/components/utils/useMemoizedFn.js +19 -0
- package/dist/components/utils/usePrevious.d.ts +3 -0
- package/dist/components/utils/usePrevious.js +13 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.css +2205 -58
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +255 -86
- package/dist/locales/en-US.json +828 -0
- package/dist/locales/zh-CN.json +828 -0
- package/dist/request.js +7 -6
- package/package.json +13 -4
|
@@ -56,6 +56,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
};
|
|
59
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
59
60
|
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
|
60
61
|
import { Upload as AntUpload } from 'antd';
|
|
61
62
|
import { UploadOutlined } from '@ant-design/icons';
|
|
@@ -66,6 +67,7 @@ import { downloadFileCallBack, downloadPublicFile, previewFile, createThumbnailU
|
|
|
66
67
|
import { transformFileSize } from 'ztxkutils/dist/tools';
|
|
67
68
|
import { MAX_PREVIEW_FILE_SIZE } from '../utils/constants';
|
|
68
69
|
import { fileBatchDownload, preCanDownload, nextDownload, } from './utils';
|
|
70
|
+
import ImgCrop from 'antd-img-crop';
|
|
69
71
|
var _accept = [
|
|
70
72
|
'.pdf',
|
|
71
73
|
'.txt',
|
|
@@ -113,10 +115,37 @@ export function getFileSize(item) {
|
|
|
113
115
|
}
|
|
114
116
|
return null;
|
|
115
117
|
}
|
|
118
|
+
// 获取图片尺寸的辅助函数
|
|
119
|
+
var getImageDimensions = function (file) {
|
|
120
|
+
return new Promise(function (resolve, reject) {
|
|
121
|
+
// 检查是否是图片类型
|
|
122
|
+
if (!file.type.startsWith('image/')) {
|
|
123
|
+
resolve({ width: 0, height: 0 });
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
var img = new Image();
|
|
127
|
+
var url = URL.createObjectURL(file);
|
|
128
|
+
img.onload = function () {
|
|
129
|
+
URL.revokeObjectURL(url);
|
|
130
|
+
resolve({ width: img.width, height: img.height });
|
|
131
|
+
};
|
|
132
|
+
img.onerror = function () {
|
|
133
|
+
URL.revokeObjectURL(url);
|
|
134
|
+
reject(new Error('Failed to load image'));
|
|
135
|
+
};
|
|
136
|
+
img.src = url;
|
|
137
|
+
});
|
|
138
|
+
};
|
|
116
139
|
var Upload = function (props) {
|
|
117
|
-
var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, rowSelection = props.rowSelection, uploadTableRef = props.uploadTableRef, tableRestProps = props.tableRestProps, showAllDeleteBtn = props.showAllDeleteBtn, showAllDownloadBtn = props.showAllDownloadBtn, allDeleteCallback = props.allDeleteCallback, allDownloadCallback = props.allDownloadCallback, batchDownloadZipName = props.batchDownloadZipName, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload", "rowSelection", "uploadTableRef", "tableRestProps", "showAllDeleteBtn", "showAllDownloadBtn", "allDeleteCallback", "allDownloadCallback", "batchDownloadZipName"]);
|
|
140
|
+
var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, minSize = props.minSize, minSizeStr = props.minSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, rowSelection = props.rowSelection, uploadTableRef = props.uploadTableRef, tableRestProps = props.tableRestProps, showAllDeleteBtn = props.showAllDeleteBtn, showAllDownloadBtn = props.showAllDownloadBtn, allDeleteCallback = props.allDeleteCallback, allDownloadCallback = props.allDownloadCallback, batchDownloadZipName = props.batchDownloadZipName, maxResolution = props.maxResolution, minResolution = props.minResolution, isCrop = props.isCrop, cropProps = props.cropProps, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "minSize", "minSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload", "rowSelection", "uploadTableRef", "tableRestProps", "showAllDeleteBtn", "showAllDownloadBtn", "allDeleteCallback", "allDownloadCallback", "batchDownloadZipName", "maxResolution", "minResolution", "isCrop", "cropProps"]);
|
|
118
141
|
var _j = useState(originFileList || []), fileList = _j[0], setFileList = _j[1];
|
|
119
142
|
var _k = useState('20M'), maxSizeTransStr = _k[0], setMaxSizeTransStr = _k[1];
|
|
143
|
+
var ACCEPT = ztAccept ? ztAccept : _accept;
|
|
144
|
+
// 记录当前上传图片的分辨率
|
|
145
|
+
var currentResolutionRef = useRef({
|
|
146
|
+
width: 0,
|
|
147
|
+
height: 0,
|
|
148
|
+
});
|
|
120
149
|
useEffect(function () {
|
|
121
150
|
if (upload) {
|
|
122
151
|
upload.current = upload.current ? upload.current : {};
|
|
@@ -137,7 +166,7 @@ var Upload = function (props) {
|
|
|
137
166
|
return [4 /*yield*/, Promise.reject({
|
|
138
167
|
errorFields: [
|
|
139
168
|
{
|
|
140
|
-
errors: (info.title || ''
|
|
169
|
+
errors: i18next.t('{{slot0}} 第{{slot1}}个附件还在上传中,请稍等...', { slot0: info.title || '', slot1: i + 1 }),
|
|
141
170
|
},
|
|
142
171
|
],
|
|
143
172
|
})];
|
|
@@ -149,7 +178,7 @@ var Upload = function (props) {
|
|
|
149
178
|
return [4 /*yield*/, Promise.reject({
|
|
150
179
|
errorFields: [
|
|
151
180
|
{
|
|
152
|
-
errors: (info.title || ''
|
|
181
|
+
errors: i18next.t('{{slot0}} 第{{slot1}}个附件上传失败,请检查', { slot0: info.title || '', slot1: i + 1 }),
|
|
153
182
|
},
|
|
154
183
|
],
|
|
155
184
|
})];
|
|
@@ -170,7 +199,7 @@ var Upload = function (props) {
|
|
|
170
199
|
var MAXSIZE = maxSize ? maxSize : 1024 * 1024 * 100;
|
|
171
200
|
var MAXSIZESTR = maxSizeStr ? maxSizeStr : transformFileSize(MAXSIZE);
|
|
172
201
|
setMaxSizeTransStr(MAXSIZESTR);
|
|
173
|
-
}, [maxSize, maxSizeStr]);
|
|
202
|
+
}, [maxSize, maxSizeStr, minSize, minSizeStr]);
|
|
174
203
|
useEffect(function () {
|
|
175
204
|
// 拉平数据
|
|
176
205
|
if (Array.isArray(originFileList)) {
|
|
@@ -242,33 +271,130 @@ var Upload = function (props) {
|
|
|
242
271
|
var len = fileName.length;
|
|
243
272
|
return fileName.substring(index, len).toLowerCase() || '-';
|
|
244
273
|
};
|
|
274
|
+
// 文件分辨率
|
|
275
|
+
var fileResolution = function (file, needMessage) { return __awaiter(void 0, void 0, void 0, function () {
|
|
276
|
+
return __generator(this, function (_a) {
|
|
277
|
+
return [2 /*return*/, getImageDimensions(file)
|
|
278
|
+
.then(function (dimensions) {
|
|
279
|
+
currentResolutionRef.current = dimensions;
|
|
280
|
+
// 在这里可以访问 dimensions.width 和 dimensions.height
|
|
281
|
+
// 可以根据需要进行验证或其他操作
|
|
282
|
+
if (maxResolution &&
|
|
283
|
+
(dimensions.width > maxResolution.width ||
|
|
284
|
+
dimensions.height > maxResolution.height)) {
|
|
285
|
+
if (needMessage) {
|
|
286
|
+
if (isCrop) {
|
|
287
|
+
message.warning(i18next.t('裁剪后的图片分辨率宽*高:{{currentResolution}},超出最大值{{maxResolution}}!', {
|
|
288
|
+
maxResolution: maxResolution.width + 'x' + maxResolution.height,
|
|
289
|
+
currentResolution: dimensions.width + 'x' + dimensions.height,
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
message.warning(i18next.t('图片分辨率超出最大值宽*高 {{maxResolution}}!当前图片分辨率:{{currentResolution}}', {
|
|
294
|
+
maxResolution: maxResolution.width + 'x' + maxResolution.height,
|
|
295
|
+
currentResolution: dimensions.width + 'x' + dimensions.height,
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return AntUpload.LIST_IGNORE;
|
|
300
|
+
}
|
|
301
|
+
if (minResolution &&
|
|
302
|
+
(dimensions.width < minResolution.width ||
|
|
303
|
+
dimensions.height < minResolution.height)) {
|
|
304
|
+
if (needMessage) {
|
|
305
|
+
if (isCrop) {
|
|
306
|
+
message.warning(i18next.t('裁剪后的图片分辨率宽*高:{{currentResolution}},低于最小值{{minResolution}}!', {
|
|
307
|
+
minResolution: minResolution.width + 'x' + minResolution.height,
|
|
308
|
+
currentResolution: dimensions.width + 'x' + dimensions.height,
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
message.warning(i18next.t('图片分辨率低于最小值宽*高 {{minResolution}}!当前图片分辨率:{{currentResolution}}', {
|
|
313
|
+
minResolution: minResolution.width + 'x' + minResolution.height,
|
|
314
|
+
currentResolution: dimensions.width + 'x' + dimensions.height,
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return AntUpload.LIST_IGNORE;
|
|
319
|
+
}
|
|
320
|
+
console.log('图片分辨率:', dimensions);
|
|
321
|
+
return true;
|
|
322
|
+
})
|
|
323
|
+
.catch(function () {
|
|
324
|
+
// 获取尺寸失败也允许上传
|
|
325
|
+
return true;
|
|
326
|
+
})];
|
|
327
|
+
});
|
|
328
|
+
}); };
|
|
245
329
|
/**上传文件之前的钩子 */
|
|
246
330
|
var beforeFileUpload = function (file, fileList) {
|
|
247
331
|
var fileName = file.name, fileSize = file.size;
|
|
248
332
|
var fileNameSuffix = getFileSuffix(fileName);
|
|
249
|
-
var ACCEPT = _accept;
|
|
250
333
|
var MAXSIZE = maxSize ? maxSize : 1024 * 1024 * 100;
|
|
251
334
|
var MAXSIZESTR = maxSizeStr ? maxSizeStr : transformFileSize(MAXSIZE);
|
|
252
335
|
setMaxSizeTransStr(MAXSIZESTR);
|
|
336
|
+
var MINSIZE = minSize ? minSize : null;
|
|
337
|
+
var MINSIZSTR = minSizeStr
|
|
338
|
+
? minSizeStr
|
|
339
|
+
: MINSIZE
|
|
340
|
+
? transformFileSize(MINSIZE)
|
|
341
|
+
: '';
|
|
253
342
|
if (!ACCEPT.includes(fileNameSuffix)) {
|
|
254
|
-
message.warning(
|
|
343
|
+
message.warning(i18next.t('不支持 {{fileNameSuffix}} 文件格式!', {
|
|
344
|
+
fileNameSuffix: fileNameSuffix,
|
|
345
|
+
}));
|
|
255
346
|
return AntUpload.LIST_IGNORE;
|
|
256
347
|
}
|
|
257
348
|
if (fileSize === 0) {
|
|
258
|
-
message.warning(
|
|
349
|
+
message.warning(i18next.t('不能上传空文件!', {}));
|
|
259
350
|
return AntUpload.LIST_IGNORE;
|
|
260
351
|
}
|
|
261
352
|
if (fileSize > MAXSIZE) {
|
|
262
|
-
|
|
353
|
+
if (isCrop) {
|
|
354
|
+
message.warning(i18next.t('裁剪后的图片大小:{{fileSizeStr}},超出最大值{{MAXSIZESTR}}!', {
|
|
355
|
+
MAXSIZESTR: MAXSIZESTR,
|
|
356
|
+
fileSizeStr: transformFileSize(fileSize),
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
message.warning(i18next.t('文件超出 {{MAXSIZESTR}}!当前文件大小:{{fileSizeStr}}', {
|
|
361
|
+
MAXSIZESTR: MAXSIZESTR,
|
|
362
|
+
fileSizeStr: transformFileSize(fileSize),
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
263
365
|
return AntUpload.LIST_IGNORE;
|
|
264
366
|
}
|
|
367
|
+
if (MINSIZE && fileSize < MINSIZE) {
|
|
368
|
+
if (isCrop) {
|
|
369
|
+
message.warning(i18next.t('裁剪后的图片大小:{{fileSizeStr}},低于最小值{{MINSIZSTR}}!', {
|
|
370
|
+
MINSIZSTR: MINSIZSTR,
|
|
371
|
+
fileSizeStr: transformFileSize(fileSize),
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
message.warning(i18next.t('文件小于 {{MINSIZSTR}}!当前文件大小:{{fileSizeStr}}', {
|
|
376
|
+
MINSIZSTR: MINSIZSTR,
|
|
377
|
+
fileSizeStr: transformFileSize(fileSize),
|
|
378
|
+
}));
|
|
379
|
+
}
|
|
380
|
+
return AntUpload.LIST_IGNORE;
|
|
381
|
+
}
|
|
382
|
+
// 如果是图片,获取文件分辨率
|
|
383
|
+
if (listType === 'picture-card' &&
|
|
384
|
+
file.type.startsWith('image/') &&
|
|
385
|
+
(maxResolution || minResolution)) {
|
|
386
|
+
return fileResolution(file, true);
|
|
387
|
+
}
|
|
265
388
|
return Promise.resolve(file);
|
|
266
389
|
};
|
|
267
390
|
/**上传文件改变时的状态 */
|
|
268
391
|
var onFileChange = function (info) {
|
|
269
|
-
var fileList = info.fileList;
|
|
392
|
+
var file = info.file, fileList = info.fileList;
|
|
270
393
|
setFileList(fileList);
|
|
271
|
-
callback &&
|
|
394
|
+
callback &&
|
|
395
|
+
callback(fileList, {
|
|
396
|
+
currentResolution: currentResolutionRef.current,
|
|
397
|
+
});
|
|
272
398
|
};
|
|
273
399
|
/**文件删除 */
|
|
274
400
|
var onDeleteHandle = function (index, file) {
|
|
@@ -326,7 +452,7 @@ var Upload = function (props) {
|
|
|
326
452
|
console.log(file);
|
|
327
453
|
var _a = file.response.data, attachId = _a.attachId, attachName = _a.attachName, size = file.size;
|
|
328
454
|
if (size >= MAX_PREVIEW_FILE_SIZE) {
|
|
329
|
-
message.warning('文件大于20MB,暂不支持在线预览,请先下载后查看!');
|
|
455
|
+
message.warning(i18next.t('文件大于20MB,暂不支持在线预览,请先下载后查看!'));
|
|
330
456
|
}
|
|
331
457
|
else {
|
|
332
458
|
previewFile(fileBaseUrl, attachId, {
|
|
@@ -355,7 +481,7 @@ var Upload = function (props) {
|
|
|
355
481
|
allDeleteCallback && allDeleteCallback(list);
|
|
356
482
|
}
|
|
357
483
|
else {
|
|
358
|
-
message.info('请选择需要删除得附件!');
|
|
484
|
+
message.info(i18next.t('请选择需要删除得附件!'));
|
|
359
485
|
}
|
|
360
486
|
}, [fileList, callback, allDeleteCallback]);
|
|
361
487
|
/** 批量下载 */
|
|
@@ -407,7 +533,7 @@ var Upload = function (props) {
|
|
|
407
533
|
}
|
|
408
534
|
}
|
|
409
535
|
else {
|
|
410
|
-
message.info('请选择需要下载的附件!');
|
|
536
|
+
message.info(i18next.t('请选择需要下载的附件!'));
|
|
411
537
|
}
|
|
412
538
|
}, [
|
|
413
539
|
allDownloadCallback,
|
|
@@ -430,26 +556,45 @@ var Upload = function (props) {
|
|
|
430
556
|
onAllDownloadHandle(false);
|
|
431
557
|
}
|
|
432
558
|
} },
|
|
433
|
-
React.createElement(Menu.Item, { key: "compress" },
|
|
434
|
-
React.createElement(Menu.Item, { key: "no-compress" },
|
|
435
|
-
React.createElement(Button, { type: "primary", style: { marginRight: '10px' } },
|
|
559
|
+
React.createElement(Menu.Item, { key: "compress" }, i18next.t('压缩')),
|
|
560
|
+
React.createElement(Menu.Item, { key: "no-compress" }, i18next.t('不压缩')))); }, placement: "bottomLeft" },
|
|
561
|
+
React.createElement(Button, { type: "primary", style: { marginRight: '10px' } }, i18next.t('批量下载')))); };
|
|
562
|
+
var renderUpload = (React.createElement(AntUpload, __assign({ className: classes, beforeUpload: beforeUpload ? beforeUpload : beforeFileUpload, onChange: onChange ? onChange : onFileChange, showUploadList: showUploadList ? showUploadList : false, fileList: fileList, multiple: typeof multiple === 'boolean' ? multiple : maxCount === 1 ? false : true, action: fileAction, headers: headers, data: data, method: method, onDownload: onFileDownload, onPreview: onFilePreview, onRemove: onFileRemove, openFileDialogOnClick: maxCount !== fileList.length || isDirect, maxCount: maxCount, listType: listType, accept: ACCEPT === null || ACCEPT === void 0 ? void 0 : ACCEPT.join(',') }, restProps), children ? (children) : !listType || listType === 'text' ? (React.createElement(Button, { type: "primary", disabled: maxCount === fileList.length || restProps.disabled },
|
|
563
|
+
React.createElement(UploadOutlined, null),
|
|
564
|
+
fileBtnText || i18next.t('添加附件'),
|
|
565
|
+
maxCount === fileList.length &&
|
|
566
|
+
i18next.t('(最多上传{{maxCount}}个文件)', {
|
|
567
|
+
maxCount: maxCount,
|
|
568
|
+
}))) : maxCount && fileList.length >= maxCount && !isDirect ? null : (React.createElement("div", null,
|
|
569
|
+
React.createElement(UploadOutlined, { style: { fontSize: 18 } }),
|
|
570
|
+
React.createElement("div", { style: { marginTop: 8 } }, fileBtnText || i18next.t('添加图片'))))));
|
|
571
|
+
/**裁剪模式下,选择图片时只校验文件类型,裁剪完成后再校验大小和分辨率 */
|
|
572
|
+
var beforeCropUpload = function (file, _fileList) {
|
|
573
|
+
var fileName = file.name, fileSize = file.size;
|
|
574
|
+
var fileNameSuffix = getFileSuffix(fileName);
|
|
575
|
+
if (!ACCEPT.includes(fileNameSuffix)) {
|
|
576
|
+
message.warning(i18next.t('不支持 {{fileNameSuffix}} 文件格式!', {
|
|
577
|
+
fileNameSuffix: fileNameSuffix,
|
|
578
|
+
}));
|
|
579
|
+
return AntUpload.LIST_IGNORE;
|
|
580
|
+
}
|
|
581
|
+
if (fileSize === 0) {
|
|
582
|
+
message.warning(i18next.t('不能上传空文件!', {}));
|
|
583
|
+
return AntUpload.LIST_IGNORE;
|
|
584
|
+
}
|
|
585
|
+
return true;
|
|
586
|
+
};
|
|
436
587
|
return (React.createElement(React.Fragment, null,
|
|
437
|
-
showAllDeleteloadBtnInner && !showUploadBtn && (React.createElement(Button, { type: "primary", style: { marginRight: '10px' }, onClick: onAllDeleteHandle },
|
|
588
|
+
showAllDeleteloadBtnInner && !showUploadBtn && (React.createElement(Button, { type: "primary", style: { marginRight: '10px' }, onClick: onAllDeleteHandle }, i18next.t('批量删除'))),
|
|
438
589
|
showAllDownloadBtnInner && !showUploadBtn && createDownloadBtn(),
|
|
439
590
|
showUploadBtn && (React.createElement("div", { className: "zt-upload" },
|
|
440
|
-
showAllDeleteloadBtnInner && (React.createElement(Button, { type: "primary", style: { marginRight: '10px' }, onClick: onAllDeleteHandle },
|
|
591
|
+
showAllDeleteloadBtnInner && (React.createElement(Button, { type: "primary", style: { marginRight: '10px' }, onClick: onAllDeleteHandle }, i18next.t('批量删除'))),
|
|
441
592
|
showAllDownloadBtnInner && createDownloadBtn(),
|
|
442
|
-
React.createElement(
|
|
443
|
-
React.createElement(UploadOutlined, null),
|
|
444
|
-
fileBtnText || '添加附件',
|
|
445
|
-
maxCount === fileList.length &&
|
|
446
|
-
"\uFF08\u6700\u591A\u4E0A\u4F20" + maxCount + "\u4E2A\u6587\u4EF6\uFF09")) : maxCount && fileList.length >= maxCount && !isDirect ? null : (React.createElement("div", null,
|
|
447
|
-
React.createElement(UploadOutlined, { style: { fontSize: 18 } }),
|
|
448
|
-
React.createElement("div", { style: { marginTop: 8 } }, fileBtnText || '添加图片')))),
|
|
593
|
+
isCrop ? (React.createElement(ImgCrop, __assign({ beforeCrop: beforeCropUpload }, cropProps), renderUpload)) : (renderUpload),
|
|
449
594
|
showTip && (React.createElement("span", { className: "zt-upload__upload-tips" },
|
|
450
|
-
|
|
595
|
+
i18next.t('(单个附件最大支持'),
|
|
451
596
|
maxSizeTransStr,
|
|
452
|
-
|
|
597
|
+
i18next.t(',支持格式:'),
|
|
453
598
|
ztShowTipText
|
|
454
599
|
? ztShowTipText
|
|
455
600
|
: 'PDF、Word、Excel、Txt、JPG、PNG、BMP、GIF、RAR、ZIP',
|
|
@@ -24,7 +24,10 @@ export interface IResultType {
|
|
|
24
24
|
otherParams: IParams;
|
|
25
25
|
}
|
|
26
26
|
export declare function fileBatchDownload(fileList: IFileItem[], otherConfig: IConfig): IResultType;
|
|
27
|
-
export declare function sealFileBatchDownload(request: any, params: any,
|
|
27
|
+
export declare function sealFileBatchDownload(request: any, params: any, options?: {
|
|
28
|
+
isCompress?: boolean;
|
|
29
|
+
isWater?: boolean;
|
|
30
|
+
}): Partial<IResultType>;
|
|
28
31
|
/**
|
|
29
32
|
* 是否可以下载
|
|
30
33
|
*/
|
|
@@ -35,7 +38,11 @@ interface IOtherOption {
|
|
|
35
38
|
callbackError?: () => void;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
41
|
+
* 批量下载盖章件
|
|
39
42
|
*/
|
|
40
43
|
export declare function sealDownloadFileCallBack(request: any, params: any, otherOption?: IOtherOption): void;
|
|
44
|
+
/**
|
|
45
|
+
* 批量下载盖章件水印
|
|
46
|
+
*/
|
|
47
|
+
export declare function sealWaterDownloadFileCallBack(request: any, params: any, otherOption?: IOtherOption): void;
|
|
41
48
|
export {};
|
|
@@ -9,6 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
12
13
|
/**
|
|
13
14
|
* @author 陈亚雄
|
|
14
15
|
* @description 文件批量下载功能
|
|
@@ -23,7 +24,7 @@ export function fileBatchDownload(fileList, otherConfig) {
|
|
|
23
24
|
status: 'pending',
|
|
24
25
|
};
|
|
25
26
|
if (Array.isArray(fileList) && fileList.length > 0) {
|
|
26
|
-
var _a = otherConfig.showDownloadBtn, showDownloadBtn_1 = _a === void 0 ? true : _a, _b = otherConfig.showPreviewBtn, showPreviewBtn_1 = _b === void 0 ? true : _b, _c = otherConfig.isCompress, isCompress = _c === void 0 ? true : _c, authToken_1 = otherConfig.authToken, apiBaseUrl_1 = otherConfig.apiBaseUrl, zipName = otherConfig.zipName;
|
|
27
|
+
var _a = otherConfig.showDownloadBtn, showDownloadBtn_1 = _a === void 0 ? true : _a, _b = otherConfig.showPreviewBtn, showPreviewBtn_1 = _b === void 0 ? true : _b, _c = otherConfig.isCompress, isCompress = _c === void 0 ? true : _c, authToken_1 = otherConfig.authToken, apiBaseUrl_1 = otherConfig.apiBaseUrl, zipName = otherConfig.zipName, isWater_1 = otherConfig.isWater;
|
|
27
28
|
// 找出可以下载的文件,以及不可以下载的文件
|
|
28
29
|
fileList.forEach(function (fileItem, index) {
|
|
29
30
|
var fileSize = fileItem.fileSize, operationAuth = fileItem.operationAuth;
|
|
@@ -55,15 +56,21 @@ export function fileBatchDownload(fileList, otherConfig) {
|
|
|
55
56
|
? zipName.endsWith('.zip')
|
|
56
57
|
? zipName
|
|
57
58
|
: zipName + ".zip"
|
|
58
|
-
: '批量下载附件.zip';
|
|
59
|
+
: i18next.t('批量下载附件.zip');
|
|
60
|
+
// 批量下载默认需要水印
|
|
61
|
+
var addWaterMark_1 = typeof isWater_1 === 'boolean' ? isWater_1 : true;
|
|
59
62
|
canDownloadFileList.forEach(function (fileItem) {
|
|
60
63
|
attachIds_1.push(fileItem.fileId);
|
|
61
64
|
fileNames_1.push(fileItem.fileName || '');
|
|
65
|
+
// 只要选中的附件中,有一个不需要水印。其他附件默认不需要添加水印
|
|
66
|
+
if (!fileItem.isWatermark) {
|
|
67
|
+
addWaterMark_1 = false;
|
|
68
|
+
}
|
|
62
69
|
});
|
|
63
70
|
batchDownloadFileCallBack(apiBaseUrl_1, attachIds_1.join(','), fileNames_1.join(','), {
|
|
64
71
|
authToken: authToken_1,
|
|
65
72
|
zipName: _zipName,
|
|
66
|
-
addWaterMark:
|
|
73
|
+
addWaterMark: addWaterMark_1,
|
|
67
74
|
callbackAfter: function () {
|
|
68
75
|
otherParams.status = 'fulfilled';
|
|
69
76
|
},
|
|
@@ -75,13 +82,14 @@ export function fileBatchDownload(fileList, otherConfig) {
|
|
|
75
82
|
else {
|
|
76
83
|
// 单个文件下载
|
|
77
84
|
canDownloadFileList.forEach(function (fileItem, index) {
|
|
78
|
-
var fileId = fileItem.fileId, fileName = fileItem.fileName;
|
|
85
|
+
var fileId = fileItem.fileId, fileName = fileItem.fileName, isWatermark = fileItem.isWatermark;
|
|
79
86
|
if (!otherParams.otherList) {
|
|
80
87
|
otherParams.otherList = [];
|
|
81
88
|
otherParams.otherList.push('pending');
|
|
82
89
|
}
|
|
83
|
-
downloadFileCallBack(apiBaseUrl_1, fileId, fileName ||
|
|
90
|
+
downloadFileCallBack(apiBaseUrl_1, fileId, fileName || i18next.t('附件{{slot0}}', { slot0: index + 1 }), {
|
|
84
91
|
authToken: authToken_1,
|
|
92
|
+
addWaterMark: typeof isWater_1 === 'boolean' ? isWater_1 : isWatermark,
|
|
85
93
|
callbackAfter: function () {
|
|
86
94
|
fileItem._downloadStatus = 'fulfilled';
|
|
87
95
|
if (otherParams.otherList) {
|
|
@@ -104,8 +112,8 @@ export function fileBatchDownload(fileList, otherConfig) {
|
|
|
104
112
|
otherParams: otherParams,
|
|
105
113
|
};
|
|
106
114
|
}
|
|
107
|
-
export function sealFileBatchDownload(request, params,
|
|
108
|
-
|
|
115
|
+
export function sealFileBatchDownload(request, params, options) {
|
|
116
|
+
var _a = options || {}, _b = _a.isCompress, isCompress = _b === void 0 ? true : _b, _c = _a.isWater, isWater = _c === void 0 ? false : _c;
|
|
109
117
|
var otherParams = {
|
|
110
118
|
status: 'pending',
|
|
111
119
|
};
|
|
@@ -113,14 +121,26 @@ export function sealFileBatchDownload(request, params, isCompress) {
|
|
|
113
121
|
if (Array.isArray(fileList) && fileList.length > 0) {
|
|
114
122
|
if (isCompress) {
|
|
115
123
|
// 下载打包成PDF的文件。
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
if (isWater) {
|
|
125
|
+
sealWaterDownloadFileCallBack(request, params, {
|
|
126
|
+
callbackAfter: function () {
|
|
127
|
+
otherParams.status = 'fulfilled';
|
|
128
|
+
},
|
|
129
|
+
callbackError: function () {
|
|
130
|
+
otherParams.status = 'rejected';
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
sealDownloadFileCallBack(request, params, {
|
|
136
|
+
callbackAfter: function () {
|
|
137
|
+
otherParams.status = 'fulfilled';
|
|
138
|
+
},
|
|
139
|
+
callbackError: function () {
|
|
140
|
+
otherParams.status = 'rejected';
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
124
144
|
}
|
|
125
145
|
else {
|
|
126
146
|
// 单个文件下载
|
|
@@ -133,20 +153,41 @@ export function sealFileBatchDownload(request, params, isCompress) {
|
|
|
133
153
|
docAttachMap: params.docAttachMap,
|
|
134
154
|
qysAttachVOList: [fileItem],
|
|
135
155
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
if (isWater) {
|
|
157
|
+
newParams.watermarkOrganizationType =
|
|
158
|
+
params.watermarkOrganizationType;
|
|
159
|
+
newParams.watermarkOrganizationId = params.watermarkOrganizationId;
|
|
160
|
+
sealWaterDownloadFileCallBack(request, newParams, {
|
|
161
|
+
callbackAfter: function () {
|
|
162
|
+
fileItem._downloadStatus = 'fulfilled';
|
|
163
|
+
if (otherParams.otherList) {
|
|
164
|
+
otherParams.otherList[index] = 'fulfilled';
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
callbackError: function () {
|
|
168
|
+
fileItem._downloadStatus = 'rejected';
|
|
169
|
+
if (otherParams.otherList) {
|
|
170
|
+
otherParams.otherList[index] = 'rejected';
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
sealDownloadFileCallBack(request, newParams, {
|
|
177
|
+
callbackAfter: function () {
|
|
178
|
+
fileItem._downloadStatus = 'fulfilled';
|
|
179
|
+
if (otherParams.otherList) {
|
|
180
|
+
otherParams.otherList[index] = 'fulfilled';
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
callbackError: function () {
|
|
184
|
+
fileItem._downloadStatus = 'rejected';
|
|
185
|
+
if (otherParams.otherList) {
|
|
186
|
+
otherParams.otherList[index] = 'rejected';
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
}
|
|
150
191
|
});
|
|
151
192
|
}
|
|
152
193
|
}
|
|
@@ -165,7 +206,7 @@ export function preCanDownload(donwloadReuslt, callback) {
|
|
|
165
206
|
if (otherParams === null || otherParams === void 0 ? void 0 : otherParams.otherList) {
|
|
166
207
|
// 附件还在下载中
|
|
167
208
|
if (otherParams.otherList.find(function (i) { return i === 'pending'; })) {
|
|
168
|
-
message.info(
|
|
209
|
+
message.info(i18next.t('上次文件下载还未完成,请稍后再进行下载!', {}));
|
|
169
210
|
return false;
|
|
170
211
|
}
|
|
171
212
|
// 上次附件下载失败了 成功了 都需要重置状态
|
|
@@ -177,7 +218,7 @@ export function preCanDownload(donwloadReuslt, callback) {
|
|
|
177
218
|
else {
|
|
178
219
|
// 附件还在下载中
|
|
179
220
|
if ((otherParams === null || otherParams === void 0 ? void 0 : otherParams.status) === 'pending') {
|
|
180
|
-
message.info(
|
|
221
|
+
message.info(i18next.t('上次文件下载还未完成,请稍后再进行下载!', {}));
|
|
181
222
|
return false;
|
|
182
223
|
}
|
|
183
224
|
// 上次附件下载失败了 成功了 都需要重置状态
|
|
@@ -195,17 +236,17 @@ export function nextDownload(donwloadReuslt, callback) {
|
|
|
195
236
|
var noCanDownloadFileList = donwloadReuslt.noCanDownloadFileList, canDownloadFileList = donwloadReuslt.canDownloadFileList;
|
|
196
237
|
if (Array.isArray(noCanDownloadFileList) &&
|
|
197
238
|
noCanDownloadFileList.length > 0) {
|
|
198
|
-
message.info(
|
|
199
|
-
.map(function (item) { return item.fileName; })
|
|
200
|
-
|
|
239
|
+
message.info(i18next.t('以下文件未授权下载: {{slot0}}!', {
|
|
240
|
+
slot0: noCanDownloadFileList.map(function (item) { return item.fileName; }).join('\n'),
|
|
241
|
+
}));
|
|
201
242
|
}
|
|
202
243
|
if (Array.isArray(canDownloadFileList) && canDownloadFileList.length === 0) {
|
|
203
|
-
message.info('请选择有权限下载的附件!');
|
|
244
|
+
message.info(i18next.t('请选择有权限下载的附件!'));
|
|
204
245
|
callback && callback();
|
|
205
246
|
}
|
|
206
247
|
}
|
|
207
248
|
/**
|
|
208
|
-
*
|
|
249
|
+
* 批量下载盖章件
|
|
209
250
|
*/
|
|
210
251
|
export function sealDownloadFileCallBack(request, params, otherOption) {
|
|
211
252
|
var _a = otherOption || {}, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
|
|
@@ -219,7 +260,7 @@ export function sealDownloadFileCallBack(request, params, otherOption) {
|
|
|
219
260
|
var _a, _b, _c;
|
|
220
261
|
if (!((_a = res.headers) === null || _a === void 0 ? void 0 : _a['content-disposition'])) {
|
|
221
262
|
callbackError && callbackError();
|
|
222
|
-
message.warning('没有可下载的内容');
|
|
263
|
+
message.warning(i18next.t('没有可下载的内容'));
|
|
223
264
|
return;
|
|
224
265
|
}
|
|
225
266
|
var fileName = res.headers['content-disposition'].split(';');
|
|
@@ -230,7 +271,7 @@ export function sealDownloadFileCallBack(request, params, otherOption) {
|
|
|
230
271
|
});
|
|
231
272
|
if (blob.size < 1) {
|
|
232
273
|
callbackError && callbackError();
|
|
233
|
-
message.warning('下载失败,下载的内容为空!');
|
|
274
|
+
message.warning(i18next.t('下载失败,下载的内容为空!'));
|
|
234
275
|
return;
|
|
235
276
|
}
|
|
236
277
|
var aLink = document.createElement('a');
|
|
@@ -243,6 +284,80 @@ export function sealDownloadFileCallBack(request, params, otherOption) {
|
|
|
243
284
|
callbackAfter && callbackAfter();
|
|
244
285
|
})
|
|
245
286
|
.catch(function (err) {
|
|
287
|
+
var _a;
|
|
288
|
+
try {
|
|
289
|
+
var file_1 = new FileReader();
|
|
290
|
+
file_1.readAsText((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data, 'utf-8');
|
|
291
|
+
file_1.onload = function () {
|
|
292
|
+
var obj = {};
|
|
293
|
+
try {
|
|
294
|
+
obj = JSON.parse(file_1.result);
|
|
295
|
+
}
|
|
296
|
+
catch (err) { }
|
|
297
|
+
message.warning((obj === null || obj === void 0 ? void 0 : obj.msg) || i18next.t('没有可下载的内容'));
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
catch (err) {
|
|
301
|
+
message.warning(i18next.t('下载出错'));
|
|
302
|
+
}
|
|
303
|
+
callbackError && callbackError();
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 批量下载盖章件水印
|
|
308
|
+
*/
|
|
309
|
+
export function sealWaterDownloadFileCallBack(request, params, otherOption) {
|
|
310
|
+
var _a = otherOption || {}, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
|
|
311
|
+
request({
|
|
312
|
+
method: 'POST',
|
|
313
|
+
url: '/api/zmdms-resource/seal/batch-download-seal-files-water-mark',
|
|
314
|
+
responseType: 'blob',
|
|
315
|
+
data: params,
|
|
316
|
+
})
|
|
317
|
+
.then(function (res) {
|
|
318
|
+
var _a, _b, _c;
|
|
319
|
+
if (!((_a = res.headers) === null || _a === void 0 ? void 0 : _a['content-disposition'])) {
|
|
320
|
+
callbackError && callbackError();
|
|
321
|
+
message.warning(i18next.t('没有可下载的内容'));
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
var fileName = res.headers['content-disposition'].split(';');
|
|
325
|
+
var fileNameArray = (_b = fileName[1]) === null || _b === void 0 ? void 0 : _b.split('=');
|
|
326
|
+
var fileNameStr = decodeURIComponent(fileNameArray[1]);
|
|
327
|
+
var blob = new Blob([res.data], {
|
|
328
|
+
type: 'application/vnd.ms-excel',
|
|
329
|
+
});
|
|
330
|
+
if (blob.size < 1) {
|
|
331
|
+
callbackError && callbackError();
|
|
332
|
+
message.warning(i18next.t('下载失败,下载的内容为空!'));
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
var aLink = document.createElement('a');
|
|
336
|
+
aLink.style.display = 'none';
|
|
337
|
+
aLink.href = window.URL.createObjectURL(blob);
|
|
338
|
+
aLink.download = (_c = fileNameStr === null || fileNameStr === void 0 ? void 0 : fileNameStr.replace) === null || _c === void 0 ? void 0 : _c.call(fileNameStr, /["]/g, '');
|
|
339
|
+
document.body.appendChild(aLink);
|
|
340
|
+
aLink.click();
|
|
341
|
+
document.body.removeChild(aLink);
|
|
342
|
+
callbackAfter && callbackAfter();
|
|
343
|
+
})
|
|
344
|
+
.catch(function (err) {
|
|
345
|
+
var _a;
|
|
346
|
+
try {
|
|
347
|
+
var file_2 = new FileReader();
|
|
348
|
+
file_2.readAsText((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data, 'utf-8');
|
|
349
|
+
file_2.onload = function () {
|
|
350
|
+
var obj = {};
|
|
351
|
+
try {
|
|
352
|
+
obj = JSON.parse(file_2.result);
|
|
353
|
+
}
|
|
354
|
+
catch (err) { }
|
|
355
|
+
message.warning((obj === null || obj === void 0 ? void 0 : obj.msg) || i18next.t('没有可下载的内容'));
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
catch (err) {
|
|
359
|
+
message.warning(i18next.t('下载出错'));
|
|
360
|
+
}
|
|
246
361
|
callbackError && callbackError();
|
|
247
362
|
});
|
|
248
363
|
}
|