cloud-web-corejs 1.0.54-dev.40 → 1.0.54-dev.400
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/package.json +11 -3
- package/src/App.vue +21 -20
- package/src/api/user.js +8 -0
- package/src/components/Qrcode/fileParse.vue +0 -1
- package/src/components/Tinymce/index.vue +75 -53
- package/src/components/VabUpload/index.js +49 -1
- package/src/components/VabUpload/mixins.js +1547 -1
- package/src/components/VabUpload/propertiesDialog.vue +1 -1
- package/src/components/VabUpload/view.vue +203 -120
- package/src/components/advancedSearchDialog/mixins.js +1 -1
- package/src/components/baseAttachment/index.vue +49 -40
- package/src/components/baseAttachment/mixins.js +1 -1
- package/src/components/baseInputExport/mixins.js +1 -1
- package/src/components/baseTabs/mixins.js +166 -1
- package/src/components/errorMsg/mixins.js +6 -5
- package/src/components/excelExport/button.vue +57 -4
- package/src/components/excelExport/exportFieldDialog.vue +5 -4
- package/src/components/excelExport/index.js +48 -5
- package/src/components/excelExport/index.vue +63 -8
- package/src/components/excelExport/mixins.js +938 -2
- package/src/components/excelImport/mixins.js +2 -1
- package/src/components/fileLibrary/fileObjAuthEditDialog.vue +6 -0
- package/src/components/fileLibrary/filterDialog.vue +430 -0
- package/src/components/fileLibrary/index.vue +23 -24
- package/src/components/fileLibrary/mixins/categoryMoveDialogMixins.js +1 -1
- package/src/components/fileLibrary/mixins/fileCategoryDialogMixins.js +1 -1
- package/src/components/fileLibrary/mixins/fileHistoryDialogMixins.js +2 -2
- package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +335 -212
- package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +31 -27
- package/src/components/fileLibrary/mixins/fileObjAuthEditMixin.js +4 -4
- package/src/components/fileLibrary/mixins/indexMixins.js +217 -101
- package/src/components/fileLibrary/mixins/propertiesDialogMixins.js +64 -4
- package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +3 -3
- package/src/components/fileLibrary/propertiesDialog.vue +113 -74
- package/src/components/fileLibrary/shareDialog.vue +1 -1
- package/src/components/formOplog/mixins.js +1 -1
- package/src/components/jsonImport/index.js +1 -1
- package/src/components/jsonImport/mixins.js +2 -1
- package/src/components/langImport/mixins.js +17 -16
- package/src/components/obsUpload/index.js +34 -0
- package/src/components/obsUpload/index.vue +231 -0
- package/src/components/obsUpload/mixins.js +1457 -0
- package/src/components/scriptDescription/button.vue +12 -4
- package/src/components/statusTag/mixins.js +1 -1
- package/src/components/table/CellSlot.vue +1 -0
- package/src/components/table/index.js +1049 -10
- package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.es6.min.js +11028 -0
- package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.min.css +200 -0
- package/src/components/table/tableForm.vue +99 -63
- package/src/components/table/tableFormMixin.js +1 -1
- package/src/components/table/util/index.js +328 -0
- package/src/components/table/vxeFilter/mixin.js +326 -6
- package/src/components/tempStorage/index.vue +76 -55
- package/src/components/tempStorage/tempStorageDialog.vue +179 -54
- package/src/components/vb-tabs/x-tabs.vue +44 -30
- package/src/components/wf/addOpinionButton.vue +57 -0
- package/src/components/wf/content.vue +833 -362
- package/src/components/wf/mixins/addOpinionButton.js +3 -0
- package/src/components/wf/mixins/setCandidateButton.js +6 -0
- package/src/components/wf/mixins/setCandidateDialog.js +2 -1
- package/src/components/wf/mixins/setCandidateDialog2.js +6 -0
- package/src/components/wf/mixins/wfFlowEleScriptDialog.js +3 -0
- package/src/components/wf/mixins/wfTaskUserRangeDialog.js +3 -0
- package/src/components/wf/setCandidateButton.vue +40 -0
- package/src/components/wf/setCandidateDialog.vue +10 -0
- package/src/components/wf/setCandidateDialog2.vue +95 -0
- package/src/components/wf/wf.js +1 -1
- package/src/components/wf/wfFlowEleScriptDialog.vue +89 -0
- package/src/components/wf/wfStartDialog.vue +70 -42
- package/src/components/wf/wfTaskUserRangeDialog.vue +65 -0
- package/src/components/wf/wfUtil.js +1 -1
- package/src/components/xform/form-designer/designer.js +5 -3
- package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +419 -0
- package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +3 -3
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +9 -8
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -1
- package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +3 -3
- package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +961 -0
- package/src/components/xform/form-designer/form-widget/dialog/exportDialog.vue +13 -0
- package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +301 -0
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +16 -4
- package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +5 -1
- package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
- package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +38 -7
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +1639 -0
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1759 -8
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +120 -72
- package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +34 -5
- package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +19 -1
- package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +18 -7
- package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +4 -1
- package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +89 -0
- package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +14 -2
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +30 -4
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +77 -0
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +106 -0
- package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1634 -16
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +645 -379
- package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +962 -0
- package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +10 -8
- package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +81 -0
- package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +7 -2
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-bar-mixin.js +49 -8
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +61 -88
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +13 -0
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +179 -0
- package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +114 -81
- package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +185 -0
- package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +35 -27
- package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +108 -0
- package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +154 -47
- package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +25 -6
- package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +2 -2
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +86 -0
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +24 -9
- package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
- package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -0
- package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +2 -1
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +31 -17
- package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +6 -1
- package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +99 -0
- package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +147 -0
- package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +46 -34
- package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +2 -2
- package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +2 -170
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +259 -58
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +733 -0
- package/src/components/xform/form-designer/indexMixin.js +3 -2
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +891 -157
- package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
- package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +537 -302
- package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +4 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/autoValueEnabled-editor.vue +38 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +6 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +28 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +41 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +125 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +946 -1042
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/onCheckboxChange-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1160 -511
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-pane/detail-pane-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +0 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/copyButton-editor.vue +36 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onAfterConfirmFile-editor.vue +32 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +35 -20
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +64 -5
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +27 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-item-editor.vue +21 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +185 -69
- package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +188 -86
- package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +84 -39
- package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +36 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +70 -19
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +89 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +8 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +91 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +67 -41
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +56 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +26 -7
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +30 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +63 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +89 -19
- package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +721 -466
- package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +20 -11
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +19 -14
- package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +31 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +349 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/required-editor.vue +10 -6
- package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/showRuleFlag-editor.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +42 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +305 -19
- package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +2 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +384 -53
- package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +263 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +31 -11
- package/src/components/xform/form-designer/toolbar-panel/index.vue +12 -11
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +1 -1
- package/src/components/xform/form-designer/widget-panel/index.vue +21 -1
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +19 -18
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +1604 -871
- package/src/components/xform/form-render/container-item/containerItemMixin.js +12 -11
- package/src/components/xform/form-render/container-item/data-table-item.vue +194 -199
- package/src/components/xform/form-render/container-item/data-table-mixin.js +22 -18
- package/src/components/xform/form-render/container-item/detail-pane-item.vue +17 -3
- package/src/components/xform/form-render/container-item/grid-col-item.vue +10 -3
- package/src/components/xform/form-render/container-item/grid-item.vue +1 -1
- package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -9
- package/src/components/xform/form-render/container-item/list-h5-item2.vue +1 -8
- package/src/components/xform/form-render/container-item/tab-item.vue +62 -25
- package/src/components/xform/form-render/container-item/table-cell-item.vue +38 -32
- package/src/components/xform/form-render/container-item/table-item.vue +4 -2
- package/src/components/xform/form-render/container-item/table2-cell-item.vue +53 -34
- package/src/components/xform/form-render/container-item/table2-item.vue +141 -88
- package/src/components/xform/form-render/index.vue +67 -20
- package/src/components/xform/form-render/indexMixin.js +3145 -3
- package/src/components/xform/lang/zh-CN.js +22 -4
- package/src/components/xform/mixins/defaultHandle.js +340 -1
- package/src/components/xform/mixins/scriptHttp.js +174 -1
- package/src/components/xform/utils/emitter.js +4 -4
- package/src/components/xform/utils/format.js +21 -30
- package/src/components/xform/utils/formula-util.js +835 -0
- package/src/components/xform/utils/util.js +1451 -1
- package/src/components/xform/utils/validators.js +1 -5
- package/src/index.js +210 -190
- package/src/layout/components/AppMain.vue +5 -1
- package/src/layout/components/Sidebar/default.vue +1389 -1222
- package/src/layout/components/TagsView/index.vue +37 -12
- package/src/layout/components/createCompany/createCompanyDialog.vue +157 -0
- package/src/layout/components/extractedCode/createDialog.vue +92 -0
- package/src/layout/components/extractedCode/queryDialog.vue +96 -0
- package/src/layout/components/extractedCode/viewDialog.vue +193 -0
- package/src/layout/components/watermark/index.vue +83 -0
- package/src/layout/defaultLayout.vue +1 -1
- package/src/mixins/selectDialog/index.js +266 -1
- package/src/mixins/table/index.js +152 -0
- package/src/mixins/tableTree/index.js +1 -1
- package/src/router/modules/customer.js +79 -8
- package/src/store/config/index.js +1 -532
- package/src/store/getters.js +2 -1
- package/src/store/modules/permission.js +1 -1
- package/src/store/modules/settings.js +1 -1
- package/src/store/modules/tagsView.js +1 -14
- package/src/store/modules/user.js +315 -2
- package/src/utils/index.js +2 -3
- package/src/utils/pddLog.js +103 -0
- package/src/utils/pdfUtil.js +71 -0
- package/src/utils/request.js +1 -1
- package/src/utils/vab.js +1113 -27
- package/src/views/bd/setting/bd_attach_setting/edit.vue +5 -5
- package/src/views/bd/setting/bd_attach_setting/list.vue +28 -55
- package/src/views/bd/setting/bd_attach_setting/mixins/edit.js +4 -5
- package/src/views/bd/setting/bd_attach_setting/mixins/list.js +239 -1
- package/src/views/bd/setting/bd_company_env/dialog.vue +174 -0
- package/src/views/bd/setting/bd_company_env/edit.vue +193 -0
- package/src/views/bd/setting/bd_company_env/list.vue +175 -0
- package/src/views/bd/setting/config_manage/list.vue +76 -0
- package/src/views/bd/setting/form_import_log/edit.vue +127 -0
- package/src/views/bd/setting/form_import_log/list.vue +206 -0
- package/src/views/bd/setting/form_script/edit.vue +9 -0
- package/src/views/bd/setting/form_script/edit1.vue +36 -3
- package/src/views/bd/setting/form_script/form_list.vue +1 -1
- package/src/views/bd/setting/form_script/list1.vue +4 -4
- package/src/views/bd/setting/form_script/mixins/dialog.js +130 -1
- package/src/views/bd/setting/form_script/mixins/edit.js +201 -1
- package/src/views/bd/setting/form_script/mixins/edit1.js +193 -1
- package/src/views/bd/setting/form_script/mixins/form_list.js +1 -1
- package/src/views/bd/setting/form_script/mixins/list.js +236 -1
- package/src/views/bd/setting/form_script/mixins/list1.js +423 -14
- package/src/views/bd/setting/form_script/mixins/otherAuthDialog.js +194 -0
- package/src/views/bd/setting/form_script/otherAuthDialog.vue +83 -0
- package/src/views/bd/setting/form_template/batchWfObjConfigDialog.vue +105 -0
- package/src/views/bd/setting/form_template/edit.vue +22 -1
- package/src/views/bd/setting/form_template/editWfObjConfigDialog.vue +2 -2
- package/src/views/bd/setting/form_template/list.vue +5 -5
- package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +282 -0
- package/src/views/bd/setting/form_template/mixins/edit.js +234 -9
- package/src/views/bd/setting/form_template/mixins/list.js +689 -22
- package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +193 -0
- package/src/views/bd/setting/form_template/mixins/wf_list.js +12 -0
- package/src/views/bd/setting/form_template/otherAuthDialog.vue +83 -0
- package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +140 -75
- package/src/views/bd/setting/form_template/{list2.vue → wf_list.vue} +25 -35
- package/src/views/bd/setting/logic_param/edit.vue +146 -0
- package/src/views/bd/setting/logic_param/edit1.vue +106 -0
- package/src/views/bd/setting/logic_param/edit2.vue +139 -0
- package/src/views/bd/setting/logic_param/list.vue +74 -0
- package/src/views/bd/setting/logic_param/list1.vue +12 -0
- package/src/views/bd/setting/logic_param/list2.vue +12 -0
- package/src/views/bd/setting/logic_param/mixins/edit.js +93 -0
- package/src/views/bd/setting/logic_param/mixins/list.js +369 -0
- package/src/views/bd/setting/menu_kind/list.vue +4 -0
- package/src/views/bd/setting/menu_kind/mixins/authDialog.js +300 -7
- package/src/views/bd/setting/menu_kind/mixins/list.js +201 -1
- package/src/views/bd/setting/push_data/edit.vue +139 -0
- package/src/views/bd/setting/push_data/list.vue +283 -0
- package/src/views/bd/setting/push_data_h/edit.vue +153 -0
- package/src/views/bd/setting/push_data_h/list.vue +293 -0
- package/src/views/bd/setting/request_async_setting/edit.vue +320 -0
- package/src/views/bd/setting/request_async_setting/list.vue +372 -0
- package/src/views/bd/setting/request_setting/edit.vue +300 -0
- package/src/views/bd/setting/request_setting/list.vue +311 -0
- package/src/views/bd/setting/table_model/edit.vue +875 -426
- package/src/views/bd/setting/table_model/list.vue +4 -4
- package/src/views/bd/setting/table_model/mixins/dialog.js +1 -1
- package/src/views/bd/setting/table_model/mixins/edit.js +1202 -13
- package/src/views/bd/setting/table_model/mixins/list.js +440 -14
- package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +201 -0
- package/src/views/bd/setting/table_model/otherAuthDialog.vue +83 -0
- package/src/views/user/area/dialog.vue +3 -3
- package/src/views/user/bill_setting/edit.vue +1 -1
- package/src/views/user/bill_setting/list.vue +1 -1
- package/src/views/user/common_attribute/itemEdit.vue +2 -2
- package/src/views/user/common_attribute/list.vue +1 -1
- package/src/views/user/common_script/edit.vue +1 -1
- package/src/views/user/common_script/list.vue +1 -1
- package/src/views/user/company_info/dialog.vue +164 -154
- package/src/views/user/company_info/edit.vue +1 -1
- package/src/views/user/extend_datasource/dialog.vue +1 -0
- package/src/views/user/extend_datasource/edit.vue +3 -0
- package/src/views/user/extend_datasource/list.vue +2 -1
- package/src/views/user/fieldTranslation/editDialog.vue +7 -7
- package/src/views/user/fieldTranslation/list.vue +32 -32
- package/src/views/user/form/vform/designer.vue +775 -749
- package/src/views/user/form/vform/out_render.vue +1 -1
- package/src/views/user/form/vform/render.vue +8 -4
- package/src/views/user/form/view/edit.vue +38 -37
- package/src/views/user/form/view/list.vue +142 -45
- package/src/views/user/home/default.vue +1025 -979
- package/src/views/user/home/dev.vue +29 -0
- package/src/views/user/home/index.vue +16 -6
- package/src/views/user/home/taili/index.vue +1034 -0
- package/src/views/user/login/default.vue +33 -4
- package/src/views/user/login/indexMixin.js +117 -3
- package/src/views/user/notify_message/dialog.vue +38 -18
- package/src/views/user/notify_template/edit.vue +188 -187
- package/src/views/user/notify_template/edit2.vue +176 -0
- package/src/views/user/notify_template/list.vue +4 -1
- package/src/views/user/notify_template/list2.vue +190 -0
- package/src/views/user/outLink/form_view.vue +211 -184
- package/src/views/user/outLink/index.vue +17 -0
- package/src/views/user/outLink/view.vue +28 -23
- package/src/views/user/position/edit.vue +116 -83
- package/src/views/user/position/list.vue +118 -86
- package/src/views/user/project_tag/dialog.vue +9 -4
- package/src/views/user/project_tag/edit.vue +2 -2
- package/src/views/user/project_tag/list.vue +9 -4
- package/src/views/user/push_setting/list.vue +2 -2
- package/src/views/user/request_setting/edit.vue +258 -0
- package/src/views/user/request_setting/list.vue +248 -0
- package/src/views/user/role/dialog.vue +70 -48
- package/src/views/user/role/edit.vue +499 -429
- package/src/views/user/role/list.vue +4 -4
- package/src/views/user/sale_org/dialog.vue +1 -1
- package/src/views/user/sale_org/list.vue +4 -1
- package/src/views/user/system_notice/edit.vue +232 -186
- package/src/views/user/user/dialog.vue +46 -23
- package/src/views/user/user/edit.vue +1059 -1021
- package/src/views/user/user/form_dialog.vue +158 -0
- package/src/views/user/user/form_info.vue +210 -0
- package/src/views/user/user/list.vue +647 -563
- package/src/views/user/user/modifyPasswordDialog.vue +64 -53
- package/src/views/user/wf/wfReport/index.vue +509 -0
- package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -0
- package/src/views/user/wf/wf_manage/list.vue +371 -249
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +1 -1
- package/src/views/user/wf/wf_obj_config/importItemDialog.vue +109 -0
- package/src/views/user/wf/wf_obj_config/itemEdit.vue +25 -1
- package/src/views/user/wf/wf_obj_config/list.vue +114 -9
- package/src/views/user/wf/wf_obj_config/wfBizDataSettingDialog.vue +2 -2
- package/src/views/user/wf/wf_transfer_setting/edit.vue +230 -0
- package/src/views/user/wf/wf_transfer_setting/list.vue +309 -0
- package/src/views/bd/setting/form_template/mixins/list2.js +0 -12
|
@@ -0,0 +1,1457 @@
|
|
|
1
|
+
/**version-1.0*/
|
|
2
|
+
let tmixins;
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import SparkMD5 from "spark-md5";
|
|
5
|
+
import settingConfig from "@/settings.js";
|
|
6
|
+
import ObsClient from "esdk-obs-browserjs/src/obs";
|
|
7
|
+
|
|
8
|
+
let imFun = {
|
|
9
|
+
axios,
|
|
10
|
+
SparkMD5,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
tmixins = {
|
|
14
|
+
props: {
|
|
15
|
+
auto: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true,
|
|
18
|
+
},
|
|
19
|
+
url: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "/upload",
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "file",
|
|
26
|
+
},
|
|
27
|
+
limit: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: () => 100000,
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 200,
|
|
34
|
+
},
|
|
35
|
+
accept: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "file",
|
|
38
|
+
},
|
|
39
|
+
chunkSize: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 5, //5MB
|
|
42
|
+
},
|
|
43
|
+
confirmUpload: {
|
|
44
|
+
type: Function,
|
|
45
|
+
},
|
|
46
|
+
pickPrivateProfile: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true,
|
|
49
|
+
},
|
|
50
|
+
multi: {
|
|
51
|
+
type: [String, Boolean],
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
uploadingLimit: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 5, //5MB
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
show: false,
|
|
62
|
+
loading: false,
|
|
63
|
+
dialogVisible: false,
|
|
64
|
+
dialogImageUrl: "",
|
|
65
|
+
action: "",
|
|
66
|
+
headers: {},
|
|
67
|
+
fileList: [],
|
|
68
|
+
picture: "picture",
|
|
69
|
+
allImgNum: 0,
|
|
70
|
+
imgNum: 0,
|
|
71
|
+
imgSuccessNum: 0,
|
|
72
|
+
imgErrorNum: 0,
|
|
73
|
+
typeList: null,
|
|
74
|
+
title: this.$t2("上传", "components.VabUpload.title"),
|
|
75
|
+
dialogFormVisible: false,
|
|
76
|
+
data: {},
|
|
77
|
+
fileViewDialogVisible: false,
|
|
78
|
+
fileViewInfo: {},
|
|
79
|
+
total: 0,
|
|
80
|
+
video: null,
|
|
81
|
+
btn: false,
|
|
82
|
+
filePartMap: {},
|
|
83
|
+
uploading: false,
|
|
84
|
+
hasReadyFile: false,
|
|
85
|
+
showLocalUploadBtn: false,
|
|
86
|
+
showPrivateUploadBtn: false,
|
|
87
|
+
showPrivateProfileDialog: false,
|
|
88
|
+
pasteList: [],
|
|
89
|
+
pasteAreaStatus: false,
|
|
90
|
+
option: {},
|
|
91
|
+
editFileIndex: -1,
|
|
92
|
+
showFileNameDialog: false,
|
|
93
|
+
editFileName: null,
|
|
94
|
+
editFileSuffix: null,
|
|
95
|
+
beforeUploadFlag: false,
|
|
96
|
+
uploadUrl: null,
|
|
97
|
+
|
|
98
|
+
access_key_id: "HPUAQ1TAFXWGOKSNKCGW", // 你的ak
|
|
99
|
+
secret_access_key: "Ns1nwPwikK67Acbhj3wlfUambjbdroqpk0TFv7qg", // 你的sk
|
|
100
|
+
server: "https://obs.cn-south-1.myhuaweicloud.com", // 你的endPoint 记得加入https://
|
|
101
|
+
Bucket: "gztw-file01", // 你的桶名
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
beforeDestroy() {
|
|
105
|
+
this.removePasteEvent();
|
|
106
|
+
},
|
|
107
|
+
filters: {
|
|
108
|
+
btnText(btn) {
|
|
109
|
+
return btn
|
|
110
|
+
? this.$t2("继续", "components.VabUpload.continue")
|
|
111
|
+
: this.$t2("暂停", "components.VabUpload.pause");
|
|
112
|
+
},
|
|
113
|
+
totalText(total) {
|
|
114
|
+
return total > 100 ? 100 : total;
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
computed: {
|
|
118
|
+
percentage() {
|
|
119
|
+
if (this.allImgNum == 0) return 0;
|
|
120
|
+
return ((this.imgNum / this.allImgNum, 2) * 100).toFixed(0);
|
|
121
|
+
},
|
|
122
|
+
fileMaxSize() {
|
|
123
|
+
return this.formatFileSize(this.size * 1024 * 1024);
|
|
124
|
+
},
|
|
125
|
+
errorQuantity() {
|
|
126
|
+
return this.fileList.filter((file) => file.status == "fail").length;
|
|
127
|
+
},
|
|
128
|
+
totalQuantity() {
|
|
129
|
+
return this.fileList.length;
|
|
130
|
+
},
|
|
131
|
+
successQuantity() {
|
|
132
|
+
return this.fileList.filter((file) => file.status == "success").length;
|
|
133
|
+
},
|
|
134
|
+
isMulti: function () {
|
|
135
|
+
let isMulti = true;
|
|
136
|
+
if (this.multi === "false" || this.multi === false || this.limit === 1) {
|
|
137
|
+
isMulti = false;
|
|
138
|
+
}
|
|
139
|
+
return isMulti;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
methods: {
|
|
143
|
+
updateUploadingStatus() {
|
|
144
|
+
var target = this.$refs.upload;
|
|
145
|
+
let uploading, hasReadyFile;
|
|
146
|
+
if (target) {
|
|
147
|
+
var fileList = target.uploadFiles;
|
|
148
|
+
let n = fileList.find((item) => {
|
|
149
|
+
// return item.percentage != 100;
|
|
150
|
+
return item.status == "uploading" || item.status == "preUpload";
|
|
151
|
+
});
|
|
152
|
+
uploading = n == null ? false : true;
|
|
153
|
+
|
|
154
|
+
let readyFiles = fileList.filter((file) => file.status == "ready");
|
|
155
|
+
hasReadyFile = readyFiles.length > 0;
|
|
156
|
+
} else {
|
|
157
|
+
uploading = false;
|
|
158
|
+
hasReadyFile = false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.uploading = uploading;
|
|
162
|
+
this.hasReadyFile = hasReadyFile;
|
|
163
|
+
this.checkPreUploadList();
|
|
164
|
+
return uploading;
|
|
165
|
+
},
|
|
166
|
+
submitUpload() {
|
|
167
|
+
let successDone = () => {
|
|
168
|
+
this.$refs.upload.submit();
|
|
169
|
+
};
|
|
170
|
+
var files = this.$refs.upload.uploadFiles;
|
|
171
|
+
let readyFiles = files.filter((file) => file.status == "ready");
|
|
172
|
+
if (this.confirmUpload) {
|
|
173
|
+
if (readyFiles.length) {
|
|
174
|
+
this.confirmUpload({
|
|
175
|
+
files: files,
|
|
176
|
+
done: successDone,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
successDone();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
handleProgress(event, file, fileList) {
|
|
184
|
+
// this.loading = true
|
|
185
|
+
// this.show = true
|
|
186
|
+
},
|
|
187
|
+
handleChange(file, fileList) {
|
|
188
|
+
let maxSize = this.size * 1024 * 1024;
|
|
189
|
+
if (file.size > maxSize) {
|
|
190
|
+
fileList.map((item, index) => {
|
|
191
|
+
if (item === file) {
|
|
192
|
+
fileList.splice(index, 1);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
this.fileList = fileList;
|
|
196
|
+
let errorText =
|
|
197
|
+
"文件[" + file.name + "]大小超出限制" + this.fileMaxSize;
|
|
198
|
+
this.$message({
|
|
199
|
+
message: this.$t2(errorText, "components.VabUpload.warnMsg1", {
|
|
200
|
+
fileName: file.name,
|
|
201
|
+
fileMaxSize: this.fileMaxSize,
|
|
202
|
+
}),
|
|
203
|
+
type: "error",
|
|
204
|
+
duration: 3 * 1000,
|
|
205
|
+
});
|
|
206
|
+
file.raw.status = "fail";
|
|
207
|
+
return false;
|
|
208
|
+
} else {
|
|
209
|
+
this.fileList = fileList;
|
|
210
|
+
this.allImgNum = fileList.length;
|
|
211
|
+
}
|
|
212
|
+
this.updateUploadingStatus();
|
|
213
|
+
},
|
|
214
|
+
handleSuccess(response, file, fileList) {
|
|
215
|
+
if (file.percentage == 100) {
|
|
216
|
+
this.imgNum = this.imgNum + 1;
|
|
217
|
+
this.imgSuccessNum = this.imgSuccessNum + 1;
|
|
218
|
+
}
|
|
219
|
+
if (fileList.length === this.imgNum) {
|
|
220
|
+
this.fileList = fileList;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
setTimeout(() => {
|
|
224
|
+
this.loading = false;
|
|
225
|
+
this.show = false;
|
|
226
|
+
}, 1000);
|
|
227
|
+
this.updateUploadingStatus();
|
|
228
|
+
},
|
|
229
|
+
handleError(err, file, fileList) {
|
|
230
|
+
this.imgNum = this.imgNum + 1;
|
|
231
|
+
this.imgErrorNum = this.imgErrorNum + 1;
|
|
232
|
+
setTimeout(() => {
|
|
233
|
+
this.loading = false;
|
|
234
|
+
this.show = false;
|
|
235
|
+
}, 1000);
|
|
236
|
+
this.updateUploadingStatus();
|
|
237
|
+
},
|
|
238
|
+
handleRemove(file, fileList) {
|
|
239
|
+
this.imgNum = this.imgNum - 1;
|
|
240
|
+
this.allNum = this.allNum - 1;
|
|
241
|
+
this.updateUploadingStatus();
|
|
242
|
+
},
|
|
243
|
+
handlePreview(file) {
|
|
244
|
+
this.dialogImageUrl = file.url;
|
|
245
|
+
this.dialogVisible = true;
|
|
246
|
+
},
|
|
247
|
+
handleExceed(files, fileList) {
|
|
248
|
+
let errorMsg = `当前限制选择 ${this.limit} 个文件,本次选择了
|
|
249
|
+
${files.length}
|
|
250
|
+
个文件`;
|
|
251
|
+
this.$message({
|
|
252
|
+
message: this.$t2(errorMsg, "components.VabUpload.warnMsg2", {
|
|
253
|
+
limit: this.limit,
|
|
254
|
+
size: files.length,
|
|
255
|
+
}),
|
|
256
|
+
type: "error",
|
|
257
|
+
duration: 5 * 1000,
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
handleShow(option) {
|
|
261
|
+
this.getFileServerInfo(option,()=>{
|
|
262
|
+
this.title = this.$t2("上传", "components.VabUpload.title");
|
|
263
|
+
// this.data = data;
|
|
264
|
+
this.option = option;
|
|
265
|
+
this.clearFileInfo();
|
|
266
|
+
this.initPickUploadMode();
|
|
267
|
+
this.pasteAreaStatus = false;
|
|
268
|
+
this.dialogFormVisible = true;
|
|
269
|
+
|
|
270
|
+
this.removePasteEvent();
|
|
271
|
+
this.addPasteEvent();
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
},
|
|
275
|
+
addPasteEvent() {
|
|
276
|
+
document.addEventListener("click", this.blurPasteEvent);
|
|
277
|
+
document.addEventListener("paste", this.pasteEvent);
|
|
278
|
+
},
|
|
279
|
+
removePasteEvent() {
|
|
280
|
+
document.removeEventListener("click", this.blurPasteEvent);
|
|
281
|
+
document.removeEventListener("paste", this.pasteEvent);
|
|
282
|
+
},
|
|
283
|
+
blurPasteEvent() {
|
|
284
|
+
this.pasteAreaStatus = false;
|
|
285
|
+
},
|
|
286
|
+
handleClose() {
|
|
287
|
+
let target = this.$refs.upload;
|
|
288
|
+
(target.uploadFiles || []).forEach((uploadFile) => {
|
|
289
|
+
if (uploadFile.status == "uploading" || uploadFile.status == "ready") {
|
|
290
|
+
uploadFile.raw.abort &&
|
|
291
|
+
uploadFile.raw.abort(
|
|
292
|
+
this.$t2("取消上传", "components.VabUpload.cancelUpload")
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
this.picture = "picture";
|
|
297
|
+
this.clearFileInfo();
|
|
298
|
+
this.dialogFormVisible = false;
|
|
299
|
+
},
|
|
300
|
+
clearFileInfo() {
|
|
301
|
+
this.fileList = [];
|
|
302
|
+
this.allImgNum = 0;
|
|
303
|
+
this.imgNum = 0;
|
|
304
|
+
this.imgSuccessNum = 0;
|
|
305
|
+
this.imgErrorNum = 0;
|
|
306
|
+
},
|
|
307
|
+
initUploadUrl() {
|
|
308
|
+
let mineUploadUrl = window.BASE_FILEURL;
|
|
309
|
+
return this.$http({
|
|
310
|
+
url: mineUploadUrl,
|
|
311
|
+
method: "post",
|
|
312
|
+
data: {
|
|
313
|
+
isAuth: false,
|
|
314
|
+
},
|
|
315
|
+
success: (res) => {
|
|
316
|
+
this.uploadUrl = res.objx;
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
handleBeforeUpload(file, checkFile, callback) {
|
|
321
|
+
/*if (checkFile !== false) {
|
|
322
|
+
let target = this.$refs.upload;
|
|
323
|
+
let nFile = target.getFile(file);
|
|
324
|
+
if (!nFile) {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
let mineUploadUrl = window.BASE_FILEURL;
|
|
329
|
+
return await this.$http({
|
|
330
|
+
url: mineUploadUrl,
|
|
331
|
+
method: 'post',
|
|
332
|
+
data: {
|
|
333
|
+
isAuth: false
|
|
334
|
+
},
|
|
335
|
+
success: res => {
|
|
336
|
+
this.uploadUrl = res.objx;
|
|
337
|
+
callback && callback()
|
|
338
|
+
}
|
|
339
|
+
});*/
|
|
340
|
+
callback && callback();
|
|
341
|
+
},
|
|
342
|
+
formatFileSize(fileSize) {
|
|
343
|
+
return formatFileSize(fileSize);
|
|
344
|
+
},
|
|
345
|
+
//自定义上传
|
|
346
|
+
async uploadSectionFile(param, isCustom, uploadConfig) {
|
|
347
|
+
if (!this.uploadUrl) {
|
|
348
|
+
await this.initUploadUrl();
|
|
349
|
+
}
|
|
350
|
+
let that = this;
|
|
351
|
+
var fileObj = param.file;
|
|
352
|
+
|
|
353
|
+
let source;
|
|
354
|
+
|
|
355
|
+
var form = new FormData();
|
|
356
|
+
// 文件对象
|
|
357
|
+
form.append("file", fileObj);
|
|
358
|
+
|
|
359
|
+
let target = that.$refs.upload;
|
|
360
|
+
let file = target ? target.getFile(fileObj) : null;
|
|
361
|
+
if (file) {
|
|
362
|
+
file.status = "uploading";
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
let isLoading = uploadConfig?.isLoading === true;
|
|
366
|
+
var uploadUrl = this.uploadUrl;
|
|
367
|
+
if (uploadUrl) {
|
|
368
|
+
var abort;
|
|
369
|
+
let config = {
|
|
370
|
+
isLoading: isLoading,
|
|
371
|
+
headers: {
|
|
372
|
+
"Content-Type": "multipart/form-data",
|
|
373
|
+
},
|
|
374
|
+
cancelToken: new imFun.axios.CancelToken(function executor(c) {
|
|
375
|
+
if (!isCustom) {
|
|
376
|
+
abort = c;
|
|
377
|
+
if (file) file.abort = c;
|
|
378
|
+
}
|
|
379
|
+
}),
|
|
380
|
+
onUploadProgress: (progressEvent) => {
|
|
381
|
+
if (isCustom || file) {
|
|
382
|
+
// progressEvent.loaded:已上传文件大小
|
|
383
|
+
// progressEvent.total:被上传文件的总大小
|
|
384
|
+
progressEvent.percent = Math.floor(
|
|
385
|
+
(progressEvent.loaded * 100) / progressEvent.total
|
|
386
|
+
);
|
|
387
|
+
if (!isCustom) {
|
|
388
|
+
param.onProgress(progressEvent, fileObj);
|
|
389
|
+
}
|
|
390
|
+
uploadConfig &&
|
|
391
|
+
uploadConfig.onProgress &&
|
|
392
|
+
uploadConfig.onProgress(progressEvent, fileObj);
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
failMsg: false,
|
|
396
|
+
}; //添加请求头
|
|
397
|
+
|
|
398
|
+
let req = this.$http
|
|
399
|
+
.post(uploadUrl, form, config)
|
|
400
|
+
.then((res1) => {
|
|
401
|
+
uploadConfig &&
|
|
402
|
+
uploadConfig.callback &&
|
|
403
|
+
uploadConfig.callback(res1, fileObj);
|
|
404
|
+
if (!isCustom) {
|
|
405
|
+
if (res1.type == "success") {
|
|
406
|
+
param.onSuccess(res1, fileObj);
|
|
407
|
+
} else {
|
|
408
|
+
// param.onError(new Error(res1.content || '上传异常'));
|
|
409
|
+
this.handleFileError(
|
|
410
|
+
new Error(
|
|
411
|
+
res1.content ||
|
|
412
|
+
this.$t2(
|
|
413
|
+
"上传异常",
|
|
414
|
+
"components.VabUpload.uploadException"
|
|
415
|
+
)
|
|
416
|
+
),
|
|
417
|
+
fileObj
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
})
|
|
422
|
+
.catch((error, a, b, c) => {
|
|
423
|
+
// let {err} = error;
|
|
424
|
+
try {
|
|
425
|
+
// param.onError(err, fileObj);
|
|
426
|
+
if (!isCustom) {
|
|
427
|
+
this.handleFileError(error, fileObj);
|
|
428
|
+
}
|
|
429
|
+
uploadConfig &&
|
|
430
|
+
uploadConfig.error &&
|
|
431
|
+
uploadConfig.error(error, fileObj);
|
|
432
|
+
} catch (tt) {}
|
|
433
|
+
});
|
|
434
|
+
req.abort = () => {
|
|
435
|
+
abort(this.$t2("取消上传", "components.VabUpload.cancelUpload"));
|
|
436
|
+
};
|
|
437
|
+
//return req;
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
singerUpload(uploadConfig) {
|
|
441
|
+
let onUploadProgress = uploadConfig.onUploadProgress;
|
|
442
|
+
let success = uploadConfig.success;
|
|
443
|
+
let file = uploadConfig.file;
|
|
444
|
+
this.handleBeforeUpload(file, false, () => {
|
|
445
|
+
this.uploadSectionFile(
|
|
446
|
+
{
|
|
447
|
+
file: file,
|
|
448
|
+
},
|
|
449
|
+
true,
|
|
450
|
+
uploadConfig
|
|
451
|
+
);
|
|
452
|
+
});
|
|
453
|
+
},
|
|
454
|
+
//begin
|
|
455
|
+
fileParse(file, type = "base64", callback) {
|
|
456
|
+
/*return new Promise(resolve => {
|
|
457
|
+
|
|
458
|
+
});*/
|
|
459
|
+
let fileRead = new FileReader();
|
|
460
|
+
if (type === "base64") {
|
|
461
|
+
fileRead.readAsDataURL(file);
|
|
462
|
+
} else if (type === "buffer") {
|
|
463
|
+
fileRead.readAsArrayBuffer(file);
|
|
464
|
+
}
|
|
465
|
+
fileRead.onload = (ev) => {
|
|
466
|
+
callback(ev.target.result);
|
|
467
|
+
// resolve(ev.target.result);
|
|
468
|
+
};
|
|
469
|
+
},
|
|
470
|
+
changeFile(param) {
|
|
471
|
+
if (!param.file || param.file.status == "fail") return;
|
|
472
|
+
|
|
473
|
+
let target = this.$refs.upload;
|
|
474
|
+
if (!target) return;
|
|
475
|
+
let fileObj = target.getFile(param.file);
|
|
476
|
+
fileObj.status = "preUpload";
|
|
477
|
+
this.checkPreUploadList();
|
|
478
|
+
},
|
|
479
|
+
getFileServerInfoData(callback){
|
|
480
|
+
this.$http({
|
|
481
|
+
url: USER_PREFIX + "/logic_param/getFileServerInfo",
|
|
482
|
+
method: "post",
|
|
483
|
+
data: {paramCode: "obs"},
|
|
484
|
+
failMsg: false,
|
|
485
|
+
errorMsg: false,
|
|
486
|
+
modal: false,
|
|
487
|
+
success: (res) => {
|
|
488
|
+
if(res.objx){
|
|
489
|
+
callback && callback(res.objx);
|
|
490
|
+
}else{
|
|
491
|
+
callback && callback();
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
error: (err) => {
|
|
495
|
+
callback && callback();
|
|
496
|
+
}
|
|
497
|
+
})
|
|
498
|
+
},
|
|
499
|
+
getFileServerInfo(option,callback){
|
|
500
|
+
if(option.obsConfig){
|
|
501
|
+
let fileServerInfo = option.obsConfig;
|
|
502
|
+
this.initObsClient(fileServerInfo);
|
|
503
|
+
callback && callback();
|
|
504
|
+
}else{
|
|
505
|
+
this.getFileServerInfoData((res)=>{
|
|
506
|
+
if(res?.obsConfig){
|
|
507
|
+
this.initObsClient(res.obsConfig);
|
|
508
|
+
callback && callback();
|
|
509
|
+
}else{
|
|
510
|
+
this.$message.error("上传服务信息未维护")
|
|
511
|
+
}
|
|
512
|
+
})
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
//obs begin
|
|
516
|
+
initObsClient(obsConfig) {
|
|
517
|
+
this.obsConfig = obsConfig;
|
|
518
|
+
this.obsClient = new ObsClient({
|
|
519
|
+
access_key_id: obsConfig.access_key_id,
|
|
520
|
+
secret_access_key: obsConfig.secret_access_key,
|
|
521
|
+
server: obsConfig.server,
|
|
522
|
+
// obsClient: ''
|
|
523
|
+
});
|
|
524
|
+
},
|
|
525
|
+
getBucket(){
|
|
526
|
+
return this.obsConfig.Bucket;
|
|
527
|
+
},
|
|
528
|
+
abortMultipartUpload(file, callback) {
|
|
529
|
+
if (file.uploadId && file.status == "uploading") {
|
|
530
|
+
this.obsClient
|
|
531
|
+
.abortMultipartUpload({
|
|
532
|
+
Bucket: this.getBucket(),
|
|
533
|
+
Key: file.obsKey,
|
|
534
|
+
UploadId: file.uploadId,
|
|
535
|
+
})
|
|
536
|
+
.then((result) => {
|
|
537
|
+
if (result.CommonMsg.Status < 300) {
|
|
538
|
+
callback && callback();
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
} else {
|
|
542
|
+
callback && callback();
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
createUUID() {
|
|
546
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
|
|
547
|
+
.replace(/[xy]/g, function (c) {
|
|
548
|
+
var r = (Math.random() * 16) | 0,
|
|
549
|
+
v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
550
|
+
return v.toString(16);
|
|
551
|
+
})
|
|
552
|
+
.replaceAll("-", "");
|
|
553
|
+
},
|
|
554
|
+
handleUpload(file) {
|
|
555
|
+
let target = this.$refs.upload;
|
|
556
|
+
let fileObj = target.getFile(file);
|
|
557
|
+
fileObj.status = "uploading";
|
|
558
|
+
// this.initiateData.option = option;
|
|
559
|
+
this.fileUrl = "";
|
|
560
|
+
var _this = this;
|
|
561
|
+
let fileSuffix = this.$commonFileUtil.getFileSuffix(file.name);
|
|
562
|
+
let uuids = this.createUUID() + Date.now();
|
|
563
|
+
fileObj.obsKey = uuids + "." + fileSuffix;
|
|
564
|
+
const params = {
|
|
565
|
+
Bucket: this.getBucket(),
|
|
566
|
+
Key: fileObj.obsKey,
|
|
567
|
+
};
|
|
568
|
+
// let target = this.$refs.upload;
|
|
569
|
+
// let fileObj = target.getFile(option.file);
|
|
570
|
+
// fileObj.obsKey = uuids;
|
|
571
|
+
setTimeout(() => {
|
|
572
|
+
this.obsClient.initiateMultipartUpload(params).then((result) => {
|
|
573
|
+
if (result.CommonMsg.Status < 300) {
|
|
574
|
+
var uploadId = result.InterfaceResult.UploadId;
|
|
575
|
+
// _this.initiateData.uploadId = uploadId;
|
|
576
|
+
fileObj.uploadId = uploadId;
|
|
577
|
+
/*
|
|
578
|
+
* Step 2: upload a part
|
|
579
|
+
*/
|
|
580
|
+
var etag = [];
|
|
581
|
+
var uploadPromise = new Promise((resolve) => {
|
|
582
|
+
var partLen = 5 * 1024 * 1024;
|
|
583
|
+
var count = Math.ceil(file.size / partLen);
|
|
584
|
+
var indexNum = 0;
|
|
585
|
+
this.uploadPartMethod(
|
|
586
|
+
file,
|
|
587
|
+
uploadId,
|
|
588
|
+
indexNum,
|
|
589
|
+
partLen,
|
|
590
|
+
etag,
|
|
591
|
+
count,
|
|
592
|
+
resolve
|
|
593
|
+
);
|
|
594
|
+
});
|
|
595
|
+
uploadPromise.then((result) => {
|
|
596
|
+
const paramsEnd = {
|
|
597
|
+
Bucket: this.getBucket(),
|
|
598
|
+
Key: fileObj.obsKey,
|
|
599
|
+
UploadId: uploadId,
|
|
600
|
+
Parts: etag.sort((a, b) => a.PartNumber - b.PartNumber),
|
|
601
|
+
};
|
|
602
|
+
this.obsClient
|
|
603
|
+
.completeMultipartUpload(paramsEnd)
|
|
604
|
+
.then((result) => {
|
|
605
|
+
if (result.CommonMsg.Status < 300) {
|
|
606
|
+
let fileUrl = _this.getImageUrl(file);
|
|
607
|
+
let fileData = this.parseFileUrl(fileUrl, file);
|
|
608
|
+
target.handleProgress({ percent: 100 }, file);
|
|
609
|
+
|
|
610
|
+
target.handleSuccess(
|
|
611
|
+
{
|
|
612
|
+
type: "success",
|
|
613
|
+
objx: fileData,
|
|
614
|
+
},
|
|
615
|
+
file
|
|
616
|
+
);
|
|
617
|
+
} else {
|
|
618
|
+
this.handleFileError(
|
|
619
|
+
new Error(
|
|
620
|
+
result.CommonMsg.Message ||
|
|
621
|
+
this.$t2(
|
|
622
|
+
"上传异常",
|
|
623
|
+
"components.VabUpload.uploadException"
|
|
624
|
+
)
|
|
625
|
+
),
|
|
626
|
+
file
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
});
|
|
631
|
+
} else {
|
|
632
|
+
this.handleFileError(
|
|
633
|
+
new Error(
|
|
634
|
+
result.CommonMsg.Message ||
|
|
635
|
+
this.$t2("上传异常", "components.VabUpload.uploadException")
|
|
636
|
+
),
|
|
637
|
+
file
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}, 20);
|
|
642
|
+
},
|
|
643
|
+
parseFileUrl(fileUrl,file) {
|
|
644
|
+
if (!fileUrl) return null;
|
|
645
|
+
let result = null;
|
|
646
|
+
|
|
647
|
+
// 输入校验
|
|
648
|
+
if (typeof fileUrl !== "string") {
|
|
649
|
+
throw new TypeError("输入必须是字符串格式");
|
|
650
|
+
}
|
|
651
|
+
if (!fileUrl.trim()) {
|
|
652
|
+
throw new Error("URL不能为空");
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// 基本URL格式验证
|
|
656
|
+
const urlRegex =
|
|
657
|
+
/^(https?:\/\/)?([\w.-]+)(:\d+)?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i;
|
|
658
|
+
if (!urlRegex.test(fileUrl)) {
|
|
659
|
+
throw new Error("无效的URL格式");
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// 提取域名部分
|
|
663
|
+
const domainRegex = /^(https?:\/\/[^\/]+)/i;
|
|
664
|
+
const domainMatch = fileUrl.match(domainRegex);
|
|
665
|
+
if (!domainMatch) {
|
|
666
|
+
throw new Error("URL缺少协议或域名部分");
|
|
667
|
+
}
|
|
668
|
+
const domain = domainMatch[0];
|
|
669
|
+
|
|
670
|
+
// 提取完整路径
|
|
671
|
+
const url = fileUrl.substring(domain.length);
|
|
672
|
+
if (!url || url === "/") {
|
|
673
|
+
throw new Error("URL缺少文件路径部分");
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
// 提取带扩展名的文件名
|
|
677
|
+
const filenameRegex = /[^\/]+$/;
|
|
678
|
+
const filenameMatch = url.match(filenameRegex);
|
|
679
|
+
if (!filenameMatch) {
|
|
680
|
+
throw new Error("无法从路径中提取文件名");
|
|
681
|
+
}
|
|
682
|
+
const fullFilename = filenameMatch[0];
|
|
683
|
+
|
|
684
|
+
// 验证文件名格式(至少1字符+扩展名)
|
|
685
|
+
const nameFormat = /^.+\..+$/;
|
|
686
|
+
if (!nameFormat.test(fullFilename)) {
|
|
687
|
+
throw new Error(`无效的文件名格式: ${fullFilename}`);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// 修复点:更可靠的文件名和扩展名分离
|
|
691
|
+
const lastDotIndex = fullFilename.lastIndexOf(".");
|
|
692
|
+
const filenameBase = fullFilename.substring(0, lastDotIndex); // 点之前部分
|
|
693
|
+
const extension = fullFilename.substring(lastDotIndex + 1).toLowerCase(); // 点之后部分
|
|
694
|
+
|
|
695
|
+
// 扩展名验证
|
|
696
|
+
/* const validExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'];
|
|
697
|
+
if (!validExtensions.includes(extension)) {
|
|
698
|
+
throw new Error(`不支持的扩展名类型: ${extension}`);
|
|
699
|
+
} */
|
|
700
|
+
|
|
701
|
+
let thumbnail = null,
|
|
702
|
+
large = null,
|
|
703
|
+
medium = null,
|
|
704
|
+
source = null;
|
|
705
|
+
if (this.$commonFileUtil.isPicture(extension)) {
|
|
706
|
+
thumbnail = url;
|
|
707
|
+
large = url;
|
|
708
|
+
medium = url;
|
|
709
|
+
source = url;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
result = {
|
|
713
|
+
extension,
|
|
714
|
+
domain,
|
|
715
|
+
url,
|
|
716
|
+
thumbnail,
|
|
717
|
+
large,
|
|
718
|
+
medium,
|
|
719
|
+
source,
|
|
720
|
+
fileSize: file?file.size:0,
|
|
721
|
+
name: file?file.name:null
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
// 返回结构化对象
|
|
725
|
+
return result;
|
|
726
|
+
},
|
|
727
|
+
uploadPartMethod(file, UploadId, indexNum, partLen, etag, count, resolve) {
|
|
728
|
+
let target = this.$refs.upload;
|
|
729
|
+
let fileObj = target.getFile(file);
|
|
730
|
+
var _this = this;
|
|
731
|
+
this.obsClient
|
|
732
|
+
.uploadPart({
|
|
733
|
+
Bucket: this.getBucket(),
|
|
734
|
+
Key: fileObj.obsKey,
|
|
735
|
+
UploadId,
|
|
736
|
+
PartNumber: indexNum + 1,
|
|
737
|
+
SourceFile: file,
|
|
738
|
+
PartSize: partLen,
|
|
739
|
+
Offset: partLen * indexNum,
|
|
740
|
+
})
|
|
741
|
+
.then((result) => {
|
|
742
|
+
if (fileObj.status !== "uploading") {
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
if (result.CommonMsg.Status < 300) {
|
|
746
|
+
etag.push({
|
|
747
|
+
ETag: result.InterfaceResult.ETag,
|
|
748
|
+
PartNumber: indexNum + 1,
|
|
749
|
+
});
|
|
750
|
+
indexNum++;
|
|
751
|
+
if (indexNum < count) {
|
|
752
|
+
let percentage = Math.ceil((indexNum / count) * 100);
|
|
753
|
+
// _this.percentage = Math.ceil((indexNum / count) * 100);
|
|
754
|
+
fileObj.percentage = percentage;
|
|
755
|
+
// option.file.percent = percentage;
|
|
756
|
+
// option.onProgress(option.file);
|
|
757
|
+
|
|
758
|
+
let progressEvent = document.createEvent("Event");
|
|
759
|
+
progressEvent.percent = percentage;
|
|
760
|
+
target.handleProgress(progressEvent, file);
|
|
761
|
+
|
|
762
|
+
_this.uploadPartMethod(
|
|
763
|
+
file,
|
|
764
|
+
UploadId,
|
|
765
|
+
indexNum,
|
|
766
|
+
partLen,
|
|
767
|
+
etag,
|
|
768
|
+
count,
|
|
769
|
+
resolve
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
if (indexNum == count) {
|
|
773
|
+
// _this.percentage = 100;
|
|
774
|
+
let percentage = 100;
|
|
775
|
+
fileObj.percentage = percentage;
|
|
776
|
+
/* option.file.percent = percentage;
|
|
777
|
+
option.onProgress(option.file); */
|
|
778
|
+
|
|
779
|
+
let progressEvent = document.createEvent("Event");
|
|
780
|
+
progressEvent.percent = percentage;
|
|
781
|
+
target.handleProgress(progressEvent, file);
|
|
782
|
+
|
|
783
|
+
resolve("任务完成");
|
|
784
|
+
}
|
|
785
|
+
} else {
|
|
786
|
+
this.handleFileError(
|
|
787
|
+
new Error(
|
|
788
|
+
result.CommonMsg.Message ||
|
|
789
|
+
this.$t2("上传异常", "components.VabUpload.uploadException")
|
|
790
|
+
),
|
|
791
|
+
file
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
})
|
|
795
|
+
.catch((error) => {
|
|
796
|
+
this.handleFileError(error, file);
|
|
797
|
+
});
|
|
798
|
+
},
|
|
799
|
+
getImageUrl(file) {
|
|
800
|
+
let target = this.$refs.upload;
|
|
801
|
+
let fileObj = target.getFile(file);
|
|
802
|
+
let Bucket= this.getBucket();
|
|
803
|
+
let server = this.obsConfig.server
|
|
804
|
+
let arr = server.split("//")
|
|
805
|
+
let url = `${arr[0]}//${Bucket}.${arr[1]}/${fileObj.obsKey}`
|
|
806
|
+
// let url = `https://gztw-file01.obs.cn-south-1.myhuaweicloud.com/${fileObj.obsKey}`;
|
|
807
|
+
return url;
|
|
808
|
+
console.log(url);
|
|
809
|
+
/* let target = this.$refs.upload;
|
|
810
|
+
let fileObj = target.getFile(file);
|
|
811
|
+
const _this = this;
|
|
812
|
+
this.obsClient.getObject(
|
|
813
|
+
{
|
|
814
|
+
Bucket: this.getBucket(),
|
|
815
|
+
Key: fileObj.obsKey,
|
|
816
|
+
SaveByType: "file",
|
|
817
|
+
},
|
|
818
|
+
function (error, response) {
|
|
819
|
+
if (error) {
|
|
820
|
+
} else if (response.CommonMsg.Status < 300) {
|
|
821
|
+
const url = response.InterfaceResult.Content.SignedUrl;
|
|
822
|
+
console.log(url);
|
|
823
|
+
// this.imageUrl = url;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
); */
|
|
827
|
+
},
|
|
828
|
+
//obs end
|
|
829
|
+
|
|
830
|
+
checkPreUploadList() {
|
|
831
|
+
let uploadingLimit = this.option.uploadingLimit || this.uploadingLimit;
|
|
832
|
+
let target = this.$refs.upload;
|
|
833
|
+
let fileList1 = (target.uploadFiles || []).filter((item) => {
|
|
834
|
+
return item.status == "preUpload";
|
|
835
|
+
});
|
|
836
|
+
let fileList2 = (target.uploadFiles || []).filter((item) => {
|
|
837
|
+
return item.status == "uploading";
|
|
838
|
+
});
|
|
839
|
+
if (fileList2.length < uploadingLimit && fileList1.length > 0) {
|
|
840
|
+
let num = uploadingLimit - fileList2.length;
|
|
841
|
+
if (num) {
|
|
842
|
+
let toNum = Math.min(fileList1.length, num);
|
|
843
|
+
for (let i = 0; i < toNum; i++) {
|
|
844
|
+
let fileRaw = fileList1[i].raw;
|
|
845
|
+
// this.uploadFile(fileRaw);
|
|
846
|
+
this.handleUpload(fileRaw);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
async uploadFile(file) {
|
|
852
|
+
if (!file || file.status == "fail") return;
|
|
853
|
+
let target = this.$refs.upload;
|
|
854
|
+
if (!target) return;
|
|
855
|
+
let fileObj = target.getFile(file);
|
|
856
|
+
if (fileObj.status != "preUpload") return;
|
|
857
|
+
if (!this.uploadUrl) {
|
|
858
|
+
await this.initUploadUrl();
|
|
859
|
+
}
|
|
860
|
+
this.total = 0;
|
|
861
|
+
target.handleProgress({ percent: 0 }, file);
|
|
862
|
+
|
|
863
|
+
// 解析为BUFFER数据
|
|
864
|
+
// 我们会把文件切片处理:把一个文件分割成为好几个部分(固定数量/固定大小)
|
|
865
|
+
// 每一个切片有自己的部分数据和自己的名字
|
|
866
|
+
// HASH_1.mp4
|
|
867
|
+
// HASH_2.mp4
|
|
868
|
+
// ...
|
|
869
|
+
|
|
870
|
+
this.fileParse(file, "buffer", (buffer) => {
|
|
871
|
+
let spark = new imFun.SparkMD5.ArrayBuffer(),
|
|
872
|
+
chunkSize = this.chunkSize * 1024 * 1024, // Read in chunks of 2MB
|
|
873
|
+
chunks = Math.ceil(file.size / chunkSize),
|
|
874
|
+
hash,
|
|
875
|
+
suffix;
|
|
876
|
+
spark.append(buffer);
|
|
877
|
+
hash = spark.end();
|
|
878
|
+
let nameSplit = /\.([0-9a-zA-Z]+)$/i.exec(file.name);
|
|
879
|
+
|
|
880
|
+
suffix = nameSplit && nameSplit.length > 1 ? nameSplit[1] : "";
|
|
881
|
+
|
|
882
|
+
let checkUrl = this.uploadUrl.replace(
|
|
883
|
+
"/docfile/upload",
|
|
884
|
+
"/docfile/check"
|
|
885
|
+
);
|
|
886
|
+
let checkData = {
|
|
887
|
+
name: file.name,
|
|
888
|
+
md5: hash,
|
|
889
|
+
};
|
|
890
|
+
let abort;
|
|
891
|
+
let checkReq = this.$http({
|
|
892
|
+
url: checkUrl,
|
|
893
|
+
method: "post",
|
|
894
|
+
cancelToken: new imFun.axios.CancelToken(function executor(c) {
|
|
895
|
+
abort = c;
|
|
896
|
+
file.abort = c;
|
|
897
|
+
}),
|
|
898
|
+
data: checkData,
|
|
899
|
+
failMsg: false,
|
|
900
|
+
modal: false,
|
|
901
|
+
callback: (res) => {
|
|
902
|
+
if (res.type == "success") {
|
|
903
|
+
let resData = res.objx || {};
|
|
904
|
+
let chunkParam = {
|
|
905
|
+
fullFile: file,
|
|
906
|
+
chunkSize: chunkSize,
|
|
907
|
+
chunks: chunks,
|
|
908
|
+
chunkIndex: 0,
|
|
909
|
+
md5: hash,
|
|
910
|
+
uuid: resData.uuid,
|
|
911
|
+
};
|
|
912
|
+
file.chunkParam = chunkParam;
|
|
913
|
+
|
|
914
|
+
this.sendRequest(file);
|
|
915
|
+
} else {
|
|
916
|
+
this.handleFileError(
|
|
917
|
+
new Error(
|
|
918
|
+
res.content ||
|
|
919
|
+
this.$t2("上传异常", "components.VabUpload.uploadException")
|
|
920
|
+
),
|
|
921
|
+
file
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
error: (e) => {
|
|
926
|
+
this.handleFileError(e, file);
|
|
927
|
+
},
|
|
928
|
+
});
|
|
929
|
+
checkReq.abort = () => {
|
|
930
|
+
abort(this.$t2("取消上传", "components.VabUpload.cancelUpload"));
|
|
931
|
+
};
|
|
932
|
+
});
|
|
933
|
+
},
|
|
934
|
+
async sendRequest(fullFile) {
|
|
935
|
+
let that = this;
|
|
936
|
+
let uploadUrl = this.uploadUrl;
|
|
937
|
+
let chunkParam = fullFile.chunkParam;
|
|
938
|
+
let target = that.$refs.upload;
|
|
939
|
+
let abort;
|
|
940
|
+
let config = {
|
|
941
|
+
headers: {
|
|
942
|
+
"Content-Type": "multipart/form-data",
|
|
943
|
+
},
|
|
944
|
+
cancelToken: new imFun.axios.CancelToken(function executor(c) {
|
|
945
|
+
/* let target = that.$refs.upload;
|
|
946
|
+
let filem = target.getFile(file);
|
|
947
|
+
abort = c;
|
|
948
|
+
filem.abort = c; */
|
|
949
|
+
abort = c;
|
|
950
|
+
fullFile.abort = c;
|
|
951
|
+
}),
|
|
952
|
+
onUploadProgress: (progressEvent) => {
|
|
953
|
+
if (!target || !fullFile) return;
|
|
954
|
+
let file = target.getFile(fullFile);
|
|
955
|
+
if (file) {
|
|
956
|
+
// progressEvent.loaded:已上传文件大小
|
|
957
|
+
// progressEvent.total:被上传文件的总大小
|
|
958
|
+
let start = chunkParam.start;
|
|
959
|
+
let uploadedSize =
|
|
960
|
+
start +
|
|
961
|
+
Math.floor(
|
|
962
|
+
(chunkParam.currentSize * progressEvent.loaded) /
|
|
963
|
+
progressEvent.total
|
|
964
|
+
);
|
|
965
|
+
let percent = Math.floor((uploadedSize * 100) / fullFile.size);
|
|
966
|
+
if (percent == 100) {
|
|
967
|
+
percent = 99;
|
|
968
|
+
}
|
|
969
|
+
progressEvent.percent = percent;
|
|
970
|
+
target.handleProgress(progressEvent, fullFile);
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
failMsg: false,
|
|
974
|
+
modal: false,
|
|
975
|
+
}; //添加请求头
|
|
976
|
+
|
|
977
|
+
let chunkIndex = chunkParam.chunkIndex;
|
|
978
|
+
let chunkSize = chunkParam.chunkSize;
|
|
979
|
+
var start = chunkIndex * chunkSize,
|
|
980
|
+
end =
|
|
981
|
+
start + chunkSize >= fullFile.size
|
|
982
|
+
? fullFile.size
|
|
983
|
+
: start + chunkParam.chunkSize;
|
|
984
|
+
chunkParam.currentSize = end - start;
|
|
985
|
+
chunkParam.start = start;
|
|
986
|
+
chunkParam.end = end;
|
|
987
|
+
|
|
988
|
+
let preFormData = {
|
|
989
|
+
file: fullFile.slice(start, end),
|
|
990
|
+
name: fullFile.name,
|
|
991
|
+
chunks: chunkParam.chunks,
|
|
992
|
+
chunk: chunkIndex,
|
|
993
|
+
md5: chunkParam.md5,
|
|
994
|
+
uuid: chunkParam.uuid,
|
|
995
|
+
fileSize: fullFile.size,
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
let formData = new FormData();
|
|
999
|
+
Object.keys(preFormData).forEach((key) => {
|
|
1000
|
+
formData.append(key, preFormData[key]);
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
let req = this.$http
|
|
1004
|
+
.post(uploadUrl, formData, config)
|
|
1005
|
+
.then((res1) => {
|
|
1006
|
+
if (res1.type == "success") {
|
|
1007
|
+
if (preFormData.chunk + 1 >= preFormData.chunks) {
|
|
1008
|
+
let mergeData = {};
|
|
1009
|
+
Object.keys(preFormData).forEach((key) => {
|
|
1010
|
+
if (key != "file" && key != "chunk") {
|
|
1011
|
+
mergeData[key] = preFormData[key];
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
let _param = {
|
|
1015
|
+
mergeData: mergeData,
|
|
1016
|
+
chunkParam: chunkParam,
|
|
1017
|
+
};
|
|
1018
|
+
this.mergeFile(_param);
|
|
1019
|
+
} else {
|
|
1020
|
+
chunkParam.chunkIndex = chunkParam.chunkIndex + 1;
|
|
1021
|
+
this.sendRequest(fullFile);
|
|
1022
|
+
}
|
|
1023
|
+
} else {
|
|
1024
|
+
this.handleFileError(
|
|
1025
|
+
new Error(
|
|
1026
|
+
res1.content ||
|
|
1027
|
+
this.$t2("上传异常", "components.VabUpload.uploadException")
|
|
1028
|
+
),
|
|
1029
|
+
fullFile
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
return res1;
|
|
1033
|
+
})
|
|
1034
|
+
.catch((err) => {
|
|
1035
|
+
try {
|
|
1036
|
+
if (!abort) {
|
|
1037
|
+
this.handleFileError(err, fullFile);
|
|
1038
|
+
}
|
|
1039
|
+
} catch (tt) {}
|
|
1040
|
+
});
|
|
1041
|
+
req.abort = () => {
|
|
1042
|
+
abort(this.$t2("取消上传", "components.VabUpload.cancelUpload"));
|
|
1043
|
+
};
|
|
1044
|
+
},
|
|
1045
|
+
mergeFile(param) {
|
|
1046
|
+
let mergeData = param.mergeData;
|
|
1047
|
+
let chunkParam = param.chunkParam;
|
|
1048
|
+
let fullFile = chunkParam.fullFile;
|
|
1049
|
+
let mergeUrl = this.uploadUrl.replace(
|
|
1050
|
+
"/docfile/upload",
|
|
1051
|
+
"/docfile/merge"
|
|
1052
|
+
);
|
|
1053
|
+
let target = this.$refs.upload;
|
|
1054
|
+
this.$http({
|
|
1055
|
+
url: mergeUrl,
|
|
1056
|
+
method: "post",
|
|
1057
|
+
data: mergeData,
|
|
1058
|
+
failMsg: false,
|
|
1059
|
+
modal: false,
|
|
1060
|
+
cancelToken: new imFun.axios.CancelToken(function executor(c) {
|
|
1061
|
+
if (fullFile) fullFile.abort = c;
|
|
1062
|
+
}),
|
|
1063
|
+
callback: (res) => {
|
|
1064
|
+
if (!target || !fullFile) return;
|
|
1065
|
+
if (res.type == "success") {
|
|
1066
|
+
let file = target.getFile(fullFile);
|
|
1067
|
+
if (file) {
|
|
1068
|
+
target.handleProgress(
|
|
1069
|
+
{
|
|
1070
|
+
percent: 100,
|
|
1071
|
+
},
|
|
1072
|
+
fullFile
|
|
1073
|
+
);
|
|
1074
|
+
target.handleSuccess(res, fullFile);
|
|
1075
|
+
}
|
|
1076
|
+
} else {
|
|
1077
|
+
this.handleFileError(
|
|
1078
|
+
new Error(
|
|
1079
|
+
res.content ||
|
|
1080
|
+
this.$t2("上传异常", "components.VabUpload.uploadException")
|
|
1081
|
+
),
|
|
1082
|
+
fullFile
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
error: (e) => {
|
|
1087
|
+
if (!target || !fullFile) return;
|
|
1088
|
+
if (fullFile) {
|
|
1089
|
+
let file = target.getFile(fullFile);
|
|
1090
|
+
if (file) {
|
|
1091
|
+
this.handleFileError(e, fullFile);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
});
|
|
1096
|
+
},
|
|
1097
|
+
handleBtn() {
|
|
1098
|
+
let target = this.$refs.upload;
|
|
1099
|
+
let fileList = (target.uploadFiles || []).filter((item) => {
|
|
1100
|
+
return item.status == "uploading" || item.status == "ready";
|
|
1101
|
+
});
|
|
1102
|
+
if (this.btn) {
|
|
1103
|
+
//断点续传
|
|
1104
|
+
this.abort = false;
|
|
1105
|
+
this.btn = false;
|
|
1106
|
+
fileList.forEach((uploadFile) => {
|
|
1107
|
+
let nextChunk = uploadFile.raw.nextChunk;
|
|
1108
|
+
this.sendRequest(uploadFile.raw.partList, nextChunk);
|
|
1109
|
+
});
|
|
1110
|
+
} else {
|
|
1111
|
+
//暂停上传
|
|
1112
|
+
fileList.forEach((uploadFile) => {
|
|
1113
|
+
uploadFile.raw.abort(
|
|
1114
|
+
this.$t2("取消上传", "components.VabUpload.cancelUpload")
|
|
1115
|
+
);
|
|
1116
|
+
});
|
|
1117
|
+
this.btn = true;
|
|
1118
|
+
this.abort = true;
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
//end
|
|
1122
|
+
getShowImage(file, fileName) {
|
|
1123
|
+
fileName = fileName || file.name;
|
|
1124
|
+
if (this.$commonFileUtil.isPictureFile(fileName)) {
|
|
1125
|
+
return file.showUrl || file.url;
|
|
1126
|
+
} else {
|
|
1127
|
+
return this.$commonFileUtil.getFileIconRequire(fileName);
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
removeFile(sfile) {
|
|
1131
|
+
var target = this.$refs.upload;
|
|
1132
|
+
var index;
|
|
1133
|
+
var fileList = target.uploadFiles;
|
|
1134
|
+
for (let i = 0; i < fileList.length; i++) {
|
|
1135
|
+
let file = fileList[i];
|
|
1136
|
+
if (sfile.uid == file.uid) {
|
|
1137
|
+
index = i;
|
|
1138
|
+
if (sfile.status == "uploading") {
|
|
1139
|
+
// file.status == 'delete'
|
|
1140
|
+
//target.abort(file);
|
|
1141
|
+
this.abortMultipartUpload(file);
|
|
1142
|
+
/* file.raw.abort &&
|
|
1143
|
+
file.raw.abort(
|
|
1144
|
+
this.$t2("取消上传", "components.VabUpload.cancelUpload")
|
|
1145
|
+
); */
|
|
1146
|
+
}
|
|
1147
|
+
break;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
target.uploadFiles.splice(index, 1);
|
|
1152
|
+
this.handleChange(sfile, target.uploadFiles);
|
|
1153
|
+
},
|
|
1154
|
+
submitImage() {
|
|
1155
|
+
var target = this.$refs.upload;
|
|
1156
|
+
var fileList = target.uploadFiles;
|
|
1157
|
+
let fileInfos = [];
|
|
1158
|
+
let fileDatas = [];
|
|
1159
|
+
for (let i = 0; i < fileList.length; i++) {
|
|
1160
|
+
let file = fileList[i];
|
|
1161
|
+
if (file.status == "uploading") {
|
|
1162
|
+
this.$message({
|
|
1163
|
+
message: this.$t2(
|
|
1164
|
+
"文件上传中",
|
|
1165
|
+
"components.VabUpload.fileUploading"
|
|
1166
|
+
),
|
|
1167
|
+
type: "error",
|
|
1168
|
+
duration: 2000,
|
|
1169
|
+
});
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
if (file.status == "success") {
|
|
1173
|
+
let fileData = file.response.objx;
|
|
1174
|
+
fileData.name = file.name;
|
|
1175
|
+
let fileInfo = {
|
|
1176
|
+
name: file.name,
|
|
1177
|
+
fileData: fileData,
|
|
1178
|
+
file: file.raw,
|
|
1179
|
+
};
|
|
1180
|
+
fileInfos.push(fileInfo);
|
|
1181
|
+
fileDatas.push(fileData);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
this.handleClose();
|
|
1185
|
+
this.$emit("callback", fileInfos, fileDatas);
|
|
1186
|
+
this.callback && this.callback(fileDatas, fileInfos);
|
|
1187
|
+
},
|
|
1188
|
+
showViewDialog(lineData) {
|
|
1189
|
+
var data = lineData.fileData ? lineData.fileData : lineData;
|
|
1190
|
+
|
|
1191
|
+
let thumbnail = data ? data.thumbnail || "" : "";
|
|
1192
|
+
|
|
1193
|
+
var realUrl = data.domain + data.url;
|
|
1194
|
+
var showUrl = "";
|
|
1195
|
+
let fileName = lineData ? lineData.name || "" : "";
|
|
1196
|
+
if (!this.$commonFileUtil.isPictureFile(fileName)) {
|
|
1197
|
+
showUrl = this.$commonFileUtil.getFileIconRequire(fileName);
|
|
1198
|
+
} else if (thumbnail) {
|
|
1199
|
+
showUrl = data.domain + thumbnail;
|
|
1200
|
+
} else {
|
|
1201
|
+
showUrl = data.domain + data.url;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
var preName = "";
|
|
1205
|
+
var suffix = "";
|
|
1206
|
+
var i = fileName.lastIndexOf(".");
|
|
1207
|
+
if (i >= 0) {
|
|
1208
|
+
suffix = fileName.substring(i + 1, fileName.length).toLowerCase();
|
|
1209
|
+
}
|
|
1210
|
+
this.fileViewInfo = {
|
|
1211
|
+
realUrl: realUrl,
|
|
1212
|
+
showUrl: showUrl,
|
|
1213
|
+
fileName: fileName,
|
|
1214
|
+
suffix: suffix,
|
|
1215
|
+
data: data,
|
|
1216
|
+
};
|
|
1217
|
+
this.fileViewDialogVisible = true;
|
|
1218
|
+
},
|
|
1219
|
+
getShowUrl(attachment, field) {
|
|
1220
|
+
let showUrl = null;
|
|
1221
|
+
let typeStr = Object.prototype.toString.call(attachment);
|
|
1222
|
+
if (typeStr == "[object Object]") {
|
|
1223
|
+
let showField = field ? field : "medium";
|
|
1224
|
+
let fullUrl =
|
|
1225
|
+
attachment.domain +
|
|
1226
|
+
(attachment[showField] ? attachment[showField] : attachment.url);
|
|
1227
|
+
showUrl = this.$commonFileUtil.getShowUrl(fullUrl);
|
|
1228
|
+
} else {
|
|
1229
|
+
showUrl = this.$commonFileUtil.getShowUrl(attachment);
|
|
1230
|
+
}
|
|
1231
|
+
return showUrl;
|
|
1232
|
+
},
|
|
1233
|
+
addPrivateFiles(rows) {
|
|
1234
|
+
var target = this.$refs.upload;
|
|
1235
|
+
let uploadFiles = target.uploadFiles;
|
|
1236
|
+
let sourceSns = uploadFiles
|
|
1237
|
+
.filter((row) => {
|
|
1238
|
+
return !!(
|
|
1239
|
+
row.response &&
|
|
1240
|
+
row.response.objx &&
|
|
1241
|
+
row.response.objx.sourceSn
|
|
1242
|
+
);
|
|
1243
|
+
})
|
|
1244
|
+
.map((row) => row.response.objx.sourceSn);
|
|
1245
|
+
|
|
1246
|
+
let newFiles = rows
|
|
1247
|
+
.filter((row) => !row.dirs && !sourceSns.includes(row.sn))
|
|
1248
|
+
.map((row) => {
|
|
1249
|
+
let item = {
|
|
1250
|
+
status: "success",
|
|
1251
|
+
name: row.fileName,
|
|
1252
|
+
size: row.fileSize,
|
|
1253
|
+
percentage: 100,
|
|
1254
|
+
uid: row.fileSn,
|
|
1255
|
+
raw: {
|
|
1256
|
+
lastModified: "",
|
|
1257
|
+
lastModifiedDate: new Date(),
|
|
1258
|
+
name: row.fileName,
|
|
1259
|
+
size: row.fileSize,
|
|
1260
|
+
type: "",
|
|
1261
|
+
uid: row.fileSn,
|
|
1262
|
+
webkitRelativePath: "",
|
|
1263
|
+
},
|
|
1264
|
+
response: {
|
|
1265
|
+
time: "",
|
|
1266
|
+
type: "success",
|
|
1267
|
+
objx: {
|
|
1268
|
+
thumbnail: row.thumbnail,
|
|
1269
|
+
extension: row.extension,
|
|
1270
|
+
large: row.large,
|
|
1271
|
+
fileSize: row.fileSize,
|
|
1272
|
+
domain: row.domain,
|
|
1273
|
+
source: row.source,
|
|
1274
|
+
medium: row.medium,
|
|
1275
|
+
url: row.url,
|
|
1276
|
+
sourceSn: row.sn,
|
|
1277
|
+
},
|
|
1278
|
+
content: "success",
|
|
1279
|
+
rmid: null,
|
|
1280
|
+
},
|
|
1281
|
+
url: row.domain + row.url,
|
|
1282
|
+
showUrl: this.getShowUrl(row),
|
|
1283
|
+
};
|
|
1284
|
+
return item;
|
|
1285
|
+
});
|
|
1286
|
+
uploadFiles.push(...newFiles);
|
|
1287
|
+
},
|
|
1288
|
+
confirmPrivateProfileDialog(rows) {
|
|
1289
|
+
this.addPrivateFiles(rows);
|
|
1290
|
+
},
|
|
1291
|
+
initPrivateUploadBt() {
|
|
1292
|
+
if (settingConfig.privateProfileCode && this.pickPrivateProfile) {
|
|
1293
|
+
this.$http({
|
|
1294
|
+
url: USER_PREFIX + "/file_store_area/getByCode",
|
|
1295
|
+
method: "post",
|
|
1296
|
+
data: { stringOne: settingConfig.privateProfileCode },
|
|
1297
|
+
failMsg: false,
|
|
1298
|
+
errorMsg: false,
|
|
1299
|
+
success: (res) => {
|
|
1300
|
+
this.showPrivateUploadBtn = res.objx ? true : false;
|
|
1301
|
+
},
|
|
1302
|
+
});
|
|
1303
|
+
} else {
|
|
1304
|
+
this.showPrivateUploadBtn = false;
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
initPickUploadMode() {
|
|
1308
|
+
this.showLocalUploadBtn = false;
|
|
1309
|
+
this.showPrivateUploadBtn = false;
|
|
1310
|
+
this.$http({
|
|
1311
|
+
url: USER_PREFIX + "/system_parameter/getByCode",
|
|
1312
|
+
method: "post",
|
|
1313
|
+
data: { code: "pickUploadMode" },
|
|
1314
|
+
success: (res) => {
|
|
1315
|
+
let value = !res.objx || !res.objx.value ? "2" : res.objx.value;
|
|
1316
|
+
if (value == "0") {
|
|
1317
|
+
//启用本地上传,个人文档上传
|
|
1318
|
+
this.showLocalUploadBtn = true;
|
|
1319
|
+
this.initPrivateUploadBt();
|
|
1320
|
+
} else if (value == "1") {
|
|
1321
|
+
//启用个人文档上传
|
|
1322
|
+
this.initPrivateUploadBt();
|
|
1323
|
+
} else if (value == "2") {
|
|
1324
|
+
//启用本地上传
|
|
1325
|
+
this.showLocalUploadBtn = true;
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
});
|
|
1329
|
+
},
|
|
1330
|
+
pasteEvent(e) {
|
|
1331
|
+
// e.preventDefault();
|
|
1332
|
+
e.stopPropagation();
|
|
1333
|
+
if (!this.pasteAreaStatus) {
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
if (!(e.clipboardData && e.clipboardData.items)) {
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
let files = Array.from(e.clipboardData.files);
|
|
1340
|
+
let getFileSuffix = this.$commonFileUtil.getFileSuffix;
|
|
1341
|
+
if (files.length) {
|
|
1342
|
+
let fileList = files.map((rawFile) => {
|
|
1343
|
+
let name = rawFile.name;
|
|
1344
|
+
let index = name.lastIndexOf(".");
|
|
1345
|
+
let fileSuffix = getFileSuffix(name);
|
|
1346
|
+
let fileName =
|
|
1347
|
+
index >= 0 ? name.substring(0, index).toString() : name.toString();
|
|
1348
|
+
let file = {
|
|
1349
|
+
name: rawFile.name,
|
|
1350
|
+
size: rawFile.size,
|
|
1351
|
+
raw: rawFile,
|
|
1352
|
+
showUrl: URL.createObjectURL(rawFile),
|
|
1353
|
+
fileName: fileName,
|
|
1354
|
+
fileSuffix: fileSuffix,
|
|
1355
|
+
};
|
|
1356
|
+
return file;
|
|
1357
|
+
});
|
|
1358
|
+
this.pasteList.push(...fileList);
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
deletePasteFile(index) {
|
|
1362
|
+
this.pasteList.splice(index, 1);
|
|
1363
|
+
},
|
|
1364
|
+
confirmPasteFile() {
|
|
1365
|
+
let target = this.$refs.upload;
|
|
1366
|
+
let innerTarget = target.$refs["upload-inner"];
|
|
1367
|
+
let pasteList = this.$baseLodash.cloneDeep(this.pasteList);
|
|
1368
|
+
let files = pasteList.map((item) => {
|
|
1369
|
+
let name = item.name;
|
|
1370
|
+
let fileRaw = item.raw;
|
|
1371
|
+
fileRaw.fileName = name;
|
|
1372
|
+
return fileRaw;
|
|
1373
|
+
});
|
|
1374
|
+
innerTarget.uploadFiles(files);
|
|
1375
|
+
this.$nextTick(() => {
|
|
1376
|
+
target.uploadFiles.forEach((uploadFile) => {
|
|
1377
|
+
let fileRaw = uploadFile.raw;
|
|
1378
|
+
if (fileRaw.fileName) {
|
|
1379
|
+
uploadFile.name = fileRaw.fileName;
|
|
1380
|
+
delete fileRaw.fileName;
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
});
|
|
1384
|
+
this.pasteList = [];
|
|
1385
|
+
},
|
|
1386
|
+
changeFileName(file) {
|
|
1387
|
+
if (file.fileSuffix) {
|
|
1388
|
+
file.name = (file.fileName + "." + file.fileSuffix).toString();
|
|
1389
|
+
} else {
|
|
1390
|
+
file.name = file.fileName.toString();
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
handleFileError(err, rawFile) {
|
|
1394
|
+
let target = this.$refs.upload;
|
|
1395
|
+
if (!target) return;
|
|
1396
|
+
const file = target.getFile(rawFile);
|
|
1397
|
+
const fileList = target.uploadFiles;
|
|
1398
|
+
|
|
1399
|
+
file.status = "fail";
|
|
1400
|
+
file.failMsg = err && err.message ? err.message : null;
|
|
1401
|
+
|
|
1402
|
+
// fileList.splice(fileList.indexOf(file), 1);
|
|
1403
|
+
|
|
1404
|
+
target.onError(err, file, target.uploadFiles);
|
|
1405
|
+
target.onChange(file, target.uploadFiles);
|
|
1406
|
+
this.updateUploadingStatus();
|
|
1407
|
+
},
|
|
1408
|
+
choosePasteArea(e) {
|
|
1409
|
+
e.stopPropagation();
|
|
1410
|
+
this.pasteAreaStatus = true;
|
|
1411
|
+
},
|
|
1412
|
+
openFileNameDialog(row, index) {
|
|
1413
|
+
this.editFileName = row.fileName?.toString();
|
|
1414
|
+
this.editFileSuffix = row.fileSuffix?.toString();
|
|
1415
|
+
this.editFileIndex = index;
|
|
1416
|
+
this.showFileNameDialog = true;
|
|
1417
|
+
},
|
|
1418
|
+
confirmFileNameDialog() {
|
|
1419
|
+
if (!this.editFileName) {
|
|
1420
|
+
this.$message({
|
|
1421
|
+
message: this.$t2("文件名不能为空", "components.VabUpload.warnMsg3"),
|
|
1422
|
+
type: "error",
|
|
1423
|
+
showClose: true,
|
|
1424
|
+
duration: 3000,
|
|
1425
|
+
});
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
let editFileIndex = this.editFileIndex;
|
|
1429
|
+
let file = this.pasteList[editFileIndex];
|
|
1430
|
+
file.fileName = this.editFileName.toString();
|
|
1431
|
+
file.name = (file.fileName + "." + file.fileSuffix).toString();
|
|
1432
|
+
this.showFileNameDialog = false;
|
|
1433
|
+
},
|
|
1434
|
+
},
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
function formatFileSize(fileSize) {
|
|
1439
|
+
fileSize = fileSize || 0;
|
|
1440
|
+
if (fileSize < 1024) {
|
|
1441
|
+
return fileSize + "B";
|
|
1442
|
+
} else if (fileSize < 1024 * 1024) {
|
|
1443
|
+
var temp = fileSize / 1024;
|
|
1444
|
+
temp = temp.toFixed(2);
|
|
1445
|
+
return temp + "KB";
|
|
1446
|
+
} else if (fileSize < 1024 * 1024 * 1024) {
|
|
1447
|
+
var temp = fileSize / (1024 * 1024);
|
|
1448
|
+
temp = temp.toFixed(2);
|
|
1449
|
+
return temp + "MB";
|
|
1450
|
+
} else {
|
|
1451
|
+
var temp = fileSize / (1024 * 1024 * 1024);
|
|
1452
|
+
temp = temp.toFixed(2);
|
|
1453
|
+
return temp + "GB";
|
|
1454
|
+
}
|
|
1455
|
+
}``
|
|
1456
|
+
|
|
1457
|
+
export const mixins = tmixins;
|