cloud-web-corejs 1.1.0-dev.6 → 1.1.0-dev.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (498) hide show
  1. package/README.md +38 -0
  2. package/bin/core-resources.js +16 -0
  3. package/bin/create-child-app.js +34 -0
  4. package/docs/child-app/README.md +95 -0
  5. package/docs/child-app/activiti-resources.md +63 -0
  6. package/docs/child-app/generate-prompt.md +55 -0
  7. package/docs/child-app/luckysheet-resources.md +80 -0
  8. package/docs/child-app/public-resources-plan.md +288 -0
  9. package/docs/child-app/resources-implementation.md +101 -0
  10. package/docs/child-app/tinymce-resources.md +88 -0
  11. package/docs/child-app/validation.md +34 -0
  12. package/docs/qiankun/346/216/245/345/205/245/345/215/217/350/256/256.md +298 -0
  13. 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
  14. package/package.json +29 -4
  15. package/resource-tools/index.js +126 -0
  16. package/src/app-bootstrap.js +531 -0
  17. package/src/app-bootstrap.sync.js +502 -0
  18. package/src/boot-assets.legacy.js +13 -0
  19. package/src/boot-assets.next.js +7 -0
  20. package/src/components/Qrcode/fileParse.vue +11 -0
  21. package/src/components/Tinymce/dynamicLoadScript.js +51 -59
  22. package/src/components/Tinymce/index.vue +382 -336
  23. package/src/components/Tinymce/mce-chrome.scss +150 -0
  24. package/src/components/VabUpload/image-viewer.vue +18 -10
  25. package/src/components/VabUpload/index.js +11 -4
  26. package/src/components/VabUpload/index.vue +1 -1
  27. package/src/components/VabUpload/mixins/fileLibraryDialog.js +2 -0
  28. package/src/components/VabUpload/mixins.js +72 -40
  29. package/src/components/VabUpload/partUploadConfig.js +95 -0
  30. package/src/components/VabUpload/privateProfileDialogMixins.js +2 -0
  31. package/src/components/VabUpload/style.scss +282 -0
  32. package/src/components/VabUpload/view.vue +19 -18
  33. package/src/components/baseArea/index.vue +2 -2
  34. package/src/components/baseInputExport/mixins.js +1 -6
  35. package/src/components/bizTab/BizTabListPage.vue +66 -33
  36. package/src/components/bizTab/README.md +3 -1
  37. package/src/components/bizTab/bizBillDetailMixin.js +2 -0
  38. package/src/components/code-editor/ace-chrome.scss +17 -0
  39. package/src/components/code-editor/index.vue +361 -340
  40. package/src/components/errorMsg/index.vue +142 -13
  41. package/src/components/errorMsg/mixins.js +53 -0
  42. package/src/components/excelExport/conditionExportConfig.js +112 -0
  43. package/src/components/excelExport/exportColumnMemory.js +118 -0
  44. package/src/components/excelExport/exportFieldDialog.vue +50 -38
  45. package/src/components/excelExport/exportType.js +8 -0
  46. package/src/components/excelExport/index.js +30 -13
  47. package/src/components/excelExport/index.vue +7 -1
  48. package/src/components/excelExport/mixins.js +782 -293
  49. package/src/components/excelImport/index.vue +156 -156
  50. package/src/components/excelImport/mixins.js +888 -834
  51. package/src/components/fileLibrary/mixins/indexMixins.js +2 -0
  52. package/src/components/fileLibrary/style.scss +579 -0
  53. package/src/components/formDialog/index.vue +11 -8
  54. package/src/components/hiprint/style.scss +188 -0
  55. package/src/components/hiprint/view/json-view.vue +4 -4
  56. package/src/components/jdPrint/mixins.js +2 -0
  57. package/src/components/jsonImport/index.vue +1 -1
  58. package/src/components/jsonImport/mixins.js +6 -10
  59. package/src/components/langImport/index.vue +1 -1
  60. package/src/components/langImport/mixins.js +6 -10
  61. package/src/components/luckysheet/loadResources.js +64 -0
  62. package/src/components/luckysheet/view.vue +239 -210
  63. package/src/components/mobile/buttonGroup/index.vue +1 -1
  64. package/src/components/mobile/wf/addTaskUserdialog.vue +100 -80
  65. package/src/components/mobile/wf/content.vue +1734 -1662
  66. package/src/components/mobile/wf/deleteTaskUserDialog.vue +73 -54
  67. package/src/components/mobile/wf/selectUserDialog.vue +118 -0
  68. package/src/components/mobile/wf/setCandidateDialog.vue +69 -48
  69. package/src/components/mobile/wf/urgingDialog.vue +75 -52
  70. package/src/components/mobile/wf/wfModifyDialog.vue +4 -0
  71. package/src/components/obsUpload/index.js +4 -1
  72. package/src/components/obsUpload/index.vue +1 -1
  73. package/src/components/obsUpload/mixins.js +45 -15
  74. package/src/components/onlineTalk/index.vue +4 -4
  75. package/src/components/onlineTalk/mixins.js +21 -7
  76. package/src/components/table/index.js +96 -81
  77. package/src/components/table/plugins/cell-area/index.js +10 -3
  78. package/src/components/table/style.scss +1399 -0
  79. package/src/components/table/vxeFilter/mixin.js +28 -18
  80. package/src/components/wf/content.vue +3 -2
  81. package/src/components/wf/content2.vue +1 -1
  82. package/src/components/wf/style.scss +265 -0
  83. package/src/components/wf/wf.js +7 -0
  84. package/src/components/wf/wfActionItems.js +3 -0
  85. package/src/components/wf/wfStartDialog.vue +1 -0
  86. package/src/components/wf/wfTransferEnabled.js +54 -0
  87. package/src/components/wf/wfUtil.js +47 -29
  88. package/src/components/wf/wfVisibility.js +6 -0
  89. 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
  90. 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
  91. 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
  92. 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
  93. 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
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. package/src/components/xform/form-designer/designer.js +2133 -2100
  100. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +7 -0
  101. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -2
  102. package/src/components/xform/form-designer/form-widget/container-widget/detail-h5-widget.vue +243 -227
  103. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-pane-widget.vue +228 -207
  104. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-widget.vue +165 -136
  105. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +30 -4
  106. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +190 -185
  107. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +2657 -1774
  108. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +27 -4
  109. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +1 -1
  110. package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
  111. package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +1 -1
  112. package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +1 -1
  113. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +1 -1
  114. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  115. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +1 -1
  116. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +1 -1
  117. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +1 -1
  118. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +1 -1
  119. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +1 -1
  120. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +1 -1
  121. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +1 -1
  122. package/src/components/xform/form-designer/form-widget/field-widget/descriptions-widget.vue +1 -1
  123. package/src/components/xform/form-designer/form-widget/field-widget/divider-widget.vue +1 -1
  124. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +1 -1
  125. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +1 -1
  126. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +35 -4
  127. package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
  128. package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
  129. package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
  130. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +64 -10
  131. package/src/components/xform/form-designer/form-widget/field-widget/file-upload-widget.vue +1 -1
  132. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +14 -4
  133. package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +1 -1
  134. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +19 -6
  135. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +1 -1
  136. package/src/components/xform/form-designer/form-widget/field-widget/index.js +10 -1
  137. package/src/components/xform/form-designer/form-widget/field-widget/input-batch-widget.vue +1 -1
  138. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +29 -3
  139. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +1 -1
  140. package/src/components/xform/form-designer/form-widget/field-widget/news-list-widget.vue +1 -1
  141. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
  142. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +1 -1
  143. package/src/components/xform/form-designer/form-widget/field-widget/picture-upload-widget.vue +1 -1
  144. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +1 -1
  145. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +1 -1
  146. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +1 -1
  147. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +1 -1
  148. package/src/components/xform/form-designer/form-widget/field-widget/rate-widget.vue +1 -1
  149. package/src/components/xform/form-designer/form-widget/field-widget/rich-editor-widget.vue +1 -1
  150. package/src/components/xform/form-designer/form-widget/field-widget/row-col-select-widget.vue +64 -0
  151. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +1 -1
  152. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +1 -1
  153. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +1 -1
  154. package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +1 -1
  155. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -2
  156. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
  157. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +1 -1
  158. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -145
  159. package/src/components/xform/form-designer/form-widget/field-widget/slider-widget.vue +1 -1
  160. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +1 -1
  161. package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +1 -1
  162. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +1 -1
  163. package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +1 -1
  164. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +3 -2
  165. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +1 -1
  166. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +1 -1
  167. package/src/components/xform/form-designer/form-widget/field-widget/textarea-widget.vue +1 -1
  168. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +1 -1
  169. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +1 -1
  170. package/src/components/xform/form-designer/form-widget/field-widget/title-head-widget.vue +1 -1
  171. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +1 -1
  172. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +3 -3
  173. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +25 -1
  174. package/src/components/xform/form-designer/form-widget/field-widget/vue-page-widget.vue +1 -1
  175. package/src/components/xform/form-designer/indexMixin.js +27 -0
  176. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +687 -602
  177. package/src/components/xform/form-designer/setting-panel/form-setting.vue +269 -36
  178. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +335 -12
  179. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +23 -7
  180. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +13 -1
  181. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +846 -860
  182. package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tab-lazyRender-editor.vue +27 -0
  183. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onTabChange-editor.vue +28 -0
  184. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onTabClick-editor.vue +28 -0
  185. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +62 -1
  186. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +142 -2
  187. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/empty-number-input.vue +51 -0
  188. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +27 -2
  189. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +33 -3
  190. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +2 -4
  191. package/src/components/xform/form-designer/setting-panel/property-editor/suffixIconClickable-editor.vue +23 -0
  192. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +18 -4
  193. package/src/components/xform/form-designer/toolbar-panel/index.vue +884 -874
  194. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +13 -0
  195. package/src/components/xform/form-designer/widget-panel/index.vue +11 -7
  196. package/src/components/xform/form-designer/widget-panel/indexMixin.js +15 -2
  197. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +152 -9
  198. package/src/components/xform/form-render/container-item/containerItemMixin.js +93 -8
  199. package/src/components/xform/form-render/container-item/data-table-item.vue +352 -347
  200. package/src/components/xform/form-render/container-item/data-table-mixin.js +7261 -5985
  201. package/src/components/xform/form-render/container-item/detail-h5-item.vue +48 -19
  202. package/src/components/xform/form-render/container-item/detail-item.vue +350 -446
  203. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +55 -1
  204. package/src/components/xform/form-render/container-item/list-h5-item.vue +261 -178
  205. package/src/components/xform/form-render/container-item/panel-item.vue +1 -1
  206. package/src/components/xform/form-render/container-item/tab-item.vue +177 -129
  207. package/src/components/xform/form-render/fieldControlEngine.js +218 -0
  208. package/src/components/xform/form-render/fieldControlMixin.js +536 -0
  209. package/src/components/xform/form-render/index.vue +164 -153
  210. package/src/components/xform/form-render/indexMixin.js +5443 -5311
  211. package/src/components/xform/form-render/pageDialogScope.js +54 -0
  212. package/src/components/xform/icon-picker/index.vue +1 -1
  213. package/src/components/xform/lang/en-US.js +8 -0
  214. package/src/components/xform/lang/zh-CN.js +9 -0
  215. package/src/components/xform/mixins/businessLock.js +59 -0
  216. package/src/components/xform/mixins/defaultHandle.js +713 -707
  217. package/src/components/xform/mixins/scriptHttp.js +42 -21
  218. package/src/components/xform/mixins/wfStart.js +105 -0
  219. package/src/components/xform/mixins/wfVisibility.js +33 -0
  220. package/src/components/xform/styles/census.scss +288 -0
  221. package/src/components/xform/styles/containers.scss +215 -0
  222. package/src/components/xform/styles/designer.scss +904 -0
  223. package/src/components/xform/styles/detail-temp.scss +71 -0
  224. package/src/components/xform/styles/h5-designer.scss +191 -0
  225. package/src/components/xform/styles/h5-runtime.scss +520 -0
  226. package/src/components/xform/styles/h5.scss +836 -516
  227. package/src/components/xform/styles/skins.scss +398 -0
  228. package/src/components/xform/styles/table-layout.scss +91 -0
  229. package/src/components/xform/styles/titles.scss +255 -0
  230. package/src/components/xform/utils/dynamicSchemaUtil.js +385 -361
  231. package/src/components/xform/utils/fixedQueryUtil.js +29 -4
  232. package/src/components/xform/utils/serviceNameCache.js +69 -0
  233. package/src/components/xform/utils/tableColumnHelper.js +46 -4
  234. package/src/components/xform/utils/util.js +1776 -1708
  235. package/src/core-resources/css/h5.scss +548 -0
  236. package/src/core-resources/css/iconfont.css +1447 -0
  237. package/src/core-resources/font/iconfont.ttf +0 -0
  238. package/src/core-resources/font/iconfont.woff +0 -0
  239. package/src/core-resources/font/iconfont.woff2 +0 -0
  240. package/src/core-resources/images/default-header.png +0 -0
  241. package/src/core-resources/images/ico-default_wenjian.svg +1 -0
  242. package/src/core-resources/images/ico-excel.svg +1 -0
  243. package/src/core-resources/images/ico-ftl.svg +7 -0
  244. package/src/core-resources/images/ico-html.svg +1 -0
  245. package/src/core-resources/images/ico-java.svg +1 -0
  246. package/src/core-resources/images/ico-music.svg +1 -0
  247. package/src/core-resources/images/ico-pdf.svg +1 -0
  248. package/src/core-resources/images/ico-photo.svg +1 -0
  249. package/src/core-resources/images/ico-ppt.svg +1 -0
  250. package/src/core-resources/images/ico-psd.svg +1 -0
  251. package/src/core-resources/images/ico-service.png +0 -0
  252. package/src/core-resources/images/ico-txt.svg +1 -0
  253. package/src/core-resources/images/ico-video.svg +1 -0
  254. package/src/core-resources/images/ico-vue.svg +8 -0
  255. package/src/core-resources/images/ico-wenjianjia.svg +1 -0
  256. package/src/core-resources/images/ico-wrod.svg +1 -0
  257. package/src/core-resources/images/ico-xml.svg +1 -0
  258. package/src/core-resources/images/ico-yasuobao.svg +1 -0
  259. package/src/core-resources/images/icon-error.png +0 -0
  260. package/src/core-resources/images/icon-tips.png +0 -0
  261. package/src/core-resources/images/nodata.png +0 -0
  262. package/src/core-resources/images/nodata2.png +0 -0
  263. package/src/directive/append-to-body/index.js +48 -0
  264. package/src/directive/el-dialog-center/index.js +3 -2
  265. package/src/directive/el-drag-dialog/drag.js +33 -4
  266. package/src/icons/index.js +9 -0
  267. package/src/icons/svg/404.svg +1 -0
  268. package/src/icons/svg/alert.svg +1 -0
  269. package/src/icons/svg/bug.svg +1 -0
  270. package/src/icons/svg/button.svg +1 -0
  271. package/src/icons/svg/card.svg +1 -0
  272. package/src/icons/svg/cascader-field.svg +1 -0
  273. package/src/icons/svg/census.svg +1 -0
  274. package/src/icons/svg/chart.svg +1 -0
  275. package/src/icons/svg/checkbox-field.svg +1 -0
  276. package/src/icons/svg/clipboard.svg +1 -0
  277. package/src/icons/svg/color-field.svg +1 -0
  278. package/src/icons/svg/component.svg +1 -0
  279. package/src/icons/svg/custom-component.svg +1 -0
  280. package/src/icons/svg/dashboard.svg +1 -0
  281. package/src/icons/svg/data-table.svg +1 -0
  282. package/src/icons/svg/date-field.svg +1 -0
  283. package/src/icons/svg/date-range-field.svg +1 -0
  284. package/src/icons/svg/descriptions.svg +1 -0
  285. package/src/icons/svg/divider.svg +1 -0
  286. package/src/icons/svg/document.svg +1 -0
  287. package/src/icons/svg/documentation.svg +1 -0
  288. package/src/icons/svg/drag.svg +1 -0
  289. package/src/icons/svg/echart-category.svg +1 -0
  290. package/src/icons/svg/echart-pie.svg +1 -0
  291. package/src/icons/svg/echart.svg +1 -0
  292. package/src/icons/svg/edit.svg +1 -0
  293. package/src/icons/svg/education.svg +1 -0
  294. package/src/icons/svg/email.svg +1 -0
  295. package/src/icons/svg/example.svg +1 -0
  296. package/src/icons/svg/excel.svg +1 -0
  297. package/src/icons/svg/exit-fullscreen.svg +1 -0
  298. package/src/icons/svg/eye-open.svg +1 -0
  299. package/src/icons/svg/eye.svg +1 -0
  300. package/src/icons/svg/file-upload-field.svg +1 -0
  301. package/src/icons/svg/form.svg +1 -0
  302. package/src/icons/svg/fullscreen.svg +1 -0
  303. package/src/icons/svg/github.svg +1 -0
  304. package/src/icons/svg/grid.svg +1 -0
  305. package/src/icons/svg/guide.svg +1 -0
  306. package/src/icons/svg/html-text.svg +1 -0
  307. package/src/icons/svg/ico-more.svg +1 -0
  308. package/src/icons/svg/ico-wenjianjia.svg +1 -0
  309. package/src/icons/svg/icon.svg +1 -0
  310. package/src/icons/svg/input-batch.svg +1 -0
  311. package/src/icons/svg/international.svg +1 -0
  312. package/src/icons/svg/language.svg +1 -0
  313. package/src/icons/svg/link.svg +1 -0
  314. package/src/icons/svg/list-export.svg +1 -0
  315. package/src/icons/svg/list.svg +1 -0
  316. package/src/icons/svg/lock.svg +1 -0
  317. package/src/icons/svg/message.svg +1 -0
  318. package/src/icons/svg/money.svg +1 -0
  319. package/src/icons/svg/nested.svg +1 -0
  320. package/src/icons/svg/news-list.svg +1 -0
  321. package/src/icons/svg/node-tree.svg +1 -0
  322. package/src/icons/svg/number-field.svg +1 -0
  323. package/src/icons/svg/password.svg +1 -0
  324. package/src/icons/svg/pdf.svg +1 -0
  325. package/src/icons/svg/people.svg +1 -0
  326. package/src/icons/svg/peoples.svg +1 -0
  327. package/src/icons/svg/picture-upload-field.svg +1 -0
  328. package/src/icons/svg/qq.svg +1 -0
  329. package/src/icons/svg/query.svg +1 -0
  330. package/src/icons/svg/radio-field.svg +1 -0
  331. package/src/icons/svg/rate-field.svg +1 -0
  332. package/src/icons/svg/redo.svg +1 -0
  333. package/src/icons/svg/rich-editor-field.svg +1 -0
  334. package/src/icons/svg/search.svg +1 -0
  335. package/src/icons/svg/searchbox.svg +1 -0
  336. package/src/icons/svg/section.svg +1 -0
  337. package/src/icons/svg/select-field.svg +1 -0
  338. package/src/icons/svg/shopping.svg +1 -0
  339. package/src/icons/svg/size.svg +1 -0
  340. package/src/icons/svg/skill.svg +1 -0
  341. package/src/icons/svg/slider-field.svg +1 -0
  342. package/src/icons/svg/slot-component.svg +1 -0
  343. package/src/icons/svg/slot-field.svg +1 -0
  344. package/src/icons/svg/star.svg +1 -0
  345. package/src/icons/svg/static-text.svg +1 -0
  346. package/src/icons/svg/status.svg +1 -0
  347. package/src/icons/svg/sub-form.svg +1 -0
  348. package/src/icons/svg/switch-field.svg +1 -0
  349. package/src/icons/svg/tab.svg +1 -0
  350. package/src/icons/svg/table.svg +1 -0
  351. package/src/icons/svg/text-field.svg +1 -0
  352. package/src/icons/svg/text.svg +1 -0
  353. package/src/icons/svg/textarea-field.svg +1 -0
  354. package/src/icons/svg/theme.svg +1 -0
  355. package/src/icons/svg/time-field.svg +1 -0
  356. package/src/icons/svg/time-range-field.svg +1 -0
  357. package/src/icons/svg/tips-text.svg +1 -0
  358. package/src/icons/svg/title-head.svg +1 -0
  359. package/src/icons/svg/tree-pane.svg +1 -0
  360. package/src/icons/svg/tree-table.svg +1 -0
  361. package/src/icons/svg/tree.svg +1 -0
  362. package/src/icons/svg/undo.svg +1 -0
  363. package/src/icons/svg/uploadbox.svg +1 -0
  364. package/src/icons/svg/user.svg +1 -0
  365. package/src/icons/svg/vf-box.svg +1 -0
  366. package/src/icons/svg/vf-dialog.svg +1 -0
  367. package/src/icons/svg/vf-drawer.svg +1 -0
  368. package/src/icons/svg/vue-sfc.svg +1 -0
  369. package/src/icons/svg/wechat.svg +1 -0
  370. package/src/icons/svg/zip.svg +1 -0
  371. package/src/index.js +2 -510
  372. package/src/index.next.js +5 -0
  373. package/src/index.sync.js +5 -0
  374. package/src/layout/components/Sidebar/default.vue +1656 -1655
  375. package/src/layout/components/TagsView/index.vue +330 -323
  376. package/src/layout/components/TagsView/style.scss +92 -0
  377. package/src/layout/defaultLayout.vue +2 -2
  378. package/src/router/index.js +43 -48
  379. package/src/router/modules/customer.js +12 -0
  380. package/src/store/modules/settings.js +1 -1
  381. package/src/store/modules/tagsView.js +241 -217
  382. package/src/store/modules/user.js +16 -12
  383. package/src/styles/btn.scss +315 -0
  384. package/src/styles/dialog.scss +1710 -0
  385. package/src/styles/element-ui.scss +1076 -0
  386. package/src/styles/element-variables.scss +31 -0
  387. package/src/styles/global.scss +115 -0
  388. package/src/styles/index.scss +245 -0
  389. package/src/styles/layout-skins.scss +840 -0
  390. package/src/styles/legacy-base.scss +19 -0
  391. package/src/styles/menu-icons.scss +75 -0
  392. package/src/styles/mixin.scss +80 -0
  393. package/src/styles/nprogress.scss +14 -0
  394. package/src/styles/page-shell.scss +723 -0
  395. package/src/styles/sidebar.scss +296 -0
  396. package/src/styles/split-handle.scss +52 -0
  397. package/src/styles/theme-variables.scss +7 -0
  398. package/src/styles/transition.scss +48 -0
  399. package/src/styles/utilities.scss +253 -0
  400. package/src/styles/variables.scss +72 -0
  401. package/src/utils/baseDictsCache.js +197 -0
  402. package/src/utils/chunkLoadError.js +24 -0
  403. package/src/utils/featureResources.js +57 -0
  404. package/src/utils/importLimit.js +72 -0
  405. package/src/utils/pdfUtil.js +6 -1
  406. package/src/utils/request.js +142 -7
  407. package/src/utils/resolveViewComponent.js +45 -90
  408. package/src/utils/runtimeRecovery.js +105 -0
  409. package/src/utils/swiperLoader.js +20 -0
  410. package/src/utils/vab.js +1334 -1283
  411. package/src/utils/xlsxLoader.js +29 -0
  412. package/src/views/bd/setting/formVersion/compareContMixin.scss +1 -1
  413. package/src/views/bd/setting/form_template/edit.vue +378 -356
  414. package/src/views/bd/setting/form_template/formDesignerDialog.vue +6 -0
  415. package/src/views/bd/setting/form_template/formTemplateType.js +43 -0
  416. package/src/views/bd/setting/form_template/list.vue +304 -303
  417. package/src/views/bd/setting/form_template/mixins/edit.js +344 -280
  418. package/src/views/bd/setting/form_template/mixins/list.js +749 -721
  419. package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
  420. package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
  421. package/src/views/mobile/user/area/dialog.vue +1 -1
  422. package/src/views/mobile/user/user/dialog.vue +1 -1
  423. package/src/views/user/bill_setting/mixins/wf.js +8 -0
  424. package/src/views/user/bill_setting/render.vue +1 -1
  425. package/src/views/user/commMenu/index.vue +3 -1
  426. package/src/views/user/commMenu/style.scss +123 -0
  427. package/src/views/user/common_attribute/edit.vue +2 -0
  428. package/src/views/user/common_attribute/itemEdit.vue +2 -0
  429. package/src/views/user/file_view_ins/list.vue +970 -970
  430. package/src/views/user/form/form_template/list.vue +527 -506
  431. package/src/views/user/form/vform/designer.vue +823 -821
  432. package/src/views/user/form/view/list.vue +24 -1
  433. package/src/views/user/home/default.vue +1124 -1117
  434. package/src/views/user/home/default2.vue +12 -8
  435. package/src/views/user/home/index.vue +102 -102
  436. package/src/views/user/home/wjl/content.vue +1581 -1569
  437. package/src/views/user/intf_permission/edit.vue +230 -0
  438. package/src/views/user/intf_permission/list.vue +196 -0
  439. package/src/views/user/menuFallback/index.vue +23 -0
  440. package/src/views/user/notify_message/dialog.vue +139 -139
  441. package/src/views/user/outLink/form_view.vue +202 -202
  442. package/src/views/user/outLink/index.vue +110 -110
  443. package/src/views/user/role/edit.vue +4 -0
  444. package/src/views/user/role/role-box.scss +83 -0
  445. package/src/views/user/role/voc_edit.vue +4 -0
  446. package/src/views/user/user/list.vue +28 -6
  447. package/src/views/user/wf/iframe/index.vue +51 -51
  448. package/src/views/user/wf/iframe/index2.vue +64 -64
  449. package/src/views/user/wf/wf_diy_attribute/edit.vue +1 -1
  450. package/src/views/user/wf/wf_manage/list2.vue +871 -871
  451. package/src/views/user/wf/wf_manage/wfContentDialog.vue +177 -126
  452. package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
  453. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +1 -1
  454. package/src/views/user/wf/wf_obj_config/list.vue +747 -746
  455. package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
  456. package/templates/child-app/.env +3 -0
  457. package/templates/child-app/README.md +49 -0
  458. package/templates/child-app/app.config.js +6 -0
  459. package/templates/child-app/babel.config.js +1 -0
  460. package/templates/child-app/core-resources.config.js +15 -0
  461. package/templates/child-app/gitignore +7 -0
  462. package/templates/child-app/package.json +34 -0
  463. package/templates/child-app/public/index.html +12 -0
  464. package/templates/child-app/src/assets/401_images/401.gif +0 -0
  465. package/templates/child-app/src/assets/404_images/404.png +0 -0
  466. package/templates/child-app/src/assets/404_images/404_cloud.png +0 -0
  467. package/templates/child-app/src/assets/logo.png +0 -0
  468. package/templates/child-app/src/corejsConfig.js +2 -0
  469. package/templates/child-app/src/icons/index.js +2 -0
  470. package/templates/child-app/src/icons/svg/child-demo.svg +1 -0
  471. package/templates/child-app/src/layout/index.vue +4 -0
  472. package/templates/child-app/src/main.js +5 -0
  473. package/templates/child-app/src/prefixConfig.js +13 -0
  474. package/templates/child-app/src/resources/css/login.scss +29 -0
  475. package/templates/child-app/src/resources/images/bg-login5.jpg +0 -0
  476. package/templates/child-app/src/resources/images/home-img.png +0 -0
  477. package/templates/child-app/src/router/modules/customer.js +3 -0
  478. package/templates/child-app/src/settings.js +24 -0
  479. package/templates/child-app/src/styles/app.scss +2 -0
  480. package/templates/child-app/src/views/demo/detail.vue +19 -0
  481. package/templates/child-app/src/views/demo/list.vue +38 -0
  482. package/templates/child-app/src/views/user/login/index.vue +18 -0
  483. package/templates/child-app/vue.config.js +107 -0
  484. package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +0 -285
  485. package/src/components/xform/form-render/formDynamicFieldMixin.js +0 -131
  486. package/src/views/demo/bizTab/bill/billConfig.js +0 -41
  487. package/src/views/demo/bizTab/bill/detail.vue +0 -436
  488. package/src/views/demo/bizTab/bill/list.vue +0 -288
  489. package/src/views/demo/bizTab/bill/productDialog.vue +0 -176
  490. package/src/views/demo/bizTab/simple/billApi.js +0 -123
  491. package/src/views/demo/bizTab/simple/detail.vue +0 -407
  492. package/src/views/demo/bizTab/simple/list.vue +0 -217
  493. package/src/views/demo/bizTab/standalone/index.vue +0 -121
  494. package/src/views/demo/bizTab/wf/billConfig.js +0 -44
  495. package/src/views/demo/bizTab/wf/detail.vue +0 -661
  496. package/src/views/demo/bizTab/wf/list.vue +0 -242
  497. package/src/views/user/outLink/cc_form_view.vue +0 -188
  498. /package/src/{resources → core-resources}/js/base/common.js +0 -0
@@ -1,850 +1,904 @@
1
1
  /**version-1.0*/
2
- import { read, utils } from "xlsx";
2
+ import { loadXlsx } from "@base/utils/xlsxLoader";
3
3
 
4
4
  let tmixins = {};
5
- var XLSX = window.XLSX || { read, utils };
6
- import { getToken } from "../../utils/auth";
7
- import XEUtils from "xe-utils";
8
- import { getErrorMsg } from "@base/utils/index.js";
9
-
5
+ import { getToken } from "../../utils/auth";
6
+ import XEUtils from "xe-utils";
7
+ import { getErrorMsg } from "@base/utils/index.js";
8
+ import {
9
+ getImportCellText,
10
+ getImportFileSizeLimit,
11
+ getImportRowLimit,
12
+ isImportFileOversize,
13
+ isImportRowsOverLimit,
14
+ toFileSizeMb,
15
+ } from "../../utils/importLimit";
16
+
10
17
  let configUtil = {
11
18
  baseUrl: process.env.VUE_APP_BASE_API,
12
- XLSX,
13
19
  getToken,
14
20
  };
15
- let importTimer = null;
16
- let loadingObj = null;
17
- tmixins = {
18
- name: "excelImport",
19
- props: ["param"],
20
- data() {
21
- return {
22
- excTime: 0,
23
- showImportDialog: false,
24
- showImportDialog2: false,
25
- falseValue: false,
26
- fileRaw: false,
27
- isEnd: false,
28
- currentIndex: 0,
29
- excelTemplate: "",
30
- prefix: "/user",
31
- dataSize: 0,
32
- totalSuccessNum: 0,
33
- totalErrorNum: 0,
34
- percentageNum: 0,
35
- successRows: [],
36
- failRows: [],
37
- oriCols: [],
38
- showImportResult: false,
39
- resultType: "",
40
- option: {},
41
- showContent: false,
42
- resOption: {},
43
- };
44
- },
45
- created() {},
46
- beforeDestroy() {
47
- this.clearImportTimer();
48
- },
49
- methods: {
50
- initResGird() {
51
- var that = this;
52
- let tableRef = "resGrid";
53
- let columns = [
54
- {
55
- type: "checkbox",
56
- fixed: "left",
57
- width: 48,
58
- resizable: false,
59
- headerClassName: "vxe-hcs",
60
- className: "vxe-hcs",
61
- },
62
- {
63
- field: "impNumber",
64
- title: this.$t2("行号", "components.excelImport.impNumber"),
65
- width: 100,
66
- fixed: "left",
67
- },
68
- {
69
- field: "_resultContent",
70
- title: this.$t2("结果", "components.excelImport.resultContent"),
71
- width: 250,
72
- fixed: "left",
73
- slots: {
74
- default: ({ row, $rowIndex, $table }) => {
75
- return that.handleRes(row._resultContent);
76
- },
77
- },
78
- },
79
- ];
80
- let cCols = this.oriCols.map((oriCol, index) => {
81
- let col = {
82
- field: oriCol.field,
83
- title: oriCol.title,
84
- width: 150,
85
- };
86
- if (index === 0) {
87
- col.fixed = "left";
88
- }
89
- return col;
90
- });
91
- columns = columns.concat(cCols);
92
-
93
- let tableOption = {
94
- vue: this,
95
- tableRef: tableRef,
96
- tableNameRequired: false,
97
- columns: columns,
98
- config: {
99
- toolbarConfig: {
100
- custom: false,
101
- },
102
- },
103
- };
104
-
105
- this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
106
- this.resOption = opts;
107
- });
108
- },
109
- exc() {
110
- this.option = this.param;
111
- this.showContent = true;
112
- this.showImportDialog = true;
113
- this.showImportDialog2 = false;
114
- },
115
- showSuccessResult() {
116
- this.showImportResult = true;
117
- this.resultType = 1;
118
- this.$nextTick(() => {
119
- this.initResGird();
120
- this.$nextTick(() => {
121
- let tDatas = this.successRows.map((item, index) => {
122
- item.id = index;
123
- return item;
124
- });
125
- this.$refs.resGrid.loadData(tDatas);
126
- });
127
- });
128
- },
129
- showErrorResult() {
130
- this.showImportResult = true;
131
- this.resultType = 0;
132
- this.$nextTick(() => {
133
- this.initResGird();
134
- this.$nextTick(() => {
135
- let tDatas = this.failRows.map((item, index) => {
136
- item.id = index;
137
- return item;
138
- });
139
- this.$refs.resGrid.loadData(tDatas);
140
- });
141
- });
142
- },
143
- fileChange(file) {
144
- if (file) {
145
- this.fileRaw = file.raw;
146
- } else {
147
- this.fileRaw = false;
148
- }
149
- },
150
- dialogClose1() {
151
- this.$emit("update:visiable", false);
152
- this.showContent = false;
153
- },
154
- async dialogPrimary1() {
21
+ // 计时器与遮罩句柄必须挂实例:模块级单例在 tagsView 同时开两个导入页时会被后开的
22
+ // 那个覆盖,先开的 100ms interval 永远停不掉,还会把整个组件钉住不被回收。
23
+ tmixins = {
24
+ name: "excelImport",
25
+ props: ["param"],
26
+ data() {
27
+ return {
28
+ excTime: 0,
29
+ showImportDialog: false,
30
+ showImportDialog2: false,
31
+ falseValue: false,
32
+ fileRaw: false,
33
+ isEnd: false,
34
+ currentIndex: 0,
35
+ excelTemplate: "",
36
+ prefix: "/user",
37
+ dataSize: 0,
38
+ totalSuccessNum: 0,
39
+ totalErrorNum: 0,
40
+ percentageNum: 0,
41
+ successRows: [],
42
+ failRows: [],
43
+ oriCols: [],
44
+ showImportResult: false,
45
+ resultType: "",
46
+ option: {},
47
+ showContent: false,
48
+ resOption: {},
49
+ importTimer: null,
50
+ loadingObj: null,
51
+ };
52
+ },
53
+ created() {},
54
+ beforeDestroy() {
55
+ this.clearImportTimer();
56
+ },
57
+ methods: {
58
+ initResGird() {
59
+ var that = this;
60
+ let tableRef = "resGrid";
61
+ let columns = [
62
+ {
63
+ type: "checkbox",
64
+ fixed: "left",
65
+ width: 48,
66
+ resizable: false,
67
+ headerClassName: "vxe-hcs",
68
+ className: "vxe-hcs",
69
+ },
70
+ {
71
+ field: "impNumber",
72
+ title: this.$t2("行号", "components.excelImport.impNumber"),
73
+ width: 100,
74
+ fixed: "left",
75
+ },
76
+ {
77
+ field: "_resultContent",
78
+ title: this.$t2("结果", "components.excelImport.resultContent"),
79
+ width: 250,
80
+ fixed: "left",
81
+ slots: {
82
+ default: ({ row, $rowIndex, $table }) => {
83
+ return that.handleRes(row._resultContent);
84
+ },
85
+ },
86
+ },
87
+ ];
88
+ let cCols = this.oriCols.map((oriCol, index) => {
89
+ let col = {
90
+ field: oriCol.field,
91
+ title: oriCol.title,
92
+ width: 150,
93
+ };
94
+ if (index === 0) {
95
+ col.fixed = "left";
96
+ }
97
+ return col;
98
+ });
99
+ columns = columns.concat(cCols);
100
+
101
+ let tableOption = {
102
+ vue: this,
103
+ tableRef: tableRef,
104
+ tableNameRequired: false,
105
+ columns: columns,
106
+ config: {
107
+ toolbarConfig: {
108
+ custom: false,
109
+ },
110
+ },
111
+ };
112
+
113
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
114
+ this.resOption = opts;
115
+ });
116
+ },
117
+ exc() {
118
+ this.option = this.param;
119
+ this.showContent = true;
120
+ this.showImportDialog = true;
121
+ this.showImportDialog2 = false;
122
+ },
123
+ showSuccessResult() {
124
+ this.showImportResult = true;
125
+ this.resultType = 1;
126
+ this.$nextTick(() => {
127
+ this.initResGird();
128
+ this.$nextTick(() => {
129
+ let tDatas = this.successRows.map((item, index) => {
130
+ item.id = index;
131
+ return item;
132
+ });
133
+ this.$refs.resGrid.loadData(tDatas);
134
+ });
135
+ });
136
+ },
137
+ showErrorResult() {
138
+ this.showImportResult = true;
139
+ this.resultType = 0;
140
+ this.$nextTick(() => {
141
+ this.initResGird();
142
+ this.$nextTick(() => {
143
+ let tDatas = this.failRows.map((item, index) => {
144
+ item.id = index;
145
+ return item;
146
+ });
147
+ this.$refs.resGrid.loadData(tDatas);
148
+ });
149
+ });
150
+ },
151
+ fileChange(file) {
152
+ if (file) {
153
+ this.fileRaw = file.raw;
154
+ } else {
155
+ this.fileRaw = false;
156
+ }
157
+ },
158
+ dialogClose1() {
159
+ this.$emit("update:visiable", false);
160
+ this.showContent = false;
161
+ },
162
+ async dialogPrimary1() {
163
+ let that = this;
164
+ let option = this.option;
165
+ let saveUrl = option.saveUrl;
166
+ if (!saveUrl) {
167
+ this.dialogPrimary3();
168
+ return false;
169
+ }
170
+
171
+ if (!this.fileRaw) {
172
+ this.$baseAlert(
173
+ this.$t2("请上传附件", "components.excelImport.warmMsg1")
174
+ );
175
+ return false;
176
+ }
177
+ this.createImportTimer();
178
+ this.showImportDialog = false;
179
+ if (!option.onConfirm) {
180
+ this.showImportDialog2 = true;
181
+ }
182
+ this.$nextTick(() => {
183
+ try {
184
+ this.readExcel(this.fileRaw, function (resultData) {
185
+ if (option.onConfirm) {
186
+ option.onConfirm(resultData.data, that.fileRaw);
187
+ } else {
188
+ that.syncDataForImport({
189
+ multi: false,
190
+ data: resultData,
191
+ saveUrl: saveUrl,
192
+ });
193
+ }
194
+ });
195
+ } catch (et) {
196
+ that.clearImportTimer();
197
+ console.error(et);
198
+ }
199
+ });
200
+ },
201
+ handleBeforeClose(hide) {
202
+ this.option.onCancel
203
+ && this.option.onCancel(this.getCallbackData(), this.fileRaw);
204
+ hide();
205
+ },
206
+ dialogClose2() {
207
+ this.showImportDialog2 = false;
208
+ this.option.onBeforeCancel
209
+ && this.option.onBeforeCancel(this.getCallbackData(), this.fileRaw);
210
+ },
211
+ handleClose2() {
212
+ this.clearImportTimer();
213
+ this.showImportDialog2 = false;
214
+ this.showContent = false;
215
+ this.option.onClose
216
+ && this.option.onClose(this.getCallbackData(), this.fileRaw);
217
+ this.option.callback
218
+ && this.option.callback(this.getCallbackData(), this.fileRaw);
219
+ },
220
+ dialogPrimary2() {
221
+ this.showImportDialog2 = false;
222
+ this.option.onBeforeConfirm
223
+ && this.option.onBeforeConfirm(this.getCallbackData(), this.fileRaw);
224
+ },
225
+ getCallbackData() {
226
+ return {
227
+ ...this.resultData,
228
+ successRows: this.successRows,
229
+ failRows: this.failRows,
230
+ };
231
+ },
232
+ async readExcel(file, callback) {
155
233
  let that = this;
156
234
  let option = this.option;
157
- let saveUrl = option.saveUrl;
158
- if (!saveUrl) {
159
- this.dialogPrimary3();
235
+
236
+ // 整文件读进内存前先卡一刀:下面的 readAsBinaryString + XLSX.read 是同步的,
237
+ // 占用约为文件体积的 5~20 倍,超限时崩在库内部,连提示都给不出来。
238
+ if (isImportFileOversize(file, option)) {
239
+ this.showImportDialog2 = false;
240
+ this.showContent = false;
241
+ this.clearImportTimer();
242
+ this.$baseAlert(
243
+ this.$t1(
244
+ "导入文件过大({size}MB),当前最多支持 {limit}MB,请拆分后分批导入",
245
+ {
246
+ size: toFileSizeMb(file.size),
247
+ limit: toFileSizeMb(getImportFileSizeLimit(option)),
248
+ }
249
+ )
250
+ );
160
251
  return false;
161
252
  }
162
253
 
163
- if (!this.fileRaw) {
164
- this.$baseAlert(
165
- this.$t2("请上传附件", "components.excelImport.warmMsg1")
166
- );
254
+ let XLSX;
255
+ try {
256
+ XLSX = await loadXlsx();
257
+ } catch (error) {
258
+ this.$baseAlert(this.$t1("Excel解析组件加载失败,请刷新页面后重试"));
167
259
  return false;
168
260
  }
169
- this.createImportTimer();
170
- this.showImportDialog = false;
171
- if (!option.onConfirm) {
172
- this.showImportDialog2 = true;
173
- }
174
- this.$nextTick(() => {
175
- try {
176
- this.readExcel(this.fileRaw, function (resultData) {
177
- if (option.onConfirm) {
178
- option.onConfirm(resultData.data, that.fileRaw);
179
- } else {
180
- that.syncDataForImport({
181
- multi: false,
182
- data: resultData,
183
- saveUrl: saveUrl,
184
- });
185
- }
186
- });
187
- } catch (et) {
188
- that.clearImportTimer();
189
- console.error(et);
190
- }
191
- });
192
- },
193
- handleBeforeClose(hide) {
194
- this.option.onCancel
195
- && this.option.onCancel(this.getCallbackData(), this.fileRaw);
196
- hide();
197
- },
198
- dialogClose2() {
199
- this.showImportDialog2 = false;
200
- this.option.onBeforeCancel
201
- && this.option.onBeforeCancel(this.getCallbackData(), this.fileRaw);
202
- },
203
- handleClose2() {
204
- this.clearImportTimer();
205
- this.showImportDialog2 = false;
206
- this.showContent = false;
207
- this.option.onClose
208
- && this.option.onClose(this.getCallbackData(), this.fileRaw);
209
- this.option.callback
210
- && this.option.callback(this.getCallbackData(), this.fileRaw);
211
- },
212
- dialogPrimary2() {
213
- this.showImportDialog2 = false;
214
- this.option.onBeforeConfirm
215
- && this.option.onBeforeConfirm(this.getCallbackData(), this.fileRaw);
216
- },
217
- getCallbackData() {
218
- return {
219
- ...this.resultData,
220
- successRows: this.successRows,
221
- failRows: this.failRows,
222
- };
223
- },
224
- async readExcel(file, callback) {
225
- let that = this;
226
- let option = this.option;
227
261
 
228
262
  const fileReader = new FileReader();
229
- fileReader.onload = async (ev) => {
230
- var resultData;
231
- try {
232
- const data = ev.target.result;
233
- const workbook = configUtil.XLSX.read(data, {
234
- type: "binary",
235
- });
236
-
237
- var sheet = workbook.Sheets[workbook.SheetNames[0]];
238
- if (sheet["!ref"] === undefined) {
239
- that.showImportDialog2 = false;
240
- that.showContent = false;
241
- that.clearImportTimer();
242
- that.$baseAlert(
243
- this.$t2(
244
- "请使用正确的导入模版!",
245
- "components.excelImport.warmMsg2"
246
- )
247
- );
248
- return false;
249
- }
250
- var range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
251
- var dataSize = range.e.r + 1; //行数
252
- that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
253
- var titles = [];
254
- var fields = [];
255
-
256
- const ws = workbook.Sheets[sheet];
257
-
258
- let prefix = option.prefix;
259
- let excelUrl = option.excel;
260
-
261
- var excelRows = [];
262
- var row;
263
- var rowNum;
264
- var colNum;
265
- for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
266
- row = [];
267
- for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
268
- var nextCell
269
- = sheet[
270
- configUtil.XLSX.utils.encode_cell({
271
- r: rowNum,
272
- c: colNum,
273
- })
274
- ];
275
- if (typeof nextCell === "undefined") {
276
- row.push(void 0);
277
- } else {
278
- row.push(nextCell.w.trim());
279
- }
280
- }
281
- if (rowNum === 1) {
282
- titles = row;
283
- }
284
- if (rowNum === 2) {
285
- fields = row;
286
- let checkResult = true;
287
- if (!option.importAttachCode) {
288
- await that
289
- .checkExcelForImport(titles, fields, excelUrl, prefix)
290
- .then((res) => {
291
- if (res.type != "success") {
292
- checkResult = false;
293
- }
294
- });
295
- if (!checkResult) {
296
- that.showContent = false;
297
- that.clearImportTimer();
298
- return false;
299
- }
300
- }
301
- }
302
- if (rowNum > 2) {
303
- let item = {};
304
- for (let i = 0; i < fields.length; i++) {
305
- let field = fields[i];
306
- item[field] = row[i];
307
- }
308
- excelRows.push(item);
309
- }
310
- }
311
- if (
312
- !titles.length
313
- || !fields.length
314
- || titles.length != fields.length
315
- ) {
316
- that.showContent = false;
317
- that.clearImportTimer();
318
- that.$baseAlert(
319
- this.$t2(
320
- "请使用正确的导入模版!",
321
- "components.excelImport.warmMsg2"
322
- )
323
- );
324
- return false;
325
- }
326
-
327
- var columns = [];
328
- var cols = [];
329
- let uniqueFields = [];
330
- for (let i = 0; i < titles.length; i++) {
331
- let title = titles[i];
332
- if (title) {
333
- let field = fields[i];
334
- if (field === null) {
335
- that.showContent = false;
336
- that.clearImportTimer();
337
- that.$baseAlert(
338
- this.$t2(
339
- "请使用正确的导入模版!",
340
- "components.excelImport.warmMsg2"
341
- )
342
- );
343
- return false;
344
- }
345
- let t = title.substr(-1);
346
- let u = title.length >= 2 ? title.substr(-2) : title;
347
- let isNeed = false;
348
- if (t === "*") {
349
- isNeed = true;
350
- }
351
- let isUnique = false;
352
- if (u === "**") {
353
- uniqueFields.push(field);
354
- isUnique = true;
355
- }
356
- let col = {
357
- field: field,
358
- title: title,
359
- width: 100,
360
- isNeed: isNeed,
361
- isUnique: isUnique,
362
- };
363
- cols.push(col);
364
- }
365
- }
366
-
367
- var oriCols = JSON.parse(JSON.stringify(cols)); //列信息
368
- if (uniqueFields.length) {
369
- //分组唯一字段为空时,全部不发包。
370
- for (let i = 0; i < oriCols.length; i++) {
371
- let oriCol = oriCols[i];
372
- if (oriCol.isNeed) {
373
- for (let j = 0; j < excelRows.length; j++) {
374
- let data = excelRows[j];
375
- let value = data[oriCol.field];
376
- if (value === null || value === "") {
377
- that.clearImportTimer();
378
- that.$baseAlert(
379
- this.$t2(
380
- "第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
381
- "components.excelImport.warmMsg3",
382
- {
383
- lineNo: j + 4,
384
- title: oriCol.title,
385
- }
386
- )
387
- );
388
- return false;
389
- }
390
- }
391
- }
392
- }
393
- }
394
-
395
- this.oriCols = oriCols;
396
-
397
- resultData = {
398
- data: excelRows,
399
- titles: titles,
400
- fields: fields,
401
- uniqueFields: uniqueFields,
402
- oriCols: oriCols,
403
- };
404
- this.resultData = resultData;
405
- callback(resultData);
406
- } catch (et) {
407
- that.showContent = false;
408
- that.clearImportTimer();
409
- console.error(et);
410
- }
411
- };
412
- fileReader.readAsBinaryString(file);
413
- },
414
- async checkExcelForImport(titles, fields, turl, prefix) {
415
- let that = this;
416
- var data = {
417
- filed_name: fields,
418
- field_note: titles,
419
- url: turl,
420
- };
421
- var param = JSON.stringify(data);
422
- return this.$http({
423
- url: prefix + "/sf_common/compareExcelFields",
424
- method: "post",
425
- headers: {
426
- "Content-Type": "application/json;charset=utf-8",
427
- },
428
- // data: param,
429
- data: data,
430
- });
431
- },
432
- syncDataForImport(opts) {
433
- let that = this;
434
- var multi = this.option.multi;
435
- var resultData = opts.data;
436
- var datas = resultData.data;
437
- var titles = resultData.titles;
438
- var fields = resultData.fields;
439
- let uniqueFields = resultData.uniqueFields;
440
- var saveUrl = opts.saveUrl;
441
- var size = datas.length;
442
- var index = 0;
443
- var successNum = 0;
444
- var failNum = 0;
445
- var dialogObj = this.$refs.importDialog.$el;
446
- var successNumObj = dialogObj.querySelector(".successNum");
447
- var failNumObj = dialogObj.querySelector(".failNum");
448
- var percentageObj = dialogObj.querySelector(".percentage");
449
- var doneNumObj = dialogObj.querySelector(".doneNum");
450
- dialogObj.querySelector(".dataSize").innerText = size;
451
-
452
- that.successRows = [];
453
- that.failRows = [];
454
-
455
- var multiSize = opts.multiSize || 2;
456
-
457
- let groupIndex = 0;
458
- let groupDatas = [];
459
- if (uniqueFields.length) {
460
- let d = XEUtils.groupBy(datas, function (item, itemIndex, items) {
461
- let keyArr = [];
462
- uniqueFields.forEach((field) => {
463
- keyArr.push(item[field]);
464
- });
465
- return keyArr.join("&_&");
466
- });
467
- for (let key in d) {
468
- groupDatas.push(d[key]);
469
- }
470
- datas.forEach((item, itemIndex) => {
471
- item.impSeq = itemIndex;
472
- item.impNumber = itemIndex + 4;
473
- });
474
- }
475
-
476
- var compareV = function (property) {
477
- return function (a, b) {
478
- var value1 = a[property];
479
- var value2 = b[property];
480
- return value1 - value2;
481
- };
482
- };
483
-
484
- var prevHandleData = function (percentageStr, excNum) {
485
- successNumObj.innerText = successNum;
486
- failNumObj.innerText = failNum;
487
- doneNumObj.innerText = successNum + failNum;
488
- that.percentageNum = percentageStr;
489
- let isEnd = false;
490
- if (uniqueFields.length) {
491
- isEnd = groupIndex + 1 >= groupDatas.length;
492
- } else {
493
- isEnd = index + excNum >= size;
494
- }
495
- if (!isEnd) {
496
- index = index + excNum;
497
- groupIndex = groupIndex + 1;
498
- setTimeout(function () {
499
- handleData();
500
- }, 1);
501
- } else {
502
- setTimeout(function () {
503
- that.clearImportTimer();
504
- }, 300);
505
- }
506
- };
507
-
508
- let getDefaultValue = (row) => {
509
- let value = null;
510
- let defaultValue = this.option.defaultValue;
511
- if (defaultValue) {
512
- if (typeof defaultValue === "function") {
513
- value = defaultValue(row) || {};
514
- } else {
515
- value = defaultValue || {};
516
- }
517
- }
518
- return value;
519
- };
520
-
521
- let handleData = () => {
522
- if (!that.isEnd && index < size) {
523
- var param;
524
- var excNum;
525
- if (multi) {
526
- if (!uniqueFields.length) {
527
- if (index + multiSize < size) {
528
- excNum = multiSize;
529
- } else {
530
- excNum = size - index;
531
- }
532
-
533
- let dataList = [];
534
- for (let i = 0; i < excNum; i++) {
535
- var mIndex = index + i;
536
- let mData = datas[mIndex];
537
- mData.impSeq = mIndex;
538
- mData.impNumber = mIndex + 4;
539
-
540
- let errorInfo = that.vailData(mData, opts);
541
- if (errorInfo.length > 0) {
542
- mData._resultType = "error";
543
- mData._resultContent = errorInfo;
544
- failNum++;
545
- that.failRows.push(mData);
546
- } else {
547
- let defaultValue = getDefaultValue(mData);
548
- if (defaultValue) {
549
- Object.assign(mData, defaultValue);
550
- }
551
- dataList.push(mData);
552
- }
553
-
554
- datas[mIndex] = mData;
555
- }
556
- if (dataList.length > 0) {
557
- param = dataList;
558
- }
559
- } else {
560
- excNum = groupDatas[groupIndex].length;
561
- param = groupDatas[groupIndex];
562
- }
563
- } else {
564
- var data = datas[index];
565
- data.impSeq = index;
566
- data.impNumber = index + 4;
567
- excNum = 1;
568
- datas[index] = data;
569
-
570
- let errorInfo = that.vailData(data, opts);
571
- if (errorInfo.length > 0) {
572
- data._resultType = "error";
573
- data._resultContent = errorInfo;
574
- failNum++;
575
- that.failRows.push(data);
576
- } else {
577
- param = data;
578
- let defaultValue = getDefaultValue(data);
579
- if (defaultValue) {
580
- Object.assign(param, defaultValue);
581
- }
582
- }
583
- }
584
-
585
- var percentageStr = parseInt(((index + excNum) * 100) / size);
586
- if (param === null || param.length === 0) {
587
- if (that.showContent) {
588
- prevHandleData(percentageStr, excNum);
589
- }
590
- return;
591
- }
592
-
593
- that
594
- .$http({
595
- url: saveUrl,
596
- method: "post",
597
- data: param,
598
- resultType: "special",
599
- modal: false,
600
- callback: (resultMsg) => {
601
- if (multi) {
602
- if (resultMsg.type === "success") {
603
- var multiRows = resultMsg.objx;
604
- for (let i = 0; i < multiRows.length; i++) {
605
- var multiRow = multiRows[i];
606
- var data = { ...datas[multiRow.impSeq] };
607
- data._rqeData = { ...datas[multiRow.impSeq] };
608
- data._resultData = multiRow;
609
- data._resultType = multiRow.impReturnType;
610
- data._resultContent
611
- = multiRow.impReturnType === "success"
612
- ? this.$t2(
613
- "导入成功",
614
- "components.excelImport.importSucess"
615
- )
616
- : multiRow.impReturnMsg;
617
- if (multiRow.impReturnType === "success") {
618
- successNum++;
619
- that.successRows.push(data);
620
- } else {
621
- failNum++;
622
- that.failRows.push(data);
623
- }
624
- }
625
-
626
- that.failRows = that.failRows.sort(compareV("impSeq"));
627
- } else {
628
- // error_win(resultMsg);
629
- // layer.close(opts.dialogObjIndex);
630
- that.$errorMsg(resultMsg);
631
- that.showContent = false;
632
- that.clearImportTimer();
633
- return;
634
- }
635
- } else {
636
- var data = { ...datas[index] };
637
- data._resultType = resultMsg.type;
638
- data._resultContent
639
- = resultMsg.type === "success"
640
- ? this.$t2(
641
- "导入成功",
642
- "components.excelImport.importSucess"
643
- )
644
- : this.handleRes(resultMsg.content);
645
- data._rqeData = { ...datas[index] };
646
- data._resultData = resultMsg.objx;
647
- if (resultMsg.type === "success") {
648
- successNum++;
649
- that.successRows.push(data);
650
- } else {
651
- failNum++;
652
- that.failRows.push(data);
653
- }
654
- }
655
- if (that.showContent) {
656
- prevHandleData(percentageStr, excNum);
657
- }
658
- },
659
- })
660
- .catch(function (et) {
661
- that.isEnd = true;
662
- that.clearImportTimer();
663
- console.error(et);
664
- });
665
- }
666
- };
667
- handleData();
668
- },
669
- commonLocalDownload() {
670
- if (this.option.importAttachCode) {
671
- this.commonLocalDownload2();
672
- return;
673
- }
674
- let path = this.option.excel;
675
- let prefix = this.option.prefix;
676
- prefix = prefix || "";
677
- var url = configUtil.baseUrl + prefix + "/sf_common/download";
678
- if (path) {
679
- var params = {
680
- url: path,
681
- };
682
- params["access_token"] = configUtil.getToken();
683
-
684
- var form = document.createElement("form");
685
-
686
- let randomNum
687
- = new Date().valueOf() + Math.floor(Math.random() * 1000000);
688
- let formId = "formId-" + randomNum;
689
- let formName = "formName-" + randomNum;
690
-
691
- form.id = formId;
692
- form.name = formName;
693
- form.target = "_blank";
694
- document.body.appendChild(form);
695
- for (let obj in params) {
696
- if (params.hasOwnProperty(obj)) {
697
- let input = document.createElement("input");
698
- input.tpye = "hidden";
699
- input.name = obj;
700
- input.value = params[obj];
701
- form.appendChild(input);
702
- }
703
- }
704
- form.method = "post"; //请求方式
705
- form.action = url;
706
- form.submit();
707
- document.body.removeChild(form);
708
- }
709
- },
710
- commonLocalDownload2() {
711
- let importAttachCode = this.option.importAttachCode;
712
- if (!importAttachCode) return;
713
- this.$http({
714
- url: USER_PREFIX + "/bd_attach_setting/getByCode",
715
- method: "post",
716
- data: {
717
- stringOne: importAttachCode,
718
- },
719
- success: (res) => {
720
- let fileObj = res.objx;
721
- let url = fileObj?.url;
722
- if (fileObj && url) {
723
- this.$commonFileUtil.downloadFile(url, fileObj.name);
724
- }
725
- },
726
- });
727
- },
728
- vailData(data, opts) {
729
- var oriCols = opts.data.oriCols;
730
- var errorInfo = [];
731
- for (let i = 0; i < oriCols.length; i++) {
732
- let oriCol = oriCols[i];
733
- if (oriCol.isNeed) {
734
- let value = data[oriCol.field];
735
- if (value === null || value === "") {
736
- errorInfo.push(
737
- this.$t2(
738
- "[" + oriCol.title + "]不能为空;",
739
- "components.excelImport.warmMsg4",
740
- { title: oriCol.title }
741
- )
742
- );
743
- }
744
- }
745
- }
746
- return errorInfo.join("");
747
- },
748
- handleRes(val) {
749
- /* var content = val;
750
- var text = content;
751
- if (content && content.indexOf("Exception") >= 0) {
752
- var index0 = content.lastIndexOf("*]");
753
- if (index0 >= 0) {
754
- text = content.substr(index0);
755
- if (text) {
756
- var index1 = text.indexOf("Exception:");
757
- if (index1 >= 0) {
758
- text = text.substr(index1 + 10);
759
- }
760
- }
761
- }
762
- } */
763
- let text = getErrorMsg(val);
764
- return text;
765
- },
766
- exportToExcel() {
767
- let str
768
- = this.resultType === 1
769
- ? this.$t2("成功", "components.excelImport.success")
770
- : this.$t2("失败", "components.excelImport.fail");
771
- let fileName
772
- = this.$t2("导入结果导出", "components.excelImport.exportFileName")
773
- + "("
774
- + str
775
- + ")";
776
- let $grid = this.$refs.resGrid;
777
- let columns = $grid.getColumns();
778
- if (columns && columns.length) {
779
- let fields = columns
780
- .filter((item, index) => {
781
- return index > 0 && item.property;
782
- })
783
- .map((item, index) => {
784
- return item.property;
785
- });
786
- this.$refs.resGrid.exportData({
787
- filename: fileName,
788
- mode: "all",
789
- type: "csv",
790
- columns: fields,
791
- });
792
- }
793
- },
794
- createImportTimer() {
795
- this.excTime = 0;
796
- let beginTime = new Date().getTime();
797
- importTimer = setInterval(() => {
798
- let nowTime = new Date().getTime();
799
- let diffTime = (nowTime - beginTime) / 1000;
800
- this.$set(this, "excTime", this.$baseLodash.round(diffTime, 2));
801
- }, 100);
802
- },
803
- clearImportTimer() {
804
- clearInterval(importTimer);
805
- loadingObj && loadingObj.close();
806
- },
807
- async dialogPrimary3() {
808
- if (!this.fileRaw) {
809
- this.$baseAlert(
810
- this.$t2("请上传附件", "components.excelImport.warmMsg1")
811
- );
812
- return false;
813
- }
814
- let that = this;
815
- let option = this.option;
816
- let done = () => {
817
- that.showImportDialog = false;
818
- };
819
- if (!option.excel) {
820
- if (
821
- option.callback
822
- && option.callback(null, this.fileRaw, done) !== false
823
- ) {
824
- that.showImportDialog = false;
825
- }
826
- return;
827
- }
828
- loadingObj = this.$baseLoading({
829
- target: document.body,
830
- background: "unset",
831
- });
832
- this.readExcel(this.fileRaw, function (resultData) {
833
- try {
834
- if (
835
- option.callback
836
- && option.callback(resultData, that.fileRaw, done) !== false
837
- ) {
838
- that.showImportDialog = false;
839
- }
840
- } catch (et) {
841
- console.error(et);
842
- }
843
- setTimeout(function () {
844
- loadingObj && loadingObj.close();
845
- }, 200);
846
- });
847
- },
848
- },
849
- };
850
- export const mixins = tmixins;
263
+ fileReader.onload = async (ev) => {
264
+ var resultData;
265
+ try {
266
+ const data = ev.target.result;
267
+ const workbook = XLSX.read(data, {
268
+ type: "binary",
269
+ });
270
+
271
+ var sheet = workbook.Sheets[workbook.SheetNames[0]];
272
+ if (sheet["!ref"] === undefined) {
273
+ that.showImportDialog2 = false;
274
+ that.showContent = false;
275
+ that.clearImportTimer();
276
+ that.$baseAlert(
277
+ this.$t2(
278
+ "请使用正确的导入模版!",
279
+ "components.excelImport.warmMsg2"
280
+ )
281
+ );
282
+ return false;
283
+ }
284
+ var range = XLSX.utils.decode_range(sheet["!ref"]);
285
+ var dataSize = range.e.r + 1; //行数
286
+ that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
287
+ // 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时
288
+ // 主线程会被占死甚至 OOM。文件本身不大但行极多(窄表)时只有这一道能拦。
289
+ if (isImportRowsOverLimit(that.dataSize, option)) {
290
+ that.showImportDialog2 = false;
291
+ that.showContent = false;
292
+ that.clearImportTimer();
293
+ that.$baseAlert(
294
+ that.$t1(
295
+ "导入数据 {size} 行,超过单次上限 {limit} 行,请拆分后分批导入",
296
+ {
297
+ size: that.dataSize,
298
+ limit: getImportRowLimit(option),
299
+ }
300
+ )
301
+ );
302
+ return false;
303
+ }
304
+ var titles = [];
305
+ var fields = [];
306
+
307
+ const ws = workbook.Sheets[sheet];
308
+
309
+ let prefix = option.prefix;
310
+ let excelUrl = option.excel;
311
+
312
+ var excelRows = [];
313
+ var row;
314
+ var rowNum;
315
+ var colNum;
316
+ for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
317
+ row = [];
318
+ for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
319
+ var nextCell
320
+ = sheet[
321
+ XLSX.utils.encode_cell({
322
+ r: rowNum,
323
+ c: colNum,
324
+ })
325
+ ];
326
+ if (typeof nextCell === "undefined") {
327
+ row.push(void 0);
328
+ } else {
329
+ row.push(getImportCellText(nextCell));
330
+ }
331
+ }
332
+ if (rowNum === 1) {
333
+ titles = row;
334
+ }
335
+ if (rowNum === 2) {
336
+ fields = row;
337
+ let checkResult = true;
338
+ if (!option.importAttachCode) {
339
+ await that
340
+ .checkExcelForImport(titles, fields, excelUrl, prefix)
341
+ .then((res) => {
342
+ if (res.type != "success") {
343
+ checkResult = false;
344
+ }
345
+ });
346
+ if (!checkResult) {
347
+ that.showContent = false;
348
+ that.clearImportTimer();
349
+ return false;
350
+ }
351
+ }
352
+ }
353
+ if (rowNum > 2) {
354
+ let item = {};
355
+ for (let i = 0; i < fields.length; i++) {
356
+ let field = fields[i];
357
+ item[field] = row[i];
358
+ }
359
+ excelRows.push(item);
360
+ }
361
+ }
362
+ if (
363
+ !titles.length
364
+ || !fields.length
365
+ || titles.length != fields.length
366
+ ) {
367
+ that.showContent = false;
368
+ that.clearImportTimer();
369
+ that.$baseAlert(
370
+ this.$t2(
371
+ "请使用正确的导入模版!",
372
+ "components.excelImport.warmMsg2"
373
+ )
374
+ );
375
+ return false;
376
+ }
377
+
378
+ var columns = [];
379
+ var cols = [];
380
+ let uniqueFields = [];
381
+ for (let i = 0; i < titles.length; i++) {
382
+ let title = titles[i];
383
+ if (title) {
384
+ let field = fields[i];
385
+ if (field === null) {
386
+ that.showContent = false;
387
+ that.clearImportTimer();
388
+ that.$baseAlert(
389
+ this.$t2(
390
+ "请使用正确的导入模版!",
391
+ "components.excelImport.warmMsg2"
392
+ )
393
+ );
394
+ return false;
395
+ }
396
+ let t = title.substr(-1);
397
+ let u = title.length >= 2 ? title.substr(-2) : title;
398
+ let isNeed = false;
399
+ if (t === "*") {
400
+ isNeed = true;
401
+ }
402
+ let isUnique = false;
403
+ if (u === "**") {
404
+ uniqueFields.push(field);
405
+ isUnique = true;
406
+ }
407
+ let col = {
408
+ field: field,
409
+ title: title,
410
+ width: 100,
411
+ isNeed: isNeed,
412
+ isUnique: isUnique,
413
+ };
414
+ cols.push(col);
415
+ }
416
+ }
417
+
418
+ var oriCols = JSON.parse(JSON.stringify(cols)); //列信息
419
+ if (uniqueFields.length) {
420
+ //分组唯一字段为空时,全部不发包。
421
+ for (let i = 0; i < oriCols.length; i++) {
422
+ let oriCol = oriCols[i];
423
+ if (oriCol.isNeed) {
424
+ for (let j = 0; j < excelRows.length; j++) {
425
+ let data = excelRows[j];
426
+ let value = data[oriCol.field];
427
+ if (value === null || value === "") {
428
+ that.clearImportTimer();
429
+ that.$baseAlert(
430
+ this.$t2(
431
+ "第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
432
+ "components.excelImport.warmMsg3",
433
+ {
434
+ lineNo: j + 4,
435
+ title: oriCol.title,
436
+ }
437
+ )
438
+ );
439
+ return false;
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+
446
+ this.oriCols = oriCols;
447
+
448
+ resultData = {
449
+ data: excelRows,
450
+ titles: titles,
451
+ fields: fields,
452
+ uniqueFields: uniqueFields,
453
+ oriCols: oriCols,
454
+ };
455
+ this.resultData = resultData;
456
+ callback(resultData);
457
+ } catch (et) {
458
+ that.showContent = false;
459
+ that.clearImportTimer();
460
+ console.error(et);
461
+ }
462
+ };
463
+ fileReader.readAsBinaryString(file);
464
+ },
465
+ async checkExcelForImport(titles, fields, turl, prefix) {
466
+ let that = this;
467
+ var data = {
468
+ filed_name: fields,
469
+ field_note: titles,
470
+ url: turl,
471
+ };
472
+ var param = JSON.stringify(data);
473
+ return this.$http({
474
+ url: prefix + "/sf_common/compareExcelFields",
475
+ method: "post",
476
+ headers: {
477
+ "Content-Type": "application/json;charset=utf-8",
478
+ },
479
+ // data: param,
480
+ data: data,
481
+ });
482
+ },
483
+ syncDataForImport(opts) {
484
+ let that = this;
485
+ var multi = this.option.multi;
486
+ var resultData = opts.data;
487
+ var datas = resultData.data;
488
+ var titles = resultData.titles;
489
+ var fields = resultData.fields;
490
+ let uniqueFields = resultData.uniqueFields;
491
+ var saveUrl = opts.saveUrl;
492
+ var size = datas.length;
493
+ var index = 0;
494
+ var successNum = 0;
495
+ var failNum = 0;
496
+ var dialogObj = this.$refs.importDialog.$el;
497
+ var successNumObj = dialogObj.querySelector(".successNum");
498
+ var failNumObj = dialogObj.querySelector(".failNum");
499
+ var percentageObj = dialogObj.querySelector(".percentage");
500
+ var doneNumObj = dialogObj.querySelector(".doneNum");
501
+ dialogObj.querySelector(".dataSize").innerText = size;
502
+
503
+ that.successRows = [];
504
+ that.failRows = [];
505
+
506
+ var multiSize = opts.multiSize || 2;
507
+
508
+ let groupIndex = 0;
509
+ let groupDatas = [];
510
+ if (uniqueFields.length) {
511
+ let d = XEUtils.groupBy(datas, function (item, itemIndex, items) {
512
+ let keyArr = [];
513
+ uniqueFields.forEach((field) => {
514
+ keyArr.push(item[field]);
515
+ });
516
+ return keyArr.join("&_&");
517
+ });
518
+ for (let key in d) {
519
+ groupDatas.push(d[key]);
520
+ }
521
+ datas.forEach((item, itemIndex) => {
522
+ item.impSeq = itemIndex;
523
+ item.impNumber = itemIndex + 4;
524
+ });
525
+ }
526
+
527
+ var compareV = function (property) {
528
+ return function (a, b) {
529
+ var value1 = a[property];
530
+ var value2 = b[property];
531
+ return value1 - value2;
532
+ };
533
+ };
534
+
535
+ var prevHandleData = function (percentageStr, excNum) {
536
+ successNumObj.innerText = successNum;
537
+ failNumObj.innerText = failNum;
538
+ doneNumObj.innerText = successNum + failNum;
539
+ that.percentageNum = percentageStr;
540
+ let isEnd = false;
541
+ if (uniqueFields.length) {
542
+ isEnd = groupIndex + 1 >= groupDatas.length;
543
+ } else {
544
+ isEnd = index + excNum >= size;
545
+ }
546
+ if (!isEnd) {
547
+ index = index + excNum;
548
+ groupIndex = groupIndex + 1;
549
+ setTimeout(function () {
550
+ handleData();
551
+ }, 1);
552
+ } else {
553
+ setTimeout(function () {
554
+ that.clearImportTimer();
555
+ }, 300);
556
+ }
557
+ };
558
+
559
+ let getDefaultValue = (row) => {
560
+ let value = null;
561
+ let defaultValue = this.option.defaultValue;
562
+ if (defaultValue) {
563
+ if (typeof defaultValue === "function") {
564
+ value = defaultValue(row) || {};
565
+ } else {
566
+ value = defaultValue || {};
567
+ }
568
+ }
569
+ return value;
570
+ };
571
+
572
+ let handleData = () => {
573
+ if (!that.isEnd && index < size) {
574
+ var param;
575
+ var excNum;
576
+ if (multi) {
577
+ if (!uniqueFields.length) {
578
+ if (index + multiSize < size) {
579
+ excNum = multiSize;
580
+ } else {
581
+ excNum = size - index;
582
+ }
583
+
584
+ let dataList = [];
585
+ for (let i = 0; i < excNum; i++) {
586
+ var mIndex = index + i;
587
+ let mData = datas[mIndex];
588
+ mData.impSeq = mIndex;
589
+ mData.impNumber = mIndex + 4;
590
+
591
+ let errorInfo = that.vailData(mData, opts);
592
+ if (errorInfo.length > 0) {
593
+ mData._resultType = "error";
594
+ mData._resultContent = errorInfo;
595
+ failNum++;
596
+ that.failRows.push(mData);
597
+ } else {
598
+ let defaultValue = getDefaultValue(mData);
599
+ if (defaultValue) {
600
+ Object.assign(mData, defaultValue);
601
+ }
602
+ dataList.push(mData);
603
+ }
604
+
605
+ datas[mIndex] = mData;
606
+ }
607
+ if (dataList.length > 0) {
608
+ param = dataList;
609
+ }
610
+ } else {
611
+ excNum = groupDatas[groupIndex].length;
612
+ param = groupDatas[groupIndex];
613
+ }
614
+ } else {
615
+ var data = datas[index];
616
+ data.impSeq = index;
617
+ data.impNumber = index + 4;
618
+ excNum = 1;
619
+ datas[index] = data;
620
+
621
+ let errorInfo = that.vailData(data, opts);
622
+ if (errorInfo.length > 0) {
623
+ data._resultType = "error";
624
+ data._resultContent = errorInfo;
625
+ failNum++;
626
+ that.failRows.push(data);
627
+ } else {
628
+ param = data;
629
+ let defaultValue = getDefaultValue(data);
630
+ if (defaultValue) {
631
+ Object.assign(param, defaultValue);
632
+ }
633
+ }
634
+ }
635
+
636
+ var percentageStr = parseInt(((index + excNum) * 100) / size);
637
+ if (param === null || param.length === 0) {
638
+ if (that.showContent) {
639
+ prevHandleData(percentageStr, excNum);
640
+ }
641
+ return;
642
+ }
643
+
644
+ that
645
+ .$http({
646
+ url: saveUrl,
647
+ method: "post",
648
+ data: param,
649
+ resultType: "special",
650
+ modal: false,
651
+ callback: (resultMsg) => {
652
+ if (multi) {
653
+ if (resultMsg.type === "success") {
654
+ var multiRows = resultMsg.objx;
655
+ for (let i = 0; i < multiRows.length; i++) {
656
+ var multiRow = multiRows[i];
657
+ var data = { ...datas[multiRow.impSeq] };
658
+ data._rqeData = { ...datas[multiRow.impSeq] };
659
+ data._resultData = multiRow;
660
+ data._resultType = multiRow.impReturnType;
661
+ data._resultContent
662
+ = multiRow.impReturnType === "success"
663
+ ? this.$t2(
664
+ "导入成功",
665
+ "components.excelImport.importSucess"
666
+ )
667
+ : multiRow.impReturnMsg;
668
+ if (multiRow.impReturnType === "success") {
669
+ successNum++;
670
+ that.successRows.push(data);
671
+ } else {
672
+ failNum++;
673
+ that.failRows.push(data);
674
+ }
675
+ }
676
+
677
+ that.failRows = that.failRows.sort(compareV("impSeq"));
678
+ } else {
679
+ // error_win(resultMsg);
680
+ // layer.close(opts.dialogObjIndex);
681
+ that.$errorMsg(resultMsg);
682
+ that.showContent = false;
683
+ that.clearImportTimer();
684
+ return;
685
+ }
686
+ } else {
687
+ var data = { ...datas[index] };
688
+ data._resultType = resultMsg.type;
689
+ data._resultContent
690
+ = resultMsg.type === "success"
691
+ ? this.$t2(
692
+ "导入成功",
693
+ "components.excelImport.importSucess"
694
+ )
695
+ : this.handleRes(resultMsg.content);
696
+ data._rqeData = { ...datas[index] };
697
+ data._resultData = resultMsg.objx;
698
+ if (resultMsg.type === "success") {
699
+ successNum++;
700
+ that.successRows.push(data);
701
+ } else {
702
+ failNum++;
703
+ that.failRows.push(data);
704
+ }
705
+ }
706
+ if (that.showContent) {
707
+ prevHandleData(percentageStr, excNum);
708
+ }
709
+ },
710
+ })
711
+ .catch(function (et) {
712
+ that.isEnd = true;
713
+ that.clearImportTimer();
714
+ console.error(et);
715
+ });
716
+ }
717
+ };
718
+ handleData();
719
+ },
720
+ commonLocalDownload() {
721
+ if (this.option.importAttachCode) {
722
+ this.commonLocalDownload2();
723
+ return;
724
+ }
725
+ let path = this.option.excel;
726
+ let prefix = this.option.prefix;
727
+ prefix = prefix || "";
728
+ var url = configUtil.baseUrl + prefix + "/sf_common/download";
729
+ if (path) {
730
+ var params = {
731
+ url: path,
732
+ };
733
+ params["access_token"] = configUtil.getToken();
734
+
735
+ var form = document.createElement("form");
736
+
737
+ let randomNum
738
+ = new Date().valueOf() + Math.floor(Math.random() * 1000000);
739
+ let formId = "formId-" + randomNum;
740
+ let formName = "formName-" + randomNum;
741
+
742
+ form.id = formId;
743
+ form.name = formName;
744
+ form.target = "_blank";
745
+ document.body.appendChild(form);
746
+ for (let obj in params) {
747
+ if (params.hasOwnProperty(obj)) {
748
+ let input = document.createElement("input");
749
+ input.tpye = "hidden";
750
+ input.name = obj;
751
+ input.value = params[obj];
752
+ form.appendChild(input);
753
+ }
754
+ }
755
+ form.method = "post"; //请求方式
756
+ form.action = url;
757
+ form.submit();
758
+ document.body.removeChild(form);
759
+ }
760
+ },
761
+ commonLocalDownload2() {
762
+ let importAttachCode = this.option.importAttachCode;
763
+ if (!importAttachCode) return;
764
+ this.$http({
765
+ url: USER_PREFIX + "/bd_attach_setting/getByCode",
766
+ method: "post",
767
+ data: {
768
+ stringOne: importAttachCode,
769
+ },
770
+ success: (res) => {
771
+ let fileObj = res.objx;
772
+ let url = fileObj?.url;
773
+ if (fileObj && url) {
774
+ this.$commonFileUtil.downloadFile(url, fileObj.name);
775
+ }
776
+ },
777
+ });
778
+ },
779
+ vailData(data, opts) {
780
+ var oriCols = opts.data.oriCols;
781
+ var errorInfo = [];
782
+ for (let i = 0; i < oriCols.length; i++) {
783
+ let oriCol = oriCols[i];
784
+ if (oriCol.isNeed) {
785
+ let value = data[oriCol.field];
786
+ if (value === null || value === "") {
787
+ errorInfo.push(
788
+ this.$t2(
789
+ "[" + oriCol.title + "]不能为空;",
790
+ "components.excelImport.warmMsg4",
791
+ { title: oriCol.title }
792
+ )
793
+ );
794
+ }
795
+ }
796
+ }
797
+ return errorInfo.join("");
798
+ },
799
+ handleRes(val) {
800
+ /* var content = val;
801
+ var text = content;
802
+ if (content && content.indexOf("Exception") >= 0) {
803
+ var index0 = content.lastIndexOf("*]");
804
+ if (index0 >= 0) {
805
+ text = content.substr(index0);
806
+ if (text) {
807
+ var index1 = text.indexOf("Exception:");
808
+ if (index1 >= 0) {
809
+ text = text.substr(index1 + 10);
810
+ }
811
+ }
812
+ }
813
+ } */
814
+ let text = getErrorMsg(val);
815
+ return text;
816
+ },
817
+ exportToExcel() {
818
+ let str
819
+ = this.resultType === 1
820
+ ? this.$t2("成功", "components.excelImport.success")
821
+ : this.$t2("失败", "components.excelImport.fail");
822
+ let fileName
823
+ = this.$t2("导入结果导出", "components.excelImport.exportFileName")
824
+ + "("
825
+ + str
826
+ + ")";
827
+ let $grid = this.$refs.resGrid;
828
+ let columns = $grid.getColumns();
829
+ if (columns && columns.length) {
830
+ let fields = columns
831
+ .filter((item, index) => {
832
+ return index > 0 && item.property;
833
+ })
834
+ .map((item, index) => {
835
+ return item.property;
836
+ });
837
+ this.$refs.resGrid.exportData({
838
+ filename: fileName,
839
+ mode: "all",
840
+ type: "csv",
841
+ columns: fields,
842
+ });
843
+ }
844
+ },
845
+ createImportTimer() {
846
+ this.excTime = 0;
847
+ let beginTime = new Date().getTime();
848
+ this.importTimer = setInterval(() => {
849
+ let nowTime = new Date().getTime();
850
+ let diffTime = (nowTime - beginTime) / 1000;
851
+ this.$set(this, "excTime", this.$baseLodash.round(diffTime, 2));
852
+ }, 100);
853
+ },
854
+ clearImportTimer() {
855
+ if (this.importTimer) clearInterval(this.importTimer);
856
+ this.importTimer = null;
857
+ this.loadingObj && this.loadingObj.close();
858
+ this.loadingObj = null;
859
+ },
860
+ async dialogPrimary3() {
861
+ if (!this.fileRaw) {
862
+ this.$baseAlert(
863
+ this.$t2("请上传附件", "components.excelImport.warmMsg1")
864
+ );
865
+ return false;
866
+ }
867
+ let that = this;
868
+ let option = this.option;
869
+ let done = () => {
870
+ that.showImportDialog = false;
871
+ };
872
+ if (!option.excel) {
873
+ if (
874
+ option.callback
875
+ && option.callback(null, this.fileRaw, done) !== false
876
+ ) {
877
+ that.showImportDialog = false;
878
+ }
879
+ return;
880
+ }
881
+ this.loadingObj = this.$baseLoading({
882
+ target: document.body,
883
+ background: "unset",
884
+ });
885
+ this.readExcel(this.fileRaw, function (resultData) {
886
+ try {
887
+ if (
888
+ option.callback
889
+ && option.callback(resultData, that.fileRaw, done) !== false
890
+ ) {
891
+ that.showImportDialog = false;
892
+ }
893
+ } catch (et) {
894
+ console.error(et);
895
+ }
896
+ setTimeout(function () {
897
+ that.loadingObj && that.loadingObj.close();
898
+ that.loadingObj = null;
899
+ }, 200);
900
+ });
901
+ },
902
+ },
903
+ };
904
+ export const mixins = tmixins;