cloud-web-corejs 1.0.276 → 1.0.277

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 (305) hide show
  1. package/package.json +28 -24
  2. package/src/App.vue +73 -71
  3. package/src/api/user.js +21 -0
  4. package/src/components/baseArea/index.vue +82 -27
  5. package/src/components/baseTabs/mixins.js +5 -1
  6. package/src/components/luckysheet/dialog.vue +1 -1
  7. package/src/components/micro-view-host/contract.js +66 -0
  8. package/src/components/micro-view-host/index.vue +148 -0
  9. package/src/components/table/tableForm.vue +16 -5
  10. package/src/components/table/tableFormMixin.js +35 -7
  11. package/src/components/vb-tabs/x-tabs.vue +167 -143
  12. package/src/components/wf/content.vue +14 -0
  13. package/src/components/wf/content2.vue +4 -2
  14. package/src/components/wf/wf.js +74 -23
  15. package/src/components/wf/wfActionDropdown.vue +85 -0
  16. package/src/components/wf/wfActionItems.js +136 -0
  17. package/src/components/wf/wfAutoConfirm.js +55 -0
  18. package/src/components/wf/wfButtonName.js +60 -0
  19. package/src/components/wf/wfUserRange.js +53 -0
  20. package/src/components/wf/wfUtil.js +373 -295
  21. package/src/components/xform/XFormTabContainer//346/226/260/345/242/236/351/241/265/347/255/276/346/250/241/345/274/217-/346/234/200/347/273/210/345/256/236/347/216/260.md +195 -0
  22. 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" +57 -0
  23. package/src/components/xform/docs/2026-07 /346/216/222/346/237/245/344/277/256/345/244/215/350/256/260/345/275/225.md" +73 -0
  24. package/src/components/xform/docs/autocomplete /350/207/252/345/212/250/345/256/214/346/210/220/347/273/204/344/273/266/350/257/264/346/230/216.md" +126 -0
  25. package/src/components/xform/docs//345/257/271/346/257/224/345/212/237/350/203/275/350/220/275/345/234/260/346/226/271/346/241/210.md +986 -0
  26. package/src/components/xform/docs//346/225/260/346/215/256/350/241/250/346/240/274/345/212/250/346/200/201/345/210/227 JSON /350/257/264/346/230/216.md" +657 -0
  27. package/src/components/xform/docs//346/240/221/350/241/250rowField/346/224/266/346/225/233-/350/220/275/345/234/260/346/226/207/346/241/243.md +1427 -0
  28. package/src/components/xform/form-designer/designer.js +2085 -2025
  29. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +9 -11
  30. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +76 -75
  31. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +10 -4
  32. package/src/components/xform/form-designer/form-widget/container-widget/detail-plain-widget.vue +76 -0
  33. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +59 -5
  34. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +38 -17
  35. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +138 -13
  36. package/src/components/xform/form-designer/form-widget/dialog/formFieldDialog.vue +1 -1
  37. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1774 -1772
  38. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +2 -3
  39. package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +1 -1
  40. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +66 -53
  41. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +287 -214
  42. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +76 -66
  43. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +208 -124
  44. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +3 -9
  45. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +11 -2
  46. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +7 -6
  47. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +43 -19
  48. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +680 -372
  49. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +879 -763
  50. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +17 -2
  51. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-bar-mixin.js +3 -9
  52. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +3 -9
  53. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +3 -9
  54. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relative-default-mixin.js +107 -0
  55. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relativeDateUtil.js +321 -0
  56. package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +77 -0
  57. package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +13 -0
  58. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +13 -8
  59. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +4 -9
  60. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +3 -0
  61. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +120 -120
  62. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +4 -0
  63. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +11 -0
  64. package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +9 -1
  65. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +1 -1
  66. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +7 -3
  67. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +4 -2
  68. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +36 -5
  69. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +338 -374
  70. package/src/components/xform/form-designer/form-widget/index.vue +6 -1
  71. package/src/components/xform/form-designer/form-widget/indexMixin.js +29 -25
  72. package/src/components/xform/form-designer/index.vue +194 -191
  73. package/src/components/xform/form-designer/indexMixin.js +860 -847
  74. package/src/components/xform/form-designer/setting-panel/dataSource-setting.vue +397 -397
  75. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +602 -601
  76. package/src/components/xform/form-designer/setting-panel/form-setting.vue +1790 -1483
  77. package/src/components/xform/form-designer/setting-panel/index.vue +2 -7
  78. package/src/components/xform/form-designer/setting-panel/indexMixin.js +370 -335
  79. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +585 -544
  80. package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +1 -1
  81. package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +1 -1
  82. package/src/components/xform/form-designer/setting-panel/property-editor/alignType-editor.vue +1 -1
  83. package/src/components/xform/form-designer/setting-panel/property-editor/buttonIcon-editor.vue +14 -15
  84. package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +1 -1
  85. package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +1 -1
  86. package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +3 -3
  87. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +124 -125
  88. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +1151 -957
  89. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +96 -74
  90. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-plain/detail-plain-editor.vue +75 -0
  91. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/colHeight-editor.vue +1 -1
  92. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +14 -13
  93. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-height-editor.vue +1 -1
  94. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
  95. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
  96. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
  97. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue +4 -4
  98. package/src/components/xform/form-designer/setting-panel/property-editor/container-h5-card/h5-card-editor.vue +124 -124
  99. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +26 -31
  100. package/src/components/xform/form-designer/setting-panel/property-editor/container-panel/height-editor.vue +1 -1
  101. package/src/components/xform/form-designer/setting-panel/property-editor/container-panel/width-editor.vue +1 -1
  102. package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue +119 -119
  103. package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tabClass-editor.vue +45 -45
  104. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +340 -342
  105. package/src/components/xform/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue +1 -1
  106. package/src/components/xform/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue +1 -1
  107. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree/tree-customClass-editor.vue +2 -2
  108. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree-pane/tree-pane-editor.vue +1 -1
  109. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/cancelButtonLabel-editor.vue +1 -1
  110. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/okButtonLabel-editor.vue +1 -1
  111. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/title-editor.vue +1 -1
  112. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/width-editor.vue +1 -1
  113. package/src/components/xform/form-designer/setting-panel/property-editor/containerClass-editor.vue +1 -1
  114. package/src/components/xform/form-designer/setting-panel/property-editor/customClass-editor.vue +1 -1
  115. package/src/components/xform/form-designer/setting-panel/property-editor/defaultValue-editor.vue +1 -1
  116. package/src/components/xform/form-designer/setting-panel/property-editor/descriptionsItems-editor.vue +4 -4
  117. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +3 -3
  118. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +6 -2
  119. package/src/components/xform/form-designer/setting-panel/property-editor/dsName-editor.vue +1 -1
  120. package/src/components/xform/form-designer/setting-panel/property-editor/echartHeight-editor.vue +1 -1
  121. package/src/components/xform/form-designer/setting-panel/property-editor/endPlaceholder-editor.vue +1 -1
  122. package/src/components/xform/form-designer/setting-panel/property-editor/field-accessUrl/accessUrl-editor.vue +2 -2
  123. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaDataType-editor.vue +1 -1
  124. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaMinLevel-editor.vue +50 -50
  125. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaName-editor.vue +1 -1
  126. package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +7 -7
  127. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/addTableData-event-editor.vue +84 -85
  128. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/button-type-editor.vue +1 -1
  129. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindActions.js +262 -0
  130. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +97 -88
  131. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/form-host-event-editor.vue +188 -0
  132. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/icon-editor.vue +14 -15
  133. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +27 -10
  134. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/checkStrictly-editor.vue +11 -13
  135. package/src/components/xform/form-designer/setting-panel/property-editor/field-common/keyName-editor.vue +74 -67
  136. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +27 -5
  137. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +35 -18
  138. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +1 -1
  139. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-type-editor.vue +1 -1
  140. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-valueFormat-editor.vue +1 -1
  141. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +1 -1
  142. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +35 -18
  143. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +1 -1
  144. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-type-editor.vue +1 -1
  145. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-valueFormat-editor.vue +1 -1
  146. package/src/components/xform/form-designer/setting-panel/property-editor/field-divider/contentPosition-editor.vue +1 -1
  147. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -59
  148. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +11 -11
  149. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +10 -10
  150. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +12 -12
  151. package/src/components/xform/form-designer/setting-panel/property-editor/field-file-upload/file-upload-fileTypes-editor.vue +44 -44
  152. package/src/components/xform/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue +29 -29
  153. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +6 -6
  154. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +4 -4
  155. package/src/components/xform/form-designer/setting-panel/property-editor/field-number/controlsPosition-editor.vue +1 -1
  156. package/src/components/xform/form-designer/setting-panel/property-editor/field-picture-upload/picture-upload-fileTypes-editor.vue +44 -44
  157. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +115 -115
  158. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -115
  159. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/highThreshold-editor.vue +1 -1
  160. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/lowThreshold-editor.vue +1 -1
  161. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
  162. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-max-editor.vue +1 -1
  163. package/src/components/xform/form-designer/setting-panel/property-editor/field-script/script-editor.vue +4 -4
  164. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +4 -4
  165. package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/fontSize-editor.vue +1 -1
  166. package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +1 -1
  167. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +3 -3
  168. package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/activeText-editor.vue +1 -1
  169. package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue +1 -1
  170. package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/switchWidth-editor.vue +1 -1
  171. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +2 -2
  172. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +74 -74
  173. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +3 -3
  174. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +34 -18
  175. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +1 -1
  176. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-timeLimit-editor.vue +53 -0
  177. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +35 -18
  178. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +1 -1
  179. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchField-editor.vue +2 -2
  180. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +2 -2
  181. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +1 -1
  182. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +1 -1
  183. package/src/components/xform/form-designer/setting-panel/property-editor/field-vue-page/vue-page-editor.vue +2 -2
  184. package/src/components/xform/form-designer/setting-panel/property-editor/fileMaxSize-editor.vue +1 -1
  185. package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +176 -176
  186. package/src/components/xform/form-designer/setting-panel/property-editor/fixedQuery-editor.vue +39 -0
  187. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +41 -6
  188. package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +2 -2
  189. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +972 -972
  190. package/src/components/xform/form-designer/setting-panel/property-editor/iconClass-editor.vue +1 -1
  191. package/src/components/xform/form-designer/setting-panel/property-editor/label-editor.vue +1 -1
  192. package/src/components/xform/form-designer/setting-panel/property-editor/labelAlign-editor.vue +1 -1
  193. package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +1 -1
  194. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
  195. package/src/components/xform/form-designer/setting-panel/property-editor/labelWidth-editor.vue +1 -1
  196. package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
  197. package/src/components/xform/form-designer/setting-panel/property-editor/max-editor.vue +1 -1
  198. package/src/components/xform/form-designer/setting-panel/property-editor/maxLength-editor.vue +1 -1
  199. package/src/components/xform/form-designer/setting-panel/property-editor/min-editor.vue +1 -1
  200. package/src/components/xform/form-designer/setting-panel/property-editor/minLength-editor.vue +1 -1
  201. package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  202. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +15 -4
  203. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +3 -3
  204. package/src/components/xform/form-designer/setting-panel/property-editor/placeholder-editor.vue +1 -1
  205. package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
  206. package/src/components/xform/form-designer/setting-panel/property-editor/prefixIcon-editor.vue +14 -15
  207. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +6 -6
  208. package/src/components/xform/form-designer/setting-panel/property-editor/relative-default-block.vue +369 -0
  209. package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +1 -1
  210. package/src/components/xform/form-designer/setting-panel/property-editor/rows-editor.vue +1 -1
  211. package/src/components/xform/form-designer/setting-panel/property-editor/space-editor-editor.vue +1 -1
  212. package/src/components/xform/form-designer/setting-panel/property-editor/startPlaceholder-editor.vue +1 -1
  213. package/src/components/xform/form-designer/setting-panel/property-editor/step-editor.vue +1 -1
  214. package/src/components/xform/form-designer/setting-panel/property-editor/styleTableClass-editor.vue +1 -1
  215. package/src/components/xform/form-designer/setting-panel/property-editor/styleTitClass-editor.vue +1 -1
  216. package/src/components/xform/form-designer/setting-panel/property-editor/suffixIcon-editor.vue +14 -15
  217. package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +1 -1
  218. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +2 -3
  219. package/src/components/xform/form-designer/setting-panel/property-editor/type-editor.vue +1 -1
  220. package/src/components/xform/form-designer/setting-panel/property-editor/uploadTip-editor.vue +1 -1
  221. package/src/components/xform/form-designer/setting-panel/property-editor/uploadURL-editor.vue +1 -1
  222. package/src/components/xform/form-designer/setting-panel/property-editor/urlValueEnabled-editor.vue +91 -0
  223. package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +1 -1
  224. package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +1 -1
  225. package/src/components/xform/form-designer/setting-panel/property-editor/widgetWidth-editor.vue +1 -1
  226. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +374 -351
  227. package/src/components/xform/form-designer/toolbar-panel/index.vue +266 -103
  228. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +655 -589
  229. package/src/components/xform/form-designer/widget-panel/index.vue +391 -341
  230. package/src/components/xform/form-designer/widget-panel/indexMixin.js +351 -308
  231. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +4642 -4028
  232. package/src/components/xform/form-render/container-item/containerItemMixin.js +76 -61
  233. package/src/components/xform/form-render/container-item/data-table-item.vue +24 -13
  234. package/src/components/xform/form-render/container-item/data-table-mixin.js +5927 -3400
  235. package/src/components/xform/form-render/container-item/detail-h5-item.vue +173 -173
  236. package/src/components/xform/form-render/container-item/detail-item.vue +446 -224
  237. package/src/components/xform/form-render/container-item/detail-plain-item.vue +92 -0
  238. package/src/components/xform/form-render/container-item/list-h5-item.vue +1186 -411
  239. package/src/components/xform/form-render/container-item/tab-item.vue +129 -125
  240. package/src/components/xform/form-render/container-item/table-item.vue +0 -3
  241. package/src/components/xform/form-render/container-item/table2-item.vue +18 -10
  242. package/src/components/xform/form-render/dynamicDialogRender.js +140 -99
  243. package/src/components/xform/form-render/index.vue +8 -8
  244. package/src/components/xform/form-render/indexMixin.js +5299 -3766
  245. package/src/components/xform/form-render/refMixin.js +14 -11
  246. package/src/components/xform/lang/en-US.js +473 -438
  247. package/src/components/xform/lang/en-US_extension.js +4 -0
  248. package/src/components/xform/lang/zh-CN.js +646 -620
  249. package/src/components/xform/mixins/defaultHandle.js +363 -26
  250. package/src/components/xform/mixins/scriptHttp.js +54 -51
  251. package/src/components/xform/utils/attachmentValueUtil.js +239 -0
  252. package/src/components/xform/utils/fixedQueryUtil.js +93 -0
  253. package/src/components/xform/utils/format.js +195 -169
  254. package/src/components/xform/utils/queryParamUtil.js +84 -0
  255. package/src/components/xform/utils/tableColumnHelper.js +7 -8
  256. package/src/components/xform/utils/util.js +1663 -1551
  257. package/src/components/xform/utils/validators.js +100 -48
  258. package/src/index.js +403 -89
  259. package/src/layout/components/AppMain.vue +147 -119
  260. package/src/layout/components/Sidebar/default.vue +109 -59
  261. package/src/layout/components/TagsView/index.vue +1 -1
  262. package/src/layout/components/extractedCode/queryDialog.vue +33 -26
  263. package/src/layout/components/extractedCode/viewDialog.vue +207 -193
  264. package/src/layout/components/langTool.vue +128 -123
  265. package/src/layout/defaultLayout.vue +170 -158
  266. package/src/mixins/wf/index.js +40 -38
  267. package/src/public-path.js +38 -0
  268. package/src/router/modules/system.js +4 -0
  269. package/src/store/config/index.js +945 -669
  270. package/src/utils/pdfUtil.js +428 -70
  271. package/src/views/bd/setting/bd_company_env/dialog.vue +1 -1
  272. package/src/views/bd/setting/formVersion/button.vue +5 -0
  273. package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +21 -10
  274. package/src/views/bd/setting/formVersion/link.vue +5 -0
  275. package/src/views/bd/setting/form_script/edit.vue +1 -0
  276. package/src/views/bd/setting/form_script/edit1.vue +1 -0
  277. package/src/views/bd/setting/form_script/form_list.vue +1 -0
  278. package/src/views/bd/setting/form_script/list.vue +1 -0
  279. package/src/views/bd/setting/form_script/list1.vue +2 -0
  280. package/src/views/bd/setting/form_template/edit.vue +1 -0
  281. package/src/views/bd/setting/form_template/list.vue +2 -0
  282. package/src/views/bd/setting/form_template/mixins/edit.js +77 -74
  283. package/src/views/bd/setting/table_model/edit.vue +16 -29
  284. package/src/views/bd/setting/table_model/list.vue +1 -0
  285. package/src/views/bd/setting/table_model/mixins/edit.js +295 -149
  286. package/src/views/bd/setting/table_model/mixins/zdDialog.js +32 -0
  287. package/src/views/support/export_template/list.vue +1 -1
  288. package/src/views/user/company_info/edit.vue +149 -88
  289. package/src/views/user/form/form_template/dialog.vue +1 -1
  290. package/src/views/user/form/form_template/itemList.vue +1 -1
  291. package/src/views/user/form/form_template/list.vue +1 -1
  292. package/src/views/user/form/form_template_field/dialog.vue +1 -1
  293. package/src/views/user/form/form_type/dialog.vue +1 -1
  294. package/src/views/user/form/form_type/list.vue +1 -1
  295. package/src/views/user/form/report_requestaccess/dialog.vue +1 -1
  296. package/src/views/user/form/report_requestaccess/list.vue +1 -1
  297. package/src/views/user/form/vform/designer.vue +51 -22
  298. package/src/views/user/form/vform/render.vue +21 -23
  299. package/src/views/user/form/view/list.vue +134 -37
  300. package/src/views/user/wf/wfReport/index.vue +24 -1
  301. package/src/views/user/wf/wf_manage/list.vue +8 -4
  302. package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +0 -209
  303. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +0 -1639
  304. package/src/views/bd/setting/table_model/mixins/edit copy.js +0 -903
  305. package/src/views/user/menu/voc_list.vue +0 -686
@@ -1,1639 +0,0 @@
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;