cloud-web-corejs 1.0.54-dev.52 → 1.0.54-dev.521

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 (408) hide show
  1. package/package.json +14 -3
  2. package/src/App.vue +30 -34
  3. package/src/api/user.js +16 -0
  4. package/src/components/Qrcode/fileParse.vue +0 -1
  5. package/src/components/Tinymce/index.vue +112 -71
  6. package/src/components/VabUpload/image-viewer.vue +2 -2
  7. package/src/components/VabUpload/index.js +2 -1
  8. package/src/components/VabUpload/mixins.js +2 -2
  9. package/src/components/VabUpload/privateProfileDialogMixins.js +1 -1063
  10. package/src/components/VabUpload/propertiesDialog.vue +1 -1
  11. package/src/components/VabUpload/view.vue +209 -120
  12. package/src/components/advancedSearchDialog/mixins.js +1 -1
  13. package/src/components/base-textarea/index.vue +104 -0
  14. package/src/components/baseAlert/mixins.js +1 -1
  15. package/src/components/baseAttachment/index.vue +49 -40
  16. package/src/components/baseAttachment/mixins.js +2 -1
  17. package/src/components/baseInputExport/index.vue +19 -12
  18. package/src/components/baseInputExport/mixins.js +1 -1
  19. package/src/components/baseTabs/mixins.js +1 -1
  20. package/src/components/code-editor/index.vue +102 -63
  21. package/src/components/confirmDialog/index.vue +24 -17
  22. package/src/components/confirmDialog/mixins.js +1 -1
  23. package/src/components/errorMsg/index.vue +42 -34
  24. package/src/components/errorMsg/mixins.js +6 -5
  25. package/src/components/excelExport/button.vue +57 -4
  26. package/src/components/excelExport/index.js +6 -6
  27. package/src/components/excelExport/index.vue +56 -2
  28. package/src/components/excelExport/mixins.js +3 -2
  29. package/src/components/excelImport/mixins.js +2 -1
  30. package/src/components/fileLibrary/fileObjAuthDialog.vue +179 -89
  31. package/src/components/fileLibrary/fileObjAuthEditDialog.vue +6 -0
  32. package/src/components/fileLibrary/filterDialog.vue +454 -0
  33. package/src/components/fileLibrary/index.vue +594 -254
  34. package/src/components/fileLibrary/mixins/categoryMoveDialogMixins.js +1 -1
  35. package/src/components/fileLibrary/mixins/fileCategoryDialogMixins.js +1 -1
  36. package/src/components/fileLibrary/mixins/fileHistoryDialogMixins.js +2 -2
  37. package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +339 -211
  38. package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +31 -27
  39. package/src/components/fileLibrary/mixins/fileObjAuthEditMixin.js +4 -4
  40. package/src/components/fileLibrary/mixins/indexMixins.js +220 -101
  41. package/src/components/fileLibrary/mixins/propertiesDialogMixins.js +64 -4
  42. package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +3 -3
  43. package/src/components/fileLibrary/propertiesDialog.vue +113 -74
  44. package/src/components/fileLibrary/shareDialog.vue +1 -1
  45. package/src/components/formOplog/mixins.js +1 -1
  46. package/src/components/jsonImport/index.js +1 -1
  47. package/src/components/jsonImport/mixins.js +2 -1
  48. package/src/components/langImport/mixins.js +17 -16
  49. package/src/components/obsUpload/index.js +1 -0
  50. package/src/components/obsUpload/index.vue +231 -0
  51. package/src/components/obsUpload/mixins.js +8 -0
  52. package/src/components/scriptDescription/button.vue +12 -4
  53. package/src/components/scriptTest/mixins.js +1 -1
  54. package/src/components/statusTag/mixins.js +1 -1
  55. package/src/components/table/CellSlot.vue +1 -0
  56. package/src/components/table/index.js +12 -11
  57. package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.es6.min.js +11028 -0
  58. package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.min.css +200 -0
  59. package/src/components/table/tableForm.vue +99 -63
  60. package/src/components/table/tableFormMixin.js +1 -1
  61. package/src/components/table/util/index.js +328 -0
  62. package/src/components/table/vxeFilter/mixin.js +6 -6
  63. package/src/components/tempStorage/index.vue +76 -55
  64. package/src/components/tempStorage/tempStorageDialog.vue +179 -54
  65. package/src/components/vb-tabs/x-tabs.vue +56 -30
  66. package/src/components/wf/addOpinionButton.vue +57 -0
  67. package/src/components/wf/content.vue +834 -362
  68. package/src/components/wf/mixins/addOpinionButton.js +3 -0
  69. package/src/components/wf/mixins/setCandidateButton.js +6 -0
  70. package/src/components/wf/mixins/setCandidateDialog.js +2 -1
  71. package/src/components/wf/mixins/setCandidateDialog2.js +6 -0
  72. package/src/components/wf/mixins/wfFlowEleScriptDialog.js +3 -0
  73. package/src/components/wf/mixins/wfTaskUserRangeDialog.js +3 -0
  74. package/src/components/wf/setCandidateButton.vue +40 -0
  75. package/src/components/wf/setCandidateDialog.vue +10 -0
  76. package/src/components/wf/setCandidateDialog2.vue +105 -0
  77. package/src/components/wf/wf.js +2156 -1
  78. package/src/components/wf/wfFlowEleScriptDialog.vue +89 -0
  79. package/src/components/wf/wfStartDialog.vue +66 -42
  80. package/src/components/wf/wfTaskUserRangeDialog.vue +65 -0
  81. package/src/components/wf/wfUtil.js +279 -1
  82. package/src/components/xform/form-designer/designer.js +5 -3
  83. package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +434 -0
  84. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +3 -3
  85. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +9 -8
  86. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -1
  87. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +3 -3
  88. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +971 -0
  89. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +971 -0
  90. package/src/components/xform/form-designer/form-widget/dialog/exportDialog.vue +13 -0
  91. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +301 -0
  92. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +82 -49
  93. package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +5 -1
  94. package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
  95. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +38 -7
  96. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +1639 -0
  97. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +9 -8
  98. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +133 -72
  99. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +2 -2
  100. package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
  101. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +34 -5
  102. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  103. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +19 -1
  104. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +40 -28
  105. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +18 -7
  106. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +4 -1
  107. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +89 -0
  108. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +14 -2
  109. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +30 -4
  110. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +133 -0
  111. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +77 -0
  112. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +106 -0
  113. package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
  114. package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
  115. package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
  116. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +25 -16
  117. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +705 -379
  118. package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +964 -0
  119. package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +6 -2
  120. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +22 -11
  121. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +90 -0
  122. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +7 -2
  123. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-bar-mixin.js +49 -8
  124. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +61 -88
  125. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +13 -0
  126. package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +179 -0
  127. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
  128. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +114 -81
  129. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +186 -0
  130. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +44 -27
  131. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +116 -0
  132. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +154 -47
  133. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +26 -6
  134. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +2 -2
  135. package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +86 -0
  136. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +24 -9
  137. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
  138. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -0
  139. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +12 -1
  140. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +31 -17
  141. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +7 -2
  142. package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +99 -0
  143. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +147 -0
  144. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +106 -33
  145. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +2 -2
  146. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +3 -171
  147. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +260 -58
  148. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +753 -0
  149. package/src/components/xform/form-designer/indexMixin.js +3 -772
  150. package/src/components/xform/form-designer/setting-panel/form-setting.vue +977 -169
  151. package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
  152. package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
  153. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +537 -302
  154. package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +4 -4
  155. package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +3 -3
  156. package/src/components/xform/form-designer/setting-panel/property-editor/autoValueEnabled-editor.vue +38 -0
  157. package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +6 -0
  158. package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +28 -0
  159. package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +41 -0
  160. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +125 -0
  161. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +946 -1042
  162. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/onCheckboxChange-editor.vue +1 -1
  163. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1127 -512
  164. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +2 -2
  165. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-pane/detail-pane-editor.vue +3 -3
  166. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
  167. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
  168. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
  169. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +0 -8
  170. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree/tree-customClass-editor.vue +31 -2
  171. package/src/components/xform/form-designer/setting-panel/property-editor/copyButton-editor.vue +36 -0
  172. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +32 -0
  173. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +2 -2
  174. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onAfterConfirmFile-editor.vue +32 -0
  175. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +14 -7
  176. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +35 -20
  177. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +64 -5
  178. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +27 -0
  179. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-item-editor.vue +21 -0
  180. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
  181. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +185 -69
  182. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +188 -86
  183. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +84 -39
  184. package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +36 -0
  185. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +77 -20
  186. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -0
  187. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +44 -15
  188. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -0
  189. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
  190. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +67 -41
  191. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +56 -0
  192. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +26 -7
  193. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
  194. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +33 -1
  195. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +66 -0
  196. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +89 -19
  197. package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +137 -0
  198. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +721 -466
  199. package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +20 -11
  200. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +1 -1
  201. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
  202. package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +1 -1
  203. package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
  204. package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +19 -14
  205. package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  206. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +124 -50
  207. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +31 -0
  208. package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
  209. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +349 -0
  210. package/src/components/xform/form-designer/setting-panel/property-editor/required-editor.vue +10 -6
  211. package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +3 -3
  212. package/src/components/xform/form-designer/setting-panel/property-editor/showRuleFlag-editor.vue +1 -1
  213. package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +42 -0
  214. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +305 -19
  215. package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +2 -2
  216. package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +2 -2
  217. package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +372 -50
  218. package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +263 -0
  219. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +33 -11
  220. package/src/components/xform/form-designer/toolbar-panel/index.vue +12 -11
  221. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +1 -1
  222. package/src/components/xform/form-designer/widget-panel/index.vue +21 -1
  223. package/src/components/xform/form-designer/widget-panel/indexMixin.js +19 -18
  224. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +1657 -869
  225. package/src/components/xform/form-render/container-item/containerItemMixin.js +12 -11
  226. package/src/components/xform/form-render/container-item/data-table-item.vue +194 -199
  227. package/src/components/xform/form-render/container-item/data-table-mixin.js +22 -18
  228. package/src/components/xform/form-render/container-item/detail-pane-item.vue +17 -3
  229. package/src/components/xform/form-render/container-item/grid-col-item.vue +10 -3
  230. package/src/components/xform/form-render/container-item/grid-item.vue +1 -1
  231. package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -9
  232. package/src/components/xform/form-render/container-item/list-h5-item2.vue +1 -8
  233. package/src/components/xform/form-render/container-item/tab-item.vue +62 -25
  234. package/src/components/xform/form-render/container-item/table-cell-item.vue +38 -32
  235. package/src/components/xform/form-render/container-item/table-item.vue +4 -2
  236. package/src/components/xform/form-render/container-item/table2-cell-item.vue +53 -34
  237. package/src/components/xform/form-render/container-item/table2-item.vue +141 -88
  238. package/src/components/xform/form-render/container-item/tree-item.vue +32 -11
  239. package/src/components/xform/form-render/index.vue +77 -20
  240. package/src/components/xform/form-render/indexMixin copy.js +3462 -0
  241. package/src/components/xform/form-render/indexMixin.js +3517 -12
  242. package/src/components/xform/lang/zh-CN.js +27 -4
  243. package/src/components/xform/mixins/defaultHandle.js +1 -1
  244. package/src/components/xform/mixins/scriptHttp.js +3 -1
  245. package/src/components/xform/utils/emitter.js +4 -4
  246. package/src/components/xform/utils/format.js +35 -34
  247. package/src/components/xform/utils/formula-util.js +966 -0
  248. package/src/components/xform/utils/util.js +1 -1
  249. package/src/components/xform/utils/validators.js +1 -5
  250. package/src/components/xform/utils/vue2js-generator.js +2 -2
  251. package/src/index.js +215 -190
  252. package/src/lang/index.js +56 -51
  253. package/src/lang/locale/en/login.js +20 -0
  254. package/src/lang/locale/zh/login.js +20 -0
  255. package/src/layout/components/AppMain.vue +5 -1
  256. package/src/layout/components/Sidebar/default.vue +1423 -1222
  257. package/src/layout/components/TagsView/index.vue +37 -12
  258. package/src/layout/components/createCompany/createCompanyDialog.vue +157 -0
  259. package/src/layout/components/extractedCode/createDialog.vue +92 -0
  260. package/src/layout/components/extractedCode/queryDialog.vue +96 -0
  261. package/src/layout/components/extractedCode/viewDialog.vue +193 -0
  262. package/src/layout/components/watermark/index.vue +83 -0
  263. package/src/layout/defaultLayout.vue +1 -1
  264. package/src/layout/index.vue +3 -5
  265. package/src/mixins/selectDialog/index.js +1 -1
  266. package/src/mixins/table/index.js +151 -0
  267. package/src/mixins/tableTree/index.js +1 -1
  268. package/src/permission.js +1 -18
  269. package/src/router/modules/customer.js +89 -8
  270. package/src/store/config/index.js +1 -1
  271. package/src/store/getters.js +3 -1
  272. package/src/store/modules/permission.js +1 -1
  273. package/src/store/modules/settings.js +1 -1
  274. package/src/store/modules/tagsView.js +1 -14
  275. package/src/store/modules/user.js +1 -29
  276. package/src/utils/index.js +1 -7
  277. package/src/utils/pddLog.js +103 -0
  278. package/src/utils/pdfUtil.js +71 -0
  279. package/src/utils/request.js +1 -1
  280. package/src/utils/vab.js +19 -27
  281. package/src/views/bd/setting/bd_attach_setting/edit.vue +5 -5
  282. package/src/views/bd/setting/bd_attach_setting/list.vue +28 -55
  283. package/src/views/bd/setting/bd_attach_setting/mixins/edit.js +4 -5
  284. package/src/views/bd/setting/bd_attach_setting/mixins/list.js +239 -1
  285. package/src/views/bd/setting/bd_company_env/dialog.vue +174 -0
  286. package/src/views/bd/setting/bd_company_env/edit.vue +193 -0
  287. package/src/views/bd/setting/bd_company_env/list.vue +175 -0
  288. package/src/views/bd/setting/config_manage/list.vue +83 -0
  289. package/src/views/bd/setting/form_import_log/edit.vue +127 -0
  290. package/src/views/bd/setting/form_import_log/list.vue +206 -0
  291. package/src/views/bd/setting/form_script/edit.vue +9 -0
  292. package/src/views/bd/setting/form_script/edit1.vue +36 -3
  293. package/src/views/bd/setting/form_script/form_list.vue +99 -37
  294. package/src/views/bd/setting/form_script/list1.vue +181 -118
  295. package/src/views/bd/setting/form_script/mixins/dialog.js +130 -1
  296. package/src/views/bd/setting/form_script/mixins/edit.js +201 -1
  297. package/src/views/bd/setting/form_script/mixins/edit1.js +193 -1
  298. package/src/views/bd/setting/form_script/mixins/form_list.js +1 -1
  299. package/src/views/bd/setting/form_script/mixins/list.js +236 -1
  300. package/src/views/bd/setting/form_script/mixins/list1.js +423 -14
  301. package/src/views/bd/setting/form_script/mixins/otherAuthDialog.js +194 -0
  302. package/src/views/bd/setting/form_script/otherAuthDialog.vue +83 -0
  303. package/src/views/bd/setting/form_template/batchWfObjConfigDialog.vue +2 -2
  304. package/src/views/bd/setting/form_template/edit.vue +22 -1
  305. package/src/views/bd/setting/form_template/editWfObjConfigDialog.vue +2 -2
  306. package/src/views/bd/setting/form_template/list.vue +326 -214
  307. package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +11 -10
  308. package/src/views/bd/setting/form_template/mixins/edit.js +234 -9
  309. package/src/views/bd/setting/form_template/mixins/list.js +689 -22
  310. package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +193 -0
  311. package/src/views/bd/setting/form_template/mixins/wf_list.js +1 -423
  312. package/src/views/bd/setting/form_template/otherAuthDialog.vue +83 -0
  313. package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +4 -4
  314. package/src/views/bd/setting/form_template/wf_list.vue +1 -1
  315. package/src/views/bd/setting/logic_param/edit.vue +146 -0
  316. package/src/views/bd/setting/logic_param/edit1.vue +106 -0
  317. package/src/views/bd/setting/logic_param/edit2.vue +139 -0
  318. package/src/views/bd/setting/logic_param/list.vue +74 -0
  319. package/src/views/bd/setting/logic_param/list1.vue +12 -0
  320. package/src/views/bd/setting/logic_param/list2.vue +12 -0
  321. package/src/views/bd/setting/logic_param/mixins/edit.js +3 -0
  322. package/src/views/bd/setting/logic_param/mixins/list.js +9 -0
  323. package/src/views/bd/setting/menu_kind/list.vue +172 -83
  324. package/src/views/bd/setting/menu_kind/mixins/authDialog.js +300 -7
  325. package/src/views/bd/setting/menu_kind/mixins/list.js +201 -1
  326. package/src/views/bd/setting/push_data/edit.vue +139 -0
  327. package/src/views/bd/setting/push_data/list.vue +283 -0
  328. package/src/views/bd/setting/push_data_h/edit.vue +153 -0
  329. package/src/views/bd/setting/push_data_h/list.vue +293 -0
  330. package/src/views/bd/setting/request_async_setting/edit.vue +320 -0
  331. package/src/views/bd/setting/request_async_setting/list.vue +372 -0
  332. package/src/views/bd/setting/request_setting/edit.vue +300 -0
  333. package/src/views/bd/setting/request_setting/list.vue +311 -0
  334. package/src/views/bd/setting/table_model/edit.vue +875 -426
  335. package/src/views/bd/setting/table_model/list.vue +190 -128
  336. package/src/views/bd/setting/table_model/mixins/dialog.js +1 -1
  337. package/src/views/bd/setting/table_model/mixins/edit.js +1202 -13
  338. package/src/views/bd/setting/table_model/mixins/list.js +440 -14
  339. package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +201 -0
  340. package/src/views/bd/setting/table_model/otherAuthDialog.vue +83 -0
  341. package/src/views/user/access_log/list.vue +418 -349
  342. package/src/views/user/area/dialog.vue +223 -117
  343. package/src/views/user/area/list.vue +318 -0
  344. package/src/views/user/bill_setting/edit.vue +1 -1
  345. package/src/views/user/bill_setting/list.vue +1 -1
  346. package/src/views/user/common_attribute/itemEdit.vue +2 -2
  347. package/src/views/user/common_attribute/list.vue +5 -2
  348. package/src/views/user/common_script/edit.vue +1 -1
  349. package/src/views/user/common_script/list.vue +1 -1
  350. package/src/views/user/company_info/dialog.vue +164 -163
  351. package/src/views/user/company_info/edit.vue +1 -1
  352. package/src/views/user/extend_datasource/dialog.vue +4 -0
  353. package/src/views/user/extend_datasource/edit.vue +5 -1
  354. package/src/views/user/extend_datasource/list.vue +5 -1
  355. package/src/views/user/fieldTranslation/editDialog.vue +7 -7
  356. package/src/views/user/fieldTranslation/list.vue +32 -32
  357. package/src/views/user/form/vform/designer.vue +776 -749
  358. package/src/views/user/form/vform/out_render.vue +1 -1
  359. package/src/views/user/form/vform/render.vue +59 -37
  360. package/src/views/user/form/view/edit.vue +38 -37
  361. package/src/views/user/form/view/list.vue +261 -49
  362. package/src/views/user/home/bears/index.vue +1032 -0
  363. package/src/views/user/home/default.vue +1025 -979
  364. package/src/views/user/home/dev.vue +29 -0
  365. package/src/views/user/home/index.vue +16 -6
  366. package/src/views/user/home/taili/index.vue +1034 -0
  367. package/src/views/user/ledger_library/list.vue +10 -12
  368. package/src/views/user/login/default.vue +165 -36
  369. package/src/views/user/login/index.vue +4 -6
  370. package/src/views/user/login/indexMixin.js +184 -8
  371. package/src/views/user/menu/list.vue +24 -1
  372. package/src/views/user/notify_message/dialog.vue +38 -22
  373. package/src/views/user/notify_template/edit.vue +188 -187
  374. package/src/views/user/notify_template/edit2.vue +176 -0
  375. package/src/views/user/notify_template/list.vue +4 -1
  376. package/src/views/user/notify_template/list2.vue +190 -0
  377. package/src/views/user/outLink/form_view.vue +211 -184
  378. package/src/views/user/outLink/index.vue +67 -11
  379. package/src/views/user/outLink/view.vue +28 -23
  380. package/src/views/user/position/list.vue +4 -4
  381. package/src/views/user/project_tag/dialog.vue +9 -4
  382. package/src/views/user/project_tag/edit.vue +2 -2
  383. package/src/views/user/project_tag/list.vue +9 -4
  384. package/src/views/user/push_setting/list.vue +2 -2
  385. package/src/views/user/request_setting/edit.vue +258 -0
  386. package/src/views/user/request_setting/list.vue +248 -0
  387. package/src/views/user/role/authConfig.vue +89 -0
  388. package/src/views/user/role/dialog.vue +70 -48
  389. package/src/views/user/role/edit.vue +609 -429
  390. package/src/views/user/role/list.vue +4 -4
  391. package/src/views/user/sale_org/dialog.vue +1 -1
  392. package/src/views/user/sale_org/list.vue +4 -1
  393. package/src/views/user/user/dialog.vue +46 -23
  394. package/src/views/user/user/edit.vue +1059 -1021
  395. package/src/views/user/user/form_dialog.vue +158 -0
  396. package/src/views/user/user/form_info.vue +210 -0
  397. package/src/views/user/user/list.vue +647 -563
  398. package/src/views/user/user/modifyPasswordDialog.vue +64 -53
  399. package/src/views/user/wf/wfReport/index.vue +618 -0
  400. package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -0
  401. package/src/views/user/wf/wf_manage/list.vue +371 -249
  402. package/src/views/user/wf/wf_manage/wfContentDialog.vue +1 -1
  403. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +109 -0
  404. package/src/views/user/wf/wf_obj_config/itemEdit.vue +25 -1
  405. package/src/views/user/wf/wf_obj_config/list.vue +114 -9
  406. package/src/views/user/wf/wf_obj_config/wfBizDataSettingDialog.vue +2 -2
  407. package/src/views/user/wf/wf_transfer_setting/edit.vue +282 -0
  408. package/src/views/user/wf/wf_transfer_setting/list.vue +319 -0
@@ -0,0 +1,1639 @@
1
+ /**version-1.0*/
2
+ import { read, utils } from "xlsx";
3
+ import axios from "axios";
4
+ import SparkMD5 from "spark-md5";
5
+
6
+ let tmixins = {};
7
+ var XLSX = window.XLSX || { read, utils };
8
+ import { getToken } from "../../../../../utils/auth";
9
+ import XEUtils from "xe-utils";
10
+ import { getErrorMsg } from "@base/utils/index.js";
11
+
12
+ let configUtil = {
13
+ baseUrl: process.env.VUE_APP_BASE_API,
14
+ XLSX,
15
+ getToken,
16
+ };
17
+ let importTimer = null;
18
+ let loadingObj = null;
19
+ tmixins = {
20
+ name: "excelImport",
21
+ props: ["param", "parentTarget"],
22
+ inject: ["getReportTemplate", "formHttp"],
23
+ data() {
24
+ return {
25
+ excTime: 0,
26
+ showImportDialog: false,
27
+ showImportDialog2: false,
28
+ falseValue: false,
29
+ fileRaw: false,
30
+ isEnd: false,
31
+ currentIndex: 0,
32
+ excelTemplate: "",
33
+ prefix: "/user",
34
+ dataSize: 0,
35
+ totalSuccessNum: 0,
36
+ totalErrorNum: 0,
37
+ percentageNum: 0,
38
+ successRows: [],
39
+ failRows: [],
40
+ oriCols: [],
41
+ showImportResult: false,
42
+ resultType: "",
43
+ option: {},
44
+ showContent: false,
45
+ resOption: {},
46
+ fileCellFields: [],
47
+ importLoading: false,
48
+ loadingTitle: null,
49
+
50
+ percent1: 0,
51
+ percent2: 0,
52
+ percent3: 0,
53
+
54
+ loadingPercent: 0,
55
+ handleRowSize: 1,
56
+
57
+ headerRows: 3,
58
+ };
59
+ },
60
+ computed: {
61
+ importFileLimitSize() {
62
+ return Math.min(
63
+ this.param?.importOption?.importFileLimitSize || 200,
64
+ 200
65
+ );
66
+ },
67
+ },
68
+ created() {
69
+ this.exc();
70
+ },
71
+ beforeDestroy() {
72
+ this.clearImportTimer();
73
+ },
74
+ methods: {
75
+ initResGird() {
76
+ var that = this;
77
+ let tableRef = "resGrid";
78
+ let columns = [
79
+ {
80
+ type: "checkbox",
81
+ fixed: "left",
82
+ width: 48,
83
+ resizable: false,
84
+ headerClassName: "vxe-hcs",
85
+ className: "vxe-hcs",
86
+ },
87
+ {
88
+ field: "impNumber",
89
+ title: this.$t2("行号", "components.excelImport.impNumber"),
90
+ width: 100,
91
+ fixed: "left",
92
+ },
93
+ {
94
+ field: "_resultContent",
95
+ title: this.$t2("结果", "components.excelImport.resultContent"),
96
+ width: 250,
97
+ fixed: "left",
98
+ slots: {
99
+ default: ({ row, $rowIndex, $table }) => {
100
+ return that.handleRes(row._resultContent);
101
+ },
102
+ },
103
+ },
104
+ ];
105
+ let cCols = this.oriCols.map((oriCol, index) => {
106
+ let col = {
107
+ field: oriCol.field,
108
+ title: oriCol.title,
109
+ width: 150,
110
+ ...oriCol.otherConfig,
111
+ };
112
+ if (index == 0) {
113
+ col.fixed = "left";
114
+ }
115
+ return col;
116
+ });
117
+ columns = columns.concat(cCols);
118
+
119
+ let tableOption = {
120
+ vue: this,
121
+ tableRef: tableRef,
122
+ tableNameRequired: false,
123
+ columns: columns,
124
+ config: {
125
+ toolbarConfig: {
126
+ custom: false,
127
+ },
128
+ },
129
+ };
130
+
131
+ this.$vxeTableUtil.initVxeTable(tableOption).then((opts) => {
132
+ this.resOption = opts;
133
+ });
134
+ },
135
+ exc() {
136
+ this.option = this.param;
137
+ this.showContent = true;
138
+ this.showImportDialog = true;
139
+ this.showImportDialog2 = false;
140
+ },
141
+ showSuccessResult() {
142
+ this.showImportResult = true;
143
+ this.resultType = 1;
144
+ this.$nextTick(() => {
145
+ this.initResGird();
146
+ this.$nextTick(() => {
147
+ let tDatas = this.successRows.map((item, index) => {
148
+ item.id = index;
149
+ return item;
150
+ });
151
+ this.$refs.resGrid.loadData(tDatas);
152
+ });
153
+ });
154
+ },
155
+ showErrorResult() {
156
+ this.showImportResult = true;
157
+ this.resultType = 0;
158
+ this.$nextTick(() => {
159
+ this.initResGird();
160
+ this.$nextTick(() => {
161
+ let tDatas = this.failRows.map((item, index) => {
162
+ item.id = index;
163
+ return item;
164
+ });
165
+ this.$refs.resGrid.loadData(tDatas);
166
+ });
167
+ });
168
+ },
169
+ fileChange(file) {
170
+ if (file) {
171
+ this.fileRaw = file.raw;
172
+ } else {
173
+ this.fileRaw = false;
174
+ }
175
+ },
176
+ dialogClose1() {
177
+ this.importLoading = false;
178
+ if (!this.showImportDialog2) {
179
+ this.$emit("update:visiable", false);
180
+ this.showContent = false;
181
+ }
182
+ },
183
+ async dialogPrimary1() {
184
+ let that = this;
185
+ let option = this.option;
186
+
187
+ let fileRaw = this.fileRaw;
188
+ if (!fileRaw) {
189
+ this.$baseAlert(
190
+ this.$t2("请上传附件", "components.excelImport.warmMsg1")
191
+ );
192
+ return false;
193
+ }
194
+ let importFileLimitSize = this.importFileLimitSize;
195
+ let fileSize = fileRaw.size;
196
+ let limitSize = importFileLimitSize * 1024 * 1024;
197
+ if (fileSize > limitSize) {
198
+ this.$baseAlert(
199
+ this.$t1("导入文件不允许超过{fileSize}MB", {
200
+ fileSize: importFileLimitSize,
201
+ })
202
+ );
203
+ return false;
204
+ }
205
+
206
+ if (option.importFrontOnly) {
207
+ this.dialogPrimary3();
208
+ return false;
209
+ }
210
+
211
+ this.createImportTimer();
212
+ this.showImportDialog = false;
213
+ if (!option.onConfirm) {
214
+ this.showImportDialog2 = true;
215
+ }
216
+ this.$nextTick(() => {
217
+ try {
218
+ this.readExcel(this.fileRaw, function (resultData) {
219
+ if (option.onConfirm) {
220
+ option.onConfirm(resultData.data, that.fileRaw);
221
+ } else {
222
+ that.handleBeforeImport0(that.fileRaw, resultData, () => {
223
+ that.syncDataForImport({
224
+ multi: false,
225
+ data: resultData,
226
+ // saveUrl: saveUrl
227
+ });
228
+ });
229
+ }
230
+ });
231
+ } catch (et) {
232
+ that.clearImportTimer();
233
+ console.error(et);
234
+ }
235
+ });
236
+ },
237
+ handleBeforeImport(file, resultData, callback) {
238
+ let importOption = this.option.importOption;
239
+ let that = this;
240
+ if (importOption.onBeforeImport) {
241
+ const toDo = (res) => {
242
+ let rows = res?.objx || [];
243
+ rows.forEach((row, rowIndex) => {
244
+ let item = resultData[rowIndex];
245
+ Object.keys(row).forEach((key) => {
246
+ item[key] = row[key];
247
+ });
248
+ });
249
+ callback && callback();
250
+ };
251
+ this.getFieldTarget().handleCustomEvent(
252
+ importOption.onBeforeImport,
253
+ ["file", "resultData", "done"],
254
+ [file, resultData, toDo]
255
+ );
256
+ } else {
257
+ callback && callback();
258
+ }
259
+ },
260
+ handleBeforeImport0(file, resultData, callback) {
261
+ if (!this.showImportDialog2) return;
262
+ let importOption = this.option.importOption;
263
+ if (!importOption.enabledImportPreHandle) {
264
+ this.handleBeforeImport(file, resultData, () => {
265
+ callback && callback();
266
+ });
267
+ return;
268
+ }
269
+
270
+ this.uploadFile(() => {
271
+ this.importLoading = false;
272
+ this.handleBeforeImport(file, resultData, () => {
273
+ callback && callback();
274
+ });
275
+ });
276
+ return;
277
+ },
278
+ handleBeforeClose(hide) {
279
+ this.option.onCancel &&
280
+ this.option.onCancel(this.getCallbackData(), this.fileRaw);
281
+ let importOption = this.option.importOption;
282
+ this.getFieldTarget().handleCustomEvent(
283
+ importOption.onSuccessImport,
284
+ ["resultData", "file"],
285
+ [this.getCallbackData(), this.fileRaw]
286
+ );
287
+ this.handleTableCallback();
288
+ hide();
289
+ },
290
+ dialogClose2() {
291
+ this.showImportDialog2 = false;
292
+ this.option.onBeforeCancel &&
293
+ this.option.onBeforeCancel(this.getCallbackData(), this.fileRaw);
294
+ let importOption = this.option.importOption;
295
+ this.getFieldTarget().handleCustomEvent(
296
+ importOption.onSuccessImport,
297
+ ["resultData", "file"],
298
+ [this.getCallbackData(), this.fileRaw]
299
+ );
300
+ this.handleTableCallback();
301
+ },
302
+ handleClose2() {
303
+ this.clearImportTimer();
304
+ this.showImportDialog2 = false;
305
+ this.showContent = false;
306
+ this.option.onClose &&
307
+ this.option.onClose(this.getCallbackData(), this.fileRaw);
308
+ this.option.callback &&
309
+ this.option.callback(this.getCallbackData(), this.fileRaw);
310
+ this.dialogClose1();
311
+ },
312
+ dialogPrimary2() {
313
+ let importOption = this.option.importOption;
314
+ this.showImportDialog2 = false;
315
+ this.option.onBeforeConfirm &&
316
+ this.option.onBeforeConfirm(this.getCallbackData(), this.fileRaw);
317
+ this.getFieldTarget().handleCustomEvent(
318
+ importOption.onSuccessImport,
319
+ ["resultData", "file"],
320
+ [this.getCallbackData(), this.fileRaw]
321
+ );
322
+ this.handleTableCallback();
323
+ },
324
+ getCallbackData() {
325
+ return {
326
+ ...this.resultData,
327
+ successRows: this.successRows,
328
+ failRows: this.failRows,
329
+ };
330
+ },
331
+
332
+ /*dialogClose2(flag) {
333
+ let importOption = this.option.importOption;
334
+ this.clearImportTimer();
335
+ this.showImportDialog2 = false;
336
+ this.dialogClose1();
337
+ this.handleTableCallback(flag);
338
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.resultData, this.fileRaw])
339
+ this.option.callback && this.option.callback(this.resultData, this.fileRaw);
340
+ },
341
+ dialogPrimary2() {
342
+ let importOption = this.option.importOption;
343
+ this.clearImportTimer();
344
+ this.showImportDialog2 = false;
345
+ this.dialogClose1()
346
+ this.handleTableCallback();
347
+ let fileRaw = this.fileRaw;
348
+ this.parentTarget.handleCustomEvent(importOption.onSuccessImport, ['resultData', 'file'], [this.resultData, this.fileRaw])
349
+ this.option.callback && this.option.callback(this.resultData, this.fileRaw);
350
+ },*/
351
+ handleTableCallback(flag) {
352
+ if (flag === 0) return;
353
+ let importOption = this.option.importOption;
354
+ let tableTarget;
355
+ if (importOption.tableRef)
356
+ tableTarget = this.getFieldTarget().getWidgetRef(importOption.tableRef);
357
+ if (tableTarget) {
358
+ let isQueryTable = tableTarget.widget.options.isQueryTable;
359
+ if (isQueryTable) {
360
+ tableTarget.searchEvent();
361
+ }
362
+ }
363
+ },
364
+ async readExcel(file, callback) {
365
+ let that = this;
366
+ let option = this.option;
367
+
368
+ const fileReader = new FileReader();
369
+ fileReader.onload = async (ev) => {
370
+ var resultData;
371
+ try {
372
+ const data = ev.target.result;
373
+ const workbook = configUtil.XLSX.read(data, {
374
+ type: "binary",
375
+ });
376
+
377
+ var sheet = workbook.Sheets[workbook.SheetNames[0]];
378
+ if (sheet["!ref"] == undefined) {
379
+ /*that.showImportDialog2 = false;
380
+ that.showContent = false;
381
+ that.clearImportTimer();*/
382
+ that.$baseAlert(
383
+ this.$t2(
384
+ "请使用正确的导入模版!",
385
+ "components.excelImport.warmMsg2"
386
+ )
387
+ );
388
+ that.handleClose2();
389
+ return false;
390
+ }
391
+ var range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
392
+ var dataSize = range.e.r + 1; //行数
393
+ that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
394
+ var titles = [];
395
+ var fields = [];
396
+
397
+ const ws = workbook.Sheets[sheet];
398
+
399
+ let prefix = option.prefix;
400
+ let excelUrl = option.excel;
401
+
402
+ var excelRows = [];
403
+ var row;
404
+ var rowNum;
405
+ var colNum;
406
+ for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
407
+ row = [];
408
+ for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
409
+ var nextCell =
410
+ sheet[
411
+ configUtil.XLSX.utils.encode_cell({
412
+ r: rowNum,
413
+ c: colNum,
414
+ })
415
+ ];
416
+ if (typeof nextCell === "undefined") {
417
+ row.push(void 0);
418
+ } else {
419
+ row.push(nextCell.w.trim());
420
+ }
421
+ }
422
+ if (rowNum == 1) {
423
+ titles = row;
424
+ }
425
+ if (rowNum == 2) {
426
+ fields = row;
427
+ let checkResult = true;
428
+ /*await that.checkExcelForImport(titles, fields, excelUrl, prefix).then(
429
+ res => {
430
+ if (res.type != "success") {
431
+ checkResult = false;
432
+ }
433
+ });
434
+ if (!checkResult) {
435
+ that.showContent = false;
436
+ that.clearImportTimer();
437
+ return false;
438
+ }*/
439
+ }
440
+ if (rowNum > 2) {
441
+ let item = {};
442
+ for (let i = 0; i < fields.length; i++) {
443
+ let field = fields[i];
444
+ if (field) {
445
+ item[field] = row[i] ?? null;
446
+ }
447
+ }
448
+ excelRows.push(item);
449
+ }
450
+ }
451
+ if (
452
+ !titles.length ||
453
+ !fields.length ||
454
+ titles.length != fields.length
455
+ ) {
456
+ // that.showContent = false;
457
+ // that.clearImportTimer();
458
+ that.$baseAlert(
459
+ this.$t2(
460
+ "请使用正确的导入模版!",
461
+ "components.excelImport.warmMsg2"
462
+ )
463
+ );
464
+ that.handleClose2();
465
+ return false;
466
+ }
467
+
468
+ var columns = [];
469
+ var cols = [];
470
+ let uniqueFields = [];
471
+ for (let i = 0; i < titles.length; i++) {
472
+ let title = titles[i];
473
+ if (title) {
474
+ let field = fields[i];
475
+ if (field == null) {
476
+ // that.showContent = false;
477
+ // that.clearImportTimer();
478
+ that.$baseAlert(
479
+ this.$t2(
480
+ "请使用正确的导入模版!",
481
+ "components.excelImport.warmMsg2"
482
+ )
483
+ );
484
+ that.handleClose2();
485
+ return false;
486
+ }
487
+ let t = title.substr(-1);
488
+ let u = title.length >= 2 ? title.substr(-2) : title;
489
+ let isNeed = false;
490
+ if (t === "*") {
491
+ isNeed = true;
492
+ }
493
+ let isUnique = false;
494
+ if (u === "**") {
495
+ uniqueFields.push(field);
496
+ isUnique = true;
497
+ }
498
+
499
+ let otherConfig = {};
500
+ let isFile = false;
501
+ if (field.startsWith("attachments_")) {
502
+ that.fileCellFields.push(field);
503
+ isFile = true;
504
+ otherConfig = {
505
+ slots: {
506
+ default: "attachment",
507
+ },
508
+ };
509
+ }
510
+
511
+ let col = {
512
+ field: field,
513
+ title: title,
514
+ width: 100,
515
+ isNeed: isNeed,
516
+ isUnique: isUnique,
517
+ isFile,
518
+ otherConfig,
519
+ };
520
+ cols.push(col);
521
+ }
522
+ }
523
+
524
+ var oriCols = JSON.parse(JSON.stringify(cols)); //列信息
525
+ if (uniqueFields.length) {
526
+ //分组唯一字段为空时,全部不发包。
527
+ for (let i = 0; i < oriCols.length; i++) {
528
+ let oriCol = oriCols[i];
529
+ if (oriCol.isNeed) {
530
+ for (let j = 0; j < excelRows.length; j++) {
531
+ let data = excelRows[j];
532
+ let value = data[oriCol.field];
533
+ if (value == null || value == "") {
534
+ that.clearImportTimer();
535
+ that.$baseAlert(
536
+ this.$t2(
537
+ "第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
538
+ "components.excelImport.warmMsg3",
539
+ {
540
+ lineNo: j + 4,
541
+ title: oriCol.title,
542
+ }
543
+ )
544
+ );
545
+ that.handleClose2();
546
+ return false;
547
+ }
548
+ }
549
+ }
550
+ }
551
+ }
552
+
553
+ this.oriCols = oriCols;
554
+
555
+ resultData = {
556
+ data: excelRows,
557
+ titles: titles,
558
+ fields: fields,
559
+ uniqueFields: uniqueFields,
560
+ oriCols: oriCols,
561
+ };
562
+ this.resultData = resultData;
563
+ callback(resultData);
564
+ } catch (et) {
565
+ that.showContent = false;
566
+ that.clearImportTimer();
567
+ console.error(et);
568
+ }
569
+ };
570
+ fileReader.readAsBinaryString(file);
571
+ },
572
+ async checkExcelForImport(titles, fields, turl, prefix) {
573
+ if (!this.showImportDialog2) return;
574
+ let that = this;
575
+ var data = {
576
+ filed_name: fields,
577
+ field_note: titles,
578
+ url: turl,
579
+ };
580
+ var param = JSON.stringify(data);
581
+ return this.$http({
582
+ url: prefix + "/sf_common/compareExcelFields",
583
+ method: "post",
584
+ headers: {
585
+ "Content-Type": "application/json;charset=utf-8",
586
+ },
587
+ // data: param,
588
+ data: data,
589
+ });
590
+ },
591
+ saveImportHandle(data, opt) {
592
+ var multi = this.option.multi;
593
+ let importOption = this.option.importOption;
594
+
595
+ let entity = importOption.importEntity;
596
+
597
+ if (!entity) return;
598
+
599
+ let reportTemplate = this.getReportTemplate();
600
+ let formCode = reportTemplate?.formCode;
601
+ let scriptCode = importOption.importScriptCode || "import";
602
+ // let config = option?.config;
603
+
604
+ // let reqData = this.getReqFormData();
605
+ let fileCellFields = this.fileCellFields;
606
+ let formData = null;
607
+ if (multi) {
608
+ formData = data;
609
+ } else {
610
+ formData = {
611
+ [entity]: { ...data },
612
+ };
613
+ if (fileCellFields.length) {
614
+ fileCellFields.forEach((field) => {
615
+ let attachments = data[field] || [];
616
+ delete formData[entity][field];
617
+ formData[field] = attachments;
618
+ });
619
+ }
620
+ }
621
+
622
+ let reqData = {
623
+ formCode: formCode,
624
+ formVersion: reportTemplate.formVersion,
625
+ taBm: entity,
626
+ data: formData,
627
+ };
628
+
629
+ this.formHttp({
630
+ scriptCode: scriptCode,
631
+ data: reqData,
632
+ modal: false,
633
+ ...opt,
634
+ });
635
+ },
636
+ syncDataForImport(opts) {
637
+ let that = this;
638
+ var multi = this.option.multi;
639
+ var resultData = this.resultData;
640
+ var datas = resultData.data;
641
+ var titles = resultData.titles;
642
+ var fields = resultData.fields;
643
+ let uniqueFields = resultData.uniqueFields;
644
+ var saveUrl = opts.saveUrl;
645
+ var size = datas.length;
646
+ var index = 0;
647
+ var successNum = 0;
648
+ var failNum = 0;
649
+ var dialogObj = this.$refs.importDialog.$el;
650
+ var successNumObj = dialogObj.querySelector(".successNum");
651
+ var failNumObj = dialogObj.querySelector(".failNum");
652
+ var percentageObj = dialogObj.querySelector(".percentage");
653
+ var doneNumObj = dialogObj.querySelector(".doneNum");
654
+ dialogObj.querySelector(".dataSize").innerText = size;
655
+
656
+ that.successRows = [];
657
+ that.failRows = [];
658
+
659
+ var multiSize = opts.multiSize || 2;
660
+
661
+ let groupIndex = 0;
662
+ let groupDatas = [];
663
+ if (uniqueFields.length) {
664
+ let d = XEUtils.groupBy(datas, function (item, itemIndex, items) {
665
+ let keyArr = [];
666
+ uniqueFields.forEach((field) => {
667
+ keyArr.push(item[field]);
668
+ });
669
+ return keyArr.join("&_&");
670
+ });
671
+ for (let key in d) {
672
+ groupDatas.push(d[key]);
673
+ }
674
+ datas.forEach((item, itemIndex) => {
675
+ item.impSeq = itemIndex;
676
+ item.impNumber = itemIndex + 4;
677
+ });
678
+ }
679
+
680
+ var compareV = function (property) {
681
+ return function (a, b) {
682
+ var value1 = a[property];
683
+ var value2 = b[property];
684
+ return value1 - value2;
685
+ };
686
+ };
687
+
688
+ var prevHandleData = function (percentageStr, excNum) {
689
+ successNumObj.innerText = successNum;
690
+ failNumObj.innerText = failNum;
691
+ doneNumObj.innerText = successNum + failNum;
692
+ that.percentageNum = percentageStr;
693
+ let isEnd = false;
694
+ if (multi && uniqueFields.length) {
695
+ isEnd = groupIndex + 1 >= groupDatas.length;
696
+ } else {
697
+ isEnd = index + excNum >= size;
698
+ }
699
+ if (!isEnd) {
700
+ index = index + excNum;
701
+ groupIndex = groupIndex + 1;
702
+ setTimeout(function () {
703
+ handleData();
704
+ }, 1);
705
+ } else {
706
+ setTimeout(function () {
707
+ that.clearImportTimer();
708
+ }, 300);
709
+ }
710
+ };
711
+
712
+ let getDefaultValue = (row) => {
713
+ let value = null;
714
+ let defaultValue = this.option.defaultValue;
715
+ if (defaultValue) {
716
+ if (typeof defaultValue == "function") {
717
+ value = defaultValue(row) || {};
718
+ } else {
719
+ value = defaultValue || {};
720
+ }
721
+ }
722
+ return value;
723
+ };
724
+
725
+ let handleData = () => {
726
+ if (!that.isEnd && index < size) {
727
+ var param;
728
+ var excNum;
729
+ if (multi) {
730
+ if (!uniqueFields.length) {
731
+ if (index + multiSize < size) {
732
+ excNum = multiSize;
733
+ } else {
734
+ excNum = size - index;
735
+ }
736
+
737
+ let dataList = [];
738
+ for (let i = 0; i < excNum; i++) {
739
+ var mIndex = index + i;
740
+ let mData = datas[mIndex];
741
+ mData.impSeq = mIndex;
742
+ mData.impNumber = mIndex + 4;
743
+
744
+ let errorInfo = that.vailData(mData, opts);
745
+ if (errorInfo.length > 0) {
746
+ mData._resultType = "error";
747
+ mData._resultContent = errorInfo;
748
+ failNum++;
749
+ that.failRows.push(mData);
750
+ } else {
751
+ let defaultValue = getDefaultValue(mData);
752
+ if (defaultValue) {
753
+ Object.assign(mData, defaultValue);
754
+ }
755
+ dataList.push(mData);
756
+ }
757
+
758
+ datas[mIndex] = mData;
759
+ }
760
+ if (dataList.length > 0) {
761
+ param = dataList;
762
+ }
763
+ } else {
764
+ excNum = groupDatas[groupIndex].length;
765
+ param = groupDatas[groupIndex];
766
+ }
767
+ } else {
768
+ var data = that.resultData.data[index];
769
+ data.impSeq = index;
770
+ data.impNumber = index + 4;
771
+ excNum = 1;
772
+ datas[index] = data;
773
+
774
+ let errorInfo = that.vailData(data, opts);
775
+ if (errorInfo.length > 0) {
776
+ data._resultType = "error";
777
+ data._resultContent = errorInfo;
778
+ failNum++;
779
+ that.failRows.push(data);
780
+ } else {
781
+ param = data;
782
+ let defaultValue = getDefaultValue(data);
783
+ if (defaultValue) {
784
+ Object.assign(param, defaultValue);
785
+ }
786
+ }
787
+ }
788
+
789
+ var percentageStr = parseInt(((index + excNum) * 100) / size);
790
+ if (param == null || param.length == 0) {
791
+ if (that.showContent) {
792
+ prevHandleData(percentageStr, excNum);
793
+ }
794
+ return;
795
+ }
796
+
797
+ that.saveImportHandle(param, {
798
+ failMsg: false,
799
+ callback: (resultMsg) => {
800
+ if (multi) {
801
+ if (resultMsg.type == "success") {
802
+ var multiRows = resultMsg.objx;
803
+ for (let i = 0; i < multiRows.length; i++) {
804
+ var multiRow = multiRows[i];
805
+ var data = datas[multiRow.impSeq];
806
+ data._resultType = multiRow.impReturnType;
807
+ data._resultContent =
808
+ multiRow.impReturnType == "success"
809
+ ? this.$t2(
810
+ "导入成功",
811
+ "components.excelImport.importSucess"
812
+ )
813
+ : multiRow.impReturnMsg;
814
+ if (multiRow.impReturnType == "success") {
815
+ successNum++;
816
+ that.successRows.push(data);
817
+ } else {
818
+ failNum++;
819
+ that.failRows.push(data);
820
+ }
821
+ }
822
+
823
+ that.failRows = that.failRows.sort(compareV("impSeq"));
824
+ } else {
825
+ // error_win(resultMsg);
826
+ // layer.close(opts.dialogObjIndex);
827
+
828
+ let items = param.map((item) => {
829
+ return {
830
+ ...item,
831
+ _resultType: "error",
832
+ _resultContent: resultMsg.content,
833
+ };
834
+ });
835
+ failNum = failNum + items.length;
836
+ that.failRows.push(...items);
837
+
838
+ that.failRows = that.failRows.sort(compareV("impSeq"));
839
+
840
+ /* that.$errorMsg(resultMsg);
841
+ that.showContent = false;
842
+ that.clearImportTimer();
843
+ return; */
844
+ }
845
+ } else {
846
+ var data = that.resultData.data[index];
847
+ data._resultType = resultMsg.type;
848
+ data._resultContent =
849
+ resultMsg.type == "success"
850
+ ? this.$t2(
851
+ "导入成功",
852
+ "components.excelImport.importSucess"
853
+ )
854
+ : resultMsg.content;
855
+
856
+ if (resultMsg.type == "success") {
857
+ successNum++;
858
+ that.successRows.push(data);
859
+ } else {
860
+ failNum++;
861
+ that.failRows.push(data);
862
+ }
863
+ }
864
+ if (that.showContent) {
865
+ prevHandleData(percentageStr, excNum);
866
+ }
867
+ },
868
+ error: (et) => {
869
+ that.isEnd = true;
870
+ that.clearImportTimer();
871
+ console.error(et);
872
+ },
873
+ });
874
+ }
875
+ };
876
+ handleData();
877
+ },
878
+ commonLocalDownload() {
879
+ let importOption = this.option.importOption;
880
+ let importAttachCode = importOption.importAttachCode;
881
+ if (!importAttachCode) return;
882
+ this.$http({
883
+ url: USER_PREFIX + "/bd_attach_setting/getByCode",
884
+ method: "post",
885
+ data: {
886
+ stringOne: importAttachCode,
887
+ },
888
+ success: (res) => {
889
+ let url = res.objx?.url;
890
+ if (url) {
891
+ this.$commonFileUtil.downloadFile(url);
892
+ }
893
+ },
894
+ });
895
+ },
896
+ vailData(data, opts) {
897
+ var oriCols = opts.data.oriCols;
898
+ var errorInfo = [];
899
+ for (let i = 0; i < oriCols.length; i++) {
900
+ let oriCol = oriCols[i];
901
+ if (oriCol.isNeed) {
902
+ let value = data[oriCol.field];
903
+ if (value == null || value == "") {
904
+ errorInfo.push(
905
+ this.$t2(
906
+ "[" + oriCol.title + "]不能为空;",
907
+ "components.excelImport.warmMsg4",
908
+ { title: oriCol.title }
909
+ )
910
+ );
911
+ }
912
+ }
913
+ }
914
+ return errorInfo.join("");
915
+ },
916
+ handleRes(val) {
917
+ /* var content = val;
918
+ var text = content;
919
+ if (content && content.indexOf("Exception") >= 0) {
920
+ var index0 = content.lastIndexOf("*]");
921
+ if (index0 >= 0) {
922
+ text = content.substr(index0);
923
+ if (text) {
924
+ var index1 = text.indexOf("Exception:");
925
+ if (index1 >= 0) {
926
+ text = text.substr(index1 + 10);
927
+ }
928
+ }
929
+ }
930
+ } */
931
+ let text = getErrorMsg(val);
932
+ return text;
933
+ },
934
+ exportToExcel() {
935
+ let str =
936
+ this.resultType === 1
937
+ ? this.$t2("成功", "components.excelImport.success")
938
+ : this.$t2("失败", "components.excelImport.fail");
939
+ let fileName =
940
+ this.$t2("导入结果导出", "components.excelImport.exportFileName") +
941
+ "(" +
942
+ str +
943
+ ")";
944
+ let $grid = this.$refs.resGrid;
945
+ let columns = $grid.getColumns();
946
+ if (columns && columns.length) {
947
+ let fields = columns
948
+ .filter((item, index) => {
949
+ return index > 0 && item.property;
950
+ })
951
+ .map((item, index) => {
952
+ return item.property;
953
+ });
954
+ this.$refs.resGrid.exportData({
955
+ filename: fileName,
956
+ mode: "all",
957
+ type: "csv",
958
+ columns: fields,
959
+ });
960
+ }
961
+ },
962
+ createImportTimer() {
963
+ this.excTime = 0;
964
+ let beginTime = new Date().getTime();
965
+ importTimer = setInterval(() => {
966
+ let nowTime = new Date().getTime();
967
+ let diffTime = (nowTime - beginTime) / 1000;
968
+ this.$set(this, "excTime", this.$baseLodash.round(diffTime, 2));
969
+ }, 100);
970
+ },
971
+ clearImportTimer() {
972
+ clearInterval(importTimer);
973
+ loadingObj && loadingObj.close();
974
+ },
975
+ getWidgetTarget() {},
976
+ getFieldTarget() {
977
+ return this.param.target;
978
+ },
979
+ async dialogPrimary3() {
980
+ if (!this.fileRaw) {
981
+ this.$baseAlert(
982
+ this.$t2("请上传附件", "components.excelImport.warmMsg1")
983
+ );
984
+ return false;
985
+ }
986
+ let that = this;
987
+ let option = this.option;
988
+ loadingObj = this.$baseLoading({
989
+ target: document.body,
990
+ background: "unset",
991
+ });
992
+
993
+ let importOption = option.importOption;
994
+ this.readExcel(this.fileRaw, function (resultData) {
995
+ let file = that.fileRaw;
996
+ let flag = false;
997
+ let done = () => {
998
+ if (flag) return;
999
+ flag = true;
1000
+ that.showImportDialog = false;
1001
+ return that
1002
+ .getFieldTarget()
1003
+ .handleCustomEvent(
1004
+ importOption.onSuccessImport,
1005
+ ["resultData", "file"],
1006
+ [resultData, file]
1007
+ );
1008
+ };
1009
+ try {
1010
+ if (importOption.onConfirmImportEnabled) {
1011
+ if (
1012
+ that
1013
+ .getFieldTarget()
1014
+ .handleCustomEvent(
1015
+ importOption.onConfirmImport,
1016
+ ["resultData", "file", "done"],
1017
+ [resultData, file, done]
1018
+ ) !== false
1019
+ ) {
1020
+ done();
1021
+ }
1022
+ } else if (importOption.tableRef) {
1023
+ let tableRef = that
1024
+ .getFieldTarget()
1025
+ .getWidgetRef(importOption.tableRef);
1026
+ tableRef && tableRef.addTableData(resultData.data);
1027
+ done();
1028
+ }
1029
+ } catch (et) {
1030
+ console.error(et);
1031
+ }
1032
+ setTimeout(function () {
1033
+ loadingObj && loadingObj.close();
1034
+ }, 200);
1035
+ });
1036
+ },
1037
+
1038
+ //begin
1039
+ fileParse(file, type = "base64", callback) {
1040
+ let fileRead = new FileReader();
1041
+ if (type === "base64") {
1042
+ fileRead.readAsDataURL(file);
1043
+ } else if (type === "buffer") {
1044
+ fileRead.readAsArrayBuffer(file);
1045
+ }
1046
+ fileRead.onload = (ev) => {
1047
+ callback(ev.target.result);
1048
+ };
1049
+ },
1050
+ getUploadText(percent) {
1051
+ return this.$t1("上传导入文件 {percent}%", { percent });
1052
+ },
1053
+ changeUploadPercent(percent) {
1054
+ // return this.$t1('上传导入文件 {percent}%', {percent})
1055
+ this.percent1 = percent;
1056
+ this.loadingIndex = 1;
1057
+ },
1058
+ uploadFile(callback) {
1059
+ let that = this;
1060
+ that.loadingPercent = 0;
1061
+ // that.loadingTitle = this.getUploadText(0);
1062
+ that.changeUploadPercent(0);
1063
+ let file = this.fileRaw;
1064
+ let uploadChunkSize = 5;
1065
+ this.importLoading = true;
1066
+ this.fileUploadCallback = callback;
1067
+ this.fileParse(file, "buffer", (buffer) => {
1068
+ let spark = new SparkMD5.ArrayBuffer(),
1069
+ chunkSize = uploadChunkSize * 1024 * 1024, // Read in chunks of 2MB
1070
+ chunks = Math.ceil(file.size / chunkSize),
1071
+ hash,
1072
+ suffix;
1073
+ spark.append(buffer);
1074
+ hash = spark.end();
1075
+ let md5 = hash;
1076
+ let nameSplit = /\.([0-9a-zA-Z]+)$/i.exec(file.name);
1077
+
1078
+ suffix = nameSplit && nameSplit.length > 1 ? nameSplit[1] : "";
1079
+
1080
+ let chunkParam = {
1081
+ fullFile: file,
1082
+ chunkSize: chunkSize,
1083
+ chunks: chunks,
1084
+ chunkIndex: 0,
1085
+ md5: hash,
1086
+ uuid: "",
1087
+ name: file.name,
1088
+ };
1089
+ file.chunkParam = chunkParam;
1090
+
1091
+ this.sendRequest(file);
1092
+ });
1093
+ },
1094
+ async sendRequest(fullFile) {
1095
+ if (!this.showImportDialog2) return;
1096
+ let that = this;
1097
+ let uploadUrl = USER_PREFIX + "/excel_import/uploadFile";
1098
+ let chunkParam = fullFile.chunkParam;
1099
+ let target = that.$refs.upload;
1100
+ let abort;
1101
+ let config = {
1102
+ headers: {
1103
+ "Content-Type": "multipart/form-data",
1104
+ },
1105
+ cancelToken: new axios.CancelToken(function executor(c) {
1106
+ abort = c;
1107
+ fullFile.abort = c;
1108
+ }),
1109
+ onUploadProgress: (progressEvent) => {
1110
+ let start = chunkParam.start;
1111
+ let uploadedSize =
1112
+ start +
1113
+ Math.floor(
1114
+ (chunkParam.currentSize * progressEvent.loaded) /
1115
+ progressEvent.total
1116
+ );
1117
+ let percent = Math.floor((uploadedSize * 100) / fullFile.size);
1118
+ if (percent == 100) {
1119
+ percent = 99;
1120
+ }
1121
+ that.loadingPercent = percent;
1122
+
1123
+ // that.$set(that, 'loadingTitle', this.getUploadText(percent))
1124
+ that.changeUploadPercent(percent);
1125
+ },
1126
+ // failMsg: false,
1127
+ modal: false,
1128
+ callback: (res1) => {
1129
+ if (res1.type == "success") {
1130
+ let uuid = res1.objx.uuid;
1131
+ chunkParam.uuid = uuid;
1132
+ if (preFormData.chunk + 1 >= preFormData.chunks) {
1133
+ let mergeData = {
1134
+ name: chunkParam.name,
1135
+ md5: chunkParam.md5,
1136
+ uuid: uuid,
1137
+ };
1138
+ let _param = {
1139
+ mergeData: mergeData,
1140
+ chunkParam: chunkParam,
1141
+ };
1142
+ setTimeout(() => {
1143
+ this.mergeFile(_param);
1144
+ }, 100);
1145
+ } else {
1146
+ chunkParam.chunkIndex = chunkParam.chunkIndex + 1;
1147
+ chunkParam.uuid = uuid;
1148
+ setTimeout(() => {
1149
+ this.sendRequest(fullFile);
1150
+ }, 100);
1151
+ }
1152
+ } else {
1153
+ this.dialogClose2(0);
1154
+ }
1155
+ return res1;
1156
+ },
1157
+ error: (err) => {
1158
+ console.log(err);
1159
+ this.dialogClose2(0);
1160
+ },
1161
+ }; //添加请求头
1162
+
1163
+ let chunkIndex = chunkParam.chunkIndex;
1164
+ let chunkSize = chunkParam.chunkSize;
1165
+ var start = chunkIndex * chunkSize,
1166
+ end =
1167
+ start + chunkSize >= fullFile.size
1168
+ ? fullFile.size
1169
+ : start + chunkParam.chunkSize;
1170
+ chunkParam.currentSize = end - start;
1171
+ chunkParam.start = start;
1172
+ chunkParam.end = end;
1173
+
1174
+ let preFormData = {
1175
+ file: fullFile.slice(start, end),
1176
+ name: fullFile.name,
1177
+ chunks: chunkParam.chunks,
1178
+ chunk: chunkIndex,
1179
+ md5: chunkParam.md5,
1180
+ uuid: chunkParam.uuid,
1181
+ };
1182
+
1183
+ let formData = new FormData();
1184
+ Object.keys(preFormData).forEach((key) => {
1185
+ formData.append(key, preFormData[key]);
1186
+ });
1187
+
1188
+ let req = this.$http.post(uploadUrl, formData, config);
1189
+ req.abort = () => {
1190
+ abort(this.$t2("取消上传", "components.VabUpload.cancelUpload"));
1191
+ };
1192
+ },
1193
+ mergeFile(param) {
1194
+ if (!this.showImportDialog2) return;
1195
+ let that = this;
1196
+ let mergeData = param.mergeData;
1197
+ let chunkParam = param.chunkParam;
1198
+ let fullFile = chunkParam.fullFile;
1199
+ let mergeUrl = USER_PREFIX + "/excel_import/mergeChunk";
1200
+ let target = this.$refs.upload;
1201
+ this.$http({
1202
+ url: mergeUrl,
1203
+ method: "post",
1204
+ data: mergeData,
1205
+ // failMsg: false,
1206
+ modal: false,
1207
+ cancelToken: new axios.CancelToken(function executor(c) {
1208
+ if (fullFile) fullFile.abort = c;
1209
+ }),
1210
+ callback: (res) => {
1211
+ if (res.type == "success") {
1212
+ that.loadingPercent = 100;
1213
+ // that.loadingTitle = this.getUploadText(100);
1214
+ this.changeUploadPercent(100);
1215
+ setTimeout(() => {
1216
+ this.checkImportData();
1217
+ }, 100);
1218
+ } else {
1219
+ this.dialogClose2(0);
1220
+ }
1221
+ },
1222
+ error: (e) => {
1223
+ console.log(err);
1224
+ this.dialogClose2(0);
1225
+ },
1226
+ });
1227
+ },
1228
+ getCheckText(percent) {
1229
+ return this.$t1("校验导入文件中的图片数据格式 {percent}%", { percent });
1230
+ },
1231
+ changeCheckTextPercent(percent) {
1232
+ this.percent2 = percent;
1233
+ this.loadingIndex = 2;
1234
+ },
1235
+ checkImportData() {
1236
+ if (!this.showImportDialog2) return;
1237
+ let that = this;
1238
+ that.loadingPercent = 0;
1239
+ // that.loadingTitle = this.getCheckText(0);
1240
+ that.changeCheckTextPercent(0);
1241
+ let fullFile = this.fileRaw;
1242
+ let chunkParam = fullFile.chunkParam;
1243
+
1244
+ this.$http({
1245
+ url: USER_PREFIX + "/excel_import/checkData",
1246
+ method: "post",
1247
+ data: {
1248
+ name: chunkParam.name,
1249
+ md5: chunkParam.md5,
1250
+ uuid: chunkParam.uuid,
1251
+ },
1252
+ // failMsg: false,
1253
+ modal: false,
1254
+ cancelToken: new axios.CancelToken(function executor(c) {
1255
+ if (fullFile) fullFile.abort = c;
1256
+ }),
1257
+ onUploadProgress: (progressEvent) => {
1258
+ let percent = Math.floor(
1259
+ (progressEvent.loaded * 100) / progressEvent.total
1260
+ );
1261
+ if (percent == 100) {
1262
+ percent = 99;
1263
+ }
1264
+ that.loadingPercent = percent;
1265
+ // that.$set(that, 'loadingTitle', this.getCheckText(percent))
1266
+ that.changeCheckTextPercent(percent);
1267
+ },
1268
+ callback: (res) => {
1269
+ if (res.type == "success") {
1270
+ that.loadingPercent = 100;
1271
+ // that.loadingTitle = this.getCheckText(100);
1272
+ that.changeCheckTextPercent(100);
1273
+ this.handleImageData();
1274
+ } else {
1275
+ this.dialogClose2(0);
1276
+ }
1277
+ },
1278
+ error: (e) => {
1279
+ console.log(err);
1280
+ this.dialogClose2(0);
1281
+ },
1282
+ });
1283
+ },
1284
+ getSaveImageText(percent) {
1285
+ return this.$t1("存储导入文件中的图片 {percent}%", { percent });
1286
+ },
1287
+ changeSaveImageTextPercent(percent) {
1288
+ // return this.$t1('存储导入文件中的图片 {percent}%', {percent})
1289
+ this.percent3 = percent;
1290
+ this.loadingIndex = 3;
1291
+ },
1292
+ handleImageData() {
1293
+ let that = this;
1294
+ that.loadingPercent = 0;
1295
+ // that.loadingTitle = this.getSaveImageText(0);
1296
+ that.changeSaveImageTextPercent(0);
1297
+ this.getImportData(0);
1298
+ },
1299
+ getImportData(index) {
1300
+ if (!this.showImportDialog2) return;
1301
+ let that = this;
1302
+ let rowSize = this.handleRowSize;
1303
+ let fullFile = this.fileRaw;
1304
+ let chunkParam = fullFile.chunkParam;
1305
+ let rowDatas = this.resultData.data;
1306
+ let size = rowDatas.length;
1307
+ let currentLineNo = index + 1;
1308
+ let rowNumber = index + 3;
1309
+ let startRow = index + 3;
1310
+ let endRow = index + 3 + rowSize - 1;
1311
+ this.$http({
1312
+ url: USER_PREFIX + "/excel_import/getData",
1313
+ method: "post",
1314
+ data: {
1315
+ name: chunkParam.name,
1316
+ md5: chunkParam.md5,
1317
+ uuid: chunkParam.uuid,
1318
+ startRow: startRow,
1319
+ endRow: endRow,
1320
+ },
1321
+ // failMsg: false,
1322
+ modal: false,
1323
+ cancelToken: new axios.CancelToken(function executor(c) {
1324
+ if (fullFile) fullFile.abort = c;
1325
+ }),
1326
+ callback: (res) => {
1327
+ if (res.type == "success") {
1328
+ let rows = res?.objx?.datas || [];
1329
+ let fileCellFields = this.fileCellFields;
1330
+ rows.forEach((row) => {
1331
+ let rowIndex = row.row - 3;
1332
+ let item = rowDatas[rowIndex];
1333
+ Object.keys(row).forEach((key) => {
1334
+ if (fileCellFields.includes(key)) {
1335
+ let value = row[key] || [];
1336
+ if (!Array.isArray(value)) {
1337
+ value = [value];
1338
+ }
1339
+ item[key] = value;
1340
+ }
1341
+ });
1342
+ });
1343
+ let cIndex = index + rowSize - 1;
1344
+ let percent = Math.floor(((cIndex + 1) * 100) / size);
1345
+ that.loadingPercent = percent;
1346
+ // that.loadingTitle = this.getSaveImageText(percent);
1347
+ that.changeSaveImageTextPercent(percent);
1348
+ if (cIndex + 1 < size) {
1349
+ this.getImportData(cIndex + 1);
1350
+ } else {
1351
+ this.fileUploadCallback();
1352
+ }
1353
+ } else {
1354
+ this.dialogClose2(0);
1355
+ }
1356
+ },
1357
+ error: (e) => {
1358
+ this.dialogClose2(0);
1359
+ },
1360
+ });
1361
+ },
1362
+ async generateNewExcel() {
1363
+ let file = this.fileRaw;
1364
+ try {
1365
+ // 1. 读取原始文件
1366
+ const workbook = XLSX.read(file, { type: "binary" });
1367
+ const sheetName = workbook.SheetNames[0];
1368
+ const rawData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
1369
+
1370
+ // 2. 提取表头和数据
1371
+ const headers = rawData.slice(0, this.headerRows);
1372
+ const bodyData = rawData.slice(this.headerRows);
1373
+
1374
+ let exporLineNos = [];
1375
+ if (this.resultType) {
1376
+ exporLineNos = this.successRows.map((item) => item.impNumber - 1);
1377
+ } else {
1378
+ exporLineNos = this.failRows.map((item) => item.impNumber - 1);
1379
+ }
1380
+ // 3. 应用筛选规则
1381
+ let selectRule = (row, index) => {
1382
+ return exporLineNos.includes(index);
1383
+ };
1384
+ const filteredData = bodyData.filter(
1385
+ (row, index) => {
1386
+ return selectRule(row, index + this.headerRows);
1387
+ }
1388
+ // this.selectRule(row, index + this.headerRows) // 注意索引转换
1389
+ );
1390
+
1391
+ // 4. 合并数据
1392
+ const newData = [...headers, ...filteredData];
1393
+
1394
+ // 5. 生成新文件
1395
+ const newWorkbook = XLSX.utils.book_new();
1396
+ const newSheet = XLSX.utils.aoa_to_sheet(newData);
1397
+ XLSX.utils.book_append_sheet(newWorkbook, newSheet, "Sheet1");
1398
+
1399
+ // 6. 下载文件
1400
+ const blob = XLSX.write(newWorkbook, {
1401
+ bookType: "xlsx",
1402
+ type: "array",
1403
+ });
1404
+
1405
+ const url = URL.createObjectURL(blob);
1406
+ const a = document.createElement("a");
1407
+ a.href = url;
1408
+ let fileName = null;
1409
+ if (this.resultType) {
1410
+ fileName = `导入结果(成功).xlsx`;
1411
+ } else {
1412
+ fileName = `导入结果(失败).xlsx`;
1413
+ }
1414
+ a.download = fileName;
1415
+ a.click();
1416
+
1417
+ // 7. 更新进度
1418
+ this.progress = 100;
1419
+ setTimeout(() => (this.progress = 0), 1000);
1420
+ } catch (error) {
1421
+ console.error("处理文件时出错:", error);
1422
+ }
1423
+ },
1424
+ //end
1425
+ getLoadingClass(flag, percent) {
1426
+ let classStr = null;
1427
+ let loadingIndex = this.loadingIndex;
1428
+ if (percent >= 100) {
1429
+ classStr = "ok";
1430
+ } else if (flag === loadingIndex) {
1431
+ classStr = "loading";
1432
+ }
1433
+ return classStr;
1434
+ },
1435
+
1436
+ /***sheet1 */
1437
+ async readExcel2(file, callback) {
1438
+ let that = this;
1439
+ let option = this.option;
1440
+
1441
+ const fileReader = new FileReader();
1442
+ fileReader.onload = async (ev) => {
1443
+ var resultData;
1444
+ try {
1445
+ const data = ev.target.result;
1446
+ const workbook = configUtil.XLSX.read(data, {
1447
+ type: "binary",
1448
+ });
1449
+
1450
+ let sheetDatas = []
1451
+ for (let pi = 0; pi < workbook.SheetNames.length; pi++) {
1452
+ let sheetName = workbook.SheetNames[pi];
1453
+ let sheet = workbook.Sheets[sheetName];
1454
+
1455
+ if (sheet["!ref"] == undefined) {
1456
+ that.$baseAlert(
1457
+ this.$t2(
1458
+ "请使用正确的导入模版!",
1459
+ "components.excelImport.warmMsg2"
1460
+ )
1461
+ );
1462
+ that.handleClose2();
1463
+ return false;
1464
+ }
1465
+ var range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
1466
+ var dataSize = range.e.r + 1; //行数
1467
+ that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
1468
+ var titles = [];
1469
+ var fields = [];
1470
+
1471
+ const ws = workbook.Sheets[sheet];
1472
+
1473
+ let prefix = option.prefix;
1474
+ let excelUrl = option.excel;
1475
+
1476
+ var excelRows = [];
1477
+ var row;
1478
+ var rowNum;
1479
+ var colNum;
1480
+ for (rowNum = range.s.r; rowNum <= range.e.r; rowNum++) {
1481
+ row = [];
1482
+ for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
1483
+ var nextCell =
1484
+ sheet[
1485
+ configUtil.XLSX.utils.encode_cell({
1486
+ r: rowNum,
1487
+ c: colNum,
1488
+ })
1489
+ ];
1490
+ if (typeof nextCell === "undefined") {
1491
+ row.push(void 0);
1492
+ } else {
1493
+ row.push(nextCell.w.trim());
1494
+ }
1495
+ }
1496
+ if (rowNum == 1) {
1497
+ titles = row;
1498
+ }
1499
+ if (rowNum == 2) {
1500
+ fields = row;
1501
+ let checkResult = true;
1502
+ }
1503
+ if (rowNum > 2) {
1504
+ let item = {};
1505
+ for (let i = 0; i < fields.length; i++) {
1506
+ let field = fields[i];
1507
+ if (field) {
1508
+ item[field] = row[i] ?? null;
1509
+ }
1510
+ }
1511
+ excelRows.push(item);
1512
+ }
1513
+ }
1514
+ if (
1515
+ !titles.length ||
1516
+ !fields.length ||
1517
+ titles.length != fields.length
1518
+ ) {
1519
+ that.$baseAlert(
1520
+ this.$t2(
1521
+ "请使用正确的导入模版!",
1522
+ "components.excelImport.warmMsg2"
1523
+ )
1524
+ );
1525
+ that.handleClose2();
1526
+ return false;
1527
+ }
1528
+
1529
+ var columns = [];
1530
+ var cols = [];
1531
+ let uniqueFields = [];
1532
+ for (let i = 0; i < titles.length; i++) {
1533
+ let title = titles[i];
1534
+ if (title) {
1535
+ let field = fields[i];
1536
+ if (field == null) {
1537
+ that.$baseAlert(
1538
+ this.$t2(
1539
+ "请使用正确的导入模版!",
1540
+ "components.excelImport.warmMsg2"
1541
+ )
1542
+ );
1543
+ that.handleClose2();
1544
+ return false;
1545
+ }
1546
+ let t = title.substr(-1);
1547
+ let u = title.length >= 2 ? title.substr(-2) : title;
1548
+ let isNeed = false;
1549
+ if (t === "*") {
1550
+ isNeed = true;
1551
+ }
1552
+ let isUnique = false;
1553
+ if (u === "**") {
1554
+ uniqueFields.push(field);
1555
+ isUnique = true;
1556
+ }
1557
+
1558
+ let otherConfig = {};
1559
+ let isFile = false;
1560
+ if (field.startsWith("attachments_")) {
1561
+ that.fileCellFields.push(field);
1562
+ isFile = true;
1563
+ otherConfig = {
1564
+ slots: {
1565
+ default: "attachment",
1566
+ },
1567
+ };
1568
+ }
1569
+
1570
+ let col = {
1571
+ field: field,
1572
+ title: title,
1573
+ width: 100,
1574
+ isNeed: isNeed,
1575
+ isUnique: isUnique,
1576
+ isFile,
1577
+ otherConfig,
1578
+ };
1579
+ cols.push(col);
1580
+ }
1581
+ }
1582
+
1583
+ var oriCols = JSON.parse(JSON.stringify(cols)); //列信息
1584
+ if (uniqueFields.length) {
1585
+ //分组唯一字段为空时,全部不发包。
1586
+ for (let i = 0; i < oriCols.length; i++) {
1587
+ let oriCol = oriCols[i];
1588
+ if (oriCol.isNeed) {
1589
+ for (let j = 0; j < excelRows.length; j++) {
1590
+ let data = excelRows[j];
1591
+ let value = data[oriCol.field];
1592
+ if (value == null || value == "") {
1593
+ that.clearImportTimer();
1594
+ that.$baseAlert(
1595
+ `[${sheetName}]`+
1596
+ this.$t2(
1597
+ "第" + (j + 4) + "行[" + oriCol.title + "]不能为空;",
1598
+ "components.excelImport.warmMsg3",
1599
+ {
1600
+ lineNo: j + 4,
1601
+ title: oriCol.title,
1602
+ }
1603
+ )
1604
+ );
1605
+ that.handleClose2();
1606
+ return false;
1607
+ }
1608
+ }
1609
+ }
1610
+ }
1611
+ }
1612
+
1613
+ this.oriCols = oriCols;
1614
+
1615
+ let resultData1 = {
1616
+ sheetName: sheetName,
1617
+ data: excelRows,
1618
+ titles: titles,
1619
+ fields: fields,
1620
+ uniqueFields: uniqueFields,
1621
+ oriCols: oriCols,
1622
+ };
1623
+ sheetDatas.push(resultData1);
1624
+ }
1625
+ // var sheet = workbook.Sheets[workbook.SheetNames[0]];
1626
+ // this.resultData = resultData;
1627
+ callback(sheetDatas);
1628
+ } catch (et) {
1629
+ that.showContent = false;
1630
+ that.clearImportTimer();
1631
+ console.error(et);
1632
+ }
1633
+ };
1634
+ fileReader.readAsBinaryString(file);
1635
+ },
1636
+ /***sheet2 */
1637
+ },
1638
+ };
1639
+ export const mixins = tmixins;