cloud-web-corejs 1.0.54-dev.46 → 1.0.54-dev.460

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 (394) hide show
  1. package/package.json +13 -3
  2. package/src/App.vue +31 -33
  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/index.js +49 -1
  7. package/src/components/VabUpload/mixins.js +2 -2
  8. package/src/components/VabUpload/propertiesDialog.vue +1 -1
  9. package/src/components/VabUpload/view.vue +207 -120
  10. package/src/components/advancedSearchDialog/mixins.js +1 -1
  11. package/src/components/baseAttachment/index.vue +49 -40
  12. package/src/components/baseAttachment/mixins.js +295 -1
  13. package/src/components/baseInputExport/index.vue +19 -12
  14. package/src/components/baseInputExport/mixins.js +389 -1
  15. package/src/components/baseTabs/mixins.js +166 -1
  16. package/src/components/errorMsg/mixins.js +6 -5
  17. package/src/components/excelExport/button.vue +57 -4
  18. package/src/components/excelExport/index.js +48 -6
  19. package/src/components/excelExport/index.vue +56 -2
  20. package/src/components/excelExport/mixins.js +938 -2
  21. package/src/components/excelImport/mixins.js +2 -1
  22. package/src/components/fileLibrary/fileObjAuthEditDialog.vue +6 -0
  23. package/src/components/fileLibrary/filterDialog.vue +454 -0
  24. package/src/components/fileLibrary/index.vue +594 -254
  25. package/src/components/fileLibrary/mixins/categoryMoveDialogMixins.js +1 -1
  26. package/src/components/fileLibrary/mixins/fileCategoryDialogMixins.js +1 -1
  27. package/src/components/fileLibrary/mixins/fileHistoryDialogMixins.js +2 -2
  28. package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +335 -212
  29. package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +31 -27
  30. package/src/components/fileLibrary/mixins/fileObjAuthEditMixin.js +4 -4
  31. package/src/components/fileLibrary/mixins/indexMixins.js +220 -101
  32. package/src/components/fileLibrary/mixins/propertiesDialogMixins.js +64 -4
  33. package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +3 -3
  34. package/src/components/fileLibrary/propertiesDialog.vue +113 -74
  35. package/src/components/fileLibrary/shareDialog.vue +1 -1
  36. package/src/components/formOplog/mixins.js +1 -1
  37. package/src/components/jsonImport/index.js +1 -1
  38. package/src/components/jsonImport/mixins.js +2 -1
  39. package/src/components/langImport/mixins.js +17 -16
  40. package/src/components/obsUpload/index.js +1 -0
  41. package/src/components/obsUpload/index.vue +231 -0
  42. package/src/components/obsUpload/mixins.js +8 -0
  43. package/src/components/scriptDescription/button.vue +12 -4
  44. package/src/components/scriptTest/mixins.js +1 -1
  45. package/src/components/statusTag/mixins.js +1 -1
  46. package/src/components/table/CellSlot.vue +1 -0
  47. package/src/components/table/index.js +1049 -1293
  48. package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.es6.min.js +11028 -0
  49. package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.min.css +200 -0
  50. package/src/components/table/tableForm.vue +99 -63
  51. package/src/components/table/tableFormMixin.js +1 -1
  52. package/src/components/table/util/index.js +328 -0
  53. package/src/components/table/vxeFilter/mixin.js +6 -6
  54. package/src/components/tempStorage/index.vue +76 -55
  55. package/src/components/tempStorage/tempStorageDialog.vue +179 -54
  56. package/src/components/vb-tabs/x-tabs.vue +56 -30
  57. package/src/components/wf/addOpinionButton.vue +57 -0
  58. package/src/components/wf/content.vue +833 -362
  59. package/src/components/wf/mixins/addOpinionButton.js +3 -0
  60. package/src/components/wf/mixins/setCandidateButton.js +6 -0
  61. package/src/components/wf/mixins/setCandidateDialog.js +2 -1
  62. package/src/components/wf/mixins/setCandidateDialog2.js +6 -0
  63. package/src/components/wf/mixins/wfFlowEleScriptDialog.js +3 -0
  64. package/src/components/wf/mixins/wfTaskUserRangeDialog.js +3 -0
  65. package/src/components/wf/setCandidateButton.vue +40 -0
  66. package/src/components/wf/setCandidateDialog.vue +10 -0
  67. package/src/components/wf/setCandidateDialog2.vue +105 -0
  68. package/src/components/wf/wf.js +1 -1
  69. package/src/components/wf/wfFlowEleScriptDialog.vue +89 -0
  70. package/src/components/wf/wfStartDialog.vue +66 -42
  71. package/src/components/wf/wfTaskUserRangeDialog.vue +65 -0
  72. package/src/components/wf/wfUtil.js +1 -1
  73. package/src/components/xform/form-designer/designer.js +1657 -3
  74. package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +419 -0
  75. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +3 -3
  76. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +290 -8
  77. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -1
  78. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +3 -3
  79. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +971 -0
  80. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +971 -0
  81. package/src/components/xform/form-designer/form-widget/dialog/exportDialog.vue +13 -0
  82. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +301 -0
  83. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +16 -4
  84. package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +5 -1
  85. package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
  86. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +38 -7
  87. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +1639 -0
  88. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1759 -8
  89. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +120 -72
  90. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +1 -1
  91. package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
  92. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +34 -5
  93. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  94. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +19 -1
  95. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +18 -7
  96. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +4 -1
  97. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +89 -0
  98. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +14 -2
  99. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +30 -4
  100. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +133 -0
  101. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +77 -0
  102. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +106 -0
  103. package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
  104. package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
  105. package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
  106. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1634 -16
  107. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +645 -379
  108. package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +962 -0
  109. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +10 -8
  110. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +81 -0
  111. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +7 -2
  112. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-bar-mixin.js +49 -8
  113. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +61 -88
  114. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +13 -0
  115. package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +179 -0
  116. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
  117. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +114 -81
  118. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +186 -0
  119. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +41 -27
  120. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +113 -0
  121. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +154 -47
  122. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +25 -6
  123. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +2 -2
  124. package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +86 -0
  125. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +24 -9
  126. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
  127. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -0
  128. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +2 -1
  129. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +31 -17
  130. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +6 -1
  131. package/src/components/xform/form-designer/form-widget/field-widget/tableexportbuttonwidget.vue +99 -0
  132. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +147 -0
  133. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +46 -34
  134. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +2 -2
  135. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +3 -171
  136. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +259 -58
  137. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +744 -0
  138. package/src/components/xform/form-designer/indexMixin.js +3 -2
  139. package/src/components/xform/form-designer/setting-panel/form-setting.vue +947 -156
  140. package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
  141. package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
  142. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +537 -302
  143. package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +4 -4
  144. package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +3 -3
  145. package/src/components/xform/form-designer/setting-panel/property-editor/autoValueEnabled-editor.vue +38 -0
  146. package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +6 -0
  147. package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +28 -0
  148. package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +41 -0
  149. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +125 -0
  150. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +946 -1042
  151. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/onCheckboxChange-editor.vue +1 -1
  152. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1127 -512
  153. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +2 -2
  154. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-pane/detail-pane-editor.vue +3 -3
  155. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
  156. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
  157. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
  158. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +0 -8
  159. package/src/components/xform/form-designer/setting-panel/property-editor/copyButton-editor.vue +36 -0
  160. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +32 -0
  161. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +2 -2
  162. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onAfterConfirmFile-editor.vue +32 -0
  163. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +2 -2
  164. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +35 -20
  165. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +64 -5
  166. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +27 -0
  167. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-item-editor.vue +21 -0
  168. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
  169. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +185 -69
  170. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +188 -86
  171. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +84 -39
  172. package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +36 -0
  173. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +70 -19
  174. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +89 -0
  175. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +44 -15
  176. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -0
  177. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
  178. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +67 -41
  179. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +56 -0
  180. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +26 -7
  181. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
  182. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +30 -1
  183. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +63 -0
  184. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +89 -19
  185. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +721 -466
  186. package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +20 -11
  187. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +1 -1
  188. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
  189. package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +1 -1
  190. package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
  191. package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +19 -14
  192. package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  193. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +31 -0
  194. package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
  195. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +349 -0
  196. package/src/components/xform/form-designer/setting-panel/property-editor/required-editor.vue +10 -6
  197. package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +3 -3
  198. package/src/components/xform/form-designer/setting-panel/property-editor/showRuleFlag-editor.vue +1 -1
  199. package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +42 -0
  200. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +305 -19
  201. package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +2 -2
  202. package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +2 -2
  203. package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +372 -50
  204. package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +263 -0
  205. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +32 -11
  206. package/src/components/xform/form-designer/toolbar-panel/index.vue +12 -11
  207. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +1 -1
  208. package/src/components/xform/form-designer/widget-panel/index.vue +21 -1
  209. package/src/components/xform/form-designer/widget-panel/indexMixin.js +19 -18
  210. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +1644 -871
  211. package/src/components/xform/form-render/container-item/containerItemMixin.js +386 -11
  212. package/src/components/xform/form-render/container-item/data-table-item.vue +194 -199
  213. package/src/components/xform/form-render/container-item/data-table-mixin.js +2928 -18
  214. package/src/components/xform/form-render/container-item/detail-pane-item.vue +17 -3
  215. package/src/components/xform/form-render/container-item/grid-col-item.vue +10 -3
  216. package/src/components/xform/form-render/container-item/grid-item.vue +1 -1
  217. package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -9
  218. package/src/components/xform/form-render/container-item/list-h5-item2.vue +1 -8
  219. package/src/components/xform/form-render/container-item/tab-item.vue +62 -25
  220. package/src/components/xform/form-render/container-item/table-cell-item.vue +38 -32
  221. package/src/components/xform/form-render/container-item/table-item.vue +4 -2
  222. package/src/components/xform/form-render/container-item/table2-cell-item.vue +53 -34
  223. package/src/components/xform/form-render/container-item/table2-item.vue +141 -88
  224. package/src/components/xform/form-render/index.vue +69 -20
  225. package/src/components/xform/form-render/indexMixin.js +3427 -12
  226. package/src/components/xform/lang/zh-CN.js +27 -4
  227. package/src/components/xform/mixins/defaultHandle.js +340 -1
  228. package/src/components/xform/mixins/scriptHttp.js +174 -1
  229. package/src/components/xform/utils/emitter.js +4 -4
  230. package/src/components/xform/utils/format.js +21 -30
  231. package/src/components/xform/utils/formula-util copy 2.js +945 -0
  232. package/src/components/xform/utils/formula-util copy.js +860 -0
  233. package/src/components/xform/utils/formula-util.js +970 -0
  234. package/src/components/xform/utils/util.js +1463 -1
  235. package/src/components/xform/utils/validators.js +1 -5
  236. package/src/components/xform/utils/vue2js-generator.js +2 -2
  237. package/src/index.js +210 -190
  238. package/src/lang/index.js +56 -51
  239. package/src/lang/locale/en/login.js +20 -0
  240. package/src/lang/locale/zh/login.js +20 -0
  241. package/src/layout/components/AppMain.vue +5 -1
  242. package/src/layout/components/Sidebar/default.vue +1389 -1222
  243. package/src/layout/components/TagsView/index.vue +37 -12
  244. package/src/layout/components/createCompany/createCompanyDialog.vue +157 -0
  245. package/src/layout/components/extractedCode/createDialog.vue +92 -0
  246. package/src/layout/components/extractedCode/queryDialog.vue +96 -0
  247. package/src/layout/components/extractedCode/viewDialog.vue +193 -0
  248. package/src/layout/components/watermark/index.vue +83 -0
  249. package/src/layout/defaultLayout.vue +1 -1
  250. package/src/layout/index.vue +3 -5
  251. package/src/mixins/selectDialog/index.js +266 -1
  252. package/src/mixins/table/index.js +151 -0
  253. package/src/mixins/tableTree/index.js +1 -1
  254. package/src/permission.js +135 -18
  255. package/src/router/modules/customer.js +79 -8
  256. package/src/store/config/index.js +1 -532
  257. package/src/store/getters.js +3 -1
  258. package/src/store/modules/permission.js +1 -1
  259. package/src/store/modules/settings.js +1 -1
  260. package/src/store/modules/tagsView.js +1 -14
  261. package/src/store/modules/user.js +341 -16
  262. package/src/utils/index.js +2 -3
  263. package/src/utils/pddLog.js +103 -0
  264. package/src/utils/pdfUtil.js +71 -0
  265. package/src/utils/request.js +1 -1
  266. package/src/utils/vab.js +19 -27
  267. package/src/views/bd/setting/bd_attach_setting/edit.vue +5 -5
  268. package/src/views/bd/setting/bd_attach_setting/list.vue +28 -55
  269. package/src/views/bd/setting/bd_attach_setting/mixins/edit.js +4 -5
  270. package/src/views/bd/setting/bd_attach_setting/mixins/list.js +239 -1
  271. package/src/views/bd/setting/bd_company_env/dialog.vue +174 -0
  272. package/src/views/bd/setting/bd_company_env/edit.vue +193 -0
  273. package/src/views/bd/setting/bd_company_env/list.vue +175 -0
  274. package/src/views/bd/setting/config_manage/list.vue +76 -0
  275. package/src/views/bd/setting/form_import_log/edit.vue +127 -0
  276. package/src/views/bd/setting/form_import_log/list.vue +206 -0
  277. package/src/views/bd/setting/form_script/edit.vue +9 -0
  278. package/src/views/bd/setting/form_script/edit1.vue +36 -3
  279. package/src/views/bd/setting/form_script/form_list.vue +1 -1
  280. package/src/views/bd/setting/form_script/list1.vue +4 -4
  281. package/src/views/bd/setting/form_script/mixins/dialog.js +130 -1
  282. package/src/views/bd/setting/form_script/mixins/edit.js +201 -1
  283. package/src/views/bd/setting/form_script/mixins/edit1.js +193 -1
  284. package/src/views/bd/setting/form_script/mixins/form_list.js +1 -1
  285. package/src/views/bd/setting/form_script/mixins/list.js +236 -1
  286. package/src/views/bd/setting/form_script/mixins/list1.js +423 -14
  287. package/src/views/bd/setting/form_script/mixins/otherAuthDialog.js +194 -0
  288. package/src/views/bd/setting/form_script/otherAuthDialog.vue +83 -0
  289. package/src/views/bd/setting/form_template/batchWfObjConfigDialog.vue +105 -0
  290. package/src/views/bd/setting/form_template/edit.vue +22 -1
  291. package/src/views/bd/setting/form_template/editWfObjConfigDialog.vue +2 -2
  292. package/src/views/bd/setting/form_template/list.vue +5 -5
  293. package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +282 -0
  294. package/src/views/bd/setting/form_template/mixins/edit.js +234 -9
  295. package/src/views/bd/setting/form_template/mixins/list.js +689 -22
  296. package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +193 -0
  297. package/src/views/bd/setting/form_template/mixins/wf_list.js +12 -0
  298. package/src/views/bd/setting/form_template/otherAuthDialog.vue +83 -0
  299. package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +140 -75
  300. package/src/views/bd/setting/form_template/{list2.vue → wf_list.vue} +25 -35
  301. package/src/views/bd/setting/logic_param/edit.vue +146 -0
  302. package/src/views/bd/setting/logic_param/edit1.vue +106 -0
  303. package/src/views/bd/setting/logic_param/edit2.vue +139 -0
  304. package/src/views/bd/setting/logic_param/list.vue +74 -0
  305. package/src/views/bd/setting/logic_param/list1.vue +12 -0
  306. package/src/views/bd/setting/logic_param/list2.vue +12 -0
  307. package/src/views/bd/setting/logic_param/mixins/edit.js +93 -0
  308. package/src/views/bd/setting/logic_param/mixins/list.js +369 -0
  309. package/src/views/bd/setting/menu_kind/list.vue +4 -0
  310. package/src/views/bd/setting/menu_kind/mixins/authDialog.js +300 -7
  311. package/src/views/bd/setting/menu_kind/mixins/list.js +201 -1
  312. package/src/views/bd/setting/push_data/edit.vue +139 -0
  313. package/src/views/bd/setting/push_data/list.vue +283 -0
  314. package/src/views/bd/setting/push_data_h/edit.vue +153 -0
  315. package/src/views/bd/setting/push_data_h/list.vue +293 -0
  316. package/src/views/bd/setting/request_async_setting/edit.vue +320 -0
  317. package/src/views/bd/setting/request_async_setting/list.vue +372 -0
  318. package/src/views/bd/setting/request_setting/edit.vue +300 -0
  319. package/src/views/bd/setting/request_setting/list.vue +311 -0
  320. package/src/views/bd/setting/table_model/edit.vue +875 -426
  321. package/src/views/bd/setting/table_model/list.vue +4 -4
  322. package/src/views/bd/setting/table_model/mixins/dialog.js +1 -1
  323. package/src/views/bd/setting/table_model/mixins/edit.js +1202 -13
  324. package/src/views/bd/setting/table_model/mixins/list.js +440 -14
  325. package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +201 -0
  326. package/src/views/bd/setting/table_model/otherAuthDialog.vue +83 -0
  327. package/src/views/user/access_log/list.vue +418 -349
  328. package/src/views/user/area/dialog.vue +0 -1
  329. package/src/views/user/bill_setting/edit.vue +1 -1
  330. package/src/views/user/bill_setting/list.vue +1 -1
  331. package/src/views/user/common_attribute/itemEdit.vue +2 -2
  332. package/src/views/user/common_attribute/list.vue +1 -1
  333. package/src/views/user/common_script/edit.vue +1 -1
  334. package/src/views/user/common_script/list.vue +1 -1
  335. package/src/views/user/company_info/dialog.vue +164 -154
  336. package/src/views/user/company_info/edit.vue +1 -1
  337. package/src/views/user/extend_datasource/dialog.vue +1 -0
  338. package/src/views/user/extend_datasource/edit.vue +3 -0
  339. package/src/views/user/extend_datasource/list.vue +2 -1
  340. package/src/views/user/fieldTranslation/editDialog.vue +7 -7
  341. package/src/views/user/fieldTranslation/list.vue +32 -32
  342. package/src/views/user/form/vform/designer.vue +775 -749
  343. package/src/views/user/form/vform/out_render.vue +1 -1
  344. package/src/views/user/form/vform/render.vue +59 -37
  345. package/src/views/user/form/view/edit.vue +38 -37
  346. package/src/views/user/form/view/list.vue +236 -46
  347. package/src/views/user/home/bears/index.vue +1032 -0
  348. package/src/views/user/home/default.vue +1025 -979
  349. package/src/views/user/home/dev.vue +29 -0
  350. package/src/views/user/home/index.vue +16 -6
  351. package/src/views/user/home/taili/index.vue +1034 -0
  352. package/src/views/user/ledger_library/list.vue +10 -12
  353. package/src/views/user/login/default.vue +165 -36
  354. package/src/views/user/login/index.vue +4 -6
  355. package/src/views/user/login/indexMixin.js +184 -8
  356. package/src/views/user/notify_message/dialog.vue +38 -22
  357. package/src/views/user/notify_template/edit.vue +188 -187
  358. package/src/views/user/notify_template/edit2.vue +176 -0
  359. package/src/views/user/notify_template/list.vue +4 -1
  360. package/src/views/user/notify_template/list2.vue +190 -0
  361. package/src/views/user/outLink/form_view.vue +211 -184
  362. package/src/views/user/outLink/index.vue +67 -11
  363. package/src/views/user/outLink/view.vue +28 -23
  364. package/src/views/user/position/edit.vue +116 -83
  365. package/src/views/user/position/list.vue +118 -86
  366. package/src/views/user/project_tag/dialog.vue +9 -4
  367. package/src/views/user/project_tag/edit.vue +2 -2
  368. package/src/views/user/project_tag/list.vue +9 -4
  369. package/src/views/user/push_setting/list.vue +2 -2
  370. package/src/views/user/request_setting/edit.vue +258 -0
  371. package/src/views/user/request_setting/list.vue +248 -0
  372. package/src/views/user/role/dialog.vue +70 -48
  373. package/src/views/user/role/edit.vue +499 -429
  374. package/src/views/user/role/list.vue +4 -4
  375. package/src/views/user/sale_org/dialog.vue +1 -1
  376. package/src/views/user/sale_org/list.vue +4 -1
  377. package/src/views/user/system_notice/edit.vue +232 -186
  378. package/src/views/user/user/dialog.vue +46 -23
  379. package/src/views/user/user/edit.vue +1059 -1021
  380. package/src/views/user/user/form_dialog.vue +158 -0
  381. package/src/views/user/user/form_info.vue +210 -0
  382. package/src/views/user/user/list.vue +647 -563
  383. package/src/views/user/user/modifyPasswordDialog.vue +64 -53
  384. package/src/views/user/wf/wfReport/index.vue +618 -0
  385. package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -0
  386. package/src/views/user/wf/wf_manage/list.vue +371 -249
  387. package/src/views/user/wf/wf_manage/wfContentDialog.vue +1 -1
  388. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +109 -0
  389. package/src/views/user/wf/wf_obj_config/itemEdit.vue +25 -1
  390. package/src/views/user/wf/wf_obj_config/list.vue +114 -9
  391. package/src/views/user/wf/wf_obj_config/wfBizDataSettingDialog.vue +2 -2
  392. package/src/views/user/wf/wf_transfer_setting/edit.vue +230 -0
  393. package/src/views/user/wf/wf_transfer_setting/list.vue +309 -0
  394. package/src/views/bd/setting/form_template/mixins/list2.js +0 -12
@@ -1,1293 +1,1049 @@
1
- /**version-1.0*/
2
- let modules = {};
3
- import Sortable from "sortablejs";
4
- import tableConfig from "./config.js";
5
- import customConfig from "./customConfig.js";
6
- import Vue from "vue";
7
- import CellSlot from "../../components/table/CellSlot.vue";
8
- import {extendDeeply} from "../../utils/index.js";
9
- import corejsConfig from "@/corejsConfig";
10
-
11
- let configUtil = {
12
- Sortable,
13
- extendDeeply,
14
- tableConfig,
15
- Vue,
16
- CellSlot,
17
- };
18
-
19
- function getGrid(that, tableRef) {
20
- var $grid;
21
- if (Array.isArray(that.$refs[tableRef])) {
22
- $grid = that.$refs[tableRef][0];
23
- } else {
24
- $grid = that.$refs[tableRef];
25
- }
26
- return $grid;
27
- }
28
-
29
- async function initVxeTable(option) {
30
- let tableName = option.tableName;
31
- if (
32
- !configUtil.tableConfig.disableTableName
33
- && option.tableNameRequired !== false
34
- && !tableName
35
- ) {
36
- return false;
37
- }
38
- var that = option.vue;
39
- if (!that.$refs[option.tableRef]) {
40
- await that.$nextTick();
41
- }
42
- var $grid = getGrid(that, option.tableRef);
43
- if (!$grid) {
44
- return false;
45
- }
46
- delete option.vue;
47
-
48
- //操作列自动补全
49
- handleCustomAlign(option);
50
-
51
- $grid.originOption = that.$baseLodash.cloneDeep(option);
52
- $grid.originOption.vue = that;
53
- option.vue = that;
54
-
55
- var isQueryAllPage = true;
56
- if (option.isQueryAllPage != null) {
57
- isQueryAllPage = option.isQueryAllPage;
58
- }
59
-
60
- if (tableName) {
61
- $grid.tableName = tableName;
62
- if (option.path) {
63
- await getTableData(that, option.tableRef, "isQueryAllPage", (res1) => {
64
- let result = res1.objx ? res1.objx.data : null;
65
- if (result != null) {
66
- if (result === "false" || result == false) {
67
- isQueryAllPage = false;
68
- } else {
69
- isQueryAllPage = true;
70
- }
71
- }
72
- });
73
- }
74
- await getTableJson(tableName, that, (resultMsg) => {
75
- var objx = resultMsg.objx;
76
- if (objx != null) {
77
- let jsonStr = objx.data;
78
- if (jsonStr) {
79
- let json = JSON.parse(decodeURIComponent(jsonStr));
80
- let columnData = json.columns ? json.columns : json;
81
- if (columnData) {
82
- option.columns = initColumn(
83
- option,
84
- columnData
85
- );
86
- }
87
- $grid.searchColumns = initSearchColumns(option, json.searchColumns);
88
- initExportColumns($grid, json)
89
- }
90
- }
91
- if (!$grid.searchColumns || !$grid.searchColumns.length) {
92
- $grid.searchColumns = initSearchColumns(option);
93
- }
94
-
95
- });
96
- } else {
97
- $grid.searchColumns = initSearchColumns(option);
98
- }
99
-
100
- $grid.$refs.xTable.getCellValue = getCellValue;
101
- $grid.getCellValue = getCellValue;
102
- $grid.$refs.xTable.createParams = createParams;
103
- $grid.createParams = createParams;
104
-
105
- option.isQueryAllPage = isQueryAllPage;
106
- let nOption = initOption(option);
107
-
108
- $grid.isQueryAllPage = isQueryAllPage;
109
-
110
- if (tableName) {
111
- nOption.tableName = tableName;
112
- }
113
-
114
- nOption.vue = that;
115
- //绑定列位置拖拽
116
- columnDrop(that, tableName, option.tableRef);
117
-
118
- //自动绑定toobar
119
- handleToolbar($grid, option);
120
-
121
- return nOption;
122
- }
123
-
124
- //自动绑定toobar
125
- function handleToolbar($grid, option) {
126
- let selfConfig = getSelfConfig();
127
- if (
128
- option.bindToolbar
129
- || (option.bindToolbar !== false && selfConfig.bindToolbar)
130
- ) {
131
- let loopDo = function (children) {
132
- if (children && children.length) {
133
- children.forEach((item) => {
134
- if (item.$options.name == "VxeToolbar") {
135
- $grid.connect(item);
136
- } else {
137
- loopDo(item.$children);
138
- }
139
- });
140
- }
141
- };
142
- that.$nextTick(() => {
143
- loopDo($grid.$children);
144
- });
145
- }
146
- }
147
-
148
- //操作列自动补全
149
- function handleCustomAlign(option) {
150
- let selfConfig = getSelfConfig();
151
- // let customAlign = option.customAlign || selfConfig.customAlign || "right";
152
- let customAlign = selfConfig.customAlign === false ? false : (selfConfig.customAlign || "right");
153
- customAlign = option.customAlign === false ? false : (option.customAlign || customAlign);
154
-
155
- let customColumnWidth
156
- = option.customColumnWidth || selfConfig.customColumnWidth || 47;
157
- let checkBoxColumnWidth
158
- = option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
159
-
160
- let checkBoxRequired = selfConfig.checkBoxRequired !== false;
161
- if (option.checkBoxRequired === false) {
162
- checkBoxRequired = false;
163
- }
164
-
165
- let columnSize = option.columns.length;
166
- if (columnSize > 0) {
167
- if (checkBoxRequired) {
168
- let firstColumn = option.columns[0];
169
- if (firstColumn.type != "checkbox") {
170
- option.columns.splice(0, 0, {
171
- type: "checkbox",
172
- width: checkBoxColumnWidth,
173
- resizable: false,
174
- fixed: "left",
175
- });
176
- }
177
- }
178
- if (customAlign !== false) {
179
- let lastColumn = option.columns[columnSize - 1];
180
- if (customAlign == "left") {
181
- if (!lastColumn.field && lastColumn.fixed == "right") {
182
- option.columns.splice(columnSize - 1, 1);
183
- lastColumn.fixed = "left";
184
- option.columns.splice(1, 0, lastColumn);
185
- } else if (columnSize > 1) {
186
- if (option.columns[1].field) {
187
- option.columns.splice(1, 0, {
188
- width: customColumnWidth,
189
- fixed: "left",
190
- title: "",
191
- sortable: false,
192
- });
193
- }
194
- }
195
- } else if (customAlign == "right") {
196
- let column1 = option.columns[1];
197
- if (!column1.field && column1.fixed == "left") {
198
- option.columns.splice(1, 1);
199
- column1.fixed = "right";
200
- option.columns.push(column1);
201
- } else if (lastColumn.field || lastColumn.fixed != "right") {
202
- option.columns.push({
203
- width: customColumnWidth,
204
- fixed: "right",
205
- title: "",
206
- sortable: false,
207
- });
208
- }
209
- }
210
- }
211
- }
212
- }
213
-
214
- //列位置拖拽
215
- function columnDrop(t, tableName, tableRef) {
216
- var that = t;
217
- const $table = getGrid(that, tableRef);
218
- if (!$table) {
219
- return;
220
- }
221
- if ($table.sortable) {
222
- $table.sortable.destroy();
223
- }
224
- $table.sortable = configUtil.Sortable.create(
225
- $table.$el.querySelector(
226
- ".body--wrapper>.vxe-table--header .vxe-header--row"
227
- ),
228
- {
229
- handle: ".vxe-header--column:not(.col--fixed)",
230
- onEnd: ({item, newIndex, oldIndex}) => {
231
- const {fullColumn, tableColumn} = $table.getTableColumn();
232
- const targetThElem = item;
233
- const wrapperElem = targetThElem.parentNode;
234
- const newColumn = fullColumn[newIndex];
235
- if (newColumn.fixed) {
236
- // 错误的移动
237
- if (newIndex > oldIndex) {
238
- wrapperElem.insertBefore(
239
- targetThElem,
240
- wrapperElem.children[oldIndex]
241
- );
242
- } else {
243
- wrapperElem.insertBefore(
244
- wrapperElem.children[oldIndex],
245
- targetThElem
246
- );
247
- }
248
- return;
249
- /* return that.$XModal.message({
250
- content: '固定列不允许拖动!',
251
- status: 'error'
252
- }) */
253
- }
254
- // 转换真实索引
255
- const oldColumnIndex = $table.getColumnIndex(tableColumn[oldIndex]);
256
- const newColumnIndex = $table.getColumnIndex(tableColumn[newIndex]);
257
- // 移动到目标列
258
- const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
259
- fullColumn.splice(newColumnIndex, 0, currRow);
260
-
261
- $table.loadColumn(fullColumn);
262
- addTableJson(that, $table, tableName, fullColumn);
263
- },
264
- }
265
- );
266
- }
267
-
268
- function getSelfConfig() {
269
- let tableConfig = configUtil.tableConfig || {};
270
- let selfConfig = tableConfig.selfConfig || {};
271
- return selfConfig;
272
- }
273
-
274
- function initColumnDefaulAttrs(columns, opts) {
275
- if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
276
- for (let i = 0; i < columns.length; i++) {
277
- if (columns[i].title && columns[i].sortable == null) {
278
- columns[i].sortable = true;
279
- }
280
- }
281
- }
282
-
283
- let tableConfig = configUtil.tableConfig || {};
284
- let selfConfig = getSelfConfig();
285
- if (opts.filterType !== false && !opts.treeNodeUrl) {
286
- let filterType
287
- = opts.filterType || selfConfig.filterType || "filterContent";
288
- if (filterType) {
289
- columns.forEach((column) => {
290
- if (column.title && column.field) {
291
- if (
292
- column.filterType == "filterContent"
293
- || (column.filterType == null && filterType == "filterContent")
294
- ) {
295
- if (!column.filters) {
296
- column.filters = [
297
- {
298
- data: {},
299
- },
300
- ];
301
- }
302
- if (!column.filterRender) {
303
- column.filterRender = {
304
- name: "FilterContent",
305
- };
306
- }
307
- } else if (
308
- column.filterType === "filterInput"
309
- || (column.filterType == null && filterType == "filterInput")
310
- ) {
311
- if (!column.filters) {
312
- column.filters = [
313
- {
314
- data: "",
315
- },
316
- ];
317
- }
318
- if (!column.filterRender) {
319
- column.filterRender = {
320
- name: "FilterInput",
321
- };
322
- }
323
- }
324
- }
325
- });
326
- }
327
- }
328
-
329
- //设置复选框列的锁定宽度
330
- if (opts.lockCheckboxWidth !== false) {
331
- let lockCheckboxWidth = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
332
- if (lockCheckboxWidth) {
333
- columns.forEach((column) => {
334
- if (column.type == 'checkbox') {
335
- column.width = lockCheckboxWidth;
336
- }
337
- });
338
- }
339
- }
340
- }
341
-
342
- function initOption(opts) {
343
- let result = {};
344
- var that = opts.vue;
345
- var $grid = getGrid(that, opts.tableRef);
346
-
347
- let path = opts.path || "";
348
- // let columns = JSON.parse(JSON.stringify(opts.columns || []));
349
- let columns = opts.columns || [];
350
- let isQueryAllPage = opts.isQueryAllPage;
351
- var pagerLayouts = getPagerConfigLayouts(opts);
352
-
353
- let config = opts.config || {};
354
-
355
- initColumnDefaulAttrs(columns, opts);
356
- /*if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
357
- for (let i = 0; i < columns.length; i++) {
358
- if (columns[i].title && columns[i].sortable == null) {
359
- columns[i].sortable = true;
360
- }
361
- }
362
- }
363
-
364
- let tableConfig = configUtil.tableConfig || {};
365
- let selfConfig = getSelfConfig();
366
- if (opts.filterType !== false && !opts.treeNodeUrl) {
367
- let filterType
368
- = opts.filterType || selfConfig.filterType || "filterContent";
369
- if (filterType) {
370
- columns.forEach((column) => {
371
- if (column.title && column.field) {
372
- if (
373
- column.filterType == "filterContent"
374
- || (column.filterType == null && filterType == "filterContent")
375
- ) {
376
- if (!column.filters) {
377
- column.filters = [
378
- {
379
- data: {},
380
- },
381
- ];
382
- }
383
- if (!column.filterRender) {
384
- column.filterRender = {
385
- name: "FilterContent",
386
- };
387
- }
388
- } else if (
389
- column.filterType === "filterInput"
390
- || (column.filterType == null && filterType == "filterInput")
391
- ) {
392
- if (!column.filters) {
393
- column.filters = [
394
- {
395
- data: "",
396
- },
397
- ];
398
- }
399
- if (!column.filterRender) {
400
- column.filterRender = {
401
- name: "FilterInput",
402
- };
403
- }
404
- }
405
- }
406
- });
407
- }
408
- }
409
-
410
- //设置复选框列的锁定宽度
411
- if (opts.lockCheckboxWidth !== false) {
412
- let lockCheckboxWidth = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
413
- if (lockCheckboxWidth) {
414
- columns.forEach((column) => {
415
- if (column.type == 'checkbox') {
416
- column.width = lockCheckboxWidth;
417
- }
418
- });
419
- }
420
- }*/
421
-
422
- let defaultOptions = {
423
- columnKey: true,
424
- resizable: true,
425
- showOverflow: true,
426
- showHeaderOverflow: true,
427
- showFooterOverflow: true,
428
- highlightHoverRow: true,
429
- border: "inner",
430
- height: "auto",
431
- // maxHeight:"1000px",
432
- // rowId: 'id',
433
- emptyText: " ",
434
- sortConfig: {
435
- trigger: "cell",
436
- remote: false,
437
- },
438
- filterConfig: {
439
- remote: false,
440
- },
441
- pagerConfig: {
442
- autoHidden: true,
443
- perfect: true,
444
- pageSize: 200,
445
- pageSizes: [50, 100, 200, 500],
446
- layouts: pagerLayouts,
447
- slots: {
448
- left: (obj, b, c) => {
449
- var $grid = obj.$grid;
450
- let k = $grid.$data;
451
- let tableDataInfo = $grid.getTableData();
452
- let data = tableDataInfo.fullData;
453
- let h = $grid.$createElement;
454
-
455
- let proxyInfo = $grid.getProxyInfo();
456
- let pager = proxyInfo ? proxyInfo.pager : null;
457
-
458
- let celems = [
459
- h("span", $grid.$t2('本页记录数', 'components.table.currentNum')),
460
- h(
461
- "span",
462
- {
463
- attrs: {
464
- class: "f-red",
465
- },
466
- },
467
- " " + tableDataInfo.visibleData.length + " "
468
- ),
469
- ];
470
- if (pager && $grid.isQueryAllPage) {
471
- celems.push(h("span", "," + $grid.$t2('总记录数', 'components.table.totalNum')));
472
- celems.push(
473
- h(
474
- "span",
475
- {
476
- attrs: {
477
- class: "f-red",
478
- },
479
- },
480
- " " + pager.total + " "
481
- )
482
- );
483
- }
484
- let elem = h("span", {}, celems);
485
- return [elem];
486
- },
487
- },
488
- },
489
- exportConfig: {
490
- // 默认选中类型
491
- type: "xlsx",
492
- // 局部自定义类型
493
- types: ["xlsx", "csv", "html", "xml", "txt"],
494
- // 自定义数据量列表
495
- modes: ["current", "all"],
496
- },
497
- radioConfig: {
498
- labelField: "id",
499
- reserve: true,
500
- highlight: true,
501
- },
502
- checkboxConfig: {
503
- highlight: true,
504
- },
505
- customConfig: {
506
- storage: false,
507
- },
508
- scrollX: {
509
- enabled: false,
510
- },
511
- columns: columns,
512
- };
513
- let tableDefaultConfig = corejsConfig?.componentConfig?.table?.defaultConfig || {};
514
- defaultOptions = configUtil.extendDeeply(defaultOptions, tableConfig);
515
- defaultOptions = configUtil.extendDeeply(defaultOptions, customConfig);
516
- defaultOptions = configUtil.extendDeeply(defaultOptions, tableDefaultConfig);
517
-
518
- if (opts.path) {
519
- // defaultOptions.filterInput = true;
520
- defaultOptions.pagerConfig.autoHidden = false;
521
- defaultOptions.proxyConfig = {
522
- seq: true, // 启用动态序号代理
523
- sort: true, // 启用排序代理
524
- filter: true, // 启用筛选代理
525
- props: {
526
- result: "objx.records", // 配置响应结果列表字段
527
- total: "objx.total", // 配置响应结果总页数字段
528
- },
529
- ajax: {
530
- // 接收 Promise 对象
531
- query: ({page, sorts, filters, form}) => {
532
- if (!opts.path) {
533
- return;
534
- }
535
- return new Promise((resolve, reject) => {
536
- let toDo = () => {
537
- let formData = opts.param ? opts.param() || {} : {};
538
- const queryParams = Object.assign({}, formData);
539
-
540
- // 处理排序条件
541
- const firstSort = sorts[0];
542
- if (firstSort) {
543
- queryParams.sort = firstSort.property;
544
- queryParams.order = firstSort.order;
545
- }
546
- // 处理筛选条件
547
- filters.forEach(({property, values}) => {
548
- queryParams[property] = values.join(",");
549
- });
550
- if (page.pageSize !== undefined) {
551
- queryParams["size"] = `${page.pageSize}`;
552
- queryParams["current"] = `${page.currentPage}`;
553
- }
554
-
555
- var $grid = getGrid(that, opts.tableRef);
556
- let isQueryAllPage = $grid.isQueryAllPage;
557
- let pathStr1 = "";
558
- if (isQueryAllPage === false) {
559
- queryParams.searchCount = false;
560
- }
561
-
562
- var reqPath = typeof path == "function" ? path() : path;
563
- that.$commonHttp({
564
- aes: opts.aes || false,
565
- url: reqPath,
566
- method: "post",
567
- data: queryParams,
568
- addCreateInfo: opts.addCreateInfo,
569
- queryCreateInfo: opts.queryCreateInfo,
570
- callback: (res) => {
571
- resolve(res);
572
- if (res.type == "success") {
573
- let rows = res.objx ? res.objx.records || res.objx || [] : [];
574
- if (opts.treeNodeUrl) {
575
- if (rows.length > 0) {
576
- let $t = getGrid(that, opts.tableRef);
577
- var treeConditions = $t.originOption.treeConditions || [
578
- "enabled",
579
- ];
580
- let treeFiled = Object.keys(formData).some((key) => {
581
- return (
582
- !treeConditions.includes(key)
583
- && formData[key] != null
584
- && formData[key] != ""
585
- );
586
- });
587
- if (treeFiled) {
588
- that.$nextTick(() => {
589
- setTimeout(function () {
590
- let isLazy = $t.treeConfig.lazy;
591
- $t.treeConfig.lazy = false;
592
- $t.setAllTreeExpand(true).then(() => {
593
- let fullAllDataRowMap
594
- = $t.$refs.xTable.fullAllDataRowMap;
595
- let fullData = $t.getTableData().fullData;
596
- fullData.forEach((lineData) => {
597
- if (
598
- $t.$refs.xTable.isTreeExpandByRow(lineData)
599
- ) {
600
- var rest = fullAllDataRowMap.get(lineData);
601
- rest.treeLoaded = true;
602
- }
603
- });
604
- $t.treeConfig.lazy = isLazy;
605
- });
606
- }, 0);
607
- });
608
- } else {
609
- let row = rows[0];
610
- if (row[result.treeConfig.hasChild]) {
611
- that.$nextTick(() => {
612
- setTimeout(function () {
613
- $t.setTreeExpand(row, true);
614
- }, 0);
615
- });
616
- }
617
- }
618
- }
619
- }
620
- if (opts.callback) {
621
- that.$nextTick(() => {
622
- setTimeout(function () {
623
- opts.callback(rows);
624
- }, 0);
625
- });
626
- }
627
- }
628
- },
629
- error: (error) => {
630
- reject(error);
631
- },
632
- });
633
- };
634
- let index = 0;
635
- let loopHandle = () => {
636
- if (index < 500 && $grid.tableFormStop === true) {
637
- //阻塞列表查询,或者次数达到500时,自动释放
638
- index++
639
- setTimeout(() => {
640
- loopHandle();
641
- }, 10)
642
- } else {
643
- if ($grid.tableFormStop) $grid.tableFormStop = false;
644
- toDo();
645
- }
646
- }
647
- loopHandle();
648
- });
649
-
650
- },
651
- // 被某些特殊功能所触发,例如:导出数据 mode=all 时,会触发该方法并对返回的数据进行导出
652
- queryAll: () => fetch(path || "").then((response) => response.json()),
653
- },
654
- };
655
- /*defaultOptions.scrollX = {
656
- enabled: true,
657
- gt: 20
658
- };*/
659
- defaultOptions.scrollY = {
660
- enabled: true,
661
- gt: 20
662
- };
663
- } else {
664
- if (!$grid.height && (!opts.config || !opts.config.height)) {
665
- defaultOptions.maxHeight = "528px";
666
- }
667
- defaultOptions.scrollY = {
668
- enabled: true,
669
- gt: 50,
670
- };
671
- }
672
-
673
- if (opts.editSaveUrl) {
674
- (defaultOptions.keepSource = true),
675
- (defaultOptions.editConfig = {
676
- trigger: "manual",
677
- mode: "row",
678
- showStatus: true,
679
- autoClear: false,
680
- });
681
- }
682
- if (opts.treeNodeUrl) {
683
- defaultOptions.proxyConfig.props.result = "objx";
684
- defaultOptions.pagerConfig.autoHidden = true;
685
- defaultOptions.treeConfig = {
686
- lazy: true,
687
- children: "children",
688
- hasChild: "hasChild", // 设置是否有子节点标识
689
- parentField: "parent",
690
- transform: true,
691
- loadMethod({$table, row}) {
692
- // 模拟后台接口
693
- return new Promise((resolve, reject) => {
694
- let treeNodeParam = opts.treeNodeParam
695
- ? opts.treeNodeParam(row) || {}
696
- : {
697
- parent: row.id,
698
- };
699
- that.$http({
700
- aes: opts.aes || false,
701
- url: opts.treeNodeUrl,
702
- method: "post",
703
- data: treeNodeParam,
704
- callback: (res) => {
705
- if (res.type == "success") {
706
- // let rows = res.objx || [];
707
- let rows = res.objx ? res.objx.records || res.objx || [] : [];
708
- let hasChildField = $grid.treeConfig.hasChild;
709
- if (row[hasChildField] && !rows.length) {
710
- row[hasChildField] = false;
711
- }
712
- resolve(rows);
713
- if (opts.treeCallback) {
714
- that.$nextTick(() => {
715
- setTimeout(function () {
716
- opts.treeCallback(rows);
717
- }, 0);
718
- });
719
- }
720
- } else {
721
- reject(res);
722
- }
723
- },
724
- });
725
- });
726
- },
727
- };
728
- }
729
-
730
- result = configUtil.extendDeeply(defaultOptions, config);
731
-
732
- let pageSize = result.pagerConfig.pageSize;
733
- let pageSizes = result.pagerConfig.pageSizes;
734
- if (pageSizes && !pageSizes.includes(pageSize)) {
735
- for (let i = 0; i < pageSizes.length; i++) {
736
- let item = pageSizes[i];
737
- if (item > pageSize) {
738
- pageSizes.splice(i, 0, pageSize);
739
- break;
740
- }
741
- }
742
- }
743
-
744
- return result;
745
- }
746
-
747
- function getTableJson(tableName, that, success) {
748
- if (configUtil.tableConfig.disableTableName) return false;
749
- if (!tableName) return;
750
- var url = USER_PREFIX + "/table_column/getTableJson";
751
- var data = {
752
- tableName: tableName,
753
- };
754
- var json = null;
755
- return that.$http({
756
- url: url,
757
- method: "post",
758
- data: data,
759
- success: success,
760
- });
761
- }
762
-
763
- function addTableExportJson() {
764
-
765
- }
766
-
767
- function addTableJson(that, $grid, tableName, columns, success) {
768
- if (configUtil.tableConfig.disableTableName) return false;
769
- if (!tableName) return;
770
- if (!columns) {
771
- columns = $grid.getTableColumn().fullColumn;
772
- }
773
- let saveColumn = [];
774
- columns.forEach(function (item, index) {
775
- saveColumn.push({
776
- field: item.field || item.property,
777
- title: item.title,
778
- visible: item.visible,
779
- width: item.renderWidth || item.width,
780
- });
781
- });
782
-
783
- let searchColumns = $grid.searchColumns || [];
784
- let jsonData = {
785
- columns: saveColumn,
786
- searchColumns: searchColumns
787
- }
788
- if ($grid.exportColumns && $grid.exportColumns.length) {
789
- jsonData.exportColumns = $grid.exportColumns;
790
- }
791
- let json = encodeURIComponent(JSON.stringify(jsonData))
792
-
793
- var url = USER_PREFIX + "/table_column/addTableJson";
794
- var data = {
795
- tableName: tableName,
796
- // json: encodeURIComponent(JSON.stringify(saveColumn)),
797
- json: json
798
- };
799
- that.$http({
800
- url: url,
801
- method: "post",
802
- data: data,
803
- success: success,
804
- });
805
- }
806
-
807
- function initColumn(option, syncColumns) {
808
- let oldColumns = option.columns;
809
- let newColumns = [];
810
- if (syncColumns) {
811
- let fields = [];
812
- syncColumns.forEach(function (syncColumn) {
813
- let field = syncColumn.field;
814
- if (field) {
815
- oldColumns.some(function (oldColumn) {
816
- let flag = oldColumn.field === field;
817
- if (flag) {
818
- if (option.visibleSync !== false) {
819
- oldColumn.visible = syncColumn.visible;
820
- }
821
- if (syncColumn.width) oldColumn.width = syncColumn.width;
822
- newColumns.push(oldColumn);
823
- fields.push(field);
824
- }
825
- return flag;
826
- });
827
- }
828
- });
829
- oldColumns.forEach(function (oldColumn, index) {
830
- let field = oldColumn.field;
831
- if (field) {
832
- if (!fields.includes(field)) {
833
- newColumns.splice(index, 0, oldColumn);
834
- }
835
- } else {
836
- newColumns.splice(index, 0, oldColumn);
837
- }
838
- });
839
- } else {
840
- newColumns = oldColumns;
841
- }
842
- return newColumns;
843
- }
844
-
845
- function initExportColumns($grid, json) {
846
- if (json?.exportColumns?.length) {
847
- $grid.exportColumns = json.exportColumns;
848
- }
849
- }
850
-
851
- function initSearchColumns(option, syncColumns) {
852
- let oldColumns = option.searchColumns || [];
853
- let newColumns = [];
854
- if (syncColumns) {
855
- let fields = [];
856
- syncColumns.forEach(function (syncColumn) {
857
- let field = syncColumn.field;
858
- if (field) {
859
- oldColumns.some(function (oldColumn) {
860
- let flag = oldColumn.field === field && !oldColumn.fixed;
861
- if (flag) {
862
- oldColumn.common = syncColumn.common || false;
863
- if (syncColumn.defaultValue !== undefined) {
864
- oldColumn.defaultValue = syncColumn.defaultValue;
865
- }
866
- newColumns.push(oldColumn);
867
- fields.push(field);
868
- }
869
- return flag;
870
- });
871
- }
872
- });
873
- oldColumns.forEach(function (oldColumn, index) {
874
- let field = oldColumn.field;
875
- if (field && !oldColumn.fixed) {
876
- if (!fields.includes(field)) {
877
- newColumns.splice(index, 0, oldColumn);
878
- }
879
- } else {
880
- newColumns.splice(index, 0, oldColumn);
881
- }
882
- });
883
- } else {
884
- newColumns = oldColumns;
885
- }
886
- return newColumns.length ? newColumns : oldColumns;
887
- }
888
-
889
- function onColumnWitchChange(option) {
890
- var that = option.$grid.$parent;
891
- var $grid = option.$grid;
892
- var originOption = $grid.originOption;
893
- let tableName = originOption.tableName;
894
- if (tableName) {
895
- // let columns = $grid.columns;
896
- const {fullColumn, tableColumn} = $grid.getTableColumn();
897
- addTableJson(that, $grid, tableName);
898
- }
899
- }
900
-
901
- function customHandle(option) {
902
- if (option.type == "confirm" || option.type == "reset") {
903
- let that = option.$grid.$parent;
904
- let $grid = option.$grid;
905
- var originOption = $grid.originOption;
906
- let tableName = originOption.tableName;
907
- if (option.type == "reset") {
908
- let columns = that.$baseLodash.cloneDeep(originOption.columns);
909
- initColumnDefaulAttrs(columns, originOption);
910
- $grid.columns = columns;
911
- // $grid.columns = originOption.columns;
912
- }
913
- if (tableName) {
914
- setTimeout(() => {
915
- const {fullColumn, tableColumn} = $grid.getTableColumn();
916
- addTableJson(that, $grid, tableName);
917
- }, 200);
918
- }
919
- if (option && option.$event && option.$event.preventDefault) {
920
- option.$event.preventDefault(); // 取消事件的默认行为
921
- }
922
- }
923
- }
924
-
925
- function changeSelectCount(checked) {
926
- var checkedLength = checked.records.length;
927
- }
928
-
929
- function getTableData(that, tableRef, type, success) {
930
- if (configUtil.tableConfig.disableTableName) return false;
931
- var $grid = getGrid(that, tableRef);
932
- var tableName = $grid.tableName;
933
- var url = USER_PREFIX + "/table_column/getTableData";
934
- var param = {
935
- tableName: tableName,
936
- type: type,
937
- };
938
- var data = null;
939
- return that.$http({
940
- async: false,
941
- url: url,
942
- method: "post",
943
- data: param,
944
- success: success,
945
- });
946
- }
947
-
948
- function addTableData(that, tableRef, value, success) {
949
- if (configUtil.tableConfig.disableTableName) return false;
950
- var $grid = getGrid(that, tableRef);
951
- var tableName = $grid.tableName;
952
- if (tableName) {
953
- that.$http({
954
- method: "post",
955
- url: USER_PREFIX + "/table_column/addTableData",
956
- data: {
957
- tableName: tableName,
958
- type: "isQueryAllPage",
959
- data: value,
960
- success: success,
961
- },
962
- });
963
- }
964
- }
965
-
966
- function checkQueryTotal(that, tableRef, value) {
967
- var $grid = getGrid(that, tableRef);
968
- $grid.isQueryAllPage = value;
969
- var tableName = $grid.tableName;
970
- var option = $grid.getProxyInfo();
971
- var pagerConfig = $grid.pagerConfig;
972
-
973
- $grid.pagerConfig.layouts = pagerConfig.layouts || [];
974
- addTableData(that, tableRef, value);
975
- $grid.commitProxy("query");
976
- }
977
-
978
- function getPagerConfigLayouts(opts) {
979
- if (opts.showPageSizes !== false) {
980
- return ["Sizes", "PrevPage", "JumpNumber", "NextPage"];
981
- } else {
982
- return ["PrevPage", "JumpNumber", "NextPage"];
983
- }
984
- }
985
-
986
- function getCellValue(obj) {
987
- let {column, $table} = obj;
988
- let params = createParams(obj);
989
- let h = $table.$createElement;
990
- let that = $table.$xegrid.originOption.vue;
991
-
992
- let cellValue;
993
- if (column.slots && column.slots.filterVal) {
994
- cellValue = column.slots.filterVal(params);
995
- } else {
996
- let result = column.renderCell(h, params);
997
- cellValue = vNodeRender(result);
998
- }
999
- return cellValue;
1000
- }
1001
-
1002
- function createParams(obj) {
1003
- let $xetable = obj.$table;
1004
- let {column, row} = obj;
1005
- let fixedType = $xetable.$refs.tableBody.fixedType,
1006
- afterFullData = $xetable.afterFullData,
1007
- tableData = $xetable.tableData;
1008
- var columnIndex = $xetable.getColumnIndex(column);
1009
- let items = tableData;
1010
-
1011
- var _columnIndex = $xetable.getVTColumnIndex(column);
1012
-
1013
- let overflowX = $xetable.overflowX;
1014
- var fixedHiddenColumn = fixedType
1015
- ? column.fixed !== fixedType
1016
- : column.fixed && overflowX;
1017
-
1018
- let tableColumn = $xetable.tableColumn,
1019
- scrollXLoad = $xetable.scrollXLoad,
1020
- scrollYLoad = $xetable.scrollYLoad,
1021
- allColumnOverflow = $xetable.showOverflow,
1022
- isAllOverflow = $xetable.isAllOverflow,
1023
- mergeList = $xetable.mergeList,
1024
- spanMethod = $xetable.spanMethod,
1025
- keyboardConfig = $xetable.keyboardConfig,
1026
- keyboardOpts = $xetable.keyboardOpts,
1027
- fixedColumn = $xetable.$refs.tableBody.fixedColumn,
1028
- visibleColumn = $xetable.visibleColumn;
1029
-
1030
- if (obj.tableColumn == null) {
1031
- if (fixedType) {
1032
- if (
1033
- scrollXLoad
1034
- || scrollYLoad
1035
- || (allColumnOverflow ? isAllOverflow : allColumnOverflow)
1036
- ) {
1037
- if (
1038
- !mergeList.length
1039
- && !spanMethod
1040
- && !(keyboardConfig && keyboardOpts.isMerge)
1041
- ) {
1042
- tableColumn = fixedColumn;
1043
- } else {
1044
- tableColumn = visibleColumn; // 检查固定列是否被合并,合并范围是否超出固定列
1045
- // if (mergeList.length && !isMergeLeftFixedExceeded && fixedType === 'left') {
1046
- // tableColumn = fixedColumn
1047
- // } else if (mergeList.length && !isMergeRightFixedExceeded && fixedType === 'right') {
1048
- // tableColumn = fixedColumn
1049
- // } else {
1050
- // tableColumn = visibleColumn
1051
- // }
1052
- }
1053
- } else {
1054
- tableColumn = visibleColumn;
1055
- }
1056
- }
1057
- } else {
1058
- tableColumn = obj.tableColumn;
1059
- }
1060
-
1061
- var rowid = $xetable.getRowid(row);
1062
- let fullAllDataRowIdData = $xetable.fullAllDataRowIdData;
1063
- var rest = fullAllDataRowIdData[rowid];
1064
- var rowLevel = rest ? rest.level : 0;
1065
- var seq = rest ? rest.seq : -1;
1066
- var renderType = "body";
1067
-
1068
- let $rowIndex = obj.$rowIndex;
1069
- if ($rowIndex == null) {
1070
- tableData.some(function (item, index) {
1071
- let flag = rowid == $xetable.getRowid(item);
1072
- if (flag) {
1073
- $rowIndex = index;
1074
- }
1075
- return flag;
1076
- });
1077
- }
1078
-
1079
- let $columnIndex = obj.$columnIndex;
1080
- if ($columnIndex == null) {
1081
- tableColumn.some(function (item, index) {
1082
- let flag = column.id == item.id;
1083
- if (flag) {
1084
- $columnIndex = index;
1085
- }
1086
- return flag;
1087
- });
1088
- }
1089
-
1090
- var _rowIndex = $xetable.getVTRowIndex(row); // 确保任何情况下 rowIndex 都精准指向真实 data 索引
1091
- var rowIndex = $xetable.getRowIndex(row); // 事件绑定
1092
- var params = {
1093
- $table: $xetable,
1094
- seq: seq,
1095
- rowid: rowid,
1096
- row: row,
1097
- rowIndex: rowIndex,
1098
- $rowIndex: $rowIndex,
1099
- _rowIndex: _rowIndex,
1100
- column: column,
1101
- columnIndex: columnIndex,
1102
- $columnIndex: $columnIndex,
1103
- _columnIndex: _columnIndex,
1104
- fixed: fixedType,
1105
- type: renderType,
1106
- isHidden: fixedHiddenColumn,
1107
- level: rowLevel,
1108
- visibleData: afterFullData,
1109
- data: tableData,
1110
- items: items,
1111
- };
1112
- return params;
1113
- }
1114
-
1115
- let TempSoltConstructor = configUtil.Vue.extend(configUtil.CellSlot);
1116
-
1117
- function vNodeRender(vNodes) {
1118
- if (vNodes == null) {
1119
- return null;
1120
- }
1121
- let type = typeof vNodes;
1122
- if (type == "string" || type == "number") {
1123
- return vNodes;
1124
- }
1125
-
1126
- let loop = function (item) {
1127
- if (item && item.children && item.children.length > 0) {
1128
- let arr = [];
1129
- item.children.forEach((child) => {
1130
- let text = loop(child);
1131
- if (text != null) {
1132
- arr.push(text);
1133
- }
1134
- });
1135
- return arr.join("");
1136
- } else {
1137
- if (item.text != null) {
1138
- return item.text;
1139
- }
1140
- }
1141
- };
1142
-
1143
- let contents = [];
1144
- let instance;
1145
- vNodes.forEach(function (vNode) {
1146
- if (vNode.componentOptions) {
1147
- // instance = new TempSoltConstructor({i18n: window.$vueRoot._i18n});
1148
- instance = new TempSoltConstructor();
1149
- instance.$slots.default = vNode;
1150
- instance.$mount();
1151
- let cellValue = "";
1152
- if (vNode.componentInstance && vNode.componentInstance.$el) {
1153
- cellValue = domRender(vNode.componentInstance.$el);
1154
- }
1155
- contents.push(cellValue);
1156
- instance = null;
1157
- } else {
1158
- if (vNode && vNode.children && vNode.children.length > 0) {
1159
- let text = loop(vNode);
1160
- if (text != null) {
1161
- contents.push(text);
1162
- }
1163
- } else {
1164
- if (vNode.text != null) {
1165
- contents.push(vNode.text);
1166
- }
1167
- }
1168
- }
1169
- });
1170
- return contents.join("").trim();
1171
- }
1172
-
1173
- function groupDomRender(dom) {
1174
- let contents = [];
1175
- let loop = function (item) {
1176
- if (item && item.children && item.children.length > 0) {
1177
- let arr = [];
1178
- Array.from(item.children).forEach((child) => {
1179
- let text = loop(child);
1180
- if (text != null) {
1181
- arr.push(text);
1182
- }
1183
- });
1184
- return arr.join("");
1185
- } else {
1186
- var style = window.getComputedStyle(item); //el即DOM元素
1187
- let classList = Array.from(item.classList);
1188
- if (style.display === "none") {
1189
- } else if (item.nodeName == "INPUT") {
1190
- if (item.type == "radio") {
1191
- if (item.checked && classList.includes("el-radio__original")) {
1192
- let value = item.parentNode.parentNode.innerText || "";
1193
- if (value) {
1194
- contents.push(value);
1195
- }
1196
- }
1197
- } else if (item.type == "checkbox") {
1198
- if (item.checked && classList.includes("el-checkbox__original")) {
1199
- let value = item.parentNode.parentNode.innerText || "";
1200
- if (value) {
1201
- contents.push(value);
1202
- }
1203
- }
1204
- }
1205
- }
1206
- }
1207
- };
1208
- loop(dom);
1209
- return contents.join(",");
1210
- }
1211
-
1212
- function selectGroupRender(dom) {
1213
- let ul = dom.querySelector(".el-select-dropdown__list");
1214
- if (ul) {
1215
- let lis = ul.children;
1216
- if (lis) {
1217
- return Array.from(lis)
1218
- .filter((li) => {
1219
- let classList = Array.from(li.classList);
1220
- return classList.includes("selected");
1221
- })
1222
- .map((li) => {
1223
- return li.innerText;
1224
- })
1225
- .join(",");
1226
- } else {
1227
- return "";
1228
- }
1229
- } else {
1230
- return "";
1231
- }
1232
- }
1233
-
1234
- function domRender(dom) {
1235
- let loop = function (item) {
1236
- var style = window.getComputedStyle(item); //el即DOM元素
1237
- let role = item.getAttribute("role");
1238
- let classList = Array.from(item.classList);
1239
-
1240
- if (style.display === "none") {
1241
- return "";
1242
- } else if (role == "group") {
1243
- return groupDomRender(item);
1244
- } else if (role == "radiogroup") {
1245
- return groupDomRender(item);
1246
- } else if (
1247
- classList.includes("el-select")
1248
- && item["@@clickoutsideContext"]
1249
- ) {
1250
- return selectGroupRender(item);
1251
- } else if (item && item.children && item.children.length > 0) {
1252
- let arr = [];
1253
- Array.from(item.children).forEach((child) => {
1254
- let text = loop(child);
1255
- if (text != null) {
1256
- arr.push(text);
1257
- }
1258
- });
1259
- return arr.join("");
1260
- } else {
1261
- if (item.nodeName == "INPUT") {
1262
- return item.value;
1263
- } else if (item.innerText != null && item.innerText != "") {
1264
- return item.innerText;
1265
- } else {
1266
- return "";
1267
- }
1268
- }
1269
- };
1270
- let res = loop(dom).trim();
1271
- return res;
1272
- }
1273
-
1274
- modules = {
1275
- initVxeTable,
1276
- columnDrop,
1277
- initOption,
1278
- getTableJson,
1279
- addTableJson,
1280
- onColumnWitchChange,
1281
- customHandle,
1282
- changeSelectCount,
1283
- getTableData,
1284
- addTableData,
1285
- checkQueryTotal,
1286
- getCellValue,
1287
- createParams,
1288
- };
1289
-
1290
- if (!configUtil.Vue.prototype.$vxeTableUtil)
1291
- configUtil.Vue.prototype.$vxeTableUtil = modules;
1292
-
1293
- export default modules;
1
+ /**version-1.0*/
2
+ let modules = {};
3
+ import Sortable from "sortablejs";
4
+ import tableConfig from "./config.js";
5
+ import customConfig from "./customConfig.js";
6
+ import Vue from "vue";
7
+ import {extendDeeply} from "../../utils/index.js";
8
+ import corejsConfig from "@/corejsConfig";
9
+ import settingConfig from "@/settings.js";
10
+ import {getCellValue, createParams} from "./util/index";
11
+
12
+ let configUtil = {
13
+ Sortable,
14
+ extendDeeply,
15
+ tableConfig,
16
+ Vue,
17
+ };
18
+
19
+ function getGrid(that, tableRef) {
20
+ var $grid;
21
+ if (Array.isArray(that.$refs[tableRef])) {
22
+ $grid = that.$refs[tableRef][0];
23
+ } else {
24
+ $grid = that.$refs[tableRef];
25
+ }
26
+ return $grid;
27
+ }
28
+
29
+ async function initVxeTable(option) {
30
+ let tableName = option.tableName;
31
+ if (
32
+ !configUtil.tableConfig.disableTableName
33
+ && option.tableNameRequired !== false
34
+ && !tableName
35
+ && settingConfig.tableStorageDisabled !== true
36
+ ) {
37
+ return false;
38
+ }
39
+ var that = option.vue;
40
+ if (!that.$refs[option.tableRef]) {
41
+ await that.$nextTick();
42
+ }
43
+ var $grid = getGrid(that, option.tableRef);
44
+ if (!$grid) {
45
+ return false;
46
+ }
47
+ delete option.vue;
48
+
49
+ //操作列自动补全
50
+ handleCustomAlign(option);
51
+
52
+ $grid.originOption = that.$baseLodash.cloneDeep(option);
53
+ $grid.originOption.vue = that;
54
+ option.vue = that;
55
+
56
+ var isQueryAllPage = true;
57
+ if (option.isQueryAllPage != null) {
58
+ isQueryAllPage = option.isQueryAllPage;
59
+ }
60
+
61
+ if (tableName) {
62
+ $grid.tableName = tableName;
63
+ if (option.path) {
64
+ await getTableData(that, option.tableRef, "isQueryAllPage", (res1) => {
65
+ let result = res1.objx ? res1.objx.data : null;
66
+ if (result != null) {
67
+ if (result === "false" || result == false) {
68
+ isQueryAllPage = false;
69
+ } else {
70
+ isQueryAllPage = true;
71
+ }
72
+ }
73
+ });
74
+ }
75
+ await getTableJson(tableName, that, (resultMsg) => {
76
+ var objx = resultMsg.objx;
77
+ if (objx != null) {
78
+ let jsonStr = objx.data;
79
+ if (jsonStr) {
80
+ let json = JSON.parse(decodeURIComponent(jsonStr));
81
+ let columnData = json.columns ? json.columns : json;
82
+ if (columnData) {
83
+ option.columns = initColumn(option, columnData);
84
+ }
85
+ $grid.searchColumns = initSearchColumns(option, json.searchColumns);
86
+ initExportColumns($grid, json);
87
+ }
88
+ }
89
+ if (!$grid.searchColumns || !$grid.searchColumns.length) {
90
+ $grid.searchColumns = initSearchColumns(option);
91
+ }
92
+ });
93
+ } else {
94
+ $grid.searchColumns = initSearchColumns(option);
95
+ }
96
+ if(!!$grid?.$refs?.xTable){
97
+ $grid.$refs.xTable.getCellValue = getCellValue;
98
+ $grid.$refs.xTable.createParams = createParams;
99
+ }
100
+
101
+ $grid.getCellValue = getCellValue;
102
+ $grid.createParams = createParams;
103
+
104
+ option.isQueryAllPage = isQueryAllPage;
105
+ let nOption = initOption(option);
106
+
107
+ $grid.isQueryAllPage = isQueryAllPage;
108
+
109
+ if (tableName) {
110
+ nOption.tableName = tableName;
111
+ }
112
+
113
+ nOption.vue = that;
114
+ //绑定列位置拖拽
115
+ columnDrop(that, tableName, option.tableRef);
116
+
117
+ //自动绑定toobar
118
+ handleToolbar($grid, option);
119
+
120
+ return nOption;
121
+ }
122
+
123
+ //自动绑定toobar
124
+ function handleToolbar($grid, option) {
125
+ let selfConfig = getSelfConfig();
126
+ if (
127
+ option.bindToolbar
128
+ || (option.bindToolbar !== false && selfConfig.bindToolbar)
129
+ ) {
130
+ let loopDo = function (children) {
131
+ if (children && children.length) {
132
+ children.forEach((item) => {
133
+ if (item.$options.name == "VxeToolbar") {
134
+ $grid.connect(item);
135
+ } else {
136
+ loopDo(item.$children);
137
+ }
138
+ });
139
+ }
140
+ };
141
+ that.$nextTick(() => {
142
+ loopDo($grid.$children);
143
+ });
144
+ }
145
+ }
146
+
147
+ //操作列自动补全
148
+ function handleCustomAlign(option) {
149
+ let selfConfig = getSelfConfig();
150
+ // let customAlign = option.customAlign || selfConfig.customAlign || "right";
151
+ let customAlign
152
+ = selfConfig.customAlign === false
153
+ ? false
154
+ : selfConfig.customAlign || "right";
155
+ customAlign
156
+ = option.customAlign === false ? false : option.customAlign || customAlign;
157
+
158
+ let customColumnWidth
159
+ = option.customColumnWidth || selfConfig.customColumnWidth || 47;
160
+ let checkBoxColumnWidth
161
+ = option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
162
+
163
+ let checkBoxRequired = selfConfig.checkBoxRequired !== false;
164
+ if (option.checkBoxRequired === false) {
165
+ checkBoxRequired = false;
166
+ }
167
+
168
+ let columnSize = option.columns.length;
169
+ if (columnSize > 0) {
170
+ if (checkBoxRequired) {
171
+ let firstColumn = option.columns[0];
172
+ if (firstColumn.type != "checkbox") {
173
+ option.columns.splice(0, 0, {
174
+ type: "checkbox",
175
+ width: checkBoxColumnWidth,
176
+ resizable: false,
177
+ fixed: "left",
178
+ });
179
+ }
180
+ }
181
+ if (customAlign !== false) {
182
+ let lastColumn = option.columns[columnSize - 1];
183
+ if (customAlign == "left") {
184
+ if (!lastColumn.field && lastColumn.fixed == "right") {
185
+ option.columns.splice(columnSize - 1, 1);
186
+ lastColumn.fixed = "left";
187
+ option.columns.splice(1, 0, lastColumn);
188
+ } else if (columnSize > 1) {
189
+ if (option.columns[1].field) {
190
+ option.columns.splice(1, 0, {
191
+ width: customColumnWidth,
192
+ fixed: "left",
193
+ title: "",
194
+ sortable: false,
195
+ });
196
+ }
197
+ }
198
+ } else if (customAlign == "right") {
199
+ let column1 = option.columns[1];
200
+ if (!column1.field && column1.fixed == "left") {
201
+ option.columns.splice(1, 1);
202
+ column1.fixed = "right";
203
+ option.columns.push(column1);
204
+ } else if (lastColumn.field || lastColumn.fixed != "right") {
205
+ option.columns.push({
206
+ width: customColumnWidth,
207
+ fixed: "right",
208
+ title: "",
209
+ sortable: false,
210
+ });
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }
216
+
217
+ //列位置拖拽
218
+ function columnDrop(t, tableName, tableRef) {
219
+ var that = t;
220
+ const $table = getGrid(that, tableRef);
221
+ if (!$table) {
222
+ return;
223
+ }
224
+ if ($table.sortable) {
225
+ $table.sortable.destroy();
226
+ }
227
+ $table.sortable = configUtil.Sortable.create(
228
+ $table.$el.querySelector(
229
+ ".body--wrapper>.vxe-table--header .vxe-header--row"
230
+ ),
231
+ {
232
+ handle: ".vxe-header--column:not(.col--fixed)",
233
+ onEnd: ({item, newIndex, oldIndex}) => {
234
+ const {fullColumn, tableColumn} = $table.getTableColumn();
235
+ const targetThElem = item;
236
+ const wrapperElem = targetThElem.parentNode;
237
+ const newColumn = fullColumn[newIndex];
238
+ if (newColumn.fixed) {
239
+ // 错误的移动
240
+ if (newIndex > oldIndex) {
241
+ wrapperElem.insertBefore(
242
+ targetThElem,
243
+ wrapperElem.children[oldIndex]
244
+ );
245
+ } else {
246
+ wrapperElem.insertBefore(
247
+ wrapperElem.children[oldIndex],
248
+ targetThElem
249
+ );
250
+ }
251
+ return;
252
+ /* return that.$XModal.message({
253
+ content: '固定列不允许拖动!',
254
+ status: 'error'
255
+ }) */
256
+ }
257
+ // 转换真实索引
258
+ const oldColumnIndex = $table.getColumnIndex(tableColumn[oldIndex]);
259
+ const newColumnIndex = $table.getColumnIndex(tableColumn[newIndex]);
260
+ // 移动到目标列
261
+ const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
262
+ fullColumn.splice(newColumnIndex, 0, currRow);
263
+
264
+ $table.loadColumn(fullColumn);
265
+ addTableJson(that, $table, tableName, fullColumn);
266
+ },
267
+ }
268
+ );
269
+ }
270
+
271
+ function getSelfConfig() {
272
+ let tableConfig = configUtil.tableConfig || {};
273
+ let selfConfig = tableConfig.selfConfig || {};
274
+ return selfConfig;
275
+ }
276
+
277
+ function initColumnDefaulAttrs(columns, opts) {
278
+ if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
279
+ for (let i = 0; i < columns.length; i++) {
280
+ if (columns[i].title && columns[i].sortable == null) {
281
+ columns[i].sortable = true;
282
+ }
283
+ }
284
+ }
285
+
286
+ let tableConfig = configUtil.tableConfig || {};
287
+ let selfConfig = getSelfConfig();
288
+ if (opts.filterType !== false && !opts.treeNodeUrl) {
289
+ let filterType
290
+ = opts.filterType || selfConfig.filterType || "filterContent";
291
+ if (filterType) {
292
+ columns.forEach((column) => {
293
+ if (column.title && column.field) {
294
+ if (
295
+ column.filterType == "filterContent"
296
+ || (column.filterType == null && filterType == "filterContent")
297
+ ) {
298
+ if (!column.filters) {
299
+ column.filters = [
300
+ {
301
+ data: {},
302
+ },
303
+ ];
304
+ }
305
+ if (!column.filterRender) {
306
+ column.filterRender = {
307
+ name: "FilterContent",
308
+ };
309
+ }
310
+ } else if (
311
+ column.filterType === "filterInput"
312
+ || (column.filterType == null && filterType == "filterInput")
313
+ ) {
314
+ if (!column.filters) {
315
+ column.filters = [
316
+ {
317
+ data: "",
318
+ },
319
+ ];
320
+ }
321
+ if (!column.filterRender) {
322
+ column.filterRender = {
323
+ name: "FilterInput",
324
+ };
325
+ }
326
+ }
327
+ }
328
+ });
329
+ }
330
+ }
331
+
332
+ //设置复选框列的锁定宽度
333
+ if (opts.lockCheckboxWidth !== false) {
334
+ let lockCheckboxWidth
335
+ = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
336
+ if (lockCheckboxWidth) {
337
+ columns.forEach((column) => {
338
+ if (column.type == "checkbox") {
339
+ column.width = lockCheckboxWidth;
340
+ }
341
+ });
342
+ }
343
+ }
344
+ }
345
+
346
+ function initOption(opts) {
347
+ let result = {};
348
+ var that = opts.vue;
349
+ var $grid = getGrid(that, opts.tableRef);
350
+
351
+ let path = opts.path || "";
352
+ // let columns = JSON.parse(JSON.stringify(opts.columns || []));
353
+ let columns = opts.columns || [];
354
+ let isQueryAllPage = opts.isQueryAllPage;
355
+ var pagerLayouts = getPagerConfigLayouts(opts);
356
+
357
+ let config = opts.config || {};
358
+
359
+ initColumnDefaulAttrs(columns, opts);
360
+ /*if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
361
+ for (let i = 0; i < columns.length; i++) {
362
+ if (columns[i].title && columns[i].sortable == null) {
363
+ columns[i].sortable = true;
364
+ }
365
+ }
366
+ }
367
+
368
+ let tableConfig = configUtil.tableConfig || {};
369
+ let selfConfig = getSelfConfig();
370
+ if (opts.filterType !== false && !opts.treeNodeUrl) {
371
+ let filterType
372
+ = opts.filterType || selfConfig.filterType || "filterContent";
373
+ if (filterType) {
374
+ columns.forEach((column) => {
375
+ if (column.title && column.field) {
376
+ if (
377
+ column.filterType == "filterContent"
378
+ || (column.filterType == null && filterType == "filterContent")
379
+ ) {
380
+ if (!column.filters) {
381
+ column.filters = [
382
+ {
383
+ data: {},
384
+ },
385
+ ];
386
+ }
387
+ if (!column.filterRender) {
388
+ column.filterRender = {
389
+ name: "FilterContent",
390
+ };
391
+ }
392
+ } else if (
393
+ column.filterType === "filterInput"
394
+ || (column.filterType == null && filterType == "filterInput")
395
+ ) {
396
+ if (!column.filters) {
397
+ column.filters = [
398
+ {
399
+ data: "",
400
+ },
401
+ ];
402
+ }
403
+ if (!column.filterRender) {
404
+ column.filterRender = {
405
+ name: "FilterInput",
406
+ };
407
+ }
408
+ }
409
+ }
410
+ });
411
+ }
412
+ }
413
+
414
+ //设置复选框列的锁定宽度
415
+ if (opts.lockCheckboxWidth !== false) {
416
+ let lockCheckboxWidth = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
417
+ if (lockCheckboxWidth) {
418
+ columns.forEach((column) => {
419
+ if (column.type == 'checkbox') {
420
+ column.width = lockCheckboxWidth;
421
+ }
422
+ });
423
+ }
424
+ }*/
425
+
426
+ let defaultOptions = {
427
+ columnKey: true,
428
+ resizable: true,
429
+ showOverflow: true,
430
+ showHeaderOverflow: true,
431
+ showFooterOverflow: true,
432
+ highlightHoverRow: true,
433
+ border: "inner",
434
+ height: "auto",
435
+ // maxHeight:"1000px",
436
+ // rowId: 'id',
437
+ emptyText: " ",
438
+ sortConfig: {
439
+ trigger: "cell",
440
+ remote: false,
441
+ },
442
+ filterConfig: {
443
+ remote: false,
444
+ },
445
+ pagerConfig: {
446
+ autoHidden: true,
447
+ perfect: true,
448
+ pageSize: 200,
449
+ pageSizes: [50, 100, 200, 500],
450
+ layouts: pagerLayouts,
451
+ slots: {
452
+ left: (obj, b, c) => {
453
+ var $grid = obj.$grid;
454
+ let k = $grid.$data;
455
+ let tableDataInfo = $grid.getTableData();
456
+ let data = tableDataInfo.fullData;
457
+ let h = $grid.$createElement;
458
+
459
+ let proxyInfo = $grid.getProxyInfo();
460
+ let pager = proxyInfo ? proxyInfo.pager : null;
461
+
462
+ let celems = [
463
+ h("span", $grid.$t2("本页记录数", "components.table.currentNum")),
464
+ h(
465
+ "span",
466
+ {
467
+ attrs: {
468
+ class: "f-red",
469
+ },
470
+ },
471
+ " " + tableDataInfo.visibleData.length + " "
472
+ ),
473
+ ];
474
+ if (pager && $grid.isQueryAllPage) {
475
+ celems.push(
476
+ h(
477
+ "span",
478
+ "," + $grid.$t2("总记录数", "components.table.totalNum")
479
+ )
480
+ );
481
+ celems.push(
482
+ h(
483
+ "span",
484
+ {
485
+ attrs: {
486
+ class: "f-red",
487
+ },
488
+ },
489
+ " " + pager.total + " "
490
+ )
491
+ );
492
+ }
493
+ let elem = h("span", {}, celems);
494
+ return [elem];
495
+ },
496
+ },
497
+ },
498
+ exportConfig: {
499
+ // 默认选中类型
500
+ type: "xlsx",
501
+ // 局部自定义类型
502
+ types: ["xlsx", "csv", "html", "xml", "txt"],
503
+ // 自定义数据量列表
504
+ modes: ["current", "all"],
505
+ },
506
+ radioConfig: {
507
+ labelField: "id",
508
+ reserve: true,
509
+ highlight: true,
510
+ },
511
+ checkboxConfig: {
512
+ highlight: true,
513
+ },
514
+ customConfig: {
515
+ storage: false,
516
+ },
517
+ scrollX: {
518
+ // enabled: true,
519
+ gt: 10,
520
+ // oSize: 5
521
+ },
522
+ /*loadingConfig: {
523
+ icon: "vxe-loading--spinner",
524
+ text: ' '
525
+ },*/
526
+ columns: columns,
527
+ };
528
+ let tableDefaultConfig
529
+ = corejsConfig?.componentConfig?.table?.defaultConfig || {};
530
+ defaultOptions = configUtil.extendDeeply(defaultOptions, tableConfig);
531
+ defaultOptions = configUtil.extendDeeply(defaultOptions, customConfig);
532
+ defaultOptions = configUtil.extendDeeply(defaultOptions, tableDefaultConfig);
533
+
534
+ if (opts.path) {
535
+ // defaultOptions.filterInput = true;
536
+ defaultOptions.pagerConfig.autoHidden = false;
537
+ defaultOptions.proxyConfig = {
538
+ seq: true, // 启用动态序号代理
539
+ sort: true, // 启用排序代理
540
+ filter: true, // 启用筛选代理
541
+ props: {
542
+ result: "objx.records", // 配置响应结果列表字段
543
+ total: "objx.total", // 配置响应结果总页数字段
544
+ },
545
+ ajax: {
546
+ // 接收 Promise 对象
547
+ query: ({page, sorts, filters, form}) => {
548
+ if (!opts.path) {
549
+ return;
550
+ }
551
+ return new Promise((resolve, reject) => {
552
+ let toDo = () => {
553
+ let formData = opts.param ? opts.param() || {} : {};
554
+ const queryParams = Object.assign({}, formData);
555
+
556
+ // 处理排序条件
557
+ /*const firstSort = sorts[0];
558
+ if (firstSort) {
559
+ queryParams.sort = firstSort.property;
560
+ queryParams.order = firstSort.order;
561
+ }*/
562
+ // 处理筛选条件
563
+ filters.forEach(({property, values}) => {
564
+ queryParams[property] = values.join(",");
565
+ });
566
+ if (page.pageSize !== undefined) {
567
+ queryParams["size"] = page.pageSize;
568
+ queryParams["current"] = page.currentPage;
569
+ }
570
+
571
+ var $grid = getGrid(that, opts.tableRef);
572
+ let isQueryAllPage = $grid.isQueryAllPage;
573
+ let pathStr1 = "";
574
+ if (isQueryAllPage === false) {
575
+ queryParams.searchCount = false;
576
+ }
577
+
578
+ var reqPath = typeof path == "function" ? path() : path;
579
+ let addUserForTableEnabled
580
+ = settingConfig.addUserForTableDisabled !== true;
581
+ let addCreateInfo
582
+ = opts.addCreateInfo === true || addUserForTableEnabled;
583
+ let queryCreateInfo
584
+ = opts.queryCreateInfo === true || addUserForTableEnabled;
585
+ that.$commonHttp({
586
+ aes: opts.aes || false,
587
+ url: reqPath,
588
+ method: "post",
589
+ data: queryParams,
590
+ addCreateInfo: addCreateInfo,
591
+ queryCreateInfo: queryCreateInfo,
592
+ callback: (res) => {
593
+ resolve(res);
594
+ if (res.type == "success") {
595
+ let rows = res.objx
596
+ ? res.objx.records || res.objx || []
597
+ : [];
598
+ if (opts.treeNodeUrl) {
599
+ if (rows.length > 0) {
600
+ let $t = getGrid(that, opts.tableRef);
601
+ var treeConditions = $t.originOption.treeConditions || [
602
+ "enabled",
603
+ ];
604
+ let treeFiled = Object.keys(formData).some((key) => {
605
+ return (
606
+ !treeConditions.includes(key)
607
+ && formData[key] != null
608
+ && formData[key] != ""
609
+ );
610
+ });
611
+ if (treeFiled) {
612
+ that.$nextTick(() => {
613
+ setTimeout(function () {
614
+ let isLazy = $t.treeConfig.lazy;
615
+ $t.treeConfig.lazy = false;
616
+ $t.setAllTreeExpand(true).then(() => {
617
+ let fullAllDataRowMap
618
+ = $t.$refs.xTable.fullAllDataRowMap;
619
+ let fullData = $t.getTableData().fullData;
620
+ fullData.forEach((lineData) => {
621
+ if (
622
+ $t.$refs.xTable.isTreeExpandByRow(lineData)
623
+ ) {
624
+ var rest = fullAllDataRowMap.get(lineData);
625
+ rest.treeLoaded = true;
626
+ }
627
+ });
628
+ $t.treeConfig.lazy = isLazy;
629
+ });
630
+ }, 0);
631
+ });
632
+ } else {
633
+ let row = rows[0];
634
+ if (row[result.treeConfig.hasChild]) {
635
+ that.$nextTick(() => {
636
+ setTimeout(function () {
637
+ $t.setTreeExpand(row, true);
638
+ }, 0);
639
+ });
640
+ }
641
+ }
642
+ }
643
+ }
644
+ if (opts.callback) {
645
+ that.$nextTick(() => {
646
+ setTimeout(function () {
647
+ opts.callback(rows);
648
+ }, 0);
649
+ });
650
+ }
651
+ }
652
+ },
653
+ error: (error) => {
654
+ reject(error);
655
+ },
656
+ });
657
+ };
658
+ let index = 0;
659
+ let loopHandle = () => {
660
+ if (index < 500 && $grid.tableFormStop === true) {
661
+ //阻塞列表查询,或者次数达到500时,自动释放
662
+ index++;
663
+ setTimeout(() => {
664
+ loopHandle();
665
+ }, 10);
666
+ } else {
667
+ if ($grid.tableFormStop) $grid.tableFormStop = false;
668
+ toDo();
669
+ }
670
+ };
671
+ loopHandle();
672
+ });
673
+ },
674
+ // 被某些特殊功能所触发,例如:导出数据 mode=all 时,会触发该方法并对返回的数据进行导出
675
+ queryAll: () => fetch(path || "").then((response) => response.json()),
676
+ },
677
+ };
678
+ /*defaultOptions.scrollX = {
679
+ enabled: true,
680
+ gt: 20
681
+ };*/
682
+ defaultOptions.scrollY = {
683
+ // enabled: false,
684
+ gt: 20,
685
+ oSize: 20,
686
+ };
687
+ } else {
688
+ if (!$grid.height && (!opts.config || !opts.config.height)) {
689
+ defaultOptions.maxHeight = "528px";
690
+ }
691
+ defaultOptions.scrollY = {
692
+ // enabled: false,
693
+ gt: 20,
694
+ oSize: 20,
695
+ };
696
+ }
697
+
698
+ if (opts.editSaveUrl) {
699
+ (defaultOptions.keepSource = true),
700
+ (defaultOptions.editConfig = {
701
+ trigger: "manual",
702
+ mode: "row",
703
+ showStatus: true,
704
+ autoClear: false,
705
+ });
706
+ }
707
+ if (opts.treeNodeUrl) {
708
+ defaultOptions.proxyConfig.props.result = "objx";
709
+ defaultOptions.pagerConfig.autoHidden = true;
710
+ defaultOptions.treeConfig = {
711
+ lazy: true,
712
+ children: "children",
713
+ hasChild: "hasChild", // 设置是否有子节点标识
714
+ parentField: "parent",
715
+ transform: true,
716
+ loadMethod({$table, row}) {
717
+ // 模拟后台接口
718
+ return new Promise((resolve, reject) => {
719
+ let treeNodeParam = opts.treeNodeParam
720
+ ? opts.treeNodeParam(row) || {}
721
+ : {
722
+ parent: row.id,
723
+ };
724
+ that.$http({
725
+ aes: opts.aes || false,
726
+ url: opts.treeNodeUrl,
727
+ method: "post",
728
+ data: treeNodeParam,
729
+ callback: (res) => {
730
+ if (res.type == "success") {
731
+ // let rows = res.objx || [];
732
+ let rows = res.objx ? res.objx.records || res.objx || [] : [];
733
+ let hasChildField = $grid.treeConfig.hasChild;
734
+ if (row[hasChildField] && !rows.length) {
735
+ row[hasChildField] = false;
736
+ }
737
+ resolve(rows);
738
+ if (opts.treeCallback) {
739
+ that.$nextTick(() => {
740
+ setTimeout(function () {
741
+ opts.treeCallback(rows);
742
+ }, 0);
743
+ });
744
+ }
745
+ } else {
746
+ reject(res);
747
+ }
748
+ },
749
+ });
750
+ });
751
+ },
752
+ };
753
+ }
754
+
755
+ result = configUtil.extendDeeply(defaultOptions, config);
756
+
757
+ let pageSize = result.pagerConfig.pageSize;
758
+ let pageSizes = result.pagerConfig.pageSizes;
759
+ if (pageSizes && !pageSizes.includes(pageSize)) {
760
+ for (let i = 0; i < pageSizes.length; i++) {
761
+ let item = pageSizes[i];
762
+ if (item > pageSize) {
763
+ pageSizes.splice(i, 0, pageSize);
764
+ break;
765
+ }
766
+ }
767
+ }
768
+
769
+ return result;
770
+ }
771
+
772
+ function getTableJson(tableName, that, success) {
773
+ if (
774
+ configUtil.tableConfig.disableTableName
775
+ || settingConfig.tableStorageDisabled
776
+ )
777
+ return false;
778
+ if (!tableName) return;
779
+ var url = USER_PREFIX + "/table_column/getTableJson";
780
+ var data = {
781
+ tableName: tableName,
782
+ };
783
+ var json = null;
784
+ return that.$http({
785
+ url: url,
786
+ method: "post",
787
+ data: data,
788
+ success: success,
789
+ });
790
+ }
791
+
792
+ function addTableExportJson() {
793
+ }
794
+
795
+ function addTableJson(that, $grid, tableName, columns, success) {
796
+ if (
797
+ configUtil.tableConfig.disableTableName
798
+ || settingConfig.tableStorageDisabled
799
+ )
800
+ return false;
801
+ if (!tableName) return;
802
+ if (!columns) {
803
+ columns = $grid.getTableColumn().fullColumn;
804
+ }
805
+ let saveColumn = [];
806
+ columns.forEach(function (item, index) {
807
+ saveColumn.push({
808
+ field: item.field || item.property,
809
+ title: item.title,
810
+ visible: item.visible,
811
+ width: item.renderWidth || item.width,
812
+ });
813
+ });
814
+
815
+ let searchColumns = $grid.searchColumns || [];
816
+ let jsonData = {
817
+ columns: saveColumn,
818
+ searchColumns: searchColumns,
819
+ };
820
+ if ($grid.exportColumns && $grid.exportColumns.length) {
821
+ jsonData.exportColumns = $grid.exportColumns;
822
+ }
823
+ let json = encodeURIComponent(JSON.stringify(jsonData));
824
+
825
+ var url = USER_PREFIX + "/table_column/addTableJson";
826
+ var data = {
827
+ tableName: tableName,
828
+ // json: encodeURIComponent(JSON.stringify(saveColumn)),
829
+ json: json,
830
+ };
831
+ that.$http({
832
+ url: url,
833
+ method: "post",
834
+ data: data,
835
+ success: success,
836
+ });
837
+ }
838
+
839
+ function initColumn(option, syncColumns) {
840
+ let oldColumns = option.columns;
841
+ let newColumns = [];
842
+ if (syncColumns) {
843
+ let fields = [];
844
+ syncColumns.forEach(function (syncColumn) {
845
+ let field = syncColumn.field;
846
+ if (field) {
847
+ oldColumns.some(function (oldColumn) {
848
+ let flag = oldColumn.field === field;
849
+ if (flag) {
850
+ let visibleSync
851
+ = option.visibleSync !== false && oldColumn.visibleSync !== false;
852
+ if (visibleSync) {
853
+ oldColumn.visible = syncColumn.visible;
854
+ }
855
+ if (syncColumn.width) oldColumn.width = syncColumn.width;
856
+ newColumns.push(oldColumn);
857
+ fields.push(field);
858
+ }
859
+ return flag;
860
+ });
861
+ }
862
+ });
863
+ oldColumns.forEach(function (oldColumn, index) {
864
+ let field = oldColumn.field;
865
+ if (field) {
866
+ if (!fields.includes(field)) {
867
+ newColumns.splice(index, 0, oldColumn);
868
+ }
869
+ } else {
870
+ newColumns.splice(index, 0, oldColumn);
871
+ }
872
+ });
873
+ } else {
874
+ newColumns = oldColumns;
875
+ }
876
+ return newColumns;
877
+ }
878
+
879
+ function initExportColumns($grid, json) {
880
+ if (json?.exportColumns?.length) {
881
+ $grid.exportColumns = json.exportColumns;
882
+ }
883
+ }
884
+
885
+ function initSearchColumns(option, syncColumns) {
886
+ let oldColumns = option.searchColumns || [];
887
+ let newColumns = [];
888
+ if (syncColumns) {
889
+ let fields = [];
890
+ syncColumns.forEach(function (syncColumn) {
891
+ let field = syncColumn.field;
892
+ if (field) {
893
+ oldColumns.some(function (oldColumn) {
894
+ let flag = oldColumn.field === field && !oldColumn.fixed;
895
+ if (flag) {
896
+ oldColumn.common = syncColumn.common || false;
897
+ if (syncColumn.defaultValue !== undefined) {
898
+ oldColumn.defaultValue = syncColumn.defaultValue;
899
+ }
900
+ newColumns.push(oldColumn);
901
+ fields.push(field);
902
+ }
903
+ return flag;
904
+ });
905
+ }
906
+ });
907
+ oldColumns.forEach(function (oldColumn, index) {
908
+ let field = oldColumn.field;
909
+ if (field && !oldColumn.fixed) {
910
+ if (!fields.includes(field)) {
911
+ newColumns.splice(index, 0, oldColumn);
912
+ }
913
+ } else {
914
+ newColumns.splice(index, 0, oldColumn);
915
+ }
916
+ });
917
+ } else {
918
+ newColumns = oldColumns;
919
+ }
920
+ return newColumns.length ? newColumns : oldColumns;
921
+ }
922
+
923
+ function onColumnWitchChange(option) {
924
+ var that = option.$grid.$parent;
925
+ var $grid = option.$grid;
926
+ var originOption = $grid.originOption;
927
+ let tableName = originOption.tableName;
928
+ if (tableName) {
929
+ // let columns = $grid.columns;
930
+ const {fullColumn, tableColumn} = $grid.getTableColumn();
931
+ addTableJson(that, $grid, tableName);
932
+ }
933
+ }
934
+
935
+ function customHandle(option) {
936
+ let that = option.$grid.$parent;
937
+ let $grid = option.$grid;
938
+ var originOption = $grid.originOption;
939
+ if (option.type == "confirm" || option.type == "reset") {
940
+ let tableName = originOption.tableName;
941
+ if (option.type == "reset") {
942
+ let columns = that.$baseLodash.cloneDeep(originOption.columns);
943
+ initColumnDefaulAttrs(columns, originOption);
944
+ $grid.columns = columns;
945
+ // $grid.columns = originOption.columns;
946
+ }
947
+ if (tableName) {
948
+ setTimeout(() => {
949
+ const {fullColumn, tableColumn} = $grid.getTableColumn();
950
+ addTableJson(that, $grid, tableName);
951
+ }, 200);
952
+ }
953
+
954
+ if (option && option.$event && option.$event.preventDefault) {
955
+ option.$event.preventDefault(); // 取消事件的默认行为
956
+ }
957
+ }
958
+ originOption.customCallback && originOption.customCallback(option);
959
+ }
960
+
961
+ function changeSelectCount(checked) {
962
+ var checkedLength = checked.records.length;
963
+ }
964
+
965
+ function getTableData(that, tableRef, type, success) {
966
+ if (
967
+ configUtil.tableConfig.disableTableName
968
+ || settingConfig.tableStorageDisabled
969
+ )
970
+ return false;
971
+ var $grid = getGrid(that, tableRef);
972
+ var tableName = $grid.tableName;
973
+ var url = USER_PREFIX + "/table_column/getTableData";
974
+ var param = {
975
+ tableName: tableName,
976
+ type: type,
977
+ };
978
+ var data = null;
979
+ return that.$http({
980
+ async: false,
981
+ url: url,
982
+ method: "post",
983
+ data: param,
984
+ success: success,
985
+ });
986
+ }
987
+
988
+ function addTableData(that, tableRef, value, success) {
989
+ if (
990
+ configUtil.tableConfig.disableTableName
991
+ || settingConfig.tableStorageDisabled
992
+ )
993
+ return false;
994
+ var $grid = getGrid(that, tableRef);
995
+ var tableName = $grid.tableName;
996
+ if (tableName) {
997
+ that.$http({
998
+ method: "post",
999
+ url: USER_PREFIX + "/table_column/addTableData",
1000
+ data: {
1001
+ tableName: tableName,
1002
+ type: "isQueryAllPage",
1003
+ data: value,
1004
+ success: success,
1005
+ },
1006
+ });
1007
+ }
1008
+ }
1009
+
1010
+ function checkQueryTotal(that, tableRef, value) {
1011
+ var $grid = getGrid(that, tableRef);
1012
+ $grid.isQueryAllPage = value;
1013
+ var tableName = $grid.tableName;
1014
+ var option = $grid.getProxyInfo();
1015
+ var pagerConfig = $grid.pagerConfig;
1016
+
1017
+ $grid.pagerConfig.layouts = pagerConfig.layouts || [];
1018
+ addTableData(that, tableRef, value);
1019
+ $grid.commitProxy("query");
1020
+ }
1021
+
1022
+ function getPagerConfigLayouts(opts) {
1023
+ if (opts.showPageSizes !== false) {
1024
+ return ["Sizes", "PrevPage", "JumpNumber", "NextPage"];
1025
+ } else {
1026
+ return ["PrevPage", "JumpNumber", "NextPage"];
1027
+ }
1028
+ }
1029
+
1030
+ modules = {
1031
+ initVxeTable,
1032
+ columnDrop,
1033
+ initOption,
1034
+ getTableJson,
1035
+ addTableJson,
1036
+ onColumnWitchChange,
1037
+ customHandle,
1038
+ changeSelectCount,
1039
+ getTableData,
1040
+ addTableData,
1041
+ checkQueryTotal,
1042
+ getCellValue,
1043
+ createParams,
1044
+ };
1045
+
1046
+ if (!configUtil.Vue.prototype.$vxeTableUtil)
1047
+ configUtil.Vue.prototype.$vxeTableUtil = modules;
1048
+
1049
+ export default modules;