cloud-web-corejs 1.1.0-dev.6 → 1.1.0-dev.61
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/README.md +38 -0
- package/bin/core-resources.js +16 -0
- package/bin/create-child-app.js +34 -0
- package/docs/child-app/README.md +95 -0
- package/docs/child-app/activiti-resources.md +63 -0
- package/docs/child-app/generate-prompt.md +55 -0
- package/docs/child-app/luckysheet-resources.md +80 -0
- package/docs/child-app/public-resources-plan.md +288 -0
- package/docs/child-app/resources-implementation.md +101 -0
- package/docs/child-app/tinymce-resources.md +88 -0
- package/docs/child-app/validation.md +34 -0
- package/docs/qiankun/346/216/245/345/205/245/345/215/217/350/256/256.md +298 -0
- package/docs/qiankun/350/257/246/346/203/205/346/211/277/350/275/275/345/255/220/345/272/224/347/224/250/345/257/271/346/216/245/346/270/205/345/215/225.md +111 -0
- package/package.json +29 -4
- package/resource-tools/index.js +126 -0
- package/src/app-bootstrap.js +531 -0
- package/src/app-bootstrap.sync.js +502 -0
- package/src/boot-assets.legacy.js +13 -0
- package/src/boot-assets.next.js +7 -0
- package/src/components/Qrcode/fileParse.vue +11 -0
- package/src/components/Tinymce/dynamicLoadScript.js +51 -59
- package/src/components/Tinymce/index.vue +382 -336
- package/src/components/Tinymce/mce-chrome.scss +150 -0
- package/src/components/VabUpload/image-viewer.vue +18 -10
- package/src/components/VabUpload/index.js +11 -4
- package/src/components/VabUpload/index.vue +1 -1
- package/src/components/VabUpload/mixins/fileLibraryDialog.js +2 -0
- package/src/components/VabUpload/mixins.js +72 -40
- package/src/components/VabUpload/partUploadConfig.js +95 -0
- package/src/components/VabUpload/privateProfileDialogMixins.js +2 -0
- package/src/components/VabUpload/style.scss +282 -0
- package/src/components/VabUpload/view.vue +19 -18
- package/src/components/baseArea/index.vue +2 -2
- package/src/components/baseInputExport/mixins.js +1 -6
- package/src/components/bizTab/BizTabListPage.vue +66 -33
- package/src/components/bizTab/README.md +3 -1
- package/src/components/bizTab/bizBillDetailMixin.js +2 -0
- package/src/components/code-editor/ace-chrome.scss +17 -0
- package/src/components/code-editor/index.vue +361 -340
- package/src/components/errorMsg/index.vue +142 -13
- package/src/components/errorMsg/mixins.js +53 -0
- package/src/components/excelExport/conditionExportConfig.js +112 -0
- package/src/components/excelExport/exportColumnMemory.js +118 -0
- package/src/components/excelExport/exportFieldDialog.vue +50 -38
- package/src/components/excelExport/exportType.js +8 -0
- package/src/components/excelExport/index.js +30 -13
- package/src/components/excelExport/index.vue +7 -1
- package/src/components/excelExport/mixins.js +782 -293
- package/src/components/excelImport/index.vue +156 -156
- package/src/components/excelImport/mixins.js +888 -834
- package/src/components/fileLibrary/mixins/indexMixins.js +2 -0
- package/src/components/fileLibrary/style.scss +579 -0
- package/src/components/formDialog/index.vue +11 -8
- package/src/components/hiprint/style.scss +188 -0
- package/src/components/hiprint/view/json-view.vue +4 -4
- package/src/components/jdPrint/mixins.js +2 -0
- package/src/components/jsonImport/index.vue +1 -1
- package/src/components/jsonImport/mixins.js +6 -10
- package/src/components/langImport/index.vue +1 -1
- package/src/components/langImport/mixins.js +6 -10
- package/src/components/luckysheet/loadResources.js +64 -0
- package/src/components/luckysheet/view.vue +239 -210
- package/src/components/mobile/buttonGroup/index.vue +1 -1
- package/src/components/mobile/wf/addTaskUserdialog.vue +100 -80
- package/src/components/mobile/wf/content.vue +1734 -1662
- package/src/components/mobile/wf/deleteTaskUserDialog.vue +73 -54
- package/src/components/mobile/wf/selectUserDialog.vue +118 -0
- package/src/components/mobile/wf/setCandidateDialog.vue +69 -48
- package/src/components/mobile/wf/urgingDialog.vue +75 -52
- package/src/components/mobile/wf/wfModifyDialog.vue +4 -0
- package/src/components/obsUpload/index.js +4 -1
- package/src/components/obsUpload/index.vue +1 -1
- package/src/components/obsUpload/mixins.js +45 -15
- package/src/components/onlineTalk/index.vue +4 -4
- package/src/components/onlineTalk/mixins.js +21 -7
- package/src/components/table/index.js +96 -81
- package/src/components/table/plugins/cell-area/index.js +10 -3
- package/src/components/table/style.scss +1399 -0
- package/src/components/table/vxeFilter/mixin.js +28 -18
- package/src/components/wf/content.vue +3 -2
- package/src/components/wf/content2.vue +1 -1
- package/src/components/wf/style.scss +265 -0
- package/src/components/wf/wf.js +7 -0
- package/src/components/wf/wfActionItems.js +3 -0
- package/src/components/wf/wfStartDialog.vue +1 -0
- package/src/components/wf/wfTransferEnabled.js +54 -0
- package/src/components/wf/wfUtil.js +47 -29
- package/src/components/wf/wfVisibility.js +6 -0
- package/src/components/xform/docs/2026-07 table/344/270/216excelExport/344/277/256/345/244/215/345/217/212/345/257/274/345/207/272/344/274/230/345/214/226.md" +64 -57
- package/src/components/xform/docs/2026-08 xform H5 P0 /345/256/236/347/216/260/350/247/204/346/240/274.md" +1 -1
- package/src/components/xform/docs/2026-08 xform /347/247/273/345/212/250/347/253/257/345/270/203/345/261/200/345/257/271/351/275/220 bill_setting /346/226/271/346/241/210.md" +1 -1
- package/src/components/xform/docs/2026-09 /345/212/250/346/200/201/345/255/227/346/256/265/350/247/204/345/210/231/344/270/216/346/265/201/347/250/213/346/216/247/345/210/266/346/211/247/350/241/214/351/241/272/345/272/217/350/220/275/345/234/260/346/226/271/346/241/210.md" +409 -0
- package/src/components/xform/docs/2026-09 /346/235/241/344/273/266/345/257/274/345/207/272/345/244/247/346/225/260/346/215/256/351/207/217/345/264/251/346/272/203/346/216/222/346/237/245.md" +389 -0
- package/src/components/xform/docs/2026-09 /346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206P0/344/273/243/347/240/201/350/257/204/345/256/241.md" +255 -0
- package/src/components/xform/docs/2026-09 /346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206P0/346/265/213/350/257/225/351/252/214/350/257/201/345/256/236/346/226/275/346/226/207/346/241/243.md" +595 -0
- package/src/components/xform/docs/2026-09 /347/274/226/350/276/221/350/241/250/350/241/214/345/206/205/344/277/235/345/255/230/346/240/241/351/252/214/350/214/203/345/233/264/344/270/216/345/210/227/345/277/205/345/241/253/350/247/243/346/236/220/344/277/256/345/244/215.md" +233 -0
- package/src/components/xform/docs/2026-09 /350/241/250/345/215/225/345/257/274/345/205/245/351/200/232/351/201/223/346/242/263/347/220/206/344/270/216/350/220/275/345/234/260/346/226/271/346/241/210.md" +745 -0
- package/src/components/xform/docs//346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206/344/270/216/344/277/256/345/244/215/350/220/275/345/234/260/346/226/271/346/241/210.md +324 -0
- package/src/components/xform/form-designer/designer.js +2133 -2100
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +7 -0
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -2
- package/src/components/xform/form-designer/form-widget/container-widget/detail-h5-widget.vue +243 -227
- package/src/components/xform/form-designer/form-widget/container-widget/h5-card-pane-widget.vue +228 -207
- package/src/components/xform/form-designer/form-widget/container-widget/h5-card-widget.vue +165 -136
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +30 -4
- package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +190 -185
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +2657 -1774
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +27 -4
- 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/area-select-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +1 -1
- 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 +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/descriptions-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/divider-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +35 -4
- 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 +64 -10
- package/src/components/xform/form-designer/form-widget/field-widget/file-upload-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +14 -4
- package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +19 -6
- package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/index.js +10 -1
- package/src/components/xform/form-designer/form-widget/field-widget/input-batch-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +29 -3
- package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/news-list-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/picture-upload-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/rate-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/rich-editor-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/row-col-select-widget.vue +64 -0
- package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -2
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -145
- package/src/components/xform/form-designer/form-widget/field-widget/slider-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +3 -2
- package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/textarea-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/title-head-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +3 -3
- package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +25 -1
- package/src/components/xform/form-designer/form-widget/field-widget/vue-page-widget.vue +1 -1
- package/src/components/xform/form-designer/indexMixin.js +27 -0
- package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +687 -602
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +269 -36
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +335 -12
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +23 -7
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +13 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +846 -860
- package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tab-lazyRender-editor.vue +27 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onTabChange-editor.vue +28 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onTabClick-editor.vue +28 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +62 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +142 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/empty-number-input.vue +51 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +27 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +33 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +2 -4
- package/src/components/xform/form-designer/setting-panel/property-editor/suffixIconClickable-editor.vue +23 -0
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +18 -4
- package/src/components/xform/form-designer/toolbar-panel/index.vue +884 -874
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +13 -0
- package/src/components/xform/form-designer/widget-panel/index.vue +11 -7
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +15 -2
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +152 -9
- package/src/components/xform/form-render/container-item/containerItemMixin.js +93 -8
- package/src/components/xform/form-render/container-item/data-table-item.vue +352 -347
- package/src/components/xform/form-render/container-item/data-table-mixin.js +7261 -5985
- package/src/components/xform/form-render/container-item/detail-h5-item.vue +48 -19
- package/src/components/xform/form-render/container-item/detail-item.vue +350 -446
- package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +55 -1
- package/src/components/xform/form-render/container-item/list-h5-item.vue +261 -178
- package/src/components/xform/form-render/container-item/panel-item.vue +1 -1
- package/src/components/xform/form-render/container-item/tab-item.vue +177 -129
- package/src/components/xform/form-render/fieldControlEngine.js +218 -0
- package/src/components/xform/form-render/fieldControlMixin.js +536 -0
- package/src/components/xform/form-render/index.vue +164 -153
- package/src/components/xform/form-render/indexMixin.js +5443 -5311
- package/src/components/xform/form-render/pageDialogScope.js +54 -0
- package/src/components/xform/icon-picker/index.vue +1 -1
- package/src/components/xform/lang/en-US.js +8 -0
- package/src/components/xform/lang/zh-CN.js +9 -0
- package/src/components/xform/mixins/businessLock.js +59 -0
- package/src/components/xform/mixins/defaultHandle.js +713 -707
- package/src/components/xform/mixins/scriptHttp.js +42 -21
- package/src/components/xform/mixins/wfStart.js +105 -0
- package/src/components/xform/mixins/wfVisibility.js +33 -0
- package/src/components/xform/styles/census.scss +288 -0
- package/src/components/xform/styles/containers.scss +215 -0
- package/src/components/xform/styles/designer.scss +904 -0
- package/src/components/xform/styles/detail-temp.scss +71 -0
- package/src/components/xform/styles/h5-designer.scss +191 -0
- package/src/components/xform/styles/h5-runtime.scss +520 -0
- package/src/components/xform/styles/h5.scss +836 -516
- package/src/components/xform/styles/skins.scss +398 -0
- package/src/components/xform/styles/table-layout.scss +91 -0
- package/src/components/xform/styles/titles.scss +255 -0
- package/src/components/xform/utils/dynamicSchemaUtil.js +385 -361
- package/src/components/xform/utils/fixedQueryUtil.js +29 -4
- package/src/components/xform/utils/serviceNameCache.js +69 -0
- package/src/components/xform/utils/tableColumnHelper.js +46 -4
- package/src/components/xform/utils/util.js +1776 -1708
- package/src/core-resources/css/h5.scss +548 -0
- package/src/core-resources/css/iconfont.css +1447 -0
- package/src/core-resources/font/iconfont.ttf +0 -0
- package/src/core-resources/font/iconfont.woff +0 -0
- package/src/core-resources/font/iconfont.woff2 +0 -0
- package/src/core-resources/images/default-header.png +0 -0
- package/src/core-resources/images/ico-default_wenjian.svg +1 -0
- package/src/core-resources/images/ico-excel.svg +1 -0
- package/src/core-resources/images/ico-ftl.svg +7 -0
- package/src/core-resources/images/ico-html.svg +1 -0
- package/src/core-resources/images/ico-java.svg +1 -0
- package/src/core-resources/images/ico-music.svg +1 -0
- package/src/core-resources/images/ico-pdf.svg +1 -0
- package/src/core-resources/images/ico-photo.svg +1 -0
- package/src/core-resources/images/ico-ppt.svg +1 -0
- package/src/core-resources/images/ico-psd.svg +1 -0
- package/src/core-resources/images/ico-service.png +0 -0
- package/src/core-resources/images/ico-txt.svg +1 -0
- package/src/core-resources/images/ico-video.svg +1 -0
- package/src/core-resources/images/ico-vue.svg +8 -0
- package/src/core-resources/images/ico-wenjianjia.svg +1 -0
- package/src/core-resources/images/ico-wrod.svg +1 -0
- package/src/core-resources/images/ico-xml.svg +1 -0
- package/src/core-resources/images/ico-yasuobao.svg +1 -0
- package/src/core-resources/images/icon-error.png +0 -0
- package/src/core-resources/images/icon-tips.png +0 -0
- package/src/core-resources/images/nodata.png +0 -0
- package/src/core-resources/images/nodata2.png +0 -0
- package/src/directive/append-to-body/index.js +48 -0
- package/src/directive/el-dialog-center/index.js +3 -2
- package/src/directive/el-drag-dialog/drag.js +33 -4
- package/src/icons/index.js +9 -0
- package/src/icons/svg/404.svg +1 -0
- package/src/icons/svg/alert.svg +1 -0
- package/src/icons/svg/bug.svg +1 -0
- package/src/icons/svg/button.svg +1 -0
- package/src/icons/svg/card.svg +1 -0
- package/src/icons/svg/cascader-field.svg +1 -0
- package/src/icons/svg/census.svg +1 -0
- package/src/icons/svg/chart.svg +1 -0
- package/src/icons/svg/checkbox-field.svg +1 -0
- package/src/icons/svg/clipboard.svg +1 -0
- package/src/icons/svg/color-field.svg +1 -0
- package/src/icons/svg/component.svg +1 -0
- package/src/icons/svg/custom-component.svg +1 -0
- package/src/icons/svg/dashboard.svg +1 -0
- package/src/icons/svg/data-table.svg +1 -0
- package/src/icons/svg/date-field.svg +1 -0
- package/src/icons/svg/date-range-field.svg +1 -0
- package/src/icons/svg/descriptions.svg +1 -0
- package/src/icons/svg/divider.svg +1 -0
- package/src/icons/svg/document.svg +1 -0
- package/src/icons/svg/documentation.svg +1 -0
- package/src/icons/svg/drag.svg +1 -0
- package/src/icons/svg/echart-category.svg +1 -0
- package/src/icons/svg/echart-pie.svg +1 -0
- package/src/icons/svg/echart.svg +1 -0
- package/src/icons/svg/edit.svg +1 -0
- package/src/icons/svg/education.svg +1 -0
- package/src/icons/svg/email.svg +1 -0
- package/src/icons/svg/example.svg +1 -0
- package/src/icons/svg/excel.svg +1 -0
- package/src/icons/svg/exit-fullscreen.svg +1 -0
- package/src/icons/svg/eye-open.svg +1 -0
- package/src/icons/svg/eye.svg +1 -0
- package/src/icons/svg/file-upload-field.svg +1 -0
- package/src/icons/svg/form.svg +1 -0
- package/src/icons/svg/fullscreen.svg +1 -0
- package/src/icons/svg/github.svg +1 -0
- package/src/icons/svg/grid.svg +1 -0
- package/src/icons/svg/guide.svg +1 -0
- package/src/icons/svg/html-text.svg +1 -0
- package/src/icons/svg/ico-more.svg +1 -0
- package/src/icons/svg/ico-wenjianjia.svg +1 -0
- package/src/icons/svg/icon.svg +1 -0
- package/src/icons/svg/input-batch.svg +1 -0
- package/src/icons/svg/international.svg +1 -0
- package/src/icons/svg/language.svg +1 -0
- package/src/icons/svg/link.svg +1 -0
- package/src/icons/svg/list-export.svg +1 -0
- package/src/icons/svg/list.svg +1 -0
- package/src/icons/svg/lock.svg +1 -0
- package/src/icons/svg/message.svg +1 -0
- package/src/icons/svg/money.svg +1 -0
- package/src/icons/svg/nested.svg +1 -0
- package/src/icons/svg/news-list.svg +1 -0
- package/src/icons/svg/node-tree.svg +1 -0
- package/src/icons/svg/number-field.svg +1 -0
- package/src/icons/svg/password.svg +1 -0
- package/src/icons/svg/pdf.svg +1 -0
- package/src/icons/svg/people.svg +1 -0
- package/src/icons/svg/peoples.svg +1 -0
- package/src/icons/svg/picture-upload-field.svg +1 -0
- package/src/icons/svg/qq.svg +1 -0
- package/src/icons/svg/query.svg +1 -0
- package/src/icons/svg/radio-field.svg +1 -0
- package/src/icons/svg/rate-field.svg +1 -0
- package/src/icons/svg/redo.svg +1 -0
- package/src/icons/svg/rich-editor-field.svg +1 -0
- package/src/icons/svg/search.svg +1 -0
- package/src/icons/svg/searchbox.svg +1 -0
- package/src/icons/svg/section.svg +1 -0
- package/src/icons/svg/select-field.svg +1 -0
- package/src/icons/svg/shopping.svg +1 -0
- package/src/icons/svg/size.svg +1 -0
- package/src/icons/svg/skill.svg +1 -0
- package/src/icons/svg/slider-field.svg +1 -0
- package/src/icons/svg/slot-component.svg +1 -0
- package/src/icons/svg/slot-field.svg +1 -0
- package/src/icons/svg/star.svg +1 -0
- package/src/icons/svg/static-text.svg +1 -0
- package/src/icons/svg/status.svg +1 -0
- package/src/icons/svg/sub-form.svg +1 -0
- package/src/icons/svg/switch-field.svg +1 -0
- package/src/icons/svg/tab.svg +1 -0
- package/src/icons/svg/table.svg +1 -0
- package/src/icons/svg/text-field.svg +1 -0
- package/src/icons/svg/text.svg +1 -0
- package/src/icons/svg/textarea-field.svg +1 -0
- package/src/icons/svg/theme.svg +1 -0
- package/src/icons/svg/time-field.svg +1 -0
- package/src/icons/svg/time-range-field.svg +1 -0
- package/src/icons/svg/tips-text.svg +1 -0
- package/src/icons/svg/title-head.svg +1 -0
- package/src/icons/svg/tree-pane.svg +1 -0
- package/src/icons/svg/tree-table.svg +1 -0
- package/src/icons/svg/tree.svg +1 -0
- package/src/icons/svg/undo.svg +1 -0
- package/src/icons/svg/uploadbox.svg +1 -0
- package/src/icons/svg/user.svg +1 -0
- package/src/icons/svg/vf-box.svg +1 -0
- package/src/icons/svg/vf-dialog.svg +1 -0
- package/src/icons/svg/vf-drawer.svg +1 -0
- package/src/icons/svg/vue-sfc.svg +1 -0
- package/src/icons/svg/wechat.svg +1 -0
- package/src/icons/svg/zip.svg +1 -0
- package/src/index.js +2 -510
- package/src/index.next.js +5 -0
- package/src/index.sync.js +5 -0
- package/src/layout/components/Sidebar/default.vue +1656 -1655
- package/src/layout/components/TagsView/index.vue +330 -323
- package/src/layout/components/TagsView/style.scss +92 -0
- package/src/layout/components/watermark/index.vue +1 -1
- package/src/layout/defaultLayout.vue +2 -2
- package/src/router/index.js +43 -48
- package/src/router/modules/customer.js +12 -0
- package/src/store/modules/settings.js +1 -1
- package/src/store/modules/tagsView.js +241 -217
- package/src/store/modules/user.js +16 -12
- package/src/styles/btn.scss +315 -0
- package/src/styles/dialog.scss +1710 -0
- package/src/styles/element-ui.scss +1076 -0
- package/src/styles/element-variables.scss +31 -0
- package/src/styles/global.scss +115 -0
- package/src/styles/index.scss +245 -0
- package/src/styles/layout-skins.scss +840 -0
- package/src/styles/legacy-base.scss +19 -0
- package/src/styles/menu-icons.scss +75 -0
- package/src/styles/mixin.scss +80 -0
- package/src/styles/nprogress.scss +14 -0
- package/src/styles/page-shell.scss +723 -0
- package/src/styles/sidebar.scss +296 -0
- package/src/styles/split-handle.scss +52 -0
- package/src/styles/theme-variables.scss +7 -0
- package/src/styles/transition.scss +48 -0
- package/src/styles/utilities.scss +253 -0
- package/src/styles/variables.scss +72 -0
- package/src/utils/baseDictsCache.js +197 -0
- package/src/utils/chunkLoadError.js +24 -0
- package/src/utils/featureResources.js +57 -0
- package/src/utils/importLimit.js +72 -0
- package/src/utils/pdfUtil.js +6 -1
- package/src/utils/request.js +149 -9
- package/src/utils/resolveViewComponent.js +45 -90
- package/src/utils/runtimeRecovery.js +105 -0
- package/src/utils/swiperLoader.js +20 -0
- package/src/utils/vab.js +1334 -1283
- package/src/utils/xlsxLoader.js +29 -0
- package/src/views/bd/setting/formVersion/compareContMixin.scss +1 -1
- package/src/views/bd/setting/form_template/edit.vue +378 -356
- package/src/views/bd/setting/form_template/formDesignerDialog.vue +6 -0
- package/src/views/bd/setting/form_template/formTemplateType.js +43 -0
- package/src/views/bd/setting/form_template/list.vue +304 -303
- package/src/views/bd/setting/form_template/mixins/edit.js +344 -280
- package/src/views/bd/setting/form_template/mixins/list.js +749 -721
- package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
- package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
- package/src/views/mobile/user/area/dialog.vue +1 -1
- package/src/views/mobile/user/user/dialog.vue +1 -1
- package/src/views/user/bill_setting/mixins/wf.js +8 -0
- package/src/views/user/bill_setting/render.vue +1 -1
- package/src/views/user/commMenu/index.vue +3 -1
- package/src/views/user/commMenu/style.scss +123 -0
- package/src/views/user/common_attribute/edit.vue +2 -0
- package/src/views/user/common_attribute/itemEdit.vue +2 -0
- package/src/views/user/file_view_ins/list.vue +970 -970
- package/src/views/user/form/form_template/list.vue +527 -506
- package/src/views/user/form/vform/designer.vue +823 -821
- package/src/views/user/form/view/list.vue +24 -1
- package/src/views/user/home/default.vue +1124 -1117
- package/src/views/user/home/default2.vue +12 -8
- package/src/views/user/home/index.vue +102 -102
- package/src/views/user/home/wjl/content.vue +1581 -1569
- package/src/views/user/intf_permission/edit.vue +230 -0
- package/src/views/user/intf_permission/list.vue +196 -0
- package/src/views/user/menuFallback/index.vue +23 -0
- package/src/views/user/notify_message/dialog.vue +139 -139
- package/src/views/user/outLink/form_view.vue +202 -202
- package/src/views/user/outLink/index.vue +110 -110
- package/src/views/user/role/edit.vue +4 -0
- package/src/views/user/role/role-box.scss +83 -0
- package/src/views/user/role/voc_edit.vue +4 -0
- package/src/views/user/user/list.vue +28 -6
- package/src/views/user/wf/iframe/index.vue +51 -51
- package/src/views/user/wf/iframe/index2.vue +64 -64
- package/src/views/user/wf/wf_diy_attribute/edit.vue +1 -1
- package/src/views/user/wf/wf_manage/list2.vue +871 -871
- package/src/views/user/wf/wf_manage/wfContentDialog.vue +177 -126
- package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
- package/src/views/user/wf/wf_obj_config/importItemDialog.vue +1 -1
- package/src/views/user/wf/wf_obj_config/list.vue +747 -746
- package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
- package/templates/child-app/.env +3 -0
- package/templates/child-app/README.md +49 -0
- package/templates/child-app/app.config.js +6 -0
- package/templates/child-app/babel.config.js +1 -0
- package/templates/child-app/core-resources.config.js +15 -0
- package/templates/child-app/gitignore +7 -0
- package/templates/child-app/package.json +34 -0
- package/templates/child-app/public/index.html +12 -0
- package/templates/child-app/src/assets/401_images/401.gif +0 -0
- package/templates/child-app/src/assets/404_images/404.png +0 -0
- package/templates/child-app/src/assets/404_images/404_cloud.png +0 -0
- package/templates/child-app/src/assets/logo.png +0 -0
- package/templates/child-app/src/corejsConfig.js +2 -0
- package/templates/child-app/src/icons/index.js +2 -0
- package/templates/child-app/src/icons/svg/child-demo.svg +1 -0
- package/templates/child-app/src/layout/index.vue +4 -0
- package/templates/child-app/src/main.js +5 -0
- package/templates/child-app/src/prefixConfig.js +13 -0
- package/templates/child-app/src/resources/css/login.scss +29 -0
- package/templates/child-app/src/resources/images/bg-login5.jpg +0 -0
- package/templates/child-app/src/resources/images/home-img.png +0 -0
- package/templates/child-app/src/router/modules/customer.js +3 -0
- package/templates/child-app/src/settings.js +25 -0
- package/templates/child-app/src/styles/app.scss +2 -0
- package/templates/child-app/src/views/demo/detail.vue +19 -0
- package/templates/child-app/src/views/demo/list.vue +38 -0
- package/templates/child-app/src/views/user/login/index.vue +18 -0
- package/templates/child-app/vue.config.js +107 -0
- package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +0 -285
- package/src/components/xform/form-render/formDynamicFieldMixin.js +0 -131
- package/src/views/demo/bizTab/bill/billConfig.js +0 -41
- package/src/views/demo/bizTab/bill/detail.vue +0 -436
- package/src/views/demo/bizTab/bill/list.vue +0 -288
- package/src/views/demo/bizTab/bill/productDialog.vue +0 -176
- package/src/views/demo/bizTab/simple/billApi.js +0 -123
- package/src/views/demo/bizTab/simple/detail.vue +0 -407
- package/src/views/demo/bizTab/simple/list.vue +0 -217
- package/src/views/demo/bizTab/standalone/index.vue +0 -121
- package/src/views/demo/bizTab/wf/billConfig.js +0 -44
- package/src/views/demo/bizTab/wf/detail.vue +0 -661
- package/src/views/demo/bizTab/wf/list.vue +0 -242
- package/src/views/user/outLink/cc_form_view.vue +0 -188
- /package/src/{resources → core-resources}/js/base/common.js +0 -0
|
@@ -1,1774 +1,2657 @@
|
|
|
1
|
-
/**version-1.0*/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
let tmixins = {};
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
columns =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.$
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
let
|
|
246
|
-
let
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
this.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
let
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
)
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
})
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
},
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
},
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
},
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
);
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
let
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
};
|
|
1774
|
-
|
|
1
|
+
/**version-1.0*/
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import SparkMD5 from "spark-md5";
|
|
4
|
+
import { loadXlsx } from "@base/utils/xlsxLoader";
|
|
5
|
+
|
|
6
|
+
let tmixins = {};
|
|
7
|
+
import { getToken } from "../../../../../utils/auth";
|
|
8
|
+
import XEUtils from "xe-utils";
|
|
9
|
+
import { getErrorMsg } from "@base/utils/index.js";
|
|
10
|
+
import {
|
|
11
|
+
getImportCellText,
|
|
12
|
+
getImportFileSizeLimit,
|
|
13
|
+
getImportRowLimit,
|
|
14
|
+
isImportFileOversize,
|
|
15
|
+
isImportRowsOverLimit,
|
|
16
|
+
toFileSizeMb,
|
|
17
|
+
} from "@base/utils/importLimit";
|
|
18
|
+
import {
|
|
19
|
+
normalizeAttachmentValue,
|
|
20
|
+
toUrlValue,
|
|
21
|
+
} from "@base/components/xform/utils/attachmentValueUtil";
|
|
22
|
+
|
|
23
|
+
let configUtil = {
|
|
24
|
+
baseUrl: process.env.VUE_APP_BASE_API,
|
|
25
|
+
getToken,
|
|
26
|
+
};
|
|
27
|
+
// 执行壳打在行上的记账字段:只服务进度框与结果表。行对象是原地复用的,
|
|
28
|
+
// 这几个字段不剥掉就会跟着数据进明细表格,最终随表单一起提交给后端。
|
|
29
|
+
const IMPORT_META_FIELDS = [
|
|
30
|
+
"impSeq",
|
|
31
|
+
"impNumber",
|
|
32
|
+
"_resultType",
|
|
33
|
+
"_resultContent",
|
|
34
|
+
];
|
|
35
|
+
// 后台校验回包里的协议字段,合并补数时不能盖掉原行的序号
|
|
36
|
+
const BACKEND_VALIDATE_SKIP_FIELDS = [
|
|
37
|
+
"impSeq",
|
|
38
|
+
"impNumber",
|
|
39
|
+
"impReturnType",
|
|
40
|
+
"impReturnMsg",
|
|
41
|
+
];
|
|
42
|
+
// 一格里填多个附件的分隔符,与 attachmentValueUtil 的 URL_SEPARATOR_REG 同口径
|
|
43
|
+
const IMPORT_ATTACH_SEPARATOR_REG = /[,\n\r]+/;
|
|
44
|
+
// 可用的附件地址:带协议(或协议相对)的绝对 URL,或以 / 开头的存储路径
|
|
45
|
+
const IMPORT_ATTACH_URL_REG = /^((https?:)?\/\/|\/)/i;
|
|
46
|
+
const IMPORT_ATTACH_PREFIX = "attachments_";
|
|
47
|
+
// 「值存为URL」列名里的取值字段 token,与附件字段的 urlValueField 同一套取值
|
|
48
|
+
const IMPORT_ATTACH_URL_FIELDS = ["url", "large", "medium", "thumbnail"];
|
|
49
|
+
// importTimer / loadingObj 原为模块级单例:两个导入弹窗并存时后者覆盖前者引用,
|
|
50
|
+
// 前一个 interval(100ms/次)与 loading 永久失控——已改为实例属性 this.importTimer / this.loadingObj
|
|
51
|
+
tmixins = {
|
|
52
|
+
name: "excelImport",
|
|
53
|
+
props: ["param", "parentTarget"],
|
|
54
|
+
inject: ["getReportTemplate", "formHttp"],
|
|
55
|
+
data() {
|
|
56
|
+
return {
|
|
57
|
+
excTime: 0,
|
|
58
|
+
showImportDialog: false,
|
|
59
|
+
showImportDialog2: false,
|
|
60
|
+
falseValue: false,
|
|
61
|
+
fileRaw: false,
|
|
62
|
+
isEnd: false,
|
|
63
|
+
currentIndex: 0,
|
|
64
|
+
excelTemplate: "",
|
|
65
|
+
prefix: "/user",
|
|
66
|
+
dataSize: 0,
|
|
67
|
+
totalSuccessNum: 0,
|
|
68
|
+
totalErrorNum: 0,
|
|
69
|
+
percentageNum: 0,
|
|
70
|
+
successRows: [],
|
|
71
|
+
failRows: [],
|
|
72
|
+
oriCols: [],
|
|
73
|
+
showImportResult: false,
|
|
74
|
+
resultType: "",
|
|
75
|
+
option: {},
|
|
76
|
+
showContent: false,
|
|
77
|
+
resOption: {},
|
|
78
|
+
fileCellFields: [],
|
|
79
|
+
// 「值存为URL」附件列:源列名 → { urlField, target },见 parseUrlAttachmentField
|
|
80
|
+
urlAttachFields: {},
|
|
81
|
+
importLoading: false,
|
|
82
|
+
loadingTitle: null,
|
|
83
|
+
backendValidating: false,
|
|
84
|
+
|
|
85
|
+
percent1: 0,
|
|
86
|
+
percent2: 0,
|
|
87
|
+
percent3: 0,
|
|
88
|
+
|
|
89
|
+
loadingPercent: 0,
|
|
90
|
+
handleRowSize: 1,
|
|
91
|
+
|
|
92
|
+
headerRows: 3,
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
computed: {
|
|
96
|
+
/** 进度框左下角的"已处理/总行数",由记账器维护的两个计数派生。 */
|
|
97
|
+
doneNum() {
|
|
98
|
+
return (this.totalSuccessNum || 0) + (this.totalErrorNum || 0);
|
|
99
|
+
},
|
|
100
|
+
importFileLimitSize() {
|
|
101
|
+
return Math.min(
|
|
102
|
+
this.param?.importOption?.importFileLimitSize || 200,
|
|
103
|
+
200
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
created() {
|
|
108
|
+
this.exc();
|
|
109
|
+
},
|
|
110
|
+
beforeDestroy() {
|
|
111
|
+
this.clearImportTimer();
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
initResGird() {
|
|
115
|
+
let that = this;
|
|
116
|
+
let tableRef = "resGrid";
|
|
117
|
+
let columns = [
|
|
118
|
+
{
|
|
119
|
+
type: "checkbox",
|
|
120
|
+
fixed: "left",
|
|
121
|
+
width: 48,
|
|
122
|
+
resizable: false,
|
|
123
|
+
headerClassName: "vxe-hcs",
|
|
124
|
+
className: "vxe-hcs",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
field: "impNumber",
|
|
128
|
+
title: this.$t2("行号", "components.excelImport.impNumber"),
|
|
129
|
+
width: 100,
|
|
130
|
+
fixed: "left",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
field: "_resultContent",
|
|
134
|
+
title: this.$t2("结果", "components.excelImport.resultContent"),
|
|
135
|
+
width: 250,
|
|
136
|
+
fixed: "left",
|
|
137
|
+
slots: {
|
|
138
|
+
default: ({ row, $rowIndex, $table }) => {
|
|
139
|
+
return that.handleRes(row._resultContent);
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
let cCols = this.oriCols.map((oriCol, index) => {
|
|
145
|
+
let col = {
|
|
146
|
+
field: oriCol.field,
|
|
147
|
+
title: oriCol.title,
|
|
148
|
+
width: 150,
|
|
149
|
+
...oriCol.otherConfig,
|
|
150
|
+
};
|
|
151
|
+
if (index === 0) {
|
|
152
|
+
col.fixed = "left";
|
|
153
|
+
}
|
|
154
|
+
return col;
|
|
155
|
+
});
|
|
156
|
+
columns = columns.concat(cCols);
|
|
157
|
+
|
|
158
|
+
let tableOption = {
|
|
159
|
+
vue: this,
|
|
160
|
+
tableRef: tableRef,
|
|
161
|
+
tableNameRequired: false,
|
|
162
|
+
columns: columns,
|
|
163
|
+
config: {
|
|
164
|
+
toolbarConfig: {
|
|
165
|
+
custom: false,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
|
|
171
|
+
this.resOption = opts;
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
exc() {
|
|
175
|
+
this.option = this.param;
|
|
176
|
+
this.showContent = true;
|
|
177
|
+
this.showImportDialog = true;
|
|
178
|
+
this.showImportDialog2 = false;
|
|
179
|
+
},
|
|
180
|
+
showSuccessResult() {
|
|
181
|
+
this.showImportResult = true;
|
|
182
|
+
this.resultType = 1;
|
|
183
|
+
this.$nextTick(() => {
|
|
184
|
+
this.initResGird();
|
|
185
|
+
this.$nextTick(() => {
|
|
186
|
+
let tDatas = this.successRows.map((item, index) => {
|
|
187
|
+
item.id = index;
|
|
188
|
+
return item;
|
|
189
|
+
});
|
|
190
|
+
this.$refs.resGrid.loadData(tDatas);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* 失败表按 Excel 行序展示:批量与分组通道的回包顺序与行序无关,
|
|
196
|
+
* 排序放在消费点做一次,而不是每标一行排一次。
|
|
197
|
+
* @param {Array} rows 失败行。@returns {Array} 排好序的副本。
|
|
198
|
+
*/
|
|
199
|
+
sortRowsByImpSeq(rows) {
|
|
200
|
+
return (rows || [])
|
|
201
|
+
.slice()
|
|
202
|
+
.sort((a, b) => (a.impSeq || 0) - (b.impSeq || 0));
|
|
203
|
+
},
|
|
204
|
+
showErrorResult() {
|
|
205
|
+
this.showImportResult = true;
|
|
206
|
+
this.resultType = 0;
|
|
207
|
+
this.$nextTick(() => {
|
|
208
|
+
this.initResGird();
|
|
209
|
+
this.$nextTick(() => {
|
|
210
|
+
let tDatas = this.sortRowsByImpSeq(this.failRows).map(
|
|
211
|
+
(item, index) => {
|
|
212
|
+
item.id = index;
|
|
213
|
+
return item;
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
this.$refs.resGrid.loadData(tDatas);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
fileChange(file) {
|
|
221
|
+
if (file) {
|
|
222
|
+
this.fileRaw = file.raw;
|
|
223
|
+
} else {
|
|
224
|
+
this.fileRaw = false;
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
dialogClose1() {
|
|
228
|
+
this.importLoading = false;
|
|
229
|
+
if (!this.showImportDialog2) {
|
|
230
|
+
this.$emit("update:visiable", false);
|
|
231
|
+
this.showContent = false;
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
async dialogPrimary1() {
|
|
235
|
+
let that = this;
|
|
236
|
+
let option = this.option;
|
|
237
|
+
|
|
238
|
+
let fileRaw = this.fileRaw;
|
|
239
|
+
if (!fileRaw) {
|
|
240
|
+
this.$baseAlert(
|
|
241
|
+
this.$t2("请上传附件", "components.excelImport.warmMsg1")
|
|
242
|
+
);
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
let importFileLimitSize = this.importFileLimitSize;
|
|
246
|
+
let fileSize = fileRaw.size;
|
|
247
|
+
let limitSize = importFileLimitSize * 1024 * 1024;
|
|
248
|
+
if (fileSize > limitSize) {
|
|
249
|
+
this.$baseAlert(
|
|
250
|
+
this.$t1("导入文件不允许超过{fileSize}MB", {
|
|
251
|
+
fileSize: importFileLimitSize,
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (option.importFrontOnly) {
|
|
258
|
+
this.dialogPrimary3();
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* this.createImportTimer();
|
|
263
|
+
this.showImportDialog = false;
|
|
264
|
+
if (!option.onConfirm) {
|
|
265
|
+
this.showImportDialog2 = true;
|
|
266
|
+
} */
|
|
267
|
+
// this.$nextTick(() => {
|
|
268
|
+
try {
|
|
269
|
+
this.readExcel(this.fileRaw, function (resultData) {
|
|
270
|
+
// strict:解析期整批硬拦,一处不合规就整份不导(选文件框留着,改完可直接重选)
|
|
271
|
+
if (option.importOption.requiredCheckMode === "strict") {
|
|
272
|
+
let requiredError = that.checkRequiredRows(
|
|
273
|
+
resultData?.data,
|
|
274
|
+
resultData?.oriCols
|
|
275
|
+
);
|
|
276
|
+
if (requiredError) {
|
|
277
|
+
that.clearImportTimer();
|
|
278
|
+
that.$baseAlert(requiredError);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
that.createImportTimer();
|
|
283
|
+
that.showImportDialog = false;
|
|
284
|
+
if (!option.onConfirm) {
|
|
285
|
+
that.showImportDialog2 = true;
|
|
286
|
+
}
|
|
287
|
+
that.$nextTick(() => {
|
|
288
|
+
if (option.onConfirm) {
|
|
289
|
+
option.onConfirm(resultData.data, that.fileRaw);
|
|
290
|
+
} else {
|
|
291
|
+
that.handleBeforeImport0(that.fileRaw, resultData, () => {
|
|
292
|
+
that.syncDataForImport({
|
|
293
|
+
multi: false,
|
|
294
|
+
data: resultData,
|
|
295
|
+
// saveUrl: saveUrl
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
} catch (et) {
|
|
302
|
+
that.clearImportTimer();
|
|
303
|
+
console.error(et);
|
|
304
|
+
}
|
|
305
|
+
// });
|
|
306
|
+
},
|
|
307
|
+
handleBeforeImport(file, resultData, callback) {
|
|
308
|
+
let importOption = this.option.importOption;
|
|
309
|
+
let that = this;
|
|
310
|
+
if (importOption.onBeforeImport) {
|
|
311
|
+
const toDo = (res) => {
|
|
312
|
+
let rows = res?.objx || [];
|
|
313
|
+
// 入参 resultData 是 readExcel 的信封 {data,titles,fields,oriCols,...},不是行数组。
|
|
314
|
+
// 早前直接按 resultData[rowIndex] 取行,恒为 undefined —— 脚本只要 done(带 objx)
|
|
315
|
+
// 回填数据就 TypeError,且崩在 new Function 里,现象是"导入点了没反应"。
|
|
316
|
+
let dataRows = Array.isArray(resultData)
|
|
317
|
+
? resultData
|
|
318
|
+
: resultData?.data || [];
|
|
319
|
+
rows.forEach((row, rowIndex) => {
|
|
320
|
+
let item = dataRows[rowIndex];
|
|
321
|
+
if (!item) return;
|
|
322
|
+
Object.keys(row).forEach((key) => {
|
|
323
|
+
item[key] = row[key];
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
callback && callback();
|
|
327
|
+
};
|
|
328
|
+
this.getFieldTarget().handleCustomEvent(
|
|
329
|
+
importOption.onBeforeImport,
|
|
330
|
+
["file", "resultData", "done"],
|
|
331
|
+
[file, resultData, toDo]
|
|
332
|
+
);
|
|
333
|
+
} else {
|
|
334
|
+
callback && callback();
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
handleBeforeImport0(file, resultData, callback) {
|
|
338
|
+
if (!this.showImportDialog2) return;
|
|
339
|
+
let importOption = this.option.importOption;
|
|
340
|
+
if (!importOption.enabledImportPreHandle) {
|
|
341
|
+
this.handleBeforeImport(file, resultData, () => {
|
|
342
|
+
callback && callback();
|
|
343
|
+
});
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.uploadFile(() => {
|
|
348
|
+
this.importLoading = false;
|
|
349
|
+
this.handleBeforeImport(file, resultData, () => {
|
|
350
|
+
callback && callback();
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
return;
|
|
354
|
+
},
|
|
355
|
+
handleBeforeClose(hide) {
|
|
356
|
+
if (this.backendValidating) {
|
|
357
|
+
this.isEnd = true;
|
|
358
|
+
this.backendValidating = false;
|
|
359
|
+
hide();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
this.option.onCancel &&
|
|
363
|
+
this.option.onCancel(this.getCallbackData(), this.fileRaw);
|
|
364
|
+
let importOption = this.option.importOption;
|
|
365
|
+
this.getFieldTarget().handleCustomEvent(
|
|
366
|
+
importOption.onSuccessImport,
|
|
367
|
+
["resultData", "file"],
|
|
368
|
+
[this.getCallbackData(), this.fileRaw]
|
|
369
|
+
);
|
|
370
|
+
this.handleTableCallback();
|
|
371
|
+
hide();
|
|
372
|
+
},
|
|
373
|
+
dialogClose2() {
|
|
374
|
+
if (this.backendValidating) return;
|
|
375
|
+
this.showImportDialog2 = false;
|
|
376
|
+
this.option.onBeforeCancel &&
|
|
377
|
+
this.option.onBeforeCancel(this.getCallbackData(), this.fileRaw);
|
|
378
|
+
let importOption = this.option.importOption;
|
|
379
|
+
this.getFieldTarget().handleCustomEvent(
|
|
380
|
+
importOption.onSuccessImport,
|
|
381
|
+
["resultData", "file"],
|
|
382
|
+
[this.getCallbackData(), this.fileRaw]
|
|
383
|
+
);
|
|
384
|
+
this.handleTableCallback();
|
|
385
|
+
},
|
|
386
|
+
handleClose2() {
|
|
387
|
+
this.backendValidating = false;
|
|
388
|
+
this.clearImportTimer();
|
|
389
|
+
this.showImportDialog2 = false;
|
|
390
|
+
this.showContent = false;
|
|
391
|
+
this.option.onClose &&
|
|
392
|
+
this.option.onClose(this.getCallbackData(), this.fileRaw);
|
|
393
|
+
this.option.callback &&
|
|
394
|
+
this.option.callback(this.getCallbackData(), this.fileRaw);
|
|
395
|
+
this.dialogClose1();
|
|
396
|
+
},
|
|
397
|
+
dialogPrimary2() {
|
|
398
|
+
if (this.backendValidating) return;
|
|
399
|
+
let importOption = this.option.importOption;
|
|
400
|
+
this.showImportDialog2 = false;
|
|
401
|
+
this.option.onBeforeConfirm &&
|
|
402
|
+
this.option.onBeforeConfirm(this.getCallbackData(), this.fileRaw);
|
|
403
|
+
this.getFieldTarget().handleCustomEvent(
|
|
404
|
+
importOption.onSuccessImport,
|
|
405
|
+
["resultData", "file"],
|
|
406
|
+
[this.getCallbackData(), this.fileRaw]
|
|
407
|
+
);
|
|
408
|
+
this.handleTableCallback();
|
|
409
|
+
},
|
|
410
|
+
getCallbackData() {
|
|
411
|
+
return {
|
|
412
|
+
...this.resultData,
|
|
413
|
+
successRows: this.successRows,
|
|
414
|
+
failRows: this.sortRowsByImpSeq(this.failRows),
|
|
415
|
+
};
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
/*dialogClose2(flag) {
|
|
419
|
+
let importOption = this.option.importOption;
|
|
420
|
+
this.clearImportTimer();
|
|
421
|
+
this.showImportDialog2 = false;
|
|
422
|
+
this.dialogClose1();
|
|
423
|
+
this.handleTableCallback(flag);
|
|
424
|
+
this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.resultData, this.fileRaw])
|
|
425
|
+
this.option.callback && this.option.callback(this.resultData, this.fileRaw);
|
|
426
|
+
},
|
|
427
|
+
dialogPrimary2() {
|
|
428
|
+
let importOption = this.option.importOption;
|
|
429
|
+
this.clearImportTimer();
|
|
430
|
+
this.showImportDialog2 = false;
|
|
431
|
+
this.dialogClose1()
|
|
432
|
+
this.handleTableCallback();
|
|
433
|
+
let fileRaw = this.fileRaw;
|
|
434
|
+
this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.resultData, this.fileRaw])
|
|
435
|
+
this.option.callback && this.option.callback(this.resultData, this.fileRaw);
|
|
436
|
+
},*/
|
|
437
|
+
handleTableCallback(flag) {
|
|
438
|
+
if (flag === 0) return;
|
|
439
|
+
let importOption = this.option.importOption;
|
|
440
|
+
let tableTarget;
|
|
441
|
+
if (importOption.tableRef)
|
|
442
|
+
tableTarget = this.getFieldTarget().getWidgetRef(importOption.tableRef);
|
|
443
|
+
if (tableTarget) {
|
|
444
|
+
let isQueryTable = tableTarget.widget.options.isQueryTable;
|
|
445
|
+
if (isQueryTable) {
|
|
446
|
+
tableTarget.searchEvent();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
async readExcel(file, callback) {
|
|
451
|
+
let that = this;
|
|
452
|
+
let option = this.option;
|
|
453
|
+
|
|
454
|
+
// 业务侧的 importFileLimitSize 允许到 200MB,而这里是整文件 readAsBinaryString +
|
|
455
|
+
// XLSX.read 同步解析,占用约为文件体积的 5~20 倍 —— 那个量级必然把标签页撑爆,
|
|
456
|
+
// 且崩在库内部,连提示都给不出来。这里再收一道解析安全上限,可用
|
|
457
|
+
// importOption.maxFileSize 覆盖(0 表示不限制)。
|
|
458
|
+
if (isImportFileOversize(file, option)) {
|
|
459
|
+
this.$baseAlert(
|
|
460
|
+
this.$t1(
|
|
461
|
+
"导入文件过大({size}MB),当前最多支持 {limit}MB,请拆分后分批导入",
|
|
462
|
+
{
|
|
463
|
+
size: toFileSizeMb(file.size),
|
|
464
|
+
limit: toFileSizeMb(getImportFileSizeLimit(option)),
|
|
465
|
+
}
|
|
466
|
+
)
|
|
467
|
+
);
|
|
468
|
+
// 与上游那道 importFileLimitSize 校验保持一致:只提示、不关弹窗,
|
|
469
|
+
// 用户可以直接重选一个小文件。
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (option.importOption.multipleSheet) {
|
|
474
|
+
this.readExcel2(file, callback);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// 附件列清单按本次解析重建:解析可以在同一个弹框里跑多次(strict 拦下来后
|
|
479
|
+
// 用户重选文件、"确定"又没有 pending 锁),只 push 不清会把上一份的附件列带进来。
|
|
480
|
+
this.fileCellFields = [];
|
|
481
|
+
this.urlAttachFields = {};
|
|
482
|
+
|
|
483
|
+
let XLSX;
|
|
484
|
+
try {
|
|
485
|
+
XLSX = await loadXlsx();
|
|
486
|
+
} catch (error) {
|
|
487
|
+
this.$baseAlert(this.$t1("Excel解析组件加载失败,请刷新页面后重试"));
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const fileReader = new FileReader();
|
|
492
|
+
fileReader.onload = async (ev) => {
|
|
493
|
+
let resultData;
|
|
494
|
+
try {
|
|
495
|
+
const data = ev.target.result;
|
|
496
|
+
const workbook = XLSX.read(data, {
|
|
497
|
+
type: "binary",
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
let sheet = workbook.Sheets[workbook.SheetNames[0]];
|
|
501
|
+
if (sheet["!ref"] === undefined || sheet["!ref"] === null) {
|
|
502
|
+
/*that.showImportDialog2 = false;
|
|
503
|
+
that.showContent = false;
|
|
504
|
+
that.clearImportTimer();*/
|
|
505
|
+
that.$baseAlert(
|
|
506
|
+
this.$t2(
|
|
507
|
+
"请使用正确的导入模版!",
|
|
508
|
+
"components.excelImport.warmMsg2"
|
|
509
|
+
)
|
|
510
|
+
);
|
|
511
|
+
that.handleClose2();
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
let range = XLSX.utils.decode_range(sheet["!ref"]);
|
|
515
|
+
let dataSize = range.e.r + 1; //行数
|
|
516
|
+
that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
|
|
517
|
+
// 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时主线程会被
|
|
518
|
+
// 占死甚至 OOM。文件体积不大但行极多(窄表)时只有这一道能拦。
|
|
519
|
+
if (isImportRowsOverLimit(that.dataSize, option)) {
|
|
520
|
+
that.clearImportTimer();
|
|
521
|
+
that.$baseAlert(
|
|
522
|
+
that.$t1(
|
|
523
|
+
"导入数据 {size} 行,超过单次上限 {limit} 行,请拆分后分批导入",
|
|
524
|
+
{
|
|
525
|
+
size: that.dataSize,
|
|
526
|
+
limit: getImportRowLimit(option),
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
);
|
|
530
|
+
that.handleClose2();
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
let titles = [];
|
|
534
|
+
let fields = [];
|
|
535
|
+
|
|
536
|
+
const ws = workbook.Sheets[sheet];
|
|
537
|
+
|
|
538
|
+
let prefix = option.prefix;
|
|
539
|
+
let excelUrl = option.excel;
|
|
540
|
+
|
|
541
|
+
let excelRows = [];
|
|
542
|
+
let row;
|
|
543
|
+
let rowNum;
|
|
544
|
+
let colNum;
|
|
545
|
+
for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
|
|
546
|
+
row = [];
|
|
547
|
+
for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
|
|
548
|
+
let nextCell =
|
|
549
|
+
sheet[
|
|
550
|
+
XLSX.utils.encode_cell({
|
|
551
|
+
r: rowNum,
|
|
552
|
+
c: colNum,
|
|
553
|
+
})
|
|
554
|
+
];
|
|
555
|
+
if (typeof nextCell === "undefined") {
|
|
556
|
+
row.push(void 0);
|
|
557
|
+
} else {
|
|
558
|
+
row.push(getImportCellText(nextCell));
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (rowNum === 1) {
|
|
562
|
+
titles = row;
|
|
563
|
+
}
|
|
564
|
+
if (rowNum === 2) {
|
|
565
|
+
fields = row;
|
|
566
|
+
let checkResult = true;
|
|
567
|
+
/*await that.checkExcelForImport(titles, fields, excelUrl, prefix).then(
|
|
568
|
+
res => {
|
|
569
|
+
if (res.type !== "success") {
|
|
570
|
+
checkResult = false;
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
if (!checkResult) {
|
|
574
|
+
that.showContent = false;
|
|
575
|
+
that.clearImportTimer();
|
|
576
|
+
return false;
|
|
577
|
+
}*/
|
|
578
|
+
}
|
|
579
|
+
if (rowNum > 2) {
|
|
580
|
+
let item = {};
|
|
581
|
+
for (let i = 0; i < fields.length; i++) {
|
|
582
|
+
let field = fields[i];
|
|
583
|
+
if (field) {
|
|
584
|
+
item[field] = row[i] ?? null;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
excelRows.push(item);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
if (
|
|
591
|
+
!titles.length ||
|
|
592
|
+
!fields.length ||
|
|
593
|
+
titles.length !== fields.length
|
|
594
|
+
) {
|
|
595
|
+
// that.showContent = false;
|
|
596
|
+
// that.clearImportTimer();
|
|
597
|
+
that.$baseAlert(
|
|
598
|
+
this.$t2(
|
|
599
|
+
"请使用正确的导入模版!",
|
|
600
|
+
"components.excelImport.warmMsg2"
|
|
601
|
+
)
|
|
602
|
+
);
|
|
603
|
+
that.handleClose2();
|
|
604
|
+
return false;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
let columns = [];
|
|
608
|
+
let cols = [];
|
|
609
|
+
let uniqueFields = [];
|
|
610
|
+
for (let i = 0; i < titles.length; i++) {
|
|
611
|
+
let title = titles[i];
|
|
612
|
+
if (title) {
|
|
613
|
+
let field = fields[i];
|
|
614
|
+
if (field === null || field === undefined) {
|
|
615
|
+
// that.showContent = false;
|
|
616
|
+
// that.clearImportTimer();
|
|
617
|
+
that.$baseAlert(
|
|
618
|
+
this.$t2(
|
|
619
|
+
"请使用正确的导入模版!",
|
|
620
|
+
"components.excelImport.warmMsg2"
|
|
621
|
+
)
|
|
622
|
+
);
|
|
623
|
+
that.handleClose2();
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
let t = title.substr(-1);
|
|
627
|
+
let u = title.length >= 2 ? title.substr(-2) : title;
|
|
628
|
+
let isNeed = false;
|
|
629
|
+
if (t === "*") {
|
|
630
|
+
isNeed = true;
|
|
631
|
+
}
|
|
632
|
+
let isUnique = false;
|
|
633
|
+
if (u === "**") {
|
|
634
|
+
uniqueFields.push(field);
|
|
635
|
+
isUnique = true;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
let otherConfig = {};
|
|
639
|
+
let isFile = false;
|
|
640
|
+
let urlTargetField = null;
|
|
641
|
+
if (field.startsWith(IMPORT_ATTACH_PREFIX)) {
|
|
642
|
+
that.fileCellFields.push(field);
|
|
643
|
+
isFile = true;
|
|
644
|
+
otherConfig = {
|
|
645
|
+
slots: {
|
|
646
|
+
default: "attachment",
|
|
647
|
+
},
|
|
648
|
+
};
|
|
649
|
+
let urlAttach = that.parseUrlAttachmentField(field);
|
|
650
|
+
if (urlAttach) {
|
|
651
|
+
that.urlAttachFields[field] = urlAttach;
|
|
652
|
+
urlTargetField = urlAttach.target;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
let col = {
|
|
657
|
+
field: field,
|
|
658
|
+
title: title,
|
|
659
|
+
width: 100,
|
|
660
|
+
isNeed: isNeed,
|
|
661
|
+
isUnique: isUnique,
|
|
662
|
+
isFile,
|
|
663
|
+
urlTargetField,
|
|
664
|
+
otherConfig,
|
|
665
|
+
};
|
|
666
|
+
cols.push(col);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
let oriCols = JSON.parse(JSON.stringify(cols)); //列信息
|
|
671
|
+
// 附件列在这里收口成对象数组,后面的校验、发包、渲染都只面对一种形状。
|
|
672
|
+
// 图片三段式在解析之后才跑,会覆盖同一个 key,两者不冲突。
|
|
673
|
+
that.normalizeImportAttachmentCells(excelRows, oriCols);
|
|
674
|
+
// 「值存为URL」列再往前一步转成 URL 字符串挪到目标实体列;三段式回填后
|
|
675
|
+
// 原始列会被重新写回来,那边跑完还要再转一次
|
|
676
|
+
that.applyImportUrlAttachments(excelRows);
|
|
677
|
+
if (uniqueFields.length) {
|
|
678
|
+
// 分组唯一字段存在时,syncDataForImport 走 groupDatas 分支整组发包,
|
|
679
|
+
// 逐行的 vailData 不会执行 —— 必填只能在这里硬拦。
|
|
680
|
+
let requiredError = that.checkRequiredRows(excelRows, oriCols);
|
|
681
|
+
if (requiredError) {
|
|
682
|
+
that.clearImportTimer();
|
|
683
|
+
that.$baseAlert(requiredError);
|
|
684
|
+
that.handleClose2();
|
|
685
|
+
return false;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
this.oriCols = oriCols;
|
|
690
|
+
|
|
691
|
+
resultData = {
|
|
692
|
+
data: excelRows,
|
|
693
|
+
titles: titles,
|
|
694
|
+
fields: fields,
|
|
695
|
+
uniqueFields: uniqueFields,
|
|
696
|
+
oriCols: oriCols,
|
|
697
|
+
};
|
|
698
|
+
this.resultData = resultData;
|
|
699
|
+
callback(resultData);
|
|
700
|
+
} catch (et) {
|
|
701
|
+
that.showContent = false;
|
|
702
|
+
that.clearImportTimer();
|
|
703
|
+
console.error(et);
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
fileReader.readAsBinaryString(file);
|
|
707
|
+
},
|
|
708
|
+
async checkExcelForImport(titles, fields, turl, prefix) {
|
|
709
|
+
if (!this.showImportDialog2) return;
|
|
710
|
+
let that = this;
|
|
711
|
+
let data = {
|
|
712
|
+
filed_name: fields,
|
|
713
|
+
field_note: titles,
|
|
714
|
+
url: turl,
|
|
715
|
+
};
|
|
716
|
+
let param = JSON.stringify(data);
|
|
717
|
+
return this.$http({
|
|
718
|
+
url: prefix + "/sf_common/compareExcelFields",
|
|
719
|
+
method: "post",
|
|
720
|
+
headers: {
|
|
721
|
+
"Content-Type": "application/json;charset=utf-8",
|
|
722
|
+
},
|
|
723
|
+
// data: param,
|
|
724
|
+
data: data,
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
/**
|
|
728
|
+
* 导入单元格是否为空。附件列归一后空值是 `[]`,不能只按 null/undefined/"" 判,
|
|
729
|
+
* 否则必填的附件列填不填都能过。
|
|
730
|
+
*
|
|
731
|
+
* @param {*} value 单元格值。
|
|
732
|
+
* @returns {Boolean}
|
|
733
|
+
*/
|
|
734
|
+
isEmptyImportCell(value) {
|
|
735
|
+
if (value === null || value === undefined) return true;
|
|
736
|
+
if (typeof value === "string") return !value.trim();
|
|
737
|
+
if (Array.isArray(value)) return !value.length;
|
|
738
|
+
return false;
|
|
739
|
+
},
|
|
740
|
+
/**
|
|
741
|
+
* 导入模板里填的附件地址是否可用:带协议(或协议相对)的绝对 URL,或以 / 开头的
|
|
742
|
+
* 存储路径。parseFileUrl 为兼容后端各种相对路径写得极宽松——"这不是地址"也会被
|
|
743
|
+
* 当成文件名收下并产出一个附件对象,直接拿它当校验等于没校验,所以这里单独收紧。
|
|
744
|
+
*
|
|
745
|
+
* @param {String} value 单个地址。
|
|
746
|
+
* @returns {Boolean}
|
|
747
|
+
*/
|
|
748
|
+
isImportAttachmentUrl(value) {
|
|
749
|
+
if (typeof value !== "string") return false;
|
|
750
|
+
return IMPORT_ATTACH_URL_REG.test(value.trim());
|
|
751
|
+
},
|
|
752
|
+
/**
|
|
753
|
+
* 附件列(isFile)的值归一。下游只认「附件对象数组」这一种形状——后端信封
|
|
754
|
+
* buildImportRowEnvelope、结果表的 base-attachment、明细表的附件字段都是照它写的;
|
|
755
|
+
* 而解析期的来源有三种:图片三段式回填的对象数组、单元格里的 URL 文本、空。
|
|
756
|
+
* 不在这里收口,三种形状就会一路带到发包与渲染(裸字符串给 base-attachment
|
|
757
|
+
* 会拼出 undefinedhttp://...,给后端则是它没见过的形状)。
|
|
758
|
+
*
|
|
759
|
+
* 地址不合法的非空单元格原样留着,交给 vailData / checkRequiredRows 按「不是数组」
|
|
760
|
+
* 判成错行——就地清成 [] 等于把填错的地址静默吞掉,那行还照样算导入成功。
|
|
761
|
+
*
|
|
762
|
+
* @param {Array} rows 数据行。@param {Array} oriCols 列信息。
|
|
763
|
+
*/
|
|
764
|
+
normalizeImportAttachmentCells(rows, oriCols) {
|
|
765
|
+
let fileCols = (oriCols || []).filter((col) => col.isFile);
|
|
766
|
+
if (!fileCols.length) return;
|
|
767
|
+
(rows || []).forEach((row) => {
|
|
768
|
+
if (!row) return;
|
|
769
|
+
fileCols.forEach((col) => {
|
|
770
|
+
let value = row[col.field];
|
|
771
|
+
if (this.isEmptyImportCell(value)) {
|
|
772
|
+
row[col.field] = [];
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
if (Array.isArray(value)) {
|
|
776
|
+
// 三段式回填的对象数组:全是对象时 normalizeAttachmentValue 原样返回,
|
|
777
|
+
// 后端带回来的 id/fileSize 等字段不会被重新解析掉
|
|
778
|
+
row[col.field] = normalizeAttachmentValue(value);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (typeof value !== "string") return;
|
|
782
|
+
let parts = value
|
|
783
|
+
.split(IMPORT_ATTACH_SEPARATOR_REG)
|
|
784
|
+
.map((part) => part.trim())
|
|
785
|
+
.filter((part) => !!part);
|
|
786
|
+
if (!parts.length) {
|
|
787
|
+
row[col.field] = [];
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
// 一格里有一个填错就整格判错,免得"导进去了但少了一个附件"这种无声缺失
|
|
791
|
+
if (!parts.every((part) => this.isImportAttachmentUrl(part))) return;
|
|
792
|
+
row[col.field] = normalizeAttachmentValue(parts);
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
},
|
|
796
|
+
/**
|
|
797
|
+
* 附件列的值是否没通过归一。归一后附件列一定是数组,还是别的形状就说明
|
|
798
|
+
* 这一格填了东西但一个附件都解析不出来。
|
|
799
|
+
*
|
|
800
|
+
* @param {Object} oriCol 列信息。@param {*} value 单元格值。
|
|
801
|
+
* @returns {Boolean}
|
|
802
|
+
*/
|
|
803
|
+
isBadAttachmentCell(oriCol, value) {
|
|
804
|
+
if (!oriCol.isFile) return false;
|
|
805
|
+
if (this.isEmptyImportCell(value)) return false;
|
|
806
|
+
// 「值存为URL」列转换后是单个 URL 字符串而不是数组,得按地址判
|
|
807
|
+
if (oriCol.urlTargetField) return !this.isImportAttachmentUrl(value);
|
|
808
|
+
return !Array.isArray(value);
|
|
809
|
+
},
|
|
810
|
+
/**
|
|
811
|
+
* 解析「值存为URL」附件列的列名:`attachments_<取值字段>_<目标字段>`,
|
|
812
|
+
* 例如 `attachments_large_image_url` = 取大图地址、写进实体列 `image_url`。
|
|
813
|
+
*
|
|
814
|
+
* 判别不会和经典的 `attachments_<uuid>` 撞车:createUUID 产出的是 32 位纯 hex
|
|
815
|
+
* 且连字符已剥掉,前缀之后一个下划线都没有,所以「还有下划线」就是新格式。
|
|
816
|
+
* 只切第一刀,目标字段名自己带下划线(`image_url`)也不受影响。
|
|
817
|
+
*
|
|
818
|
+
* @param {String} field 模板里的列名。
|
|
819
|
+
* @returns {Object|null} { urlField, target };不是新格式返回 null。
|
|
820
|
+
*/
|
|
821
|
+
parseUrlAttachmentField(field) {
|
|
822
|
+
let rest = field.substring(IMPORT_ATTACH_PREFIX.length);
|
|
823
|
+
let i = rest.indexOf("_");
|
|
824
|
+
if (i <= 0) return null;
|
|
825
|
+
let urlField = rest.substring(0, i);
|
|
826
|
+
let target = rest.substring(i + 1);
|
|
827
|
+
if (!target) return null;
|
|
828
|
+
if (!IMPORT_ATTACH_URL_FIELDS.includes(urlField)) return null;
|
|
829
|
+
return { urlField, target };
|
|
830
|
+
},
|
|
831
|
+
/**
|
|
832
|
+
* 把「值存为URL」附件列的附件对象数组转成 URL 字符串,写到它的目标实体列上,
|
|
833
|
+
* 并删掉原始列——目标列是实体自己的普通列,不能走 attachments_ 独立附件通道。
|
|
834
|
+
*
|
|
835
|
+
* 要跑两次:解析期归一之后(模板里填 URL 文本的情形),以及图片三段式回填之后
|
|
836
|
+
* (三段式按 fileCellFields 白名单把原始列重新写了回来)。
|
|
837
|
+
*
|
|
838
|
+
* 没通过归一的值不是数组,原样留着不动,交给校验判成错行。
|
|
839
|
+
*
|
|
840
|
+
* @param {Array} rows 数据行。
|
|
841
|
+
*/
|
|
842
|
+
applyImportUrlAttachments(rows) {
|
|
843
|
+
let sources = Object.keys(this.urlAttachFields || {});
|
|
844
|
+
if (!sources.length) return;
|
|
845
|
+
(rows || []).forEach((row) => {
|
|
846
|
+
if (!row) return;
|
|
847
|
+
sources.forEach((source) => {
|
|
848
|
+
if (!(source in row)) return;
|
|
849
|
+
let value = row[source];
|
|
850
|
+
if (!Array.isArray(value)) return;
|
|
851
|
+
let config = this.urlAttachFields[source];
|
|
852
|
+
// 实体列基本都是 varchar 单值,一格里有多个附件只取第一个
|
|
853
|
+
let url = toUrlValue(value, {
|
|
854
|
+
field: config.urlField,
|
|
855
|
+
multi: false,
|
|
856
|
+
});
|
|
857
|
+
delete row[source];
|
|
858
|
+
// 空附件格不覆盖目标列已有的值:模板里同时放了普通列 image_url 和
|
|
859
|
+
// attachments_large_image_url 时,空的那个不该把填好的地址清掉
|
|
860
|
+
if (url === null && config.target in row) return;
|
|
861
|
+
row[config.target] = url;
|
|
862
|
+
});
|
|
863
|
+
});
|
|
864
|
+
},
|
|
865
|
+
/**
|
|
866
|
+
* 取某一列在这一行上的值。「值存为URL」列转换后值已经挪到目标列上,原始列
|
|
867
|
+
* 不复存在;转换失败的值还留在原始列上,回退过去才能把那行报成错行。
|
|
868
|
+
*
|
|
869
|
+
* @param {Object} data 数据行。@param {Object} oriCol 列信息。
|
|
870
|
+
* @returns {*}
|
|
871
|
+
*/
|
|
872
|
+
getImportCellValue(data, oriCol) {
|
|
873
|
+
if (oriCol.urlTargetField && data[oriCol.urlTargetField] !== undefined) {
|
|
874
|
+
return data[oriCol.urlTargetField];
|
|
875
|
+
}
|
|
876
|
+
return data[oriCol.field];
|
|
877
|
+
},
|
|
878
|
+
/**
|
|
879
|
+
* 剥掉执行壳打的记账字段,得到一份可以入表、可以提交的干净行副本。
|
|
880
|
+
* 原行仍留着这些字段供结果表展示——两者是两份数据,不共享引用。
|
|
881
|
+
*
|
|
882
|
+
* @param {Object} row 数据行。
|
|
883
|
+
* @returns {Object} 副本。
|
|
884
|
+
*/
|
|
885
|
+
stripImportMeta(row) {
|
|
886
|
+
let item = { ...row };
|
|
887
|
+
IMPORT_META_FIELDS.forEach((field) => {
|
|
888
|
+
delete item[field];
|
|
889
|
+
});
|
|
890
|
+
return item;
|
|
891
|
+
},
|
|
892
|
+
/**
|
|
893
|
+
* 把一行数据包成后端要的信封:`{ [entity]: {...行}, attachments_x: [...] }`。
|
|
894
|
+
* 附件列从实体里摘出来提到信封层——附件是独立存储通道,留在实体里会被当成表字段插库。
|
|
895
|
+
*
|
|
896
|
+
* @param {Object} row 数据行。
|
|
897
|
+
* @param {String} entity 导入数据表名(importEntity)。
|
|
898
|
+
* @returns {Object} 信封。
|
|
899
|
+
*/
|
|
900
|
+
buildImportRowEnvelope(row, entity) {
|
|
901
|
+
let envelope = {
|
|
902
|
+
[entity]: { ...row },
|
|
903
|
+
};
|
|
904
|
+
this.fileCellFields.forEach((field) => {
|
|
905
|
+
// 「值存为URL」列在解析期已转成实体自己的普通列,提到信封层就存不进去了
|
|
906
|
+
if (this.urlAttachFields && this.urlAttachFields[field]) return;
|
|
907
|
+
let attachments = row[field] || [];
|
|
908
|
+
delete envelope[entity][field];
|
|
909
|
+
envelope[field] = attachments;
|
|
910
|
+
});
|
|
911
|
+
return envelope;
|
|
912
|
+
},
|
|
913
|
+
saveImportHandle(data, opt) {
|
|
914
|
+
let multi = this.option.multi;
|
|
915
|
+
let importOption = this.option.importOption;
|
|
916
|
+
|
|
917
|
+
let entity = importOption.importEntity;
|
|
918
|
+
|
|
919
|
+
if (!entity) {
|
|
920
|
+
// 早前这里直接 return:opt.callback 永不触发,syncDataForImport 的逐行循环
|
|
921
|
+
// 断在原地——用户看到的是进度框永久停在 0%,没有任何提示,也无从自查。
|
|
922
|
+
this.handleImportAbort(
|
|
923
|
+
this.$t1("导入数据表名(importEntity)未配置,无法导入")
|
|
924
|
+
);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
let reportTemplate = this.getReportTemplate();
|
|
929
|
+
let formCode = reportTemplate?.formCode;
|
|
930
|
+
let scriptCode = importOption.importScriptCode || "import";
|
|
931
|
+
// let config = option?.config;
|
|
932
|
+
|
|
933
|
+
// let reqData = this.getReqFormData();
|
|
934
|
+
let formData = null;
|
|
935
|
+
if (multi) {
|
|
936
|
+
// 批量报文本来就是裸行数组,没有"实体层"可承载附件——附件只能留在行里当字段。
|
|
937
|
+
// importMultiAttachEnvelope 打开时给每行补上与单行同构的信封,让附件有处可去;
|
|
938
|
+
// 这会改掉发包形状,所以是显式开关而不是自动推断(有没有附件列都按开关走,
|
|
939
|
+
// 免得同一张表单的后端脚本要面对两种形状)。默认关=报文一字不变。
|
|
940
|
+
formData = importOption.importMultiAttachEnvelope
|
|
941
|
+
? data.map((row) => {
|
|
942
|
+
let item = this.buildImportRowEnvelope(row, entity);
|
|
943
|
+
// 后端按 impSeq 把逐行结果映射回 objx,信封化后顶层要留一份,否则那条路会断
|
|
944
|
+
item.impSeq = row.impSeq;
|
|
945
|
+
item.impNumber = row.impNumber;
|
|
946
|
+
return item;
|
|
947
|
+
})
|
|
948
|
+
: data;
|
|
949
|
+
} else {
|
|
950
|
+
formData = this.buildImportRowEnvelope(data, entity);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
let reqData = {
|
|
954
|
+
formCode: formCode,
|
|
955
|
+
formVersion: reportTemplate.formVersion,
|
|
956
|
+
taBm: entity,
|
|
957
|
+
data: formData,
|
|
958
|
+
};
|
|
959
|
+
|
|
960
|
+
this.formHttp({
|
|
961
|
+
scriptCode: scriptCode,
|
|
962
|
+
data: reqData,
|
|
963
|
+
modal: false,
|
|
964
|
+
...opt,
|
|
965
|
+
});
|
|
966
|
+
},
|
|
967
|
+
/**
|
|
968
|
+
* 进度记账:进度框上的计数、百分比与成败行集合,前后端两条通道共用。
|
|
969
|
+
*
|
|
970
|
+
* 早前这些数字是 querySelector 直接写 innerText 的,而模板上同名 span 又绑着
|
|
971
|
+
* totalSuccessNum / totalErrorNum —— 两套并存全靠"响应式那份永远不变"侥幸成立。
|
|
972
|
+
* 这里统一收口成响应式数据:模板照常渲染,逐行结果也能被单测直接断言。
|
|
973
|
+
*
|
|
974
|
+
* @param {Number} size 本次要处理的总行数。
|
|
975
|
+
* @returns {Object} { markSuccess, markError, setPercent, finish }
|
|
976
|
+
*/
|
|
977
|
+
createImportProgress(size) {
|
|
978
|
+
let that = this;
|
|
979
|
+
this.dataSize = size;
|
|
980
|
+
this.totalSuccessNum = 0;
|
|
981
|
+
this.totalErrorNum = 0;
|
|
982
|
+
this.percentageNum = 0;
|
|
983
|
+
this.successRows = [];
|
|
984
|
+
this.failRows = [];
|
|
985
|
+
return {
|
|
986
|
+
/** @param {Object} row 数据行。@param {String} message 可选的成功文案。 */
|
|
987
|
+
markSuccess(row, message) {
|
|
988
|
+
row._resultType = "success";
|
|
989
|
+
let successText = that.$t2(
|
|
990
|
+
"导入成功",
|
|
991
|
+
"components.excelImport.importSucess"
|
|
992
|
+
);
|
|
993
|
+
row._resultContent = message || successText;
|
|
994
|
+
that.totalSuccessNum = that.totalSuccessNum + 1;
|
|
995
|
+
that.successRows.push(row);
|
|
996
|
+
},
|
|
997
|
+
/** @param {Object} row 数据行。@param {String} message 错误信息。 */
|
|
998
|
+
markError(row, message) {
|
|
999
|
+
row._resultType = "error";
|
|
1000
|
+
row._resultContent = message;
|
|
1001
|
+
that.totalErrorNum = that.totalErrorNum + 1;
|
|
1002
|
+
// 只追加。行序由消费方(结果表、回调数据)排一次——早前每标一行就整体排一次,
|
|
1003
|
+
// 数组本就有序、只多一个元素,每次仍是 O(n),整批失败时是 O(n²),
|
|
1004
|
+
// 行数上限 20000,足以把主线程卡住。
|
|
1005
|
+
that.failRows.push(row);
|
|
1006
|
+
},
|
|
1007
|
+
/** @param {Number} percent 百分比整数。 */
|
|
1008
|
+
setPercent(percent) {
|
|
1009
|
+
that.percentageNum = percent;
|
|
1010
|
+
},
|
|
1011
|
+
finish() {
|
|
1012
|
+
setTimeout(function () {
|
|
1013
|
+
that.clearImportTimer();
|
|
1014
|
+
}, 300);
|
|
1015
|
+
},
|
|
1016
|
+
};
|
|
1017
|
+
},
|
|
1018
|
+
/**
|
|
1019
|
+
* 逐行执行的壳:进度、让步、成败沉淀统一由这里负责,
|
|
1020
|
+
* "每行做什么"下沉给 handler(row, index, done) 回写结果:
|
|
1021
|
+
* done() / done({success:true}) 表示成功;
|
|
1022
|
+
* done({success:false, message}) 表示失败。
|
|
1023
|
+
*
|
|
1024
|
+
* 与 syncDataForImport 的分工:后端通道有"批量"与"唯一键分组"两种发包形态,
|
|
1025
|
+
* 一步推进的行数不固定,循环仍留在那边;这里只服务"一行一步"的前端通道。
|
|
1026
|
+
*
|
|
1027
|
+
* @param {Object} opts { rows, handler, onFinish, progress, deferFinish }
|
|
1028
|
+
* progress 复用已有记账(后台校验后的第二段不能清掉前台失败行)
|
|
1029
|
+
* deferFinish 第一段只收集通过行时不收尾,等后台回来再 finish
|
|
1030
|
+
*/
|
|
1031
|
+
runImportRows(opts) {
|
|
1032
|
+
let that = this;
|
|
1033
|
+
let rows = opts.rows || [];
|
|
1034
|
+
let handler = opts.handler;
|
|
1035
|
+
let size = rows.length;
|
|
1036
|
+
let progress = opts.progress || this.createImportProgress(size);
|
|
1037
|
+
this.importProgress = progress;
|
|
1038
|
+
let index = 0;
|
|
1039
|
+
let finish = () => {
|
|
1040
|
+
if (!opts.deferFinish) {
|
|
1041
|
+
progress.setPercent(100);
|
|
1042
|
+
progress.finish();
|
|
1043
|
+
}
|
|
1044
|
+
opts.onFinish && opts.onFinish(that.getCallbackData());
|
|
1045
|
+
};
|
|
1046
|
+
let step = () => {
|
|
1047
|
+
// 弹框已关或已被中止时停在原地,不再往下推
|
|
1048
|
+
if (that.isEnd || !that.showContent || index >= size) {
|
|
1049
|
+
finish();
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
let row = rows[index];
|
|
1053
|
+
// 第二段(后台补数后入表)行上已有 Excel 序号,不能按子集下标重写
|
|
1054
|
+
if (row.impSeq == null) {
|
|
1055
|
+
row.impSeq = index;
|
|
1056
|
+
row.impNumber = index + 4;
|
|
1057
|
+
}
|
|
1058
|
+
let settled = false;
|
|
1059
|
+
let done = (result) => {
|
|
1060
|
+
// handler 重复调 done 不能把进度推两格
|
|
1061
|
+
if (settled) return;
|
|
1062
|
+
settled = true;
|
|
1063
|
+
// done() 不传参直接算成功;只有显式 success:false 才记失败
|
|
1064
|
+
// done({ defer: true }) 只推进、不记账——前台校验通过、等后台结果时用
|
|
1065
|
+
let failed = !!(result && result.success === false);
|
|
1066
|
+
let deferred = !!(result && result.defer);
|
|
1067
|
+
if (failed) {
|
|
1068
|
+
progress.markError(row, result.message);
|
|
1069
|
+
} else if (!deferred) {
|
|
1070
|
+
progress.markSuccess(row, result && result.message);
|
|
1071
|
+
}
|
|
1072
|
+
index = index + 1;
|
|
1073
|
+
progress.setPercent(size ? parseInt((index * 100) / size) : 100);
|
|
1074
|
+
if (index >= size) {
|
|
1075
|
+
finish();
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
// 让步:整趟同步循环不给主线程喘息,正是大数据量卡死的根因
|
|
1079
|
+
setTimeout(step, 1);
|
|
1080
|
+
};
|
|
1081
|
+
try {
|
|
1082
|
+
handler(row, index, done);
|
|
1083
|
+
} catch (et) {
|
|
1084
|
+
console.error(et);
|
|
1085
|
+
done({ success: false, message: String(et?.message || et) });
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
if (!size) {
|
|
1089
|
+
finish();
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
step();
|
|
1093
|
+
},
|
|
1094
|
+
syncDataForImport(opts) {
|
|
1095
|
+
let that = this;
|
|
1096
|
+
let multi = this.option.multi;
|
|
1097
|
+
let resultData = this.resultData;
|
|
1098
|
+
let datas = resultData.data;
|
|
1099
|
+
let titles = resultData.titles;
|
|
1100
|
+
let fields = resultData.fields;
|
|
1101
|
+
let uniqueFields = resultData.uniqueFields;
|
|
1102
|
+
let saveUrl = opts.saveUrl;
|
|
1103
|
+
let size = datas.length;
|
|
1104
|
+
let index = 0;
|
|
1105
|
+
// 计数、百分比、成败行集合统一交给进度记账,与前端通道共用同一套
|
|
1106
|
+
let progress = this.createImportProgress(size);
|
|
1107
|
+
|
|
1108
|
+
let multiSize = this.option.multiSize || 2;
|
|
1109
|
+
|
|
1110
|
+
let groupIndex = 0;
|
|
1111
|
+
let groupDatas = [];
|
|
1112
|
+
if (uniqueFields.length) {
|
|
1113
|
+
let d = XEUtils.groupBy(datas, function (item, itemIndex, items) {
|
|
1114
|
+
let keyArr = [];
|
|
1115
|
+
uniqueFields.forEach((field) => {
|
|
1116
|
+
keyArr.push(item[field]);
|
|
1117
|
+
});
|
|
1118
|
+
return keyArr.join("&_&");
|
|
1119
|
+
});
|
|
1120
|
+
for (let key in d) {
|
|
1121
|
+
groupDatas.push(d[key]);
|
|
1122
|
+
}
|
|
1123
|
+
datas.forEach((item, itemIndex) => {
|
|
1124
|
+
item.impSeq = itemIndex;
|
|
1125
|
+
item.impNumber = itemIndex + 4;
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
let prevHandleData = function (percentageStr, excNum) {
|
|
1130
|
+
progress.setPercent(percentageStr);
|
|
1131
|
+
let isEnd = false;
|
|
1132
|
+
if (multi && uniqueFields.length) {
|
|
1133
|
+
isEnd = groupIndex + 1 >= groupDatas.length;
|
|
1134
|
+
} else {
|
|
1135
|
+
isEnd = index + excNum >= size;
|
|
1136
|
+
}
|
|
1137
|
+
if (!isEnd) {
|
|
1138
|
+
index = index + excNum;
|
|
1139
|
+
groupIndex = groupIndex + 1;
|
|
1140
|
+
setTimeout(function () {
|
|
1141
|
+
handleData();
|
|
1142
|
+
}, 1);
|
|
1143
|
+
} else {
|
|
1144
|
+
progress.finish();
|
|
1145
|
+
}
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
let getDefaultValue = (row) => {
|
|
1149
|
+
let value = null;
|
|
1150
|
+
let defaultValue = this.option.defaultValue;
|
|
1151
|
+
if (defaultValue) {
|
|
1152
|
+
if (typeof defaultValue === "function") {
|
|
1153
|
+
value = defaultValue(row) || {};
|
|
1154
|
+
} else {
|
|
1155
|
+
value = defaultValue || {};
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return value;
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
let handleData = () => {
|
|
1162
|
+
if (!that.isEnd && index < size) {
|
|
1163
|
+
let param;
|
|
1164
|
+
let excNum;
|
|
1165
|
+
if (multi) {
|
|
1166
|
+
if (!uniqueFields.length) {
|
|
1167
|
+
if (index + multiSize < size) {
|
|
1168
|
+
excNum = multiSize;
|
|
1169
|
+
} else {
|
|
1170
|
+
excNum = size - index;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
let dataList = [];
|
|
1174
|
+
for (let i = 0; i < excNum; i++) {
|
|
1175
|
+
let mIndex = index + i;
|
|
1176
|
+
let mData = datas[mIndex];
|
|
1177
|
+
mData.impSeq = mIndex;
|
|
1178
|
+
mData.impNumber = mIndex + 4;
|
|
1179
|
+
|
|
1180
|
+
let errorInfo = that.validateImportRow(mData, mIndex, opts);
|
|
1181
|
+
if (errorInfo) {
|
|
1182
|
+
progress.markError(mData, errorInfo);
|
|
1183
|
+
} else {
|
|
1184
|
+
let defaultValue = getDefaultValue(mData);
|
|
1185
|
+
if (defaultValue) {
|
|
1186
|
+
Object.assign(mData, defaultValue);
|
|
1187
|
+
}
|
|
1188
|
+
dataList.push(mData);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
datas[mIndex] = mData;
|
|
1192
|
+
}
|
|
1193
|
+
if (dataList.length > 0) {
|
|
1194
|
+
param = dataList;
|
|
1195
|
+
}
|
|
1196
|
+
} else {
|
|
1197
|
+
excNum = groupDatas[groupIndex].length;
|
|
1198
|
+
param = groupDatas[groupIndex];
|
|
1199
|
+
// 分组整组发包,逐行校验按既有口径由解析期那道兜底;
|
|
1200
|
+
// 但补默认值没有别的入口,这里不补 importDefaultValue 就是静默失效。
|
|
1201
|
+
param.forEach((groupRow) => {
|
|
1202
|
+
let defaultValue = getDefaultValue(groupRow);
|
|
1203
|
+
if (defaultValue) {
|
|
1204
|
+
Object.assign(groupRow, defaultValue);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
} else {
|
|
1209
|
+
let data = that.resultData.data[index];
|
|
1210
|
+
data.impSeq = index;
|
|
1211
|
+
data.impNumber = index + 4;
|
|
1212
|
+
excNum = 1;
|
|
1213
|
+
datas[index] = data;
|
|
1214
|
+
|
|
1215
|
+
let errorInfo = that.validateImportRow(data, index, opts);
|
|
1216
|
+
if (errorInfo) {
|
|
1217
|
+
progress.markError(data, errorInfo);
|
|
1218
|
+
} else {
|
|
1219
|
+
param = data;
|
|
1220
|
+
let defaultValue = getDefaultValue(data);
|
|
1221
|
+
if (defaultValue) {
|
|
1222
|
+
Object.assign(param, defaultValue);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
let percentageStr = parseInt(((index + excNum) * 100) / size);
|
|
1228
|
+
if (param === null || param === undefined || param.length === 0) {
|
|
1229
|
+
if (that.showContent) {
|
|
1230
|
+
prevHandleData(percentageStr, excNum);
|
|
1231
|
+
}
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
that.saveImportHandle(param, {
|
|
1236
|
+
failMsg: false,
|
|
1237
|
+
callback: (resultMsg) => {
|
|
1238
|
+
if (multi) {
|
|
1239
|
+
if (resultMsg.type === "success") {
|
|
1240
|
+
let multiRows = resultMsg.objx;
|
|
1241
|
+
for (let i = 0; i < multiRows.length; i++) {
|
|
1242
|
+
let multiRow = multiRows[i];
|
|
1243
|
+
let data = datas[multiRow.impSeq];
|
|
1244
|
+
if (multiRow.impReturnType === "success") {
|
|
1245
|
+
progress.markSuccess(data);
|
|
1246
|
+
} else {
|
|
1247
|
+
progress.markError(data, multiRow.impReturnMsg);
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
} else {
|
|
1251
|
+
// error_win(resultMsg);
|
|
1252
|
+
// layer.close(opts.dialogObjIndex);
|
|
1253
|
+
|
|
1254
|
+
// 整批发包失败:失败行落的是副本,不动原始行(原实现口径)
|
|
1255
|
+
param.forEach((item) => {
|
|
1256
|
+
progress.markError({ ...item }, resultMsg.content);
|
|
1257
|
+
});
|
|
1258
|
+
|
|
1259
|
+
/* that.$errorMsg(resultMsg);
|
|
1260
|
+
that.showContent = false;
|
|
1261
|
+
that.clearImportTimer();
|
|
1262
|
+
return; */
|
|
1263
|
+
}
|
|
1264
|
+
} else {
|
|
1265
|
+
let data = that.resultData.data[index];
|
|
1266
|
+
if (resultMsg.type === "success") {
|
|
1267
|
+
progress.markSuccess(data);
|
|
1268
|
+
} else {
|
|
1269
|
+
progress.markError(data, resultMsg.content);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
if (that.showContent) {
|
|
1273
|
+
prevHandleData(percentageStr, excNum);
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
error: (et) => {
|
|
1277
|
+
that.isEnd = true;
|
|
1278
|
+
that.clearImportTimer();
|
|
1279
|
+
console.error(et);
|
|
1280
|
+
},
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
handleData();
|
|
1285
|
+
},
|
|
1286
|
+
commonLocalDownload() {
|
|
1287
|
+
let importOption = this.option.importOption;
|
|
1288
|
+
let importAttachCode = importOption.importAttachCode;
|
|
1289
|
+
if (!importAttachCode) return;
|
|
1290
|
+
this.$http({
|
|
1291
|
+
url: USER_PREFIX + "/bd_attach_setting/getByCode",
|
|
1292
|
+
method: "post",
|
|
1293
|
+
data: {
|
|
1294
|
+
stringOne: importAttachCode,
|
|
1295
|
+
},
|
|
1296
|
+
success: (res) => {
|
|
1297
|
+
let fileObj = res.objx;
|
|
1298
|
+
let url = fileObj?.url;
|
|
1299
|
+
if (fileObj && url) {
|
|
1300
|
+
this.$commonFileUtil.downloadFile(url,fileObj.name);
|
|
1301
|
+
}
|
|
1302
|
+
},
|
|
1303
|
+
});
|
|
1304
|
+
},
|
|
1305
|
+
/**
|
|
1306
|
+
* 整批必填预检:返回第一处缺失的提示文案,全部通过返回 null。
|
|
1307
|
+
* 与 vailData 的分工——vailData 是逐行软校验(该行记失败、其余继续),
|
|
1308
|
+
* 这一遍面向整批、用于解析期硬中断(前端通道与多行分组的后端通道都没有逐行通道)。
|
|
1309
|
+
* @param {Array} rows 数据行。@param {Array} oriCols 解析出的列信息。@returns {String|null}
|
|
1310
|
+
*/
|
|
1311
|
+
checkRequiredRows(rows, oriCols) {
|
|
1312
|
+
let cols = oriCols || [];
|
|
1313
|
+
let datas = rows || [];
|
|
1314
|
+
for (let i = 0; i < cols.length; i++) {
|
|
1315
|
+
let oriCol = cols[i];
|
|
1316
|
+
if (!oriCol.isNeed && !oriCol.isFile) continue;
|
|
1317
|
+
for (let j = 0; j < datas.length; j++) {
|
|
1318
|
+
let value = this.getImportCellValue(datas[j], oriCol);
|
|
1319
|
+
if (oriCol.isNeed && this.isEmptyImportCell(value)) {
|
|
1320
|
+
return this.$t2(
|
|
1321
|
+
"第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
|
|
1322
|
+
"components.excelImport.warmMsg3",
|
|
1323
|
+
{
|
|
1324
|
+
lineNo: j + 4,
|
|
1325
|
+
title: oriCol.title,
|
|
1326
|
+
}
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
// 分组分支与 strict 都不走逐行 vailData,附件地址填错只能在这里整批拦
|
|
1330
|
+
if (this.isBadAttachmentCell(oriCol, value)) {
|
|
1331
|
+
return this.$t1("第{lineNo}行[{title}]不是有效的附件地址;", {
|
|
1332
|
+
lineNo: j + 4,
|
|
1333
|
+
title: oriCol.title,
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return null;
|
|
1339
|
+
},
|
|
1340
|
+
/**
|
|
1341
|
+
* 行级校验:必填 + 业务脚本,前后端两条通道共用(校验分层里的 L2 + L3)。
|
|
1342
|
+
*
|
|
1343
|
+
* `requiredCheckMode`:
|
|
1344
|
+
* ""(默认)/ "row" —— 逐行软校验,错行记失败、其余继续;
|
|
1345
|
+
* "strict" —— 逐行照常校验,另由调用方在解析期整批硬拦;
|
|
1346
|
+
* "off" —— 不做必填校验,只信业务脚本与后端。
|
|
1347
|
+
* `onValidateRow` 脚本返回 true/空 视为通过,返回字符串即错误文案。
|
|
1348
|
+
*
|
|
1349
|
+
* @param {Object} row 数据行。@param {Number} index 行下标。@param {Object} opts 可选,带 data 信封。
|
|
1350
|
+
* @returns {String|null} 错误文案;null 表示通过。
|
|
1351
|
+
*/
|
|
1352
|
+
validateImportRow(row, index, opts) {
|
|
1353
|
+
let importOption = this.option.importOption || {};
|
|
1354
|
+
if (importOption.requiredCheckMode !== "off") {
|
|
1355
|
+
let errorInfo = this.vailData(row, {
|
|
1356
|
+
data: opts?.data || this.resultData,
|
|
1357
|
+
});
|
|
1358
|
+
if (errorInfo && errorInfo.length > 0) return errorInfo;
|
|
1359
|
+
}
|
|
1360
|
+
if (!importOption.onValidateRow) return null;
|
|
1361
|
+
let result = this.getFieldTarget().handleCustomEvent(
|
|
1362
|
+
importOption.onValidateRow,
|
|
1363
|
+
["row", "index"],
|
|
1364
|
+
[row, index]
|
|
1365
|
+
);
|
|
1366
|
+
let passed =
|
|
1367
|
+
result === true
|
|
1368
|
+
|| result === null
|
|
1369
|
+
|| result === undefined
|
|
1370
|
+
|| result === "";
|
|
1371
|
+
if (passed) return null;
|
|
1372
|
+
if (result === false) return this.$t1("数据校验未通过");
|
|
1373
|
+
return String(result);
|
|
1374
|
+
},
|
|
1375
|
+
/** 导入无法继续时的统一收口:停循环、停计时器、给一次明确提示、关掉进度框。 */
|
|
1376
|
+
handleImportAbort(message) {
|
|
1377
|
+
this.backendValidating = false;
|
|
1378
|
+
this.isEnd = true;
|
|
1379
|
+
this.clearImportTimer();
|
|
1380
|
+
this.$baseAlert(message);
|
|
1381
|
+
this.handleClose2();
|
|
1382
|
+
},
|
|
1383
|
+
vailData(data, opts) {
|
|
1384
|
+
let oriCols = opts.data.oriCols;
|
|
1385
|
+
let errorInfo = [];
|
|
1386
|
+
for (let i = 0; i < oriCols.length; i++) {
|
|
1387
|
+
let oriCol = oriCols[i];
|
|
1388
|
+
let value = this.getImportCellValue(data, oriCol);
|
|
1389
|
+
if (oriCol.isNeed && this.isEmptyImportCell(value)) {
|
|
1390
|
+
errorInfo.push(
|
|
1391
|
+
this.$t2(
|
|
1392
|
+
"[" + oriCol.title + "]不能为空;",
|
|
1393
|
+
"components.excelImport.warmMsg4",
|
|
1394
|
+
{ title: oriCol.title }
|
|
1395
|
+
)
|
|
1396
|
+
);
|
|
1397
|
+
continue;
|
|
1398
|
+
}
|
|
1399
|
+
if (this.isBadAttachmentCell(oriCol, value)) {
|
|
1400
|
+
errorInfo.push(
|
|
1401
|
+
this.$t1("[{title}]不是有效的附件地址;", { title: oriCol.title })
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
return errorInfo.join("");
|
|
1406
|
+
},
|
|
1407
|
+
handleRes(val) {
|
|
1408
|
+
/* let content = val;
|
|
1409
|
+
let text = content;
|
|
1410
|
+
if (content && content.indexOf("Exception") >= 0) {
|
|
1411
|
+
let index0 = content.lastIndexOf("*]");
|
|
1412
|
+
if (index0 >= 0) {
|
|
1413
|
+
text = content.substr(index0);
|
|
1414
|
+
if (text) {
|
|
1415
|
+
let index1 = text.indexOf("Exception:");
|
|
1416
|
+
if (index1 >= 0) {
|
|
1417
|
+
text = text.substr(index1 + 10);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
} */
|
|
1422
|
+
let text = getErrorMsg(val);
|
|
1423
|
+
return text;
|
|
1424
|
+
},
|
|
1425
|
+
exportToExcel() {
|
|
1426
|
+
let str =
|
|
1427
|
+
this.resultType === 1
|
|
1428
|
+
? this.$t2("成功", "components.excelImport.success")
|
|
1429
|
+
: this.$t2("失败", "components.excelImport.fail");
|
|
1430
|
+
let fileName =
|
|
1431
|
+
this.$t2("导入结果导出", "components.excelImport.exportFileName") +
|
|
1432
|
+
"(" +
|
|
1433
|
+
str +
|
|
1434
|
+
")";
|
|
1435
|
+
let $grid = this.$refs.resGrid;
|
|
1436
|
+
let columns = $grid.getColumns();
|
|
1437
|
+
if (columns && columns.length) {
|
|
1438
|
+
let fields = columns
|
|
1439
|
+
.filter((item, index) => {
|
|
1440
|
+
return index > 0 && item.property;
|
|
1441
|
+
})
|
|
1442
|
+
.map((item, index) => {
|
|
1443
|
+
return item.property;
|
|
1444
|
+
});
|
|
1445
|
+
this.$refs.resGrid.exportData({
|
|
1446
|
+
filename: fileName,
|
|
1447
|
+
mode: "all",
|
|
1448
|
+
type: "csv",
|
|
1449
|
+
columns: fields,
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
},
|
|
1453
|
+
createImportTimer() {
|
|
1454
|
+
this.excTime = 0;
|
|
1455
|
+
let beginTime = new Date().getTime();
|
|
1456
|
+
this.importTimer = setInterval(() => {
|
|
1457
|
+
let nowTime = new Date().getTime();
|
|
1458
|
+
let diffTime = (nowTime - beginTime) / 1000;
|
|
1459
|
+
this.$set(this, "excTime", this.$baseLodash.round(diffTime, 2));
|
|
1460
|
+
}, 100);
|
|
1461
|
+
},
|
|
1462
|
+
clearImportTimer() {
|
|
1463
|
+
clearInterval(this.importTimer);
|
|
1464
|
+
this.importTimer = null;
|
|
1465
|
+
this.loadingObj && this.loadingObj.close();
|
|
1466
|
+
this.loadingObj = null;
|
|
1467
|
+
},
|
|
1468
|
+
getWidgetTarget() {},
|
|
1469
|
+
getFieldTarget() {
|
|
1470
|
+
return this.param.target;
|
|
1471
|
+
},
|
|
1472
|
+
async dialogPrimary3() {
|
|
1473
|
+
if (!this.fileRaw) {
|
|
1474
|
+
this.$baseAlert(
|
|
1475
|
+
this.$t2("请上传附件", "components.excelImport.warmMsg1")
|
|
1476
|
+
);
|
|
1477
|
+
return false;
|
|
1478
|
+
}
|
|
1479
|
+
let that = this;
|
|
1480
|
+
let option = this.option;
|
|
1481
|
+
this.loadingObj = this.$baseLoading({
|
|
1482
|
+
target: document.body,
|
|
1483
|
+
background: "unset",
|
|
1484
|
+
});
|
|
1485
|
+
|
|
1486
|
+
let importOption = option.importOption;
|
|
1487
|
+
this.readExcel(this.fileRaw, function (resultData) {
|
|
1488
|
+
let file = that.fileRaw;
|
|
1489
|
+
// 整批硬拦。两种情形要拦:
|
|
1490
|
+
// 1) 老链路(不开进度框)—— 它没有逐行通道,不拦就等于零校验:前端通道不过
|
|
1491
|
+
// syncDataForImport 的逐行 vailData,解析期那道又只在模板带 ** 时才跑,
|
|
1492
|
+
// 空值会一路灌进明细表格,直到点保存才被表单行级必填拦下;
|
|
1493
|
+
// 2) requiredCheckMode = strict —— 显式要求"一处不合规就整份不导"。
|
|
1494
|
+
let isStrictCheck = importOption.requiredCheckMode === "strict";
|
|
1495
|
+
let hasRowChannel = !!importOption.showProgressDialog;
|
|
1496
|
+
let needBatchCheck =
|
|
1497
|
+
importOption.requiredCheckMode !== "off"
|
|
1498
|
+
&& (!hasRowChannel || isStrictCheck);
|
|
1499
|
+
if (needBatchCheck) {
|
|
1500
|
+
let requiredError = that.checkRequiredRows(
|
|
1501
|
+
resultData?.data,
|
|
1502
|
+
resultData?.oriCols
|
|
1503
|
+
);
|
|
1504
|
+
if (requiredError) {
|
|
1505
|
+
that.clearImportTimer();
|
|
1506
|
+
that.$baseAlert(requiredError);
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
// 进度框形态:逐行校验 → 成败进结果表 → 通过的行一次性入表格。
|
|
1511
|
+
// 默认关闭,关闭时下面仍是原来的"全屏 loading + 整批交付"老链路。
|
|
1512
|
+
if (importOption.showProgressDialog) {
|
|
1513
|
+
// 确认回调在进度框形态下是前置钩子:解析完立刻跑,通过后再 startFrontImport。
|
|
1514
|
+
// done() = 继续导入;close() = 中止。不返回 false 则自动继续(console.log 也能进进度框)。
|
|
1515
|
+
if (importOption.onConfirmImportEnabled) {
|
|
1516
|
+
let started = false;
|
|
1517
|
+
const done = () => {
|
|
1518
|
+
if (started) return;
|
|
1519
|
+
started = true;
|
|
1520
|
+
that.startFrontImport(resultData, file);
|
|
1521
|
+
};
|
|
1522
|
+
const close = () => {
|
|
1523
|
+
if (started) return;
|
|
1524
|
+
started = true;
|
|
1525
|
+
that.loadingObj && that.loadingObj.close();
|
|
1526
|
+
that.loadingObj = null;
|
|
1527
|
+
that.clearImportTimer();
|
|
1528
|
+
};
|
|
1529
|
+
try {
|
|
1530
|
+
if (
|
|
1531
|
+
that
|
|
1532
|
+
.getFieldTarget()
|
|
1533
|
+
.handleCustomEvent(
|
|
1534
|
+
importOption.onConfirmImport,
|
|
1535
|
+
["resultData", "file", "done", "close"],
|
|
1536
|
+
[resultData, file, done, close]
|
|
1537
|
+
) !== false
|
|
1538
|
+
) {
|
|
1539
|
+
done();
|
|
1540
|
+
}
|
|
1541
|
+
} catch (et) {
|
|
1542
|
+
console.error(et);
|
|
1543
|
+
close();
|
|
1544
|
+
}
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
that.startFrontImport(resultData, file);
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
let flag = false;
|
|
1551
|
+
let done = () => {
|
|
1552
|
+
if (flag) return;
|
|
1553
|
+
flag = true;
|
|
1554
|
+
that.showImportDialog = false;
|
|
1555
|
+
return that
|
|
1556
|
+
.getFieldTarget()
|
|
1557
|
+
.handleCustomEvent(
|
|
1558
|
+
importOption.onSuccessImport,
|
|
1559
|
+
["resultData", "file"],
|
|
1560
|
+
[resultData, file]
|
|
1561
|
+
);
|
|
1562
|
+
};
|
|
1563
|
+
// close 与 done 分工:done 关框并触发 onSuccessImport,close 只关框。
|
|
1564
|
+
// 属性面板一直声明着 close 参数,运行时却没传(xform 那份已修),此处同步。
|
|
1565
|
+
const close = () => {
|
|
1566
|
+
that.dialogClose1();
|
|
1567
|
+
};
|
|
1568
|
+
try {
|
|
1569
|
+
if (importOption.onConfirmImportEnabled) {
|
|
1570
|
+
if (
|
|
1571
|
+
that
|
|
1572
|
+
.getFieldTarget()
|
|
1573
|
+
.handleCustomEvent(
|
|
1574
|
+
importOption.onConfirmImport,
|
|
1575
|
+
["resultData", "file", "done", "close"],
|
|
1576
|
+
[resultData, file, done, close]
|
|
1577
|
+
) !== false
|
|
1578
|
+
) {
|
|
1579
|
+
done();
|
|
1580
|
+
}
|
|
1581
|
+
} else if (importOption.tableRef) {
|
|
1582
|
+
let tableRef = that
|
|
1583
|
+
.getFieldTarget()
|
|
1584
|
+
.getWidgetRef(importOption.tableRef);
|
|
1585
|
+
if (tableRef) {
|
|
1586
|
+
tableRef.addTableData(
|
|
1587
|
+
resultData.data,
|
|
1588
|
+
importOption.dedupField || undefined
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
done();
|
|
1592
|
+
}
|
|
1593
|
+
} catch (et) {
|
|
1594
|
+
console.error(et);
|
|
1595
|
+
}
|
|
1596
|
+
setTimeout(function () {
|
|
1597
|
+
that.loadingObj && that.loadingObj.close();
|
|
1598
|
+
}, 200);
|
|
1599
|
+
});
|
|
1600
|
+
},
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* 前端通道的进度框形态(importOption.showProgressDialog)。
|
|
1604
|
+
*
|
|
1605
|
+
* 与老链路的差别只在"结果怎么呈现":必填由整批硬拦改成逐行软校验——
|
|
1606
|
+
* 缺必填的行进失败表,其余照常入表格,与后端通道的体感一致。
|
|
1607
|
+
* @param {Object} resultData readExcel 的解析信封。@param {File} file 原始文件。
|
|
1608
|
+
*/
|
|
1609
|
+
startFrontImport(resultData, file) {
|
|
1610
|
+
let that = this;
|
|
1611
|
+
let importOption = this.option.importOption;
|
|
1612
|
+
// 进度框接手,选文件框与全屏遮罩让位
|
|
1613
|
+
this.loadingObj && this.loadingObj.close();
|
|
1614
|
+
this.loadingObj = null;
|
|
1615
|
+
this.showImportDialog = false;
|
|
1616
|
+
this.showImportDialog2 = true;
|
|
1617
|
+
this.createImportTimer();
|
|
1618
|
+
|
|
1619
|
+
// 内嵌图片三段式(分片上传 → checkData → getData)由 getImportData 把后端解析出的
|
|
1620
|
+
// 附件写回行上的 attachments_ 列。它每一段开头都判 showImportDialog2,所以只能接在
|
|
1621
|
+
// 进度框打开之后、逐行开跑之前;跑完把 importLoading 归位,进度框切回百分比视图。
|
|
1622
|
+
if (importOption.enabledImportPreHandle) {
|
|
1623
|
+
this.uploadFile(() => {
|
|
1624
|
+
that.importLoading = false;
|
|
1625
|
+
that.runFrontImportRows(resultData);
|
|
1626
|
+
});
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
this.runFrontImportRows(resultData);
|
|
1630
|
+
},
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* 前端通道的逐行执行。
|
|
1634
|
+
* 默认:校验 → 逐行处理 → 通过的行一次性入表。
|
|
1635
|
+
* 开了后台校验:先收集前台通过行(失败立刻记账),整批一次 formHttp,
|
|
1636
|
+
* 按 impSeq 合并补数后再走入表 / 逐行脚本(不再重复前台校验)。
|
|
1637
|
+
* @param {Object} resultData readExcel 的解析信封。
|
|
1638
|
+
*/
|
|
1639
|
+
runFrontImportRows(resultData) {
|
|
1640
|
+
let that = this;
|
|
1641
|
+
let importOption = this.option.importOption || {};
|
|
1642
|
+
if (importOption.backendValidateEnabled) {
|
|
1643
|
+
if (!importOption.importScriptCode) {
|
|
1644
|
+
this.handleImportAbort(
|
|
1645
|
+
this.$t1("后台校验脚本编码(importScriptCode)未配置,无法校验")
|
|
1646
|
+
);
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
let passedRows = [];
|
|
1650
|
+
this.runImportRows({
|
|
1651
|
+
rows: resultData?.data || [],
|
|
1652
|
+
deferFinish: true,
|
|
1653
|
+
handler: (row, index, done) => {
|
|
1654
|
+
let errorInfo = that.validateImportRow(row, index, {
|
|
1655
|
+
data: resultData,
|
|
1656
|
+
});
|
|
1657
|
+
if (errorInfo) {
|
|
1658
|
+
done({ success: false, message: errorInfo });
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
passedRows.push(row);
|
|
1662
|
+
done({ defer: true });
|
|
1663
|
+
},
|
|
1664
|
+
onFinish: () => {
|
|
1665
|
+
that.requestBackendValidate(resultData, passedRows);
|
|
1666
|
+
},
|
|
1667
|
+
});
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
this.applyFrontImportRows(resultData, resultData?.data || [], {});
|
|
1671
|
+
},
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* 入表 / 逐行脚本。skipValidate 时不再跑前台校验(后台那步已经滤过)。
|
|
1675
|
+
* @param {Object} resultData readExcel 的解析信封。
|
|
1676
|
+
* @param {Array} rows 待处理行。
|
|
1677
|
+
* @param {Object} opts { skipValidate, progress }
|
|
1678
|
+
*/
|
|
1679
|
+
applyFrontImportRows(resultData, rows, opts) {
|
|
1680
|
+
let that = this;
|
|
1681
|
+
let importOption = this.option.importOption || {};
|
|
1682
|
+
let isScriptMode = importOption.importMode === "script";
|
|
1683
|
+
let skipValidate = !!(opts && opts.skipValidate);
|
|
1684
|
+
let passedRows = [];
|
|
1685
|
+
this.runImportRows({
|
|
1686
|
+
rows: rows || [],
|
|
1687
|
+
progress: opts && opts.progress,
|
|
1688
|
+
handler: (row, index, done) => {
|
|
1689
|
+
// 后台补数后只跑通过的子集,循环下标会从 0 重计;脚本要用 Excel 行序
|
|
1690
|
+
let rowIndex = row.impSeq != null ? row.impSeq : index;
|
|
1691
|
+
if (!skipValidate) {
|
|
1692
|
+
let errorInfo = that.validateImportRow(row, rowIndex, {
|
|
1693
|
+
data: resultData,
|
|
1694
|
+
});
|
|
1695
|
+
if (errorInfo) {
|
|
1696
|
+
done({ success: false, message: errorInfo });
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
if (isScriptMode) {
|
|
1701
|
+
// 逐行脚本模式:脚本只写"这一行怎么处理",循环/让步/进度归壳管。
|
|
1702
|
+
// 没配脚本时按通过处理,避免整批卡在第一行。
|
|
1703
|
+
if (!importOption.onImportRow) {
|
|
1704
|
+
done({ success: true });
|
|
1705
|
+
return;
|
|
1706
|
+
}
|
|
1707
|
+
that
|
|
1708
|
+
.getFieldTarget()
|
|
1709
|
+
.handleCustomEvent(
|
|
1710
|
+
importOption.onImportRow,
|
|
1711
|
+
["row", "index", "done"],
|
|
1712
|
+
[row, rowIndex, done]
|
|
1713
|
+
);
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
passedRows.push(row);
|
|
1717
|
+
done({ success: true });
|
|
1718
|
+
},
|
|
1719
|
+
onFinish: () => {
|
|
1720
|
+
if (isScriptMode) return;
|
|
1721
|
+
if (!importOption.tableRef || !passedRows.length) return;
|
|
1722
|
+
let tableRef = that
|
|
1723
|
+
.getFieldTarget()
|
|
1724
|
+
.getWidgetRef(importOption.tableRef);
|
|
1725
|
+
// 逐行 addTableData 会逐行 setValue + handleWbs,几百行就卡;这里一次性追加。
|
|
1726
|
+
// 入表的必须是剥掉记账字段的副本:addTableData 是 Object.assign 全量拷贝,
|
|
1727
|
+
// 不剥就把 impSeq/_resultType 一起写进表单数据,跟着保存提交出去。
|
|
1728
|
+
if (tableRef) {
|
|
1729
|
+
tableRef.addTableData(
|
|
1730
|
+
passedRows.map((row) => that.stripImportMeta(row)),
|
|
1731
|
+
importOption.dedupField || undefined
|
|
1732
|
+
);
|
|
1733
|
+
}
|
|
1734
|
+
},
|
|
1735
|
+
});
|
|
1736
|
+
},
|
|
1737
|
+
|
|
1738
|
+
/** 当前表单的 formCode / formVersion;formImport 通道没有 getReportTemplate,改从配置取。 */
|
|
1739
|
+
getImportFormMeta() {
|
|
1740
|
+
let importOption = this.option.importOption || {};
|
|
1741
|
+
let reportTemplate =
|
|
1742
|
+
typeof this.getReportTemplate === "function"
|
|
1743
|
+
? this.getReportTemplate()
|
|
1744
|
+
: null;
|
|
1745
|
+
return {
|
|
1746
|
+
formCode: reportTemplate?.formCode || importOption.formCode,
|
|
1747
|
+
formVersion: reportTemplate?.formVersion,
|
|
1748
|
+
};
|
|
1749
|
+
},
|
|
1750
|
+
|
|
1751
|
+
/** onImportParams 整批一次,非对象则当 {}。 */
|
|
1752
|
+
getBackendValidateParams(resultData) {
|
|
1753
|
+
let importOption = this.option.importOption || {};
|
|
1754
|
+
if (!importOption.onImportParams) return {};
|
|
1755
|
+
let result = this.getFieldTarget().handleCustomEvent(
|
|
1756
|
+
importOption.onImportParams,
|
|
1757
|
+
["resultData", "file"],
|
|
1758
|
+
[resultData, this.fileRaw]
|
|
1759
|
+
);
|
|
1760
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) {
|
|
1761
|
+
return {};
|
|
1762
|
+
}
|
|
1763
|
+
return result;
|
|
1764
|
+
},
|
|
1765
|
+
|
|
1766
|
+
/** 送给后台的行:剥掉进度记账字段,保留 impSeq / impNumber 供回包对位。 */
|
|
1767
|
+
buildBackendValidatePayloadRows(rows) {
|
|
1768
|
+
return (rows || []).map((row) => {
|
|
1769
|
+
let item = this.stripImportMeta(row);
|
|
1770
|
+
item.impSeq = row.impSeq;
|
|
1771
|
+
item.impNumber = row.impNumber;
|
|
1772
|
+
return item;
|
|
1773
|
+
});
|
|
1774
|
+
},
|
|
1775
|
+
|
|
1776
|
+
mergeBackendValidateRow(row, item) {
|
|
1777
|
+
if (!item) return;
|
|
1778
|
+
Object.keys(item).forEach((key) => {
|
|
1779
|
+
if (BACKEND_VALIDATE_SKIP_FIELDS.indexOf(key) >= 0) return;
|
|
1780
|
+
row[key] = item[key];
|
|
1781
|
+
});
|
|
1782
|
+
},
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* 按 impSeq 把后台逐行结果合并进原行。
|
|
1786
|
+
* 没返回的行、impReturnType=error 的行记失败,不入后续入表。
|
|
1787
|
+
*/
|
|
1788
|
+
applyBackendValidateResult(passedRows, objx) {
|
|
1789
|
+
let progress = this.importProgress;
|
|
1790
|
+
let list = Array.isArray(objx) ? objx : [];
|
|
1791
|
+
let map = {};
|
|
1792
|
+
list.forEach((item) => {
|
|
1793
|
+
if (item && item.impSeq != null) map[item.impSeq] = item;
|
|
1794
|
+
});
|
|
1795
|
+
let enriched = [];
|
|
1796
|
+
(passedRows || []).forEach((row) => {
|
|
1797
|
+
let item = map[row.impSeq];
|
|
1798
|
+
if (!item) {
|
|
1799
|
+
progress.markError(row, this.$t1("后台未返回该行结果"));
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
if (item.impReturnType === "error") {
|
|
1803
|
+
progress.markError(
|
|
1804
|
+
row,
|
|
1805
|
+
item.impReturnMsg || this.$t1("数据校验未通过")
|
|
1806
|
+
);
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
this.mergeBackendValidateRow(row, item);
|
|
1810
|
+
enriched.push(row);
|
|
1811
|
+
});
|
|
1812
|
+
return enriched;
|
|
1813
|
+
},
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* 前台通过的行整批一次送给后台校验 + 补数。
|
|
1817
|
+
* 不要求 importEntity、不套附件信封;data 就是行数组,params 来自 onImportParams。
|
|
1818
|
+
*/
|
|
1819
|
+
requestBackendValidate(resultData, passedRows) {
|
|
1820
|
+
let that = this;
|
|
1821
|
+
let finishProgress = () => {
|
|
1822
|
+
that.backendValidating = false;
|
|
1823
|
+
if (that.importProgress) that.importProgress.finish();
|
|
1824
|
+
};
|
|
1825
|
+
if (!passedRows || !passedRows.length) {
|
|
1826
|
+
finishProgress();
|
|
1827
|
+
return;
|
|
1828
|
+
}
|
|
1829
|
+
let importOption = this.option.importOption || {};
|
|
1830
|
+
let scriptCode = importOption.importScriptCode;
|
|
1831
|
+
if (!scriptCode) {
|
|
1832
|
+
this.handleImportAbort(
|
|
1833
|
+
this.$t1("后台校验脚本编码(importScriptCode)未配置,无法校验")
|
|
1834
|
+
);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
let formMeta = this.getImportFormMeta();
|
|
1838
|
+
let params;
|
|
1839
|
+
try {
|
|
1840
|
+
params = this.getBackendValidateParams(resultData);
|
|
1841
|
+
} catch (et) {
|
|
1842
|
+
console.error(et);
|
|
1843
|
+
this.handleImportAbort(this.$t1("请求额外参数脚本异常"));
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
this.backendValidating = true;
|
|
1847
|
+
this.formHttp({
|
|
1848
|
+
scriptCode: scriptCode,
|
|
1849
|
+
data: {
|
|
1850
|
+
formCode: formMeta.formCode,
|
|
1851
|
+
formVersion: formMeta.formVersion,
|
|
1852
|
+
data: this.buildBackendValidatePayloadRows(passedRows),
|
|
1853
|
+
params: params,
|
|
1854
|
+
},
|
|
1855
|
+
modal: false,
|
|
1856
|
+
failMsg: false,
|
|
1857
|
+
callback: (resultMsg) => {
|
|
1858
|
+
that.backendValidating = false;
|
|
1859
|
+
if (that.isEnd || !that.showContent) return;
|
|
1860
|
+
if (!resultMsg || resultMsg.type !== "success") {
|
|
1861
|
+
that.handleImportAbort(
|
|
1862
|
+
(resultMsg && resultMsg.content) || that.$t1("后台校验失败")
|
|
1863
|
+
);
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
let enriched = that.applyBackendValidateResult(
|
|
1867
|
+
passedRows,
|
|
1868
|
+
resultMsg.objx
|
|
1869
|
+
);
|
|
1870
|
+
that.applyFrontImportRows(resultData, enriched, {
|
|
1871
|
+
skipValidate: true,
|
|
1872
|
+
progress: that.importProgress,
|
|
1873
|
+
});
|
|
1874
|
+
},
|
|
1875
|
+
error: (et) => {
|
|
1876
|
+
that.backendValidating = false;
|
|
1877
|
+
console.error(et);
|
|
1878
|
+
that.handleImportAbort(that.$t1("后台校验失败"));
|
|
1879
|
+
},
|
|
1880
|
+
});
|
|
1881
|
+
},
|
|
1882
|
+
|
|
1883
|
+
//begin
|
|
1884
|
+
fileParse(file, type = "base64", callback) {
|
|
1885
|
+
let fileRead = new FileReader();
|
|
1886
|
+
if (type === "base64") {
|
|
1887
|
+
fileRead.readAsDataURL(file);
|
|
1888
|
+
} else if (type === "buffer") {
|
|
1889
|
+
fileRead.readAsArrayBuffer(file);
|
|
1890
|
+
}
|
|
1891
|
+
fileRead.onload = (ev) => {
|
|
1892
|
+
callback(ev.target.result);
|
|
1893
|
+
};
|
|
1894
|
+
},
|
|
1895
|
+
getUploadText(percent) {
|
|
1896
|
+
return this.$t1("上传导入文件 {percent}%", { percent });
|
|
1897
|
+
},
|
|
1898
|
+
changeUploadPercent(percent) {
|
|
1899
|
+
// return this.$t1('上传导入文件 {percent}%', {percent})
|
|
1900
|
+
this.percent1 = percent;
|
|
1901
|
+
this.loadingIndex = 1;
|
|
1902
|
+
},
|
|
1903
|
+
uploadFile(callback) {
|
|
1904
|
+
let that = this;
|
|
1905
|
+
that.loadingPercent = 0;
|
|
1906
|
+
// that.loadingTitle = this.getUploadText(0);
|
|
1907
|
+
that.changeUploadPercent(0);
|
|
1908
|
+
let file = this.fileRaw;
|
|
1909
|
+
let uploadChunkSize = 5;
|
|
1910
|
+
this.importLoading = true;
|
|
1911
|
+
this.fileUploadCallback = callback;
|
|
1912
|
+
this.fileParse(file, "buffer", (buffer) => {
|
|
1913
|
+
let spark = new SparkMD5.ArrayBuffer(),
|
|
1914
|
+
chunkSize = uploadChunkSize * 1024 * 1024, // Read in chunks of 2MB
|
|
1915
|
+
chunks = Math.ceil(file.size / chunkSize),
|
|
1916
|
+
hash,
|
|
1917
|
+
suffix;
|
|
1918
|
+
spark.append(buffer);
|
|
1919
|
+
hash = spark.end();
|
|
1920
|
+
let md5 = hash;
|
|
1921
|
+
let nameSplit = /\.([0-9a-zA-Z]+)$/i.exec(file.name);
|
|
1922
|
+
|
|
1923
|
+
suffix = nameSplit && nameSplit.length > 1 ? nameSplit[1] : "";
|
|
1924
|
+
|
|
1925
|
+
let chunkParam = {
|
|
1926
|
+
fullFile: file,
|
|
1927
|
+
chunkSize: chunkSize,
|
|
1928
|
+
chunks: chunks,
|
|
1929
|
+
chunkIndex: 0,
|
|
1930
|
+
md5: hash,
|
|
1931
|
+
uuid: "",
|
|
1932
|
+
name: file.name,
|
|
1933
|
+
};
|
|
1934
|
+
file.chunkParam = chunkParam;
|
|
1935
|
+
|
|
1936
|
+
this.sendRequest(file);
|
|
1937
|
+
});
|
|
1938
|
+
},
|
|
1939
|
+
async sendRequest(fullFile) {
|
|
1940
|
+
if (!this.showImportDialog2) return;
|
|
1941
|
+
let that = this;
|
|
1942
|
+
let uploadUrl = USER_PREFIX + "/excel_import/uploadFile";
|
|
1943
|
+
let chunkParam = fullFile.chunkParam;
|
|
1944
|
+
let target = that.$refs.upload;
|
|
1945
|
+
let abort;
|
|
1946
|
+
let config = {
|
|
1947
|
+
headers: {
|
|
1948
|
+
"Content-Type": "multipart/form-data",
|
|
1949
|
+
},
|
|
1950
|
+
cancelToken: new axios.CancelToken(function executor(c) {
|
|
1951
|
+
abort = c;
|
|
1952
|
+
fullFile.abort = c;
|
|
1953
|
+
}),
|
|
1954
|
+
onUploadProgress: (progressEvent) => {
|
|
1955
|
+
let start = chunkParam.start;
|
|
1956
|
+
let uploadedSize =
|
|
1957
|
+
start +
|
|
1958
|
+
Math.floor(
|
|
1959
|
+
(chunkParam.currentSize * progressEvent.loaded) /
|
|
1960
|
+
progressEvent.total
|
|
1961
|
+
);
|
|
1962
|
+
let percent = Math.floor((uploadedSize * 100) / fullFile.size);
|
|
1963
|
+
if (percent === 100) {
|
|
1964
|
+
percent = 99;
|
|
1965
|
+
}
|
|
1966
|
+
that.loadingPercent = percent;
|
|
1967
|
+
|
|
1968
|
+
// that.$set(that, 'loadingTitle', this.getUploadText(percent))
|
|
1969
|
+
that.changeUploadPercent(percent);
|
|
1970
|
+
},
|
|
1971
|
+
// failMsg: false,
|
|
1972
|
+
modal: false,
|
|
1973
|
+
callback: (res1) => {
|
|
1974
|
+
if (res1.type === "success") {
|
|
1975
|
+
let uuid = res1.objx.uuid;
|
|
1976
|
+
chunkParam.uuid = uuid;
|
|
1977
|
+
if (preFormData.chunk + 1 >= preFormData.chunks) {
|
|
1978
|
+
let mergeData = {
|
|
1979
|
+
name: chunkParam.name,
|
|
1980
|
+
md5: chunkParam.md5,
|
|
1981
|
+
uuid: uuid,
|
|
1982
|
+
};
|
|
1983
|
+
let _param = {
|
|
1984
|
+
mergeData: mergeData,
|
|
1985
|
+
chunkParam: chunkParam,
|
|
1986
|
+
};
|
|
1987
|
+
setTimeout(() => {
|
|
1988
|
+
this.mergeFile(_param);
|
|
1989
|
+
}, 100);
|
|
1990
|
+
} else {
|
|
1991
|
+
chunkParam.chunkIndex = chunkParam.chunkIndex + 1;
|
|
1992
|
+
chunkParam.uuid = uuid;
|
|
1993
|
+
setTimeout(() => {
|
|
1994
|
+
this.sendRequest(fullFile);
|
|
1995
|
+
}, 100);
|
|
1996
|
+
}
|
|
1997
|
+
} else {
|
|
1998
|
+
this.dialogClose2(0);
|
|
1999
|
+
}
|
|
2000
|
+
return res1;
|
|
2001
|
+
},
|
|
2002
|
+
error: (err) => {
|
|
2003
|
+
console.log(err);
|
|
2004
|
+
this.dialogClose2(0);
|
|
2005
|
+
},
|
|
2006
|
+
}; //添加请求头
|
|
2007
|
+
|
|
2008
|
+
let chunkIndex = chunkParam.chunkIndex;
|
|
2009
|
+
let chunkSize = chunkParam.chunkSize;
|
|
2010
|
+
let start = chunkIndex * chunkSize,
|
|
2011
|
+
end =
|
|
2012
|
+
start + chunkSize >= fullFile.size
|
|
2013
|
+
? fullFile.size
|
|
2014
|
+
: start + chunkParam.chunkSize;
|
|
2015
|
+
chunkParam.currentSize = end - start;
|
|
2016
|
+
chunkParam.start = start;
|
|
2017
|
+
chunkParam.end = end;
|
|
2018
|
+
|
|
2019
|
+
let preFormData = {
|
|
2020
|
+
file: fullFile.slice(start, end),
|
|
2021
|
+
name: fullFile.name,
|
|
2022
|
+
chunks: chunkParam.chunks,
|
|
2023
|
+
chunk: chunkIndex,
|
|
2024
|
+
md5: chunkParam.md5,
|
|
2025
|
+
uuid: chunkParam.uuid,
|
|
2026
|
+
};
|
|
2027
|
+
|
|
2028
|
+
let formData = new FormData();
|
|
2029
|
+
Object.keys(preFormData).forEach((key) => {
|
|
2030
|
+
formData.append(key, preFormData[key]);
|
|
2031
|
+
});
|
|
2032
|
+
|
|
2033
|
+
let req = this.$http.post(uploadUrl, formData, config);
|
|
2034
|
+
req.abort = () => {
|
|
2035
|
+
abort(this.$t2("取消上传", "components.VabUpload.cancelUpload"));
|
|
2036
|
+
};
|
|
2037
|
+
},
|
|
2038
|
+
mergeFile(param) {
|
|
2039
|
+
if (!this.showImportDialog2) return;
|
|
2040
|
+
let that = this;
|
|
2041
|
+
let mergeData = param.mergeData;
|
|
2042
|
+
let chunkParam = param.chunkParam;
|
|
2043
|
+
let fullFile = chunkParam.fullFile;
|
|
2044
|
+
let mergeUrl = USER_PREFIX + "/excel_import/mergeChunk";
|
|
2045
|
+
let target = this.$refs.upload;
|
|
2046
|
+
this.$http({
|
|
2047
|
+
url: mergeUrl,
|
|
2048
|
+
method: "post",
|
|
2049
|
+
data: mergeData,
|
|
2050
|
+
// failMsg: false,
|
|
2051
|
+
modal: false,
|
|
2052
|
+
cancelToken: new axios.CancelToken(function executor(c) {
|
|
2053
|
+
if (fullFile) fullFile.abort = c;
|
|
2054
|
+
}),
|
|
2055
|
+
callback: (res) => {
|
|
2056
|
+
if (res.type === "success") {
|
|
2057
|
+
that.loadingPercent = 100;
|
|
2058
|
+
// that.loadingTitle = this.getUploadText(100);
|
|
2059
|
+
this.changeUploadPercent(100);
|
|
2060
|
+
setTimeout(() => {
|
|
2061
|
+
this.checkImportData();
|
|
2062
|
+
}, 100);
|
|
2063
|
+
} else {
|
|
2064
|
+
this.dialogClose2(0);
|
|
2065
|
+
}
|
|
2066
|
+
},
|
|
2067
|
+
error: (e) => {
|
|
2068
|
+
console.log(err);
|
|
2069
|
+
this.dialogClose2(0);
|
|
2070
|
+
},
|
|
2071
|
+
});
|
|
2072
|
+
},
|
|
2073
|
+
getCheckText(percent) {
|
|
2074
|
+
return this.$t1("校验导入文件中的图片数据格式 {percent}%", { percent });
|
|
2075
|
+
},
|
|
2076
|
+
changeCheckTextPercent(percent) {
|
|
2077
|
+
this.percent2 = percent;
|
|
2078
|
+
this.loadingIndex = 2;
|
|
2079
|
+
},
|
|
2080
|
+
checkImportData() {
|
|
2081
|
+
if (!this.showImportDialog2) return;
|
|
2082
|
+
let that = this;
|
|
2083
|
+
that.loadingPercent = 0;
|
|
2084
|
+
// that.loadingTitle = this.getCheckText(0);
|
|
2085
|
+
that.changeCheckTextPercent(0);
|
|
2086
|
+
let fullFile = this.fileRaw;
|
|
2087
|
+
let chunkParam = fullFile.chunkParam;
|
|
2088
|
+
|
|
2089
|
+
this.$http({
|
|
2090
|
+
url: USER_PREFIX + "/excel_import/checkData",
|
|
2091
|
+
method: "post",
|
|
2092
|
+
data: {
|
|
2093
|
+
name: chunkParam.name,
|
|
2094
|
+
md5: chunkParam.md5,
|
|
2095
|
+
uuid: chunkParam.uuid,
|
|
2096
|
+
},
|
|
2097
|
+
// failMsg: false,
|
|
2098
|
+
modal: false,
|
|
2099
|
+
cancelToken: new axios.CancelToken(function executor(c) {
|
|
2100
|
+
if (fullFile) fullFile.abort = c;
|
|
2101
|
+
}),
|
|
2102
|
+
onUploadProgress: (progressEvent) => {
|
|
2103
|
+
let percent = Math.floor(
|
|
2104
|
+
(progressEvent.loaded * 100) / progressEvent.total
|
|
2105
|
+
);
|
|
2106
|
+
if (percent === 100) {
|
|
2107
|
+
percent = 99;
|
|
2108
|
+
}
|
|
2109
|
+
that.loadingPercent = percent;
|
|
2110
|
+
// that.$set(that, 'loadingTitle', this.getCheckText(percent))
|
|
2111
|
+
that.changeCheckTextPercent(percent);
|
|
2112
|
+
},
|
|
2113
|
+
callback: (res) => {
|
|
2114
|
+
if (res.type === "success") {
|
|
2115
|
+
that.loadingPercent = 100;
|
|
2116
|
+
// that.loadingTitle = this.getCheckText(100);
|
|
2117
|
+
that.changeCheckTextPercent(100);
|
|
2118
|
+
this.handleImageData();
|
|
2119
|
+
} else {
|
|
2120
|
+
this.dialogClose2(0);
|
|
2121
|
+
}
|
|
2122
|
+
},
|
|
2123
|
+
error: (e) => {
|
|
2124
|
+
console.log(err);
|
|
2125
|
+
this.dialogClose2(0);
|
|
2126
|
+
},
|
|
2127
|
+
});
|
|
2128
|
+
},
|
|
2129
|
+
getSaveImageText(percent) {
|
|
2130
|
+
return this.$t1("存储导入文件中的图片 {percent}%", { percent });
|
|
2131
|
+
},
|
|
2132
|
+
changeSaveImageTextPercent(percent) {
|
|
2133
|
+
// return this.$t1('存储导入文件中的图片 {percent}%', {percent})
|
|
2134
|
+
this.percent3 = percent;
|
|
2135
|
+
this.loadingIndex = 3;
|
|
2136
|
+
},
|
|
2137
|
+
handleImageData() {
|
|
2138
|
+
let that = this;
|
|
2139
|
+
that.loadingPercent = 0;
|
|
2140
|
+
// that.loadingTitle = this.getSaveImageText(0);
|
|
2141
|
+
that.changeSaveImageTextPercent(0);
|
|
2142
|
+
this.getImportData(0);
|
|
2143
|
+
},
|
|
2144
|
+
getImportData(index) {
|
|
2145
|
+
if (!this.showImportDialog2) return;
|
|
2146
|
+
let that = this;
|
|
2147
|
+
let rowSize = this.handleRowSize;
|
|
2148
|
+
let fullFile = this.fileRaw;
|
|
2149
|
+
let chunkParam = fullFile.chunkParam;
|
|
2150
|
+
let rowDatas = this.resultData.data;
|
|
2151
|
+
let size = rowDatas.length;
|
|
2152
|
+
let currentLineNo = index + 1;
|
|
2153
|
+
let rowNumber = index + 3;
|
|
2154
|
+
let startRow = index + 3;
|
|
2155
|
+
let endRow = index + 3 + rowSize - 1;
|
|
2156
|
+
this.$http({
|
|
2157
|
+
url: USER_PREFIX + "/excel_import/getData",
|
|
2158
|
+
method: "post",
|
|
2159
|
+
data: {
|
|
2160
|
+
name: chunkParam.name,
|
|
2161
|
+
md5: chunkParam.md5,
|
|
2162
|
+
uuid: chunkParam.uuid,
|
|
2163
|
+
startRow: startRow,
|
|
2164
|
+
endRow: endRow,
|
|
2165
|
+
},
|
|
2166
|
+
// failMsg: false,
|
|
2167
|
+
modal: false,
|
|
2168
|
+
cancelToken: new axios.CancelToken(function executor(c) {
|
|
2169
|
+
if (fullFile) fullFile.abort = c;
|
|
2170
|
+
}),
|
|
2171
|
+
callback: (res) => {
|
|
2172
|
+
if (res.type === "success") {
|
|
2173
|
+
let rows = res?.objx?.datas || [];
|
|
2174
|
+
let fileCellFields = this.fileCellFields;
|
|
2175
|
+
rows.forEach((row) => {
|
|
2176
|
+
let rowIndex = row.row - 3;
|
|
2177
|
+
let item = rowDatas[rowIndex];
|
|
2178
|
+
Object.keys(row).forEach((key) => {
|
|
2179
|
+
if (fileCellFields.includes(key)) {
|
|
2180
|
+
let value = row[key] || [];
|
|
2181
|
+
if (!Array.isArray(value)) {
|
|
2182
|
+
value = [value];
|
|
2183
|
+
}
|
|
2184
|
+
item[key] = value;
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2187
|
+
});
|
|
2188
|
+
let cIndex = index + rowSize - 1;
|
|
2189
|
+
let percent = Math.floor(((cIndex + 1) * 100) / size);
|
|
2190
|
+
that.loadingPercent = percent;
|
|
2191
|
+
// that.loadingTitle = this.getSaveImageText(percent);
|
|
2192
|
+
that.changeSaveImageTextPercent(percent);
|
|
2193
|
+
if (cIndex + 1 < size) {
|
|
2194
|
+
this.getImportData(cIndex + 1);
|
|
2195
|
+
} else {
|
|
2196
|
+
// 三段式按 fileCellFields 白名单把原始附件列写了回来,「值存为URL」
|
|
2197
|
+
// 列要在这里再转一次,否则目标实体列拿到的是附件对象数组
|
|
2198
|
+
this.applyImportUrlAttachments(rowDatas);
|
|
2199
|
+
this.fileUploadCallback();
|
|
2200
|
+
}
|
|
2201
|
+
} else {
|
|
2202
|
+
this.dialogClose2(0);
|
|
2203
|
+
}
|
|
2204
|
+
},
|
|
2205
|
+
error: (e) => {
|
|
2206
|
+
this.dialogClose2(0);
|
|
2207
|
+
},
|
|
2208
|
+
});
|
|
2209
|
+
},
|
|
2210
|
+
async generateNewExcel() {
|
|
2211
|
+
let file = this.fileRaw;
|
|
2212
|
+
try {
|
|
2213
|
+
const XLSX = await loadXlsx();
|
|
2214
|
+
// 1. 读取原始文件
|
|
2215
|
+
const workbook = XLSX.read(file, { type: "binary" });
|
|
2216
|
+
const sheetName = workbook.SheetNames[0];
|
|
2217
|
+
const rawData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
|
|
2218
|
+
|
|
2219
|
+
// 2. 提取表头和数据
|
|
2220
|
+
const headers = rawData.slice(0, this.headerRows);
|
|
2221
|
+
const bodyData = rawData.slice(this.headerRows);
|
|
2222
|
+
|
|
2223
|
+
let exporLineNos = [];
|
|
2224
|
+
if (this.resultType) {
|
|
2225
|
+
exporLineNos = this.successRows.map((item) => item.impNumber - 1);
|
|
2226
|
+
} else {
|
|
2227
|
+
exporLineNos = this.failRows.map((item) => item.impNumber - 1);
|
|
2228
|
+
}
|
|
2229
|
+
// 3. 应用筛选规则
|
|
2230
|
+
let selectRule = (row, index) => {
|
|
2231
|
+
return exporLineNos.includes(index);
|
|
2232
|
+
};
|
|
2233
|
+
const filteredData = bodyData.filter(
|
|
2234
|
+
(row, index) => {
|
|
2235
|
+
return selectRule(row, index + this.headerRows);
|
|
2236
|
+
}
|
|
2237
|
+
// this.selectRule(row, index + this.headerRows) // 注意索引转换
|
|
2238
|
+
);
|
|
2239
|
+
|
|
2240
|
+
// 4. 合并数据
|
|
2241
|
+
const newData = [...headers, ...filteredData];
|
|
2242
|
+
|
|
2243
|
+
// 5. 生成新文件
|
|
2244
|
+
const newWorkbook = XLSX.utils.book_new();
|
|
2245
|
+
const newSheet = XLSX.utils.aoa_to_sheet(newData);
|
|
2246
|
+
XLSX.utils.book_append_sheet(newWorkbook, newSheet, "Sheet1");
|
|
2247
|
+
|
|
2248
|
+
// 6. 下载文件
|
|
2249
|
+
const blob = XLSX.write(newWorkbook, {
|
|
2250
|
+
bookType: "xlsx",
|
|
2251
|
+
type: "array",
|
|
2252
|
+
});
|
|
2253
|
+
|
|
2254
|
+
const url = URL.createObjectURL(blob);
|
|
2255
|
+
const a = document.createElement("a");
|
|
2256
|
+
a.href = url;
|
|
2257
|
+
let fileName = null;
|
|
2258
|
+
if (this.resultType) {
|
|
2259
|
+
fileName = `导入结果(成功).xlsx`;
|
|
2260
|
+
} else {
|
|
2261
|
+
fileName = `导入结果(失败).xlsx`;
|
|
2262
|
+
}
|
|
2263
|
+
a.download = fileName;
|
|
2264
|
+
a.click();
|
|
2265
|
+
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
2266
|
+
|
|
2267
|
+
// 7. 更新进度
|
|
2268
|
+
this.progress = 100;
|
|
2269
|
+
setTimeout(() => (this.progress = 0), 1000);
|
|
2270
|
+
} catch (error) {
|
|
2271
|
+
console.error("处理文件时出错:", error);
|
|
2272
|
+
}
|
|
2273
|
+
},
|
|
2274
|
+
//end
|
|
2275
|
+
getLoadingClass(flag, percent) {
|
|
2276
|
+
let classStr = null;
|
|
2277
|
+
let loadingIndex = this.loadingIndex;
|
|
2278
|
+
if (percent >= 100) {
|
|
2279
|
+
classStr = "ok";
|
|
2280
|
+
} else if (flag === loadingIndex) {
|
|
2281
|
+
classStr = "loading";
|
|
2282
|
+
}
|
|
2283
|
+
return classStr;
|
|
2284
|
+
},
|
|
2285
|
+
|
|
2286
|
+
/***sheet1 */
|
|
2287
|
+
async readExcel2(file, callback) {
|
|
2288
|
+
let that = this;
|
|
2289
|
+
let option = this.option;
|
|
2290
|
+
|
|
2291
|
+
// 附件列清单按本次解析重建:解析可以在同一个弹框里跑多次(strict 拦下来后
|
|
2292
|
+
// 用户重选文件、"确定"又没有 pending 锁),只 push 不清会把上一份的附件列带进来。
|
|
2293
|
+
this.fileCellFields = [];
|
|
2294
|
+
this.urlAttachFields = {};
|
|
2295
|
+
|
|
2296
|
+
let XLSX;
|
|
2297
|
+
try {
|
|
2298
|
+
XLSX = await loadXlsx();
|
|
2299
|
+
} catch (error) {
|
|
2300
|
+
this.$baseAlert(this.$t1("Excel解析组件加载失败,请刷新页面后重试"));
|
|
2301
|
+
return false;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
const fileReader = new FileReader();
|
|
2305
|
+
fileReader.onload = async (ev) => {
|
|
2306
|
+
let resultData;
|
|
2307
|
+
try {
|
|
2308
|
+
const data = ev.target.result;
|
|
2309
|
+
const workbook = XLSX.read(data, {
|
|
2310
|
+
type: "binary",
|
|
2311
|
+
});
|
|
2312
|
+
|
|
2313
|
+
let sheetDatas = [];
|
|
2314
|
+
for (let pi = 0; pi < workbook.SheetNames.length; pi++) {
|
|
2315
|
+
let sheetName = workbook.SheetNames[pi];
|
|
2316
|
+
let sheet = workbook.Sheets[sheetName];
|
|
2317
|
+
|
|
2318
|
+
if (sheet["!ref"] === undefined || sheet["!ref"] === null) {
|
|
2319
|
+
that.$baseAlert(
|
|
2320
|
+
this.$t2(
|
|
2321
|
+
"请使用正确的导入模版!",
|
|
2322
|
+
"components.excelImport.warmMsg2"
|
|
2323
|
+
)
|
|
2324
|
+
);
|
|
2325
|
+
that.handleClose2();
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
let range = XLSX.utils.decode_range(sheet["!ref"]);
|
|
2329
|
+
let dataSize = range.e.r + 1; //行数
|
|
2330
|
+
that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
|
|
2331
|
+
// 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时主线程会被
|
|
2332
|
+
// 占死甚至 OOM。文件体积不大但行极多(窄表)时只有这一道能拦。
|
|
2333
|
+
if (isImportRowsOverLimit(that.dataSize, option)) {
|
|
2334
|
+
that.clearImportTimer();
|
|
2335
|
+
that.$baseAlert(
|
|
2336
|
+
that.$t1(
|
|
2337
|
+
"导入数据 {size} 行,超过单次上限 {limit} 行,请拆分后分批导入",
|
|
2338
|
+
{
|
|
2339
|
+
size: that.dataSize,
|
|
2340
|
+
limit: getImportRowLimit(option),
|
|
2341
|
+
}
|
|
2342
|
+
)
|
|
2343
|
+
);
|
|
2344
|
+
that.handleClose2();
|
|
2345
|
+
return false;
|
|
2346
|
+
}
|
|
2347
|
+
let titles = [];
|
|
2348
|
+
let fields = [];
|
|
2349
|
+
|
|
2350
|
+
const ws = workbook.Sheets[sheet];
|
|
2351
|
+
|
|
2352
|
+
let prefix = option.prefix;
|
|
2353
|
+
let excelUrl = option.excel;
|
|
2354
|
+
|
|
2355
|
+
let excelRows = [];
|
|
2356
|
+
let row;
|
|
2357
|
+
let rowNum;
|
|
2358
|
+
let colNum;
|
|
2359
|
+
for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
|
|
2360
|
+
row = [];
|
|
2361
|
+
for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
|
|
2362
|
+
let nextCell =
|
|
2363
|
+
sheet[
|
|
2364
|
+
XLSX.utils.encode_cell({
|
|
2365
|
+
r: rowNum,
|
|
2366
|
+
c: colNum,
|
|
2367
|
+
})
|
|
2368
|
+
];
|
|
2369
|
+
if (typeof nextCell === "undefined") {
|
|
2370
|
+
row.push(void 0);
|
|
2371
|
+
} else {
|
|
2372
|
+
row.push(getImportCellText(nextCell));
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
if (rowNum === 1) {
|
|
2376
|
+
titles = row;
|
|
2377
|
+
}
|
|
2378
|
+
if (rowNum === 2) {
|
|
2379
|
+
fields = row;
|
|
2380
|
+
let checkResult = true;
|
|
2381
|
+
}
|
|
2382
|
+
if (rowNum > 2) {
|
|
2383
|
+
let item = {};
|
|
2384
|
+
for (let i = 0; i < fields.length; i++) {
|
|
2385
|
+
let field = fields[i];
|
|
2386
|
+
if (field) {
|
|
2387
|
+
item[field] = row[i] ?? null;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
excelRows.push(item);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
if (
|
|
2394
|
+
!titles.length ||
|
|
2395
|
+
!fields.length ||
|
|
2396
|
+
titles.length !== fields.length
|
|
2397
|
+
) {
|
|
2398
|
+
that.$baseAlert(
|
|
2399
|
+
this.$t2(
|
|
2400
|
+
"请使用正确的导入模版!",
|
|
2401
|
+
"components.excelImport.warmMsg2"
|
|
2402
|
+
)
|
|
2403
|
+
);
|
|
2404
|
+
// that.handleClose2();
|
|
2405
|
+
return false;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
let columns = [];
|
|
2409
|
+
let cols = [];
|
|
2410
|
+
let uniqueFields = [];
|
|
2411
|
+
let uniqueKeys = [];
|
|
2412
|
+
for (let i = 0; i < titles.length; i++) {
|
|
2413
|
+
let title = titles[i];
|
|
2414
|
+
if (title) {
|
|
2415
|
+
let field = fields[i];
|
|
2416
|
+
if (field === null || field === undefined) {
|
|
2417
|
+
that.$baseAlert(
|
|
2418
|
+
this.$t2(
|
|
2419
|
+
"请使用正确的导入模版!",
|
|
2420
|
+
"components.excelImport.warmMsg2"
|
|
2421
|
+
)
|
|
2422
|
+
);
|
|
2423
|
+
// that.handleClose2();
|
|
2424
|
+
return false;
|
|
2425
|
+
}
|
|
2426
|
+
let t = title.substr(-1);
|
|
2427
|
+
let u = title.length >= 2 ? title.substr(-2) : title;
|
|
2428
|
+
let p = title.length >= 3 ? title.substr(-3) : title;
|
|
2429
|
+
let isNeed = false;
|
|
2430
|
+
if (t === "*") {
|
|
2431
|
+
isNeed = true;
|
|
2432
|
+
}
|
|
2433
|
+
let isUnique = false;
|
|
2434
|
+
/* if (u === "**") {
|
|
2435
|
+
uniqueFields.push(field);
|
|
2436
|
+
isUnique = true;
|
|
2437
|
+
} */
|
|
2438
|
+
let isSheetUnique = false;
|
|
2439
|
+
if (p === "***") {
|
|
2440
|
+
uniqueKeys.push(field);
|
|
2441
|
+
isSheetUnique = true;
|
|
2442
|
+
}
|
|
2443
|
+
let otherConfig = {};
|
|
2444
|
+
let isFile = false;
|
|
2445
|
+
let urlTargetField = null;
|
|
2446
|
+
if (field.startsWith(IMPORT_ATTACH_PREFIX)) {
|
|
2447
|
+
that.fileCellFields.push(field);
|
|
2448
|
+
isFile = true;
|
|
2449
|
+
otherConfig = {
|
|
2450
|
+
slots: {
|
|
2451
|
+
default: "attachment",
|
|
2452
|
+
},
|
|
2453
|
+
};
|
|
2454
|
+
let urlAttach = that.parseUrlAttachmentField(field);
|
|
2455
|
+
if (urlAttach) {
|
|
2456
|
+
that.urlAttachFields[field] = urlAttach;
|
|
2457
|
+
urlTargetField = urlAttach.target;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
let col = {
|
|
2462
|
+
field: field,
|
|
2463
|
+
title: title,
|
|
2464
|
+
width: 100,
|
|
2465
|
+
isNeed: isNeed,
|
|
2466
|
+
isUnique: isUnique,
|
|
2467
|
+
isFile,
|
|
2468
|
+
urlTargetField,
|
|
2469
|
+
otherConfig,
|
|
2470
|
+
isSheetUnique,
|
|
2471
|
+
};
|
|
2472
|
+
cols.push(col);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
// 单据唯一标识是整张 sheet 的属性,必须等该 sheet 所有列解析完再判。
|
|
2477
|
+
// 早前这段写在列循环内部:第一列还没轮到带 *** 的那列,uniqueKeys 必然是空,
|
|
2478
|
+
// 于是"唯一标识不在第一列"的模板一律误报缺失。
|
|
2479
|
+
if (!uniqueKeys.length) {
|
|
2480
|
+
that.$baseAlert(
|
|
2481
|
+
`[${sheetName}]` + that.$t1("缺失单据唯一标识***")
|
|
2482
|
+
);
|
|
2483
|
+
return false;
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
let oriCols = JSON.parse(JSON.stringify(cols)); //列信息
|
|
2487
|
+
// 附件列收口成对象数组;多 sheet 下 fileCellFields 是全表累积的,
|
|
2488
|
+
// 所以按本 sheet 自己的 oriCols 判 isFile,不能用 fileCellFields。
|
|
2489
|
+
that.normalizeImportAttachmentCells(excelRows, oriCols);
|
|
2490
|
+
that.applyImportUrlAttachments(excelRows);
|
|
2491
|
+
/* if (uniqueKeys.length) {
|
|
2492
|
+
//分组唯一字段为空时,全部不发包。
|
|
2493
|
+
for (let i = 0; i < oriCols.length; i++) {
|
|
2494
|
+
let oriCol = oriCols[i];
|
|
2495
|
+
if (uniqueKeys.includes(oriCol.field)) {
|
|
2496
|
+
for (let j = 0; j < excelRows.length; j++) {
|
|
2497
|
+
let data = excelRows[j];
|
|
2498
|
+
let value = data[oriCol.field];
|
|
2499
|
+
if (value === null || value === undefined || value === "") {
|
|
2500
|
+
that.errorHandle(`[${sheetName}]`+
|
|
2501
|
+
that.$t2(
|
|
2502
|
+
"第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
|
|
2503
|
+
"components.excelImport.warmMsg3",
|
|
2504
|
+
{
|
|
2505
|
+
lineNo: j + 4,
|
|
2506
|
+
title: oriCol.title,
|
|
2507
|
+
}
|
|
2508
|
+
));
|
|
2509
|
+
return false;
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
} */
|
|
2515
|
+
// this.oriCols = oriCols;
|
|
2516
|
+
|
|
2517
|
+
let resultData1 = {
|
|
2518
|
+
sheetName: sheetName,
|
|
2519
|
+
data: excelRows,
|
|
2520
|
+
titles: titles,
|
|
2521
|
+
fields: fields,
|
|
2522
|
+
uniqueFields: uniqueFields,
|
|
2523
|
+
oriCols: oriCols,
|
|
2524
|
+
uniqueKeys,
|
|
2525
|
+
};
|
|
2526
|
+
sheetDatas.push(resultData1);
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
//校验必填
|
|
2530
|
+
if (!that.checkAllSheetData(sheetDatas)) {
|
|
2531
|
+
return false;
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
//合并多sheet数据
|
|
2535
|
+
let newDatas = [];
|
|
2536
|
+
resultData = that.$baseLodash.cloneDeep(sheetDatas[0]);
|
|
2537
|
+
let uniqueKey = resultData.uniqueKeys[0];
|
|
2538
|
+
let data2 = [];
|
|
2539
|
+
for (let i = 0; i < resultData.data.length; i++) {
|
|
2540
|
+
let item = resultData.data[i];
|
|
2541
|
+
// 这里原有一行 `let sheetName = resultData[sheetName];`:初始化式里引用了正在
|
|
2542
|
+
// 声明的同名变量,命中 TDZ 抛 ReferenceError,被外层 try/catch 吞成
|
|
2543
|
+
// showContent=false —— 表现为多 sheet 导入弹框直接消失、只有 console 有错。
|
|
2544
|
+
// 该变量全程没人读,直接删除。
|
|
2545
|
+
let uniqueValue = item[uniqueKey];
|
|
2546
|
+
|
|
2547
|
+
if (!that.isNull(uniqueValue)) {
|
|
2548
|
+
let newItem = { ...item };
|
|
2549
|
+
let allItems = [];
|
|
2550
|
+
for (let j = 1; j < sheetDatas.length; j++) {
|
|
2551
|
+
let sheetData = sheetDatas[j];
|
|
2552
|
+
let fDatas = [];
|
|
2553
|
+
for (let k = 0; k < sheetData.data.length; k++) {
|
|
2554
|
+
let sheetItem = sheetData.data[k];
|
|
2555
|
+
if (that.isNull(sheetItem[uniqueKey])) {
|
|
2556
|
+
that.handleCellNotNull(k, sheetData);
|
|
2557
|
+
return;
|
|
2558
|
+
}
|
|
2559
|
+
if (sheetItem[uniqueKey] === uniqueValue) {
|
|
2560
|
+
fDatas.push(sheetItem);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
allItems.push(fDatas);
|
|
2564
|
+
}
|
|
2565
|
+
newItem.sheetItems = allItems;
|
|
2566
|
+
data2.push(newItem);
|
|
2567
|
+
} else {
|
|
2568
|
+
that.handleCellNotNull(i, resultData);
|
|
2569
|
+
return false;
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
resultData.sheetDatas = sheetDatas;
|
|
2574
|
+
resultData.data = data2;
|
|
2575
|
+
this.oriCols = resultData.oriCols;
|
|
2576
|
+
this.resultData = resultData;
|
|
2577
|
+
callback(resultData);
|
|
2578
|
+
} catch (et) {
|
|
2579
|
+
that.showContent = false;
|
|
2580
|
+
that.clearImportTimer();
|
|
2581
|
+
console.error(et);
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
fileReader.readAsBinaryString(file);
|
|
2585
|
+
},
|
|
2586
|
+
isNull(val) {
|
|
2587
|
+
return val === null || val === undefined || val === "";
|
|
2588
|
+
},
|
|
2589
|
+
checkAllSheetData(sheetItems){
|
|
2590
|
+
let that = this;
|
|
2591
|
+
for(let sheetItem of sheetItems){
|
|
2592
|
+
let oriCols = sheetItem.oriCols;
|
|
2593
|
+
let uniqueKeys = sheetItem.uniqueKeys;
|
|
2594
|
+
let excelRows = sheetItem.data;
|
|
2595
|
+
let sheetName = sheetItem.sheetName;
|
|
2596
|
+
|
|
2597
|
+
for (let i = 0; i < oriCols.length; i++) {
|
|
2598
|
+
let oriCol = oriCols[i];
|
|
2599
|
+
let isNeed = oriCol.isNeed || uniqueKeys.includes(oriCol.field);
|
|
2600
|
+
if (!isNeed && !oriCol.isFile) continue;
|
|
2601
|
+
for (let j = 0; j < excelRows.length; j++) {
|
|
2602
|
+
let data = excelRows[j];
|
|
2603
|
+
let value = that.getImportCellValue(data, oriCol);
|
|
2604
|
+
// 归一后附件列的空值是 [],isNull 判不出来,必填的附件列会漏过
|
|
2605
|
+
if (isNeed && that.isEmptyImportCell(value)) {
|
|
2606
|
+
that.errorHandle(`[${sheetName}]`+
|
|
2607
|
+
that.$t2(
|
|
2608
|
+
"第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
|
|
2609
|
+
"components.excelImport.warmMsg3",
|
|
2610
|
+
{
|
|
2611
|
+
lineNo: j + 4,
|
|
2612
|
+
title: oriCol.title,
|
|
2613
|
+
}
|
|
2614
|
+
));
|
|
2615
|
+
return false;
|
|
2616
|
+
}
|
|
2617
|
+
if (that.isBadAttachmentCell(oriCol, value)) {
|
|
2618
|
+
let message = that.$t1("第{lineNo}行[{title}]不是有效的附件地址;", {
|
|
2619
|
+
lineNo: j + 4,
|
|
2620
|
+
title: oriCol.title,
|
|
2621
|
+
});
|
|
2622
|
+
that.errorHandle(`[${sheetName}]${message}`);
|
|
2623
|
+
return false;
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
}
|
|
2629
|
+
return true;
|
|
2630
|
+
},
|
|
2631
|
+
|
|
2632
|
+
|
|
2633
|
+
handleCellNotNull(i, sheetData) {
|
|
2634
|
+
let that = this;
|
|
2635
|
+
let uniqueKey = sheetData.uniqueKeys[0];
|
|
2636
|
+
let oriCol = sheetData.oriCols.find((item) => item.field === uniqueKey);
|
|
2637
|
+
that.errorHandle(
|
|
2638
|
+
`[${sheetData.sheetName}]` +
|
|
2639
|
+
that.$t2(
|
|
2640
|
+
"第" + (i + 4) + "行[" + oriCol.title + "]不能为空;",
|
|
2641
|
+
"components.excelImport.warmMsg3",
|
|
2642
|
+
{
|
|
2643
|
+
lineNo: i + 4,
|
|
2644
|
+
title: oriCol.title,
|
|
2645
|
+
}
|
|
2646
|
+
)
|
|
2647
|
+
);
|
|
2648
|
+
},
|
|
2649
|
+
errorHandle(errorText) {
|
|
2650
|
+
this.clearImportTimer();
|
|
2651
|
+
this.$baseAlert(errorText);
|
|
2652
|
+
// this.handleClose2();
|
|
2653
|
+
},
|
|
2654
|
+
/***sheet2 */
|
|
2655
|
+
},
|
|
2656
|
+
};
|
|
2657
|
+
export const mixins = tmixins;
|