cloud-web-corejs 1.0.276 → 1.0.278

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 (311) hide show
  1. package/package.json +30 -24
  2. package/src/App.vue +73 -71
  3. package/src/api/user.js +21 -0
  4. package/src/components/baseArea/index.vue +82 -27
  5. package/src/components/baseTabs/mixins.js +5 -1
  6. package/src/components/formDialog/README.md +371 -0
  7. package/src/components/formDialog/actionButtons.js +90 -0
  8. package/src/components/formDialog/index.js +48 -0
  9. package/src/components/formDialog/index.vue +802 -0
  10. package/src/components/formDrawer/drawer.vue +722 -0
  11. package/src/components/formDrawer/index.js +50 -0
  12. package/src/components/luckysheet/dialog.vue +1 -1
  13. package/src/components/micro-view-host/contract.js +66 -0
  14. package/src/components/micro-view-host/index.vue +148 -0
  15. package/src/components/table/tableForm.vue +16 -5
  16. package/src/components/table/tableFormMixin.js +35 -7
  17. package/src/components/vb-tabs/x-tabs.vue +167 -143
  18. package/src/components/wf/content.vue +14 -0
  19. package/src/components/wf/content2.vue +4 -2
  20. package/src/components/wf/wf.js +74 -23
  21. package/src/components/wf/wfActionDropdown.vue +85 -0
  22. package/src/components/wf/wfActionItems.js +136 -0
  23. package/src/components/wf/wfAutoConfirm.js +55 -0
  24. package/src/components/wf/wfButtonName.js +60 -0
  25. package/src/components/wf/wfUserRange.js +53 -0
  26. package/src/components/wf/wfUtil.js +373 -295
  27. package/src/components/xform/XFormTabContainer//346/226/260/345/242/236/351/241/265/347/255/276/346/250/241/345/274/217-/346/234/200/347/273/210/345/256/236/347/216/260.md +195 -0
  28. package/src/components/xform/docs/2026-07 table/344/270/216excelExport/344/277/256/345/244/215/345/217/212/345/257/274/345/207/272/344/274/230/345/214/226.md" +57 -0
  29. package/src/components/xform/docs/2026-07 /346/216/222/346/237/245/344/277/256/345/244/215/350/256/260/345/275/225.md" +73 -0
  30. package/src/components/xform/docs/autocomplete /350/207/252/345/212/250/345/256/214/346/210/220/347/273/204/344/273/266/350/257/264/346/230/216.md" +126 -0
  31. package/src/components/xform/docs//345/257/271/346/257/224/345/212/237/350/203/275/350/220/275/345/234/260/346/226/271/346/241/210.md +986 -0
  32. package/src/components/xform/docs//346/225/260/346/215/256/350/241/250/346/240/274/345/212/250/346/200/201/345/210/227 JSON /350/257/264/346/230/216.md" +657 -0
  33. package/src/components/xform/docs//346/240/221/350/241/250rowField/346/224/266/346/225/233-/350/220/275/345/234/260/346/226/207/346/241/243.md +1427 -0
  34. package/src/components/xform/form-designer/designer.js +2085 -2025
  35. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +9 -11
  36. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +76 -75
  37. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +10 -4
  38. package/src/components/xform/form-designer/form-widget/container-widget/detail-plain-widget.vue +76 -0
  39. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +59 -5
  40. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +38 -17
  41. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +138 -13
  42. package/src/components/xform/form-designer/form-widget/dialog/formFieldDialog.vue +1 -1
  43. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1774 -1772
  44. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +2 -3
  45. package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +1 -1
  46. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +66 -53
  47. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +287 -214
  48. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +76 -66
  49. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +208 -124
  50. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +3 -9
  51. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +11 -2
  52. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +7 -6
  53. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +43 -19
  54. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +680 -372
  55. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +879 -763
  56. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +17 -2
  57. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-bar-mixin.js +3 -9
  58. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +3 -9
  59. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +3 -9
  60. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relative-default-mixin.js +107 -0
  61. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relativeDateUtil.js +321 -0
  62. package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +77 -0
  63. package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +13 -0
  64. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +13 -8
  65. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +4 -9
  66. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +3 -0
  67. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +120 -120
  68. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +4 -0
  69. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +11 -0
  70. package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +9 -1
  71. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +1 -1
  72. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +7 -3
  73. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +4 -2
  74. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +36 -5
  75. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +338 -374
  76. package/src/components/xform/form-designer/form-widget/index.vue +6 -1
  77. package/src/components/xform/form-designer/form-widget/indexMixin.js +29 -25
  78. package/src/components/xform/form-designer/index.vue +194 -191
  79. package/src/components/xform/form-designer/indexMixin.js +860 -847
  80. package/src/components/xform/form-designer/setting-panel/dataSource-setting.vue +397 -397
  81. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +602 -601
  82. package/src/components/xform/form-designer/setting-panel/form-setting.vue +1790 -1483
  83. package/src/components/xform/form-designer/setting-panel/index.vue +2 -7
  84. package/src/components/xform/form-designer/setting-panel/indexMixin.js +370 -335
  85. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +585 -544
  86. package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +1 -1
  87. package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +1 -1
  88. package/src/components/xform/form-designer/setting-panel/property-editor/alignType-editor.vue +1 -1
  89. package/src/components/xform/form-designer/setting-panel/property-editor/buttonIcon-editor.vue +14 -15
  90. package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +1 -1
  91. package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +1 -1
  92. package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +3 -3
  93. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +124 -125
  94. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +1151 -957
  95. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +96 -74
  96. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-plain/detail-plain-editor.vue +75 -0
  97. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/colHeight-editor.vue +1 -1
  98. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +14 -13
  99. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-height-editor.vue +1 -1
  100. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
  101. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
  102. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
  103. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue +4 -4
  104. package/src/components/xform/form-designer/setting-panel/property-editor/container-h5-card/h5-card-editor.vue +124 -124
  105. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +26 -31
  106. package/src/components/xform/form-designer/setting-panel/property-editor/container-panel/height-editor.vue +1 -1
  107. package/src/components/xform/form-designer/setting-panel/property-editor/container-panel/width-editor.vue +1 -1
  108. package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue +119 -119
  109. package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tabClass-editor.vue +45 -45
  110. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +340 -342
  111. package/src/components/xform/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue +1 -1
  112. package/src/components/xform/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue +1 -1
  113. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree/tree-customClass-editor.vue +2 -2
  114. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree-pane/tree-pane-editor.vue +1 -1
  115. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/cancelButtonLabel-editor.vue +1 -1
  116. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/okButtonLabel-editor.vue +1 -1
  117. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/title-editor.vue +1 -1
  118. package/src/components/xform/form-designer/setting-panel/property-editor/container-vf-dialog/width-editor.vue +1 -1
  119. package/src/components/xform/form-designer/setting-panel/property-editor/containerClass-editor.vue +1 -1
  120. package/src/components/xform/form-designer/setting-panel/property-editor/customClass-editor.vue +1 -1
  121. package/src/components/xform/form-designer/setting-panel/property-editor/defaultValue-editor.vue +1 -1
  122. package/src/components/xform/form-designer/setting-panel/property-editor/descriptionsItems-editor.vue +4 -4
  123. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +3 -3
  124. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +6 -2
  125. package/src/components/xform/form-designer/setting-panel/property-editor/dsName-editor.vue +1 -1
  126. package/src/components/xform/form-designer/setting-panel/property-editor/echartHeight-editor.vue +1 -1
  127. package/src/components/xform/form-designer/setting-panel/property-editor/endPlaceholder-editor.vue +1 -1
  128. package/src/components/xform/form-designer/setting-panel/property-editor/field-accessUrl/accessUrl-editor.vue +2 -2
  129. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaDataType-editor.vue +1 -1
  130. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaMinLevel-editor.vue +50 -50
  131. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaName-editor.vue +1 -1
  132. package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +7 -7
  133. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/addTableData-event-editor.vue +84 -85
  134. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/button-type-editor.vue +1 -1
  135. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindActions.js +262 -0
  136. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +97 -88
  137. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/form-host-event-editor.vue +188 -0
  138. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/icon-editor.vue +14 -15
  139. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +27 -10
  140. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/checkStrictly-editor.vue +11 -13
  141. package/src/components/xform/form-designer/setting-panel/property-editor/field-common/keyName-editor.vue +74 -67
  142. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +27 -5
  143. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +35 -18
  144. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +1 -1
  145. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-type-editor.vue +1 -1
  146. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-valueFormat-editor.vue +1 -1
  147. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +1 -1
  148. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +35 -18
  149. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +1 -1
  150. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-type-editor.vue +1 -1
  151. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-valueFormat-editor.vue +1 -1
  152. package/src/components/xform/form-designer/setting-panel/property-editor/field-divider/contentPosition-editor.vue +1 -1
  153. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -59
  154. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +11 -11
  155. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +10 -10
  156. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +12 -12
  157. package/src/components/xform/form-designer/setting-panel/property-editor/field-file-upload/file-upload-fileTypes-editor.vue +44 -44
  158. package/src/components/xform/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue +29 -29
  159. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +6 -6
  160. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +4 -4
  161. package/src/components/xform/form-designer/setting-panel/property-editor/field-number/controlsPosition-editor.vue +1 -1
  162. package/src/components/xform/form-designer/setting-panel/property-editor/field-picture-upload/picture-upload-fileTypes-editor.vue +44 -44
  163. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +115 -115
  164. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -115
  165. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/highThreshold-editor.vue +1 -1
  166. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/lowThreshold-editor.vue +1 -1
  167. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
  168. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-max-editor.vue +1 -1
  169. package/src/components/xform/form-designer/setting-panel/property-editor/field-script/script-editor.vue +4 -4
  170. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +4 -4
  171. package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/fontSize-editor.vue +1 -1
  172. package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +1 -1
  173. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +3 -3
  174. package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/activeText-editor.vue +1 -1
  175. package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue +1 -1
  176. package/src/components/xform/form-designer/setting-panel/property-editor/field-switch/switchWidth-editor.vue +1 -1
  177. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +2 -2
  178. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +74 -74
  179. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +3 -3
  180. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +34 -18
  181. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +1 -1
  182. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-timeLimit-editor.vue +53 -0
  183. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +35 -18
  184. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +1 -1
  185. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchField-editor.vue +2 -2
  186. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +2 -2
  187. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +1 -1
  188. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +1 -1
  189. package/src/components/xform/form-designer/setting-panel/property-editor/field-vue-page/vue-page-editor.vue +2 -2
  190. package/src/components/xform/form-designer/setting-panel/property-editor/fileMaxSize-editor.vue +1 -1
  191. package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +176 -176
  192. package/src/components/xform/form-designer/setting-panel/property-editor/fixedQuery-editor.vue +39 -0
  193. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +41 -6
  194. package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +2 -2
  195. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +972 -972
  196. package/src/components/xform/form-designer/setting-panel/property-editor/iconClass-editor.vue +1 -1
  197. package/src/components/xform/form-designer/setting-panel/property-editor/label-editor.vue +1 -1
  198. package/src/components/xform/form-designer/setting-panel/property-editor/labelAlign-editor.vue +1 -1
  199. package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +1 -1
  200. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
  201. package/src/components/xform/form-designer/setting-panel/property-editor/labelWidth-editor.vue +1 -1
  202. package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
  203. package/src/components/xform/form-designer/setting-panel/property-editor/max-editor.vue +1 -1
  204. package/src/components/xform/form-designer/setting-panel/property-editor/maxLength-editor.vue +1 -1
  205. package/src/components/xform/form-designer/setting-panel/property-editor/min-editor.vue +1 -1
  206. package/src/components/xform/form-designer/setting-panel/property-editor/minLength-editor.vue +1 -1
  207. package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  208. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +15 -4
  209. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +3 -3
  210. package/src/components/xform/form-designer/setting-panel/property-editor/placeholder-editor.vue +1 -1
  211. package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
  212. package/src/components/xform/form-designer/setting-panel/property-editor/prefixIcon-editor.vue +14 -15
  213. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +6 -6
  214. package/src/components/xform/form-designer/setting-panel/property-editor/relative-default-block.vue +369 -0
  215. package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +1 -1
  216. package/src/components/xform/form-designer/setting-panel/property-editor/rows-editor.vue +1 -1
  217. package/src/components/xform/form-designer/setting-panel/property-editor/space-editor-editor.vue +1 -1
  218. package/src/components/xform/form-designer/setting-panel/property-editor/startPlaceholder-editor.vue +1 -1
  219. package/src/components/xform/form-designer/setting-panel/property-editor/step-editor.vue +1 -1
  220. package/src/components/xform/form-designer/setting-panel/property-editor/styleTableClass-editor.vue +1 -1
  221. package/src/components/xform/form-designer/setting-panel/property-editor/styleTitClass-editor.vue +1 -1
  222. package/src/components/xform/form-designer/setting-panel/property-editor/suffixIcon-editor.vue +14 -15
  223. package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +1 -1
  224. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +2 -3
  225. package/src/components/xform/form-designer/setting-panel/property-editor/type-editor.vue +1 -1
  226. package/src/components/xform/form-designer/setting-panel/property-editor/uploadTip-editor.vue +1 -1
  227. package/src/components/xform/form-designer/setting-panel/property-editor/uploadURL-editor.vue +1 -1
  228. package/src/components/xform/form-designer/setting-panel/property-editor/urlValueEnabled-editor.vue +91 -0
  229. package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +1 -1
  230. package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +1 -1
  231. package/src/components/xform/form-designer/setting-panel/property-editor/widgetWidth-editor.vue +1 -1
  232. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +374 -351
  233. package/src/components/xform/form-designer/toolbar-panel/index.vue +266 -103
  234. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +655 -589
  235. package/src/components/xform/form-designer/widget-panel/index.vue +391 -341
  236. package/src/components/xform/form-designer/widget-panel/indexMixin.js +351 -308
  237. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +4642 -4028
  238. package/src/components/xform/form-render/container-item/containerItemMixin.js +76 -61
  239. package/src/components/xform/form-render/container-item/data-table-item.vue +24 -13
  240. package/src/components/xform/form-render/container-item/data-table-mixin.js +5927 -3400
  241. package/src/components/xform/form-render/container-item/detail-h5-item.vue +173 -173
  242. package/src/components/xform/form-render/container-item/detail-item.vue +446 -224
  243. package/src/components/xform/form-render/container-item/detail-plain-item.vue +92 -0
  244. package/src/components/xform/form-render/container-item/list-h5-item.vue +1186 -411
  245. package/src/components/xform/form-render/container-item/tab-item.vue +129 -125
  246. package/src/components/xform/form-render/container-item/table-item.vue +0 -3
  247. package/src/components/xform/form-render/container-item/table2-item.vue +18 -10
  248. package/src/components/xform/form-render/dynamicDialogRender.js +140 -99
  249. package/src/components/xform/form-render/index.vue +8 -8
  250. package/src/components/xform/form-render/indexMixin.js +5299 -3766
  251. package/src/components/xform/form-render/refMixin.js +14 -11
  252. package/src/components/xform/lang/en-US.js +473 -438
  253. package/src/components/xform/lang/en-US_extension.js +4 -0
  254. package/src/components/xform/lang/zh-CN.js +646 -620
  255. package/src/components/xform/mixins/defaultHandle.js +363 -26
  256. package/src/components/xform/mixins/scriptHttp.js +54 -51
  257. package/src/components/xform/utils/attachmentValueUtil.js +239 -0
  258. package/src/components/xform/utils/fixedQueryUtil.js +93 -0
  259. package/src/components/xform/utils/format.js +195 -169
  260. package/src/components/xform/utils/queryParamUtil.js +84 -0
  261. package/src/components/xform/utils/tableColumnHelper.js +7 -8
  262. package/src/components/xform/utils/util.js +1663 -1551
  263. package/src/components/xform/utils/validators.js +100 -48
  264. package/src/index.js +403 -89
  265. package/src/layout/components/AppMain.vue +147 -119
  266. package/src/layout/components/Sidebar/default.vue +109 -59
  267. package/src/layout/components/TagsView/index.vue +1 -1
  268. package/src/layout/components/extractedCode/queryDialog.vue +33 -26
  269. package/src/layout/components/extractedCode/viewDialog.vue +207 -193
  270. package/src/layout/components/langTool.vue +128 -123
  271. package/src/layout/defaultLayout.vue +170 -158
  272. package/src/mixins/wf/index.js +40 -38
  273. package/src/public-path.js +38 -0
  274. package/src/router/modules/system.js +4 -0
  275. package/src/store/config/index.js +945 -669
  276. package/src/utils/pdfUtil.js +428 -70
  277. package/src/views/bd/setting/bd_company_env/dialog.vue +1 -1
  278. package/src/views/bd/setting/formVersion/button.vue +5 -0
  279. package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +21 -10
  280. package/src/views/bd/setting/formVersion/link.vue +5 -0
  281. package/src/views/bd/setting/form_script/edit.vue +1 -0
  282. package/src/views/bd/setting/form_script/edit1.vue +1 -0
  283. package/src/views/bd/setting/form_script/form_list.vue +1 -0
  284. package/src/views/bd/setting/form_script/list.vue +1 -0
  285. package/src/views/bd/setting/form_script/list1.vue +2 -0
  286. package/src/views/bd/setting/form_template/edit.vue +1 -0
  287. package/src/views/bd/setting/form_template/list.vue +2 -0
  288. package/src/views/bd/setting/form_template/mixins/edit.js +77 -74
  289. package/src/views/bd/setting/table_model/edit.vue +16 -29
  290. package/src/views/bd/setting/table_model/list.vue +1 -0
  291. package/src/views/bd/setting/table_model/mixins/edit.js +295 -149
  292. package/src/views/bd/setting/table_model/mixins/zdDialog.js +32 -0
  293. package/src/views/support/export_template/list.vue +1 -1
  294. package/src/views/user/company_info/edit.vue +149 -88
  295. package/src/views/user/form/form_template/dialog.vue +1 -1
  296. package/src/views/user/form/form_template/itemList.vue +1 -1
  297. package/src/views/user/form/form_template/list.vue +1 -1
  298. package/src/views/user/form/form_template_field/dialog.vue +1 -1
  299. package/src/views/user/form/form_type/dialog.vue +1 -1
  300. package/src/views/user/form/form_type/list.vue +1 -1
  301. package/src/views/user/form/report_requestaccess/dialog.vue +1 -1
  302. package/src/views/user/form/report_requestaccess/list.vue +1 -1
  303. package/src/views/user/form/vform/designer.vue +51 -22
  304. package/src/views/user/form/vform/render.vue +21 -23
  305. package/src/views/user/form/view/list.vue +134 -37
  306. package/src/views/user/wf/wfReport/index.vue +24 -1
  307. package/src/views/user/wf/wf_manage/list.vue +8 -4
  308. package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +0 -209
  309. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +0 -1639
  310. package/src/views/bd/setting/table_model/mixins/edit copy.js +0 -903
  311. package/src/views/user/menu/voc_list.vue +0 -686
@@ -1,1551 +1,1663 @@
1
- import Clipboard from "clipboard";
2
- import axios from "axios";
3
- import request from "../../../utils/request.js";
4
- import { decode } from "js-base64";
5
-
6
- export function getAccessUrl() {
7
- return SUPPORT_PREFIX + "/report_ins/getData";
8
- }
9
-
10
- export function isNull(value) {
11
- return value === null || value === undefined;
12
- }
13
-
14
- export function isNilOrEmptyStr(value) {
15
- return value === null || value === undefined || value === "";
16
- }
17
-
18
- export function isNotNull(value) {
19
- return value !== null && value !== undefined;
20
- }
21
-
22
- const ATTACHMENT_WIDGET_TYPES = ["vabUpload", "baseAttachment", "vabUpload2"];
23
-
24
- const PROJECT_TAG_WIDGET_TYPES = [
25
- "project-tag",
26
- "user-project-tag",
27
- "saleOrg-project-tag",
28
- ];
29
-
30
- const VABSEARCH_WIDGET_TYPES = ["vabsearch", "singerSearch", "multiSearch"];
31
-
32
- export function isAttachmentWidgetType(type) {
33
- return ATTACHMENT_WIDGET_TYPES.includes(type);
34
- }
35
-
36
- export function isVabsearchWidgetType(type) {
37
- return VABSEARCH_WIDGET_TYPES.includes(type);
38
- }
39
-
40
- export function isVabsearchMultiWidget(widget) {
41
- if (!widget) {
42
- return false;
43
- }
44
- const type = widget.type;
45
- if (type === "multiSearch") {
46
- return true;
47
- }
48
- if (!isVabsearchWidgetType(type)) {
49
- return false;
50
- }
51
- const options = widget.options || {};
52
- return !!(
53
- options.multipleChoices || options.searchDialogConfig?.multipleChoices
54
- );
55
- }
56
-
57
- /** 绑定值为数组的字段组件(含附件) */
58
- export function isArrayValueWidgetType(type, options = {}) {
59
- if (isAttachmentWidgetType(type)) {
60
- return true;
61
- }
62
- if (type === "checkbox") {
63
- return true;
64
- }
65
- if (type === "select" && options.multiple) {
66
- return true;
67
- }
68
- if (type === "time-range" || type === "date-range") {
69
- return true;
70
- }
71
- if (type === "date" && options.type === "dates") {
72
- return true;
73
- }
74
- if (PROJECT_TAG_WIDGET_TYPES.includes(type)) {
75
- return true;
76
- }
77
- if (type === "multiSearch") {
78
- return true;
79
- }
80
- if (
81
- type === "vabsearch" &&
82
- (options.multipleChoices || options.searchDialogConfig?.multipleChoices)
83
- ) {
84
- return true;
85
- }
86
- return false;
87
- }
88
-
89
- /** 数组类字段值是否为空(用于必填校验) */
90
- export function isEmptyArrayFieldValue(value, type, options = {}) {
91
- if (value === null || value === undefined) {
92
- return true;
93
- }
94
- if (type === "time-range" || type === "date-range") {
95
- if (!Array.isArray(value) || value.length === 0) {
96
- return true;
97
- }
98
- return value.every(
99
- (item) => item === null || item === undefined || item === ""
100
- );
101
- }
102
- if (!Array.isArray(value)) {
103
- return true;
104
- }
105
- return value.length === 0;
106
- }
107
-
108
- export function isEmptyStr(str) {
109
- //return (str === undefined) || (!str) || (!/[^\s]/.test(str));
110
- return (
111
- str === undefined ||
112
- (!str && str !== 0 && str !== "0") ||
113
- !/[^\s]/.test(str)
114
- );
115
- }
116
-
117
- export const generateId = function () {
118
- return Math.floor(
119
- Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
120
- );
121
- };
122
-
123
- export const createUUID = function () {
124
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
125
- .replace(/[xy]/g, function (c) {
126
- var r = (Math.random() * 16) | 0,
127
- v = c === "x" ? r : (r & 0x3) | 0x8;
128
- return v.toString(16);
129
- })
130
- .replaceAll("-", "");
131
- };
132
-
133
- export const deepClone = function (origin) {
134
- if (origin === undefined) {
135
- return undefined;
136
- }
137
-
138
- return JSON.parse(JSON.stringify(origin));
139
- };
140
-
141
- export const overwriteObj = function (obj1, obj2) {
142
- /* 浅拷贝对象属性,obj2覆盖obj1 */
143
- // for (let prop in obj2) {
144
- // if (obj2.hasOwnProperty(prop)) {
145
- // obj1[prop] = obj2[prop]
146
- // }
147
- // }
148
-
149
- Object.keys(obj2).forEach((prop) => {
150
- obj1[prop] = obj2[prop];
151
- });
152
- };
153
-
154
- export const addWindowResizeHandler = function (handler) {
155
- let oldHandler = window.onresize;
156
- if (typeof window.onresize != "function") {
157
- window.onresize = handler;
158
- } else {
159
- window.onresize = function () {
160
- oldHandler();
161
- handler();
162
- };
163
- }
164
- };
165
-
166
- const createStyleSheet = function () {
167
- let head = document.head || document.getElementsByTagName("head")[0];
168
- let style = document.createElement("style");
169
- style.type = "text/css";
170
- head.appendChild(style);
171
- return style.sheet;
172
- };
173
-
174
- export const insertCustomCssToHead = function (cssCode, formId = "") {
175
- let head = document.getElementsByTagName("head")[0];
176
- let oldStyle = document.getElementById("vform-custom-css");
177
- if (!!oldStyle) {
178
- head.removeChild(oldStyle); //先清除后插入!!
179
- }
180
- if (!!formId) {
181
- oldStyle = document.getElementById("vform-custom-css" + "-" + formId);
182
- !!oldStyle && head.removeChild(oldStyle); //先清除后插入!!
183
- }
184
-
185
- let newStyle = document.createElement("style");
186
- newStyle.type = "text/css";
187
- newStyle.rel = "stylesheet";
188
- newStyle.id = !!formId
189
- ? "vform-custom-css" + "-" + formId
190
- : "vform-custom-css";
191
- try {
192
- newStyle.appendChild(document.createTextNode(cssCode));
193
- } catch (ex) {
194
- newStyle.styleSheet.cssText = cssCode;
195
- }
196
-
197
- head.appendChild(newStyle);
198
- };
199
-
200
- export const insertGlobalFunctionsToHtml = function (
201
- functionsCode,
202
- formId = ""
203
- ) {
204
- if (!functionsCode || typeof functionsCode !== "string") {
205
- return;
206
- }
207
- let sourceName = !!formId
208
- ? "v_form_global_functions" + "-" + formId
209
- : "v_form_global_functions";
210
- try {
211
- // (0, eval) 是间接调用形式,不可简写为 eval(...):直接 eval 会继承当前模块作用域,
212
- // 函数声明将落在模块内而非真实 window 上。sourceURL 让 devtools 里可定位、可下断点。
213
- (0, eval)(functionsCode + "\n//# sourceURL=" + sourceName + ".js");
214
- } catch (e) {
215
- // 原先 <script> 注入时语法/运行时错误只进 window.onerror、不影响表单渲染,
216
- // 这里必须同样吞掉:否则会中断 initFormObject 整条表单初始化链路
217
- console.error("[xform] 表单全局函数执行失败:" + sourceName, e);
218
- }
219
- };
220
-
221
- export const optionExists = function (optionsObj, optionName) {
222
- if (!optionsObj) {
223
- return false;
224
- }
225
-
226
- return Object.keys(optionsObj).indexOf(optionName) > -1;
227
- };
228
-
229
- export const loadRemoteScript = function (srcPath, callback) {
230
- /*加载远程js,加载成功后执行回调函数*/
231
- let sid = encodeURIComponent(srcPath);
232
- let oldScriptEle = document.getElementById(sid);
233
-
234
- if (!oldScriptEle) {
235
- let s = document.createElement("script");
236
- s.src = srcPath;
237
- s.id = sid;
238
- document.body.appendChild(s);
239
-
240
- s.onload = s.onreadystatechange = function (_, isAbort) {
241
- /* 借鉴自ace.js */
242
- if (
243
- isAbort ||
244
- !s.readyState ||
245
- s.readyState === "loaded" ||
246
- s.readyState === "complete"
247
- ) {
248
- s = s.onload = s.onreadystatechange = null;
249
- if (!isAbort) {
250
- callback();
251
- }
252
- }
253
- };
254
- }
255
- };
256
-
257
- export function traverseFieldWidgets(
258
- widgetList,
259
- handler,
260
- parent = null,
261
- staticWidgetsIncluded
262
- ) {
263
- if (!widgetList) {
264
- return;
265
- }
266
-
267
- loopHandleWidget(widgetList, (w, parent) => {
268
- if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
269
- handler(w, parent);
270
- }
271
- });
272
-
273
- /* widgetList.forEach((w) => {
274
- if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
275
- handler(w, parent);
276
- } else if (w.type === "grid") {
277
- w.cols.forEach((col) => {
278
- traverseFieldWidgets(col.widgetList, handler, w, staticWidgetsIncluded);
279
- });
280
- } else if (w.type === "table") {
281
- w.rows.forEach((row) => {
282
- row.cols.forEach((cell) => {
283
- traverseFieldWidgets(
284
- cell.widgetList,
285
- handler,
286
- w,
287
- staticWidgetsIncluded
288
- );
289
- });
290
- });
291
- } else if (w.type === "tab") {
292
- w.tabs.forEach((tab) => {
293
- traverseFieldWidgets(tab.widgetList, handler, w, staticWidgetsIncluded);
294
- });
295
- } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
296
- traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
297
- } else if (w.category === "container") {
298
- //自定义容器
299
- traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
300
- }
301
- }); */
302
- }
303
-
304
- export function traverseContainerWidgets(
305
- widgetList,
306
- handler,
307
- skipDialogAndDrawer
308
- ) {
309
- if (!widgetList) {
310
- return;
311
- }
312
-
313
- loopHandleWidget(widgetList, (w, parent) => {
314
- if (w.category === "container") {
315
- if (
316
- skipDialogAndDrawer &&
317
- (w.type === "vf-dialog" || w.type === "vf-drawer")
318
- ) {
319
- //什么也不做
320
- } else {
321
- handler(w);
322
- }
323
- }
324
- });
325
-
326
- /* widgetList.forEach((w) => {
327
- if (w.category === "container") {
328
- if (
329
- skipDialogAndDrawer &&
330
- (w.type === "vf-dialog" || w.type === "vf-drawer")
331
- ) {
332
- //什么也不做
333
- } else {
334
- handler(w);
335
- }
336
- }
337
-
338
- if (w.type === "grid") {
339
- w.cols.forEach((col) => {
340
- traverseContainerWidgets(col.widgetList, handler);
341
- });
342
- } else if (w.type === "table") {
343
- w.rows.forEach((row) => {
344
- row.cols.forEach((cell) => {
345
- traverseContainerWidgets(cell.widgetList, handler);
346
- });
347
- });
348
- } else if (w.type === "tab") {
349
- w.tabs.forEach((tab) => {
350
- traverseContainerWidgets(tab.widgetList, handler);
351
- });
352
- } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
353
- traverseContainerWidgets(w.widgetList, handler);
354
- } else if (w.category === "container") {
355
- //自定义容器
356
- if (
357
- skipDialogAndDrawer &&
358
- (w.type === "vf-dialog" || w.type === "vf-drawer")
359
- ) {
360
- //什么也不做
361
- } else {
362
- traverseContainerWidgets(w.widgetList, handler);
363
- }
364
- }
365
- }); */
366
- }
367
-
368
- export function traverseAllWidgetsNew(widgetList, callback) {
369
- if (!widgetList) {
370
- return;
371
- }
372
- let columnLoopDo = (t, parentWidget) => {
373
- if (t.children && t.children.length) {
374
- t.children.forEach((item) => {
375
- columnLoopDo(item, parentWidget);
376
- });
377
- } else {
378
- if (t.widget) {
379
- callback && callback(t.widget, parentWidget);
380
- }
381
- if (t.editWidget) {
382
- callback && callback(t.editWidget, parentWidget);
383
- }
384
- if (t.widgetList && t.widgetList.length) {
385
- loopHandleWidget(t.widgetList, (widget) => {
386
- callback && callback(widget, parentWidget);
387
- });
388
- }
389
- }
390
- };
391
- loopHandleWidget(widgetList, (widget, parentWidget) => {
392
- if (callback) {
393
- callback(widget, parentWidget);
394
- if (widget.type === "data-table") {
395
- for (let item of widget.options.tableColumns) {
396
- columnLoopDo(item, parentWidget);
397
- }
398
- }
399
- }
400
- });
401
- }
402
-
403
- export function traverseAllWidgets(widgetList, handler) {
404
- if (!widgetList) {
405
- return;
406
- }
407
-
408
- loopHandleWidget(widgetList, (w, parentWidget) => {
409
- handler(w, parentWidget);
410
- });
411
-
412
- /* widgetList.forEach((w) => {
413
- handler(w);
414
-
415
- if (w.type === "grid") {
416
- w.cols.forEach((col) => {
417
- handler(col);
418
- traverseAllWidgets(col.widgetList, handler);
419
- });
420
- } else if (w.type === "table") {
421
- w.rows.forEach((row) => {
422
- row.cols.forEach((cell) => {
423
- handler(cell);
424
- traverseAllWidgets(cell.widgetList, handler);
425
- });
426
- });
427
- } else if (w.type === "tab") {
428
- w.tabs.forEach((tab) => {
429
- traverseAllWidgets(tab.widgetList, handler);
430
- });
431
- } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
432
- traverseAllWidgets(w.widgetList, handler);
433
- } else if (w.category === "container") {
434
- //自定义容器
435
- traverseAllWidgets(w.widgetList, handler);
436
- }
437
- }); */
438
- }
439
-
440
- function handleWidgetForTraverse(
441
- widget,
442
- handler,
443
- staticWidgetsIncluded = false
444
- ) {
445
- if (!!widget.category && widget.category === "container") {
446
- traverseFieldWidgetsOfContainer(widget, handler);
447
- } else if (widget.formItemFlag) {
448
- handler(widget);
449
- }
450
- }
451
-
452
- export const itemFieldMap = {
453
- grid: "cols",
454
- table: "rows",
455
- "table-cell": "widgetList",
456
- "h5-table": "rows",
457
- "h5-table-cell": "widgetList",
458
- tab: "tabs",
459
- "tab-pane": "widgetList",
460
- "grid-col": "widgetList",
461
- "vf-box": "widgetList",
462
- card: "widgetList",
463
- detail: "panes",
464
- "detail-pane": "widgetList",
465
- "detail-h5": "panes",
466
- "h5-card": "panes",
467
- "h5-card-pane": "widgetList",
468
- };
469
-
470
- /**
471
- * 遍历容器内的字段组件
472
- * @param con
473
- * @param handler
474
- * @param staticWidgetsIncluded
475
- */
476
- export function traverseFieldWidgetsOfContainer(
477
- con,
478
- handler,
479
- staticWidgetsIncluded = false
480
- ) {
481
- /*loopHandleWidget([con],(w, parent)=>{
482
- handleWidgetForTraverse(w, handler, staticWidgetsIncluded);
483
- });*/
484
- if (con.type === "grid") {
485
- con.cols.forEach((col) => {
486
- col.widgetList.forEach((cw) => {
487
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
488
- });
489
- });
490
- } else if (con.type === "table") {
491
- con.rows.forEach((row) => {
492
- row.cols.forEach((cell) => {
493
- cell.widgetList.forEach((cw) => {
494
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
495
- });
496
- });
497
- });
498
- } else if (con.type === "tab") {
499
- con.tabs.forEach((tab) => {
500
- tab.widgetList.forEach((cw) => {
501
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
502
- });
503
- });
504
- } else if (con.type === "sub-form" || con.type === "grid-sub-form") {
505
- con.widgetList.forEach((cw) => {
506
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
507
- });
508
- } else if (con.type === "data-table") {
509
- /*con.widgetList.forEach((cw) => {
510
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
511
- });*/
512
- if (!!con.widgetList) {
513
- con.widgetList.forEach((childItem) => {
514
- loopHandleWidgetItem(childItem, con, handler);
515
- });
516
- }
517
- if (!!con.buttons) {
518
- con.buttons.forEach((childItem) => {
519
- loopHandleWidgetItem(childItem, con, handler);
520
- });
521
- }
522
- for (let column of con.options.tableColumns) {
523
- if (column.widget) {
524
- handleWidgetForTraverse(column.widget, handler, staticWidgetsIncluded);
525
- }
526
- if (column.widgetList) {
527
- column.widgetList.forEach((cw) => {
528
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
529
- });
530
- /*loopHandleWidget(column.widgetList, (cw) => {
531
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
532
- });*/
533
- }
534
- }
535
- } else if (con.category === "container") {
536
- //自定义容器
537
- /*let key = itemFieldMap[con.type]
538
- con[key].forEach((cw) => {
539
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
540
- });*/
541
-
542
- /*con.widgetList.forEach(cw => {
543
- handleWidgetForTraverse(cw, handler, staticWidgetsIncluded)
544
- })*/
545
- loopHandleWidgetItem(con, null, (w) => {
546
- if (con.id != w.id)
547
- handleWidgetForTraverse(w, handler, staticWidgetsIncluded);
548
- });
549
- }
550
- }
551
-
552
- function handleContainerTraverse(
553
- widget,
554
- fieldHandler,
555
- containerHandler,
556
- internalContainerCallFlag,
557
- staticWidgetsIncluded
558
- ) {
559
- if (!!widget.category && widget.category === "container") {
560
- traverseWidgetsOfContainer(
561
- widget,
562
- fieldHandler,
563
- containerHandler,
564
- internalContainerCallFlag,
565
- staticWidgetsIncluded
566
- );
567
- } else if (widget.formItemFlag) {
568
- fieldHandler(widget);
569
- } else if (staticWidgetsIncluded) {
570
- fieldHandler(widget);
571
- }
572
- }
573
-
574
- /**
575
- * 遍历容器内部的字段组件和容器组件
576
- * @param con
577
- * @param fieldHandler
578
- * @param containerHandler
579
- * @param internalContainerCallFlag 是否需要处理内部容器组件,默认不处理
580
- * @param staticWidgetsIncluded 是否需要处理静态非表单交互类组件
581
- */
582
- export function traverseWidgetsOfContainer(
583
- con,
584
- fieldHandler,
585
- containerHandler,
586
- internalContainerCallFlag,
587
- staticWidgetsIncluded
588
- ) {
589
- if (con.category === "container") {
590
- containerHandler(con);
591
- }
592
-
593
- /*loopHandleWidget([con], (cw, parent) => {
594
- if (con.id !== cw.id) {
595
- handleContainerTraverse(
596
- cw,
597
- fieldHandler,
598
- containerHandler,
599
- internalContainerCallFlag,
600
- staticWidgetsIncluded
601
- );
602
- }
603
- });*/
604
-
605
- if (con.type === "grid") {
606
- con.cols.forEach((col) => {
607
- if (internalContainerCallFlag) {
608
- containerHandler(col);
609
- }
610
- col.widgetList.forEach((cw) => {
611
- handleContainerTraverse(
612
- cw,
613
- fieldHandler,
614
- containerHandler,
615
- internalContainerCallFlag,
616
- staticWidgetsIncluded
617
- );
618
- });
619
- });
620
- } else if (con.type === "table") {
621
- con.rows.forEach((row) => {
622
- if (internalContainerCallFlag) {
623
- containerHandler(row);
624
- }
625
- row.cols.forEach((cell) => {
626
- if (internalContainerCallFlag) {
627
- containerHandler(cell);
628
- }
629
- cell.widgetList.forEach((cw) => {
630
- handleContainerTraverse(
631
- cw,
632
- fieldHandler,
633
- containerHandler,
634
- internalContainerCallFlag,
635
- staticWidgetsIncluded
636
- );
637
- });
638
- });
639
- });
640
- } else if (con.type === "tab") {
641
- con.tabs.forEach((tab) => {
642
- if (internalContainerCallFlag) {
643
- containerHandler(tab);
644
- }
645
- tab.widgetList.forEach((cw) => {
646
- handleContainerTraverse(
647
- cw,
648
- fieldHandler,
649
- containerHandler,
650
- internalContainerCallFlag,
651
- staticWidgetsIncluded
652
- );
653
- });
654
- });
655
- } else if (con.type === "sub-form" || con.type === "grid-sub-form") {
656
- con.widgetList.forEach((cw) => {
657
- handleContainerTraverse(
658
- cw,
659
- fieldHandler,
660
- containerHandler,
661
- internalContainerCallFlag,
662
- staticWidgetsIncluded
663
- );
664
- });
665
- } else if (con.category === "container") {
666
- //自定义容器
667
- let key = itemFieldMap[con.type];
668
- con[key].forEach((cw) => {
669
- handleContainerTraverse(
670
- cw,
671
- fieldHandler,
672
- containerHandler,
673
- internalContainerCallFlag,
674
- staticWidgetsIncluded
675
- );
676
- });
677
- }
678
- }
679
-
680
- export function traverseWidgetsOfGridCol(
681
- gridCol,
682
- fieldHandler,
683
- containerHandler
684
- ) {
685
- // if (gridCol.category === 'container') {
686
- // containerHandler(gridCol)
687
- // }
688
-
689
- if (gridCol.type === "grid-col") {
690
- gridCol.widgetList.forEach((cw) => {
691
- handleContainerTraverse(cw, fieldHandler, containerHandler);
692
- });
693
- }
694
- }
695
-
696
- /**
697
- * 获取所有字段组件
698
- * @param widgetList
699
- * @param staticWidgetsIncluded 是否包含按钮等静态组件,默认不包含
700
- * @returns {[]}
701
- */
702
- export function getAllFieldWidgets(widgetList, staticWidgetsIncluded) {
703
- if (!widgetList) {
704
- return [];
705
- }
706
-
707
- let result = [];
708
- let handlerFn = (w) => {
709
- result.push({
710
- type: w.type,
711
- name: w.options.name,
712
- field: w,
713
- });
714
- };
715
- traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
716
-
717
- return result;
718
- }
719
-
720
- /**
721
- * 获取所有容器组件
722
- * @param widgetList
723
- * @param skipDialogAndDrawer 是否跳过弹窗和抽屉内部组件,默认不跳过
724
- * @returns {[]}
725
- */
726
- export function getAllContainerWidgets(widgetList, skipDialogAndDrawer) {
727
- if (!widgetList) {
728
- return [];
729
- }
730
-
731
- let result = [];
732
- let handlerFn = (w) => {
733
- result.push({
734
- type: w.type,
735
- name: w.options.name,
736
- container: w,
737
- });
738
- };
739
- traverseContainerWidgets(widgetList, handlerFn, skipDialogAndDrawer);
740
-
741
- return result;
742
- }
743
-
744
- export function getFieldWidgetByName(
745
- widgetList,
746
- fieldName,
747
- staticWidgetsIncluded
748
- ) {
749
- if (!widgetList) {
750
- return null;
751
- }
752
-
753
- let foundWidget = null;
754
- let handlerFn = (widget) => {
755
- if (widget.options.name === fieldName) {
756
- foundWidget = widget;
757
- }
758
- };
759
-
760
- traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
761
- return foundWidget;
762
- }
763
-
764
- export const columnFormatMap = {
765
- editInput: "input",
766
- editNumber: "number",
767
- editDate: "date",
768
- editSelect: "select",
769
- editSearch: "vabsearch",
770
- editAttachment: "baseAttachment",
771
- editStatus: "status",
772
- aText: "a-text",
773
- aLink: "a-link",
774
- editDelete: "a-link",
775
- editButton: "a-link",
776
- button: "button",
777
- addSiblingEditRow: "a-link",
778
- addChildTreeRow: "a-link",
779
- moveUpRow: "a-link",
780
- moveDownRow: "a-link",
781
- removeTreeRow: "a-link",
782
- text: "text",
783
- checkbox: "checkbox",
784
- radio: "radio",
785
- dropdown: "dropdown",
786
- textarea: "textarea",
787
- editScriptInput: "script-input",
788
- };
789
-
790
- /** 列 widget 扩展选项:动态列 widgetOptions;设计器静态列 columnOption */
791
- export function getColumnWidgetOptions(row, isEdit = false) {
792
- if (!row) {
793
- return undefined;
794
- }
795
- if (isEdit) {
796
- return row.editWidgetOptions ?? row.editColumnOption;
797
- }
798
- return row.widgetOptions ?? row.columnOption;
799
- }
800
-
801
- /** 将列级 label / keyName / required 同步到列内 field widget(动态列 label 在列顶层) */
802
- export function applyColumnMetaToFieldWidget(fieldWidget, row, isEdit = false) {
803
- if (!fieldWidget || !row) {
804
- return fieldWidget;
805
- }
806
- const widgetOptions = getColumnWidgetOptions(row, isEdit);
807
- if (fieldWidget.options.hasOwnProperty("required")) {
808
- fieldWidget.options.required = !!(row.required || widgetOptions?.required);
809
- }
810
- if (!fieldWidget.options.label && row.label) {
811
- fieldWidget.options.label = row.label;
812
- }
813
- if (row.prop) {
814
- if (fieldWidget.options.hasOwnProperty("keyName")) {
815
- fieldWidget.options.keyName = row.prop;
816
- fieldWidget.options.keyNameEnabled = true;
817
- } else if (!fieldWidget.options.name) {
818
- fieldWidget.options.name = row.prop;
819
- }
820
- }
821
- if (fieldWidget.type !== "button" && fieldWidget.type !== "a-link") {
822
- fieldWidget.options.labelHidden = true;
823
- }
824
- return fieldWidget;
825
- }
826
-
827
- /** 同步列 widget / editWidget 的列级元数据(含 labelHidden) */
828
- export function applyColumnMetaToColumnRow(row) {
829
- if (!row) {
830
- return;
831
- }
832
- if (row.widget) {
833
- applyColumnMetaToFieldWidget(row.widget, row, false);
834
- }
835
- if (row.editWidget) {
836
- applyColumnMetaToFieldWidget(row.editWidget, row, true);
837
- }
838
- }
839
-
840
- export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
841
- if (!widgetList) {
842
- return null;
843
- }
844
-
845
- let foundWidget = null;
846
- let handlerFn = (widget) => {
847
- if (widget.id === fieldId) {
848
- foundWidget = widget;
849
- } else if (widget.type === "data-table") {
850
- for (let column of widget.options.tableColumns) {
851
- if (column?.widget?.id + "" === fieldId) {
852
- foundWidget = column.widget;
853
- break;
854
- } else if (column.widgetList) {
855
- loopHandleWidget(column.widgetList, (item1) => {
856
- if (item1.id === fieldId) {
857
- foundWidget = item1;
858
- }
859
- });
860
- }
861
- }
862
- }
863
- };
864
-
865
- traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
866
- return foundWidget;
867
- }
868
-
869
- export function getContainerWidgetByName(widgetList, containerName) {
870
- if (!widgetList) {
871
- return null;
872
- }
873
-
874
- let foundContainer = null;
875
- let handlerFn = (con) => {
876
- if (con.options.name === containerName) {
877
- foundContainer = con;
878
- }
879
- };
880
-
881
- traverseContainerWidgets(widgetList, handlerFn);
882
- return foundContainer;
883
- }
884
-
885
- export function getContainerWidgetById(widgetList, containerId) {
886
- if (!widgetList) {
887
- return null;
888
- }
889
-
890
- let foundContainer = null;
891
- let handlerFn = (con) => {
892
- if (con.id === containerId) {
893
- foundContainer = con;
894
- }
895
- };
896
-
897
- traverseContainerWidgets(widgetList, handlerFn);
898
- return foundContainer;
899
- }
900
-
901
- export function copyToClipboard(
902
- content,
903
- clickEvent,
904
- $message,
905
- successMsg,
906
- errorMsg
907
- ) {
908
- const clipboard = new Clipboard(clickEvent.target, {
909
- text: () => content,
910
- });
911
-
912
- clipboard.on("success", () => {
913
- $message.success(successMsg);
914
- clipboard.destroy();
915
- });
916
-
917
- clipboard.on("error", () => {
918
- $message.error(errorMsg);
919
- clipboard.destroy();
920
- });
921
-
922
- clipboard.onClick(clickEvent);
923
- }
924
-
925
- export function getQueryParam(variable) {
926
- let query = window.location.search.substring(1);
927
- let vars = query.split("&");
928
- for (let i = 0; i < vars.length; i++) {
929
- let pair = vars[i].split("=");
930
- if (pair[0] === variable) {
931
- return pair[1];
932
- }
933
- }
934
-
935
- return undefined;
936
- }
937
-
938
- export function getDefaultFormConfig() {
939
- return {
940
- modelName: "formData",
941
- refName: "vForm",
942
- rulesName: "rules",
943
- labelWidth: 80,
944
- labelPosition: "left",
945
- size: "",
946
- labelAlign: "label-right-align",
947
- cssCode: "",
948
- customClass: "",
949
- functions: "",
950
- layoutType: "PC",
951
- dataSources: [],
952
- onBeforeCreated: "",
953
- onFormCreated: "",
954
- onFormBeforeMounted: "",
955
- onFormMounted: "",
956
- onFormDataChange: "",
957
- gridConfig: {
958
- accessReturnType: 1,
959
- isLoadDataByAccess: false,
960
- },
961
- getConfig: {
962
- accessType: "1",
963
- accessUrl: null,
964
- accessParam: null,
965
- accessCallback: null,
966
- scriptName: null,
967
- scriptCode: null,
968
- },
969
- saveConfig: {
970
- accessType: "1",
971
- accessUrl: null,
972
- accessParam: null,
973
- accessCallback: null,
974
- scriptName: null,
975
- scriptCode: null,
976
- },
977
- scriptList: [],
978
- formType: 0,
979
- entityTableCode: null,
980
- entityTableDesc: null,
981
- editFormCode: null,
982
- editFormName: null,
983
- searchDialogNameField: null,
984
- searchDialogUniqueField: null,
985
- entity: null,
986
- wfEnabled: false,
987
- isLoadEntity: false,
988
- formScriptCode: "getOne",
989
- formScriptParam: null,
990
- formScriptSuccess: null,
991
- saveScriptCode: "saveUpdate",
992
- wfConfig: null,
993
- wfStartBindSave: false,
994
- wfStartConfirmText: null,
995
- wfAgreenBindSave: false,
996
- wfAgreeConfigData: [],
997
- wfConfigDataEnabled: false,
998
- wfConfigData: [],
999
- multiTabEnabled: false,
1000
- multiTabLabelField: null,
1001
- billNavEnabled: false, // 详情页签显示「上一单/下一单」翻单按钮
1002
- addFormCode: null,
1003
- addFormName: null,
1004
- wfTheme: null,
1005
- otherTabEnabled: false,
1006
- otherTabList: [],
1007
- hideNormalTab: false,
1008
- customListTabLabel: null,
1009
- globalConfig: null,
1010
- // 表单级动态字段规则:按本地规则/后台脚本动态控制整个表单内任意字段/容器的显隐/必填/只读/禁用/取值
1011
- dynamicFieldEnabled: false,
1012
- dynamicFieldSourceType: "local",
1013
- dynamicFieldRules: [],
1014
- dynamicFieldScriptCode: null,
1015
- dynamicFieldScriptParam: null,
1016
- dynamicFieldTriggerFields: [],
1017
- };
1018
- }
1019
-
1020
- export function buildDefaultFormJson() {
1021
- return {
1022
- widgetList: [],
1023
- formConfig: deepClone(getDefaultFormConfig()),
1024
- };
1025
- }
1026
-
1027
- export function cloneFormConfigWithoutEventHandler(e) {
1028
- var t = deepClone(e);
1029
- return (
1030
- (t.onFormCreated = ""),
1031
- (t.onFormBeforeMounted = ""),
1032
- (t.onFormMounted = ""),
1033
- (t.onFormDataChange = ""),
1034
- t
1035
- );
1036
- }
1037
-
1038
- export function translateOptionItems(rawData, widgetType, labelKey, valueKey) {
1039
- if (widgetType === "cascader") {
1040
- // 级联选择不转译
1041
- return deepClone(rawData);
1042
- }
1043
-
1044
- let result = [];
1045
- if (!!rawData && rawData.length > 0) {
1046
- result = deepClone(rawData);
1047
- result.forEach((ri) => {
1048
- ri[labelKey] = ri[labelKey] ?? null;
1049
- ri[valueKey] = ri[valueKey] ?? null;
1050
- });
1051
- }
1052
-
1053
- return result;
1054
- }
1055
-
1056
- export function assembleAxiosConfig(arrayObj, DSV, VFR) {
1057
- var result = {};
1058
- if (arrayObj && arrayObj.length) {
1059
- arrayObj.map(function (ai) {
1060
- if ("String" === ai.type) {
1061
- result[ai.name] = String(ai.value);
1062
- } else if ("Number" === ai.type) {
1063
- result[ai.name] = Number(ai.value);
1064
- } else if ("Boolean" === ai.type) {
1065
- "false" === ai.value.toLowerCase() || "0" === ai.value
1066
- ? (result[ai.name] = !1)
1067
- : "true" === ai.value.toLowerCase() || "1" === ai.value
1068
- ? (result[ai.name] = !0)
1069
- : (result[ai.name] = null);
1070
- } else if ("Variable" === ai.type) {
1071
- result[ai.name] = eval(ai.value);
1072
- } else if ("FormData" === ai.type) {
1073
- if (VFR.formDataModel.hasOwnProperty(ai.value)) {
1074
- result[ai.name] = VFR.formDataModel[ai.value];
1075
- } else {
1076
- let parentForm = VFR.parentForm;
1077
- if (parentForm && parentForm.formDataModel.hasOwnProperty(ai.value)) {
1078
- result[ai.name] = parentForm.formDataModel[ai.value];
1079
- }
1080
- }
1081
- }
1082
- });
1083
- }
1084
- return result;
1085
- }
1086
-
1087
- export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
1088
- var config = {};
1089
- /* "String" === dataSource.requestaccessType ? config.url = dataSource.requestURL : config.url = eval(dataSource
1090
- .requestURL), */
1091
- let requestAccess = DSV.requestAccess;
1092
- // config.url = dataSource.requestURL;
1093
- config.url = getAccessUrl();
1094
- (config.method = dataSource.requestMethod || "post"),
1095
- (config.headers = assembleAxiosConfig(dataSource.headers, DSV, VFR)),
1096
- (config.params = assembleAxiosConfig(dataSource.params, DSV, VFR));
1097
- // config.data = assembleAxiosConfig(dataSource.data, DSV, VFR);
1098
- let data = {};
1099
- let conditions = assembleAxiosConfig(dataSource.data, DSV, VFR);
1100
-
1101
- let globalReqData = getReportGlobalMap(); //全局请求参数
1102
- Object.assign(conditions, globalReqData);
1103
-
1104
- let doms = VFR.getWidgetRef(DSV.widgetName);
1105
- let extraAccessData = doms.extraAccessData || {};
1106
-
1107
- data.accessCode = requestAccess.accessCode;
1108
- data.conditions = conditions;
1109
- Object.assign(data.conditions, extraAccessData);
1110
-
1111
- config.data = data;
1112
- var chFn = new Function(
1113
- "config",
1114
- "isSandbox",
1115
- "DSV",
1116
- "VFR",
1117
- dataSource.configHandlerCode
1118
- );
1119
- return chFn.call(null, config, isSandbox, DSV, VFR);
1120
- }
1121
-
1122
- export function runDataSourceRequest(e, t, i, n, o) {
1123
- return _runDataSourceRequest.apply(this, arguments);
1124
- }
1125
-
1126
- export function _runDataSourceRequest() {
1127
- let _runDataSourceRequestN = function (t, i, n, o, a) {
1128
- var l, s, r, d;
1129
- (l = buildRequestConfig(t, i, n, o)),
1130
- (r = new Function(
1131
- "result",
1132
- "isSandbox",
1133
- "DSV",
1134
- "VFR",
1135
- t.dataHandlerCode
1136
- )),
1137
- (d = new Function(
1138
- "error",
1139
- "isSandbox",
1140
- "DSV",
1141
- "$message",
1142
- "VFR",
1143
- t.errorHandlerCode
1144
- ));
1145
-
1146
- return new Promise((resolve, reject) => {
1147
- request({
1148
- ...l,
1149
- callback: (res) => {
1150
- resolve(r.call(null, res, o, i, n));
1151
- },
1152
- error: (error) => {
1153
- d.call(null, error, o, i, a, n);
1154
- reject(error);
1155
- },
1156
- });
1157
- });
1158
- };
1159
- return _runDataSourceRequestN.apply(this, arguments);
1160
- }
1161
-
1162
- export function getDSByName(e, t) {
1163
- var i = null;
1164
- return (
1165
- t &&
1166
- e.dataSources &&
1167
- e.dataSources.forEach(function (e) {
1168
- e.uniqueName === t && (i = e);
1169
- }),
1170
- i
1171
- );
1172
- }
1173
-
1174
- export function setReportGlobalParam(value) {
1175
- sessionStorage.setItem("reportGlobalParam", value);
1176
- }
1177
-
1178
- export function getReportGlobalMap() {
1179
- let param = sessionStorage.getItem("reportGlobalParam");
1180
- if (param) {
1181
- let globalReqData = JSON.parse(decode(param));
1182
- return globalReqData;
1183
- }
1184
- }
1185
-
1186
- export function getSubFormNameByFieldId(o, e) {
1187
- let n = null;
1188
- return (
1189
- getAllContainerWidgets(o).forEach((s) => {
1190
- const c = (u) => {
1191
- u.id === e && (n = s.name);
1192
- };
1193
- (s.type === "sub-form" || s.type === "grid-sub-form") &&
1194
- traverseFieldWidgetsOfContainer(s.container, c);
1195
- }),
1196
- n
1197
- );
1198
- }
1199
-
1200
- export const FORMULA_REG_EXP = /\{\{(\w+\.[^.]+\.\w+)}}/g;
1201
-
1202
- export function fieldIsUsedInFormula(o, e, n) {
1203
- const l = e.match(FORMULA_REG_EXP);
1204
- if (!l) return !1;
1205
- let s = !1;
1206
- return (
1207
- l.forEach((c) => {
1208
- const u = c.split(".")[2];
1209
- if (u.substring(0, u.length - 2) === "func") return;
1210
- const g = c.split(".")[0],
1211
- y = g.substring(2, g.length);
1212
- getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options.name === o &&
1213
- (s = !0);
1214
- }),
1215
- s
1216
- );
1217
- }
1218
-
1219
- export function calculateFormula(o, e, n, l, s) {
1220
- if (
1221
- !!l.subFormItemFlag &&
1222
- !!s.subFormItemFlag &&
1223
- s.subFormRowId !== l.subFormRowId
1224
- )
1225
- return;
1226
- let c = l.field.options.formula;
1227
- c = replaceFieldsAndFunctionsOfFormula(o, l);
1228
- const u = c.match(/[A-Za-z]*/g);
1229
- u &&
1230
- u.forEach((g) => {
1231
- if (!!g && findCalFunStartIndex(g) !== -1) {
1232
- const y = g.toUpperCase();
1233
- c = c.replace(g, "formulaJs." + y);
1234
- }
1235
- }),
1236
- console.log("formula: ", c),
1237
- console.log("formulaFieldRef: ", l);
1238
- const $ = evalFn(c, e, o, n);
1239
- l.setValue($);
1240
- }
1241
-
1242
- export function replaceFieldsAndFunctionsOfFormula(o, e) {
1243
- let n = e.field.options.formula;
1244
- const l = n.match(FORMULA_REG_EXP);
1245
- if (!l) return n;
1246
- let s = n;
1247
- return (
1248
- l.forEach((c) => {
1249
- const u = c.split(".")[2];
1250
- if (u.substring(0, u.length - 2) === "func") {
1251
- const v = c.split(".")[1];
1252
- s = s.replace(c, v);
1253
- return;
1254
- }
1255
- const g = c.split(".")[0],
1256
- y = g.substring(2, g.length),
1257
- f = getFieldWidgetById(o.formJsonObj.widgetList, y, !1);
1258
- if (f) {
1259
- let v = o.getWidgetRef(f.options.name);
1260
- if (v) s = s.replace(c, v.getValue());
1261
- else {
1262
- const w = o.getSubFormNameOfWidget(f.options.name);
1263
- if (e.subFormItemFlag)
1264
- w === e.subFormName
1265
- ? ((v = o.getWidgetRef(f.options.name + "@row" + e.subFormRowId)),
1266
- v && (s = s.replaceAll(c, v.getValue())))
1267
- : console.error("Invalid formula!");
1268
- else {
1269
- const _ = o.formDataModel[w];
1270
- let O = "";
1271
- const S = f.options.name;
1272
- _.forEach((x, E) => {
1273
- O = E === 0 ? x[S] : O + ", " + x[S];
1274
- }),
1275
- (s = s.replaceAll(c, O));
1276
- }
1277
- }
1278
- }
1279
- }),
1280
- s
1281
- );
1282
- }
1283
-
1284
- export function findCalFunStartIndex(o) {
1285
- let e = -1;
1286
- for (let n = 0; n < FORMULA_JS_FUNCTIONS.length; n++) {
1287
- let l = o.indexOf(FORMULA_JS_FUNCTIONS[n]);
1288
- if (l !== -1) return l;
1289
- }
1290
- return e;
1291
- }
1292
-
1293
- export const FORMULA_JS_FUNCTIONS = [
1294
- "INT",
1295
- "SUM",
1296
- "AVERAGE",
1297
- "MAX",
1298
- "MIN",
1299
- "ABS",
1300
- "ROUND",
1301
- "CEILING",
1302
- "LOG",
1303
- "MOD",
1304
- "POWER",
1305
- "AND",
1306
- "IF",
1307
- "IFS",
1308
- "IFERROR",
1309
- "IFNA",
1310
- "NOT",
1311
- "OR",
1312
- "SWITCH",
1313
- "XOR",
1314
- "YEAR",
1315
- "MONTH",
1316
- "DAY",
1317
- "TODAY",
1318
- "NOW",
1319
- "EMONTH",
1320
- "EDAY",
1321
- "FIND",
1322
- "LEFT",
1323
- "RIGHT",
1324
- "LEN",
1325
- "LOWER",
1326
- "UPPER",
1327
- "MID",
1328
- "TRIM",
1329
- ],
1330
- formulas = [
1331
- {
1332
- fClass: "designer.hint.formulaFunctionMaths",
1333
- flist: [
1334
- {
1335
- fName: "INT",
1336
- fType: "designer.hint.formulaNumber",
1337
- fIntro: "designer.hint.formulaINT",
1338
- },
1339
- {
1340
- fName: "SUM",
1341
- fType: "designer.hint.formulaNumber",
1342
- fIntro: "designer.hint.formulaSUM",
1343
- },
1344
- {
1345
- fName: "AVERAGE",
1346
- fType: "designer.hint.formulaNumber",
1347
- fIntro: "designer.hint.formulaAVERAGE",
1348
- },
1349
- {
1350
- fName: "MAX",
1351
- fType: "designer.hint.formulaNumber",
1352
- fIntro: "designer.hint.formulaMAX",
1353
- },
1354
- {
1355
- fName: "MIN",
1356
- fType: "designer.hint.formulaNumber",
1357
- fIntro: "designer.hint.formulaMIN",
1358
- },
1359
- {
1360
- fName: "ABS",
1361
- fType: "designer.hint.formulaNumber",
1362
- fIntro: "designer.hint.formulaABS",
1363
- },
1364
- {
1365
- fName: "ROUND",
1366
- fType: "designer.hint.formulaNumber",
1367
- fIntro: "designer.hint.formulaROUND",
1368
- },
1369
- {
1370
- fName: "CEILING",
1371
- fType: "designer.hint.formulaNumber",
1372
- fIntro: "designer.hint.formulaCEILING",
1373
- },
1374
- {
1375
- fName: "LOG",
1376
- fType: "designer.hint.formulaNumber",
1377
- fIntro: "designer.hint.formulaLOG",
1378
- },
1379
- {
1380
- fName: "MOD",
1381
- fType: "designer.hint.formulaNumber",
1382
- fIntro: "designer.hint.formulaMOD",
1383
- },
1384
- {
1385
- fName: "POWER",
1386
- fType: "designer.hint.formulaNumber",
1387
- fIntro: "designer.hint.formulaPOWER",
1388
- },
1389
- ],
1390
- },
1391
- ];
1392
-
1393
- export function evalFn(o, e = null, n = null, l = null) {
1394
- return new Function("DSV", "VFR", "LS", "formulaJs", "return " + o)(
1395
- e,
1396
- n,
1397
- localStorage,
1398
- l
1399
- );
1400
- }
1401
-
1402
- export function trimEx(o, e, n) {
1403
- return e
1404
- ? n === "left"
1405
- ? o.replace(new RegExp("^%%" + e + "+", "g"), "")
1406
- : n === "right"
1407
- ? o.replace(new RegExp("%%" + e + "+$", "g"), "")
1408
- : o.replace(new RegExp("^%%" + e + "+|%%" + e + "+$", "g"), "")
1409
- : o.replace(/^%s+|%s+$/g, "");
1410
- }
1411
-
1412
- export function hasPropertyOfObject(o, e) {
1413
- const n = e.split(".");
1414
- let l = o,
1415
- s = !0;
1416
- for (const c of n)
1417
- if (l.hasOwnProperty(c)) l = l[c];
1418
- else {
1419
- s = !1;
1420
- break;
1421
- }
1422
- return s;
1423
- }
1424
-
1425
- export function objectKeysToArray(o) {
1426
- if (!o) return [];
1427
- const e = [];
1428
- return (
1429
- Object.keys(o).forEach((n) => {
1430
- e.push(n);
1431
- }),
1432
- e
1433
- );
1434
- }
1435
-
1436
- //begin
1437
- export function loopHandleWidget(widgetList, callback) {
1438
- widgetList &&
1439
- widgetList.length > 0 &&
1440
- widgetList.forEach(function (e) {
1441
- loopHandleWidgetItem(e, null, callback);
1442
- });
1443
- }
1444
-
1445
- function loopHandleWidgetItem(e, p, callback) {
1446
- if ("container" === e.category) {
1447
- callback(e, p);
1448
- if ("vf-dialog" === e.type || "vf-drawer" === e.type);
1449
- else if ("data-table" === e.type) {
1450
- if (!!e.widgetList) {
1451
- e.widgetList.forEach((childItem) => {
1452
- loopHandleWidgetItem(childItem, e, callback);
1453
- });
1454
- }
1455
- if (!!e.buttons) {
1456
- e.buttons.forEach((childItem) => {
1457
- loopHandleWidgetItem(childItem, e, callback);
1458
- });
1459
- }
1460
- } else if ("list-h5" === e.type) {
1461
- if (!!e.widgetList && e.widgetList.length > 0) {
1462
- e.widgetList.forEach((childItem) => {
1463
- loopHandleWidgetItem(childItem, e, callback);
1464
- });
1465
- }
1466
- } else if ("grid" === e.type) {
1467
- e.cols &&
1468
- e.cols.length > 0 &&
1469
- e.cols.forEach(function (childItem) {
1470
- loopHandleWidgetItem(childItem, e, callback);
1471
- });
1472
- } else if ("table" === e.type) {
1473
- e.rows &&
1474
- e.rows.length > 0 &&
1475
- e.rows.forEach(function (rowItem) {
1476
- rowItem.cols &&
1477
- rowItem.cols.length > 0 &&
1478
- rowItem.cols.forEach(function (childItem) {
1479
- loopHandleWidgetItem(childItem, e, callback);
1480
- });
1481
- });
1482
- } else if ("h5-table" === e.type) {
1483
- e.rows &&
1484
- e.rows.length > 0 &&
1485
- e.rows.forEach(function (rowItem) {
1486
- rowItem.cols &&
1487
- rowItem.cols.length > 0 &&
1488
- rowItem.cols.forEach(function (childItem) {
1489
- loopHandleWidgetItem(childItem, e, callback);
1490
- });
1491
- });
1492
- } else if ("tab" === e.type) {
1493
- e.tabs &&
1494
- e.tabs.length > 0 &&
1495
- e.tabs.forEach(function (tabItem) {
1496
- tabItem.widgetList &&
1497
- tabItem.widgetList.length > 0 &&
1498
- tabItem.widgetList.forEach(function (childItem) {
1499
- loopHandleWidgetItem(childItem, e, callback);
1500
- });
1501
- });
1502
- } else if ("detail" === e.type) {
1503
- if (e.panes) {
1504
- e.panes.forEach(function (childItem) {
1505
- loopHandleWidgetItem(childItem, e, callback);
1506
- });
1507
- }
1508
- if (e.widgetList) {
1509
- e.widgetList.forEach(function (childItem) {
1510
- loopHandleWidgetItem(childItem, e, callback);
1511
- });
1512
- }
1513
- } else if ("detail-pane" === e.type) {
1514
- if (e.widgetList) {
1515
- e.widgetList.forEach(function (childItem) {
1516
- loopHandleWidgetItem(childItem, e, callback);
1517
- });
1518
- }
1519
- if (e.buttonWidgetList) {
1520
- e.buttonWidgetList.forEach(function (childItem) {
1521
- loopHandleWidgetItem(childItem, e, callback);
1522
- });
1523
- }
1524
- } else {
1525
- "grid-col" === e.type || e.type,
1526
- e.widgetList &&
1527
- e.widgetList.length > 0 &&
1528
- e.widgetList.forEach(function (childItem) {
1529
- loopHandleWidgetItem(childItem, e, callback);
1530
- });
1531
- }
1532
- } else {
1533
- callback && callback(e);
1534
- if (e.widgetList) {
1535
- e.widgetList.forEach(function (childItem) {
1536
- loopHandleWidgetItem(childItem, e, callback);
1537
- });
1538
- }
1539
- }
1540
- }
1541
-
1542
- //end
1543
-
1544
- export function trim(value) {
1545
- if (isNull(value)) return value;
1546
- if (value.trim) {
1547
- return value.trim();
1548
- } else {
1549
- return value;
1550
- }
1551
- }
1
+ import Clipboard from "clipboard";
2
+ import axios from "axios";
3
+ import request from "../../../utils/request.js";
4
+ import { decode } from "js-base64";
5
+
6
+ export function getAccessUrl() {
7
+ return SUPPORT_PREFIX + "/report_ins/getData";
8
+ }
9
+
10
+ export function isNull(value) {
11
+ return value === null || value === undefined;
12
+ }
13
+
14
+ export function isNilOrEmptyStr(value) {
15
+ return value === null || value === undefined || value === "";
16
+ }
17
+
18
+ export function isNotNull(value) {
19
+ return value !== null && value !== undefined;
20
+ }
21
+
22
+ const ATTACHMENT_WIDGET_TYPES = ["vabUpload", "baseAttachment", "vabUpload2"];
23
+
24
+ const PROJECT_TAG_WIDGET_TYPES = [
25
+ "project-tag",
26
+ "user-project-tag",
27
+ "saleOrg-project-tag",
28
+ ];
29
+
30
+ const VABSEARCH_WIDGET_TYPES = ["vabsearch", "singerSearch", "multiSearch"];
31
+
32
+ export function isAttachmentWidgetType(type) {
33
+ return ATTACHMENT_WIDGET_TYPES.includes(type);
34
+ }
35
+
36
+ export function isVabsearchWidgetType(type) {
37
+ return VABSEARCH_WIDGET_TYPES.includes(type);
38
+ }
39
+
40
+ export function isVabsearchMultiWidget(widget) {
41
+ if (!widget) {
42
+ return false;
43
+ }
44
+ const type = widget.type;
45
+ if (type === "multiSearch") {
46
+ return true;
47
+ }
48
+ if (!isVabsearchWidgetType(type)) {
49
+ return false;
50
+ }
51
+ const options = widget.options || {};
52
+ return !!(
53
+ options.multipleChoices || options.searchDialogConfig?.multipleChoices
54
+ );
55
+ }
56
+
57
+ /** 绑定值为数组的字段组件(含附件) */
58
+ export function isArrayValueWidgetType(type, options = {}) {
59
+ if (isAttachmentWidgetType(type)) {
60
+ return true;
61
+ }
62
+ if (type === "checkbox") {
63
+ return true;
64
+ }
65
+ if (type === "select" && options.multiple) {
66
+ return true;
67
+ }
68
+ if (type === "time-range" || type === "date-range") {
69
+ return true;
70
+ }
71
+ if (type === "date" && options.type === "dates") {
72
+ return true;
73
+ }
74
+ if (PROJECT_TAG_WIDGET_TYPES.includes(type)) {
75
+ return true;
76
+ }
77
+ if (type === "multiSearch") {
78
+ return true;
79
+ }
80
+ if (
81
+ type === "vabsearch" &&
82
+ (options.multipleChoices || options.searchDialogConfig?.multipleChoices)
83
+ ) {
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+
89
+ /** 数组类字段值是否为空(用于必填校验) */
90
+ export function isEmptyArrayFieldValue(value, type, options = {}) {
91
+ if (value === null || value === undefined) {
92
+ return true;
93
+ }
94
+ if (type === "time-range" || type === "date-range") {
95
+ if (!Array.isArray(value) || value.length === 0) {
96
+ return true;
97
+ }
98
+ return value.every(
99
+ (item) => item === null || item === undefined || item === ""
100
+ );
101
+ }
102
+ /* 附件字段开了「值存为URL」且限制数量为 1 时,模型里存的是单个 URL 字符串,
103
+ 不能按空数组判空,否则必填校验永远不通过 */
104
+ if (isAttachmentWidgetType(type) && options.urlValueEnabled) {
105
+ if (typeof value === "string") {
106
+ return !value.trim();
107
+ }
108
+ }
109
+ if (!Array.isArray(value)) {
110
+ return true;
111
+ }
112
+ return value.length === 0;
113
+ }
114
+
115
+ export function isEmptyStr(str) {
116
+ //return (str === undefined) || (!str) || (!/[^\s]/.test(str));
117
+ return (
118
+ str === undefined ||
119
+ (!str && str !== 0 && str !== "0") ||
120
+ !/[^\s]/.test(str)
121
+ );
122
+ }
123
+
124
+ export const generateId = function () {
125
+ return Math.floor(
126
+ Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
127
+ );
128
+ };
129
+
130
+ // 审计字段:创建/修改人及时间,camelCase 与 snake_case 两种形式;后端保存时重新生成
131
+ const AUDIT_FIELDS = [
132
+ "createBy",
133
+ "createDate",
134
+ "modifyBy",
135
+ "modifyDate",
136
+ "_createBy",
137
+ "_modifyBy",
138
+ "create_by",
139
+ "create_date",
140
+ "modify_by",
141
+ "modify_date",
142
+ ];
143
+ // 展示态字段:查询时后端回填的创建/修改人昵称、手机号,保存前需剔除
144
+ const DISPLAY_FIELDS = [
145
+ "_createNickName",
146
+ "_createMobile",
147
+ "_modifyNickName",
148
+ "_modifyMobile",
149
+ ];
150
+ // 子表/树表外键:复制场景下需断链
151
+ export const XFORM_SUB_FK_FIELDS = [
152
+ "head_table_id",
153
+ "headTableId",
154
+ "alias_id",
155
+ "object_foreign_id",
156
+ ];
157
+ // 主表系统字段(含 id):供对比功能 sanitizeChangeData 清洗使用
158
+ export const XFORM_SYSTEM_FIELDS = ["id", ...AUDIT_FIELDS];
159
+ // 行级复制清洗字段:审计 + 展示态 + 子表外键;不含 id/parentField,
160
+ // 二者承载树层级,由调用方的树逻辑单独生成/重映射
161
+ export const XFORM_ROW_CLEAN_FIELDS = [
162
+ ...AUDIT_FIELDS,
163
+ ...DISPLAY_FIELDS,
164
+ ...XFORM_SUB_FK_FIELDS,
165
+ ];
166
+
167
+ export const createUUID = function () {
168
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
169
+ .replace(/[xy]/g, function (c) {
170
+ var r = (Math.random() * 16) | 0,
171
+ v = c === "x" ? r : (r & 0x3) | 0x8;
172
+ return v.toString(16);
173
+ })
174
+ .replaceAll("-", "");
175
+ };
176
+
177
+ export const deepClone = function (origin) {
178
+ if (origin === undefined) {
179
+ return undefined;
180
+ }
181
+
182
+ return JSON.parse(JSON.stringify(origin));
183
+ };
184
+
185
+ export const overwriteObj = function (obj1, obj2) {
186
+ /* 浅拷贝对象属性,obj2覆盖obj1 */
187
+ // for (let prop in obj2) {
188
+ // if (obj2.hasOwnProperty(prop)) {
189
+ // obj1[prop] = obj2[prop]
190
+ // }
191
+ // }
192
+
193
+ Object.keys(obj2).forEach((prop) => {
194
+ obj1[prop] = obj2[prop];
195
+ });
196
+ };
197
+
198
+ export const addWindowResizeHandler = function (handler) {
199
+ // qiankun 沙箱下 window.onresize 直赋值落在代理对象上收不到真实事件,
200
+ // 统一走 addEventListener(沙箱会在子应用卸载时自动清理)。
201
+ // 主应用/独立运行时没有沙箱兜底,返回解绑函数供调用方在 beforeDestroy 中调用,
202
+ // 否则监听闭包会钉住已销毁的组件实例(内存泄露)
203
+ window.addEventListener("resize", handler);
204
+ return function () {
205
+ window.removeEventListener("resize", handler);
206
+ };
207
+ };
208
+
209
+ const createStyleSheet = function () {
210
+ let head = document.head || document.getElementsByTagName("head")[0];
211
+ let style = document.createElement("style");
212
+ style.type = "text/css";
213
+ head.appendChild(style);
214
+ return style.sheet;
215
+ };
216
+
217
+ export const insertCustomCssToHead = function (cssCode, formId = "") {
218
+ let head = document.getElementsByTagName("head")[0];
219
+ let oldStyle = document.getElementById("vform-custom-css");
220
+ if (!!oldStyle) {
221
+ head.removeChild(oldStyle); //先清除后插入!!
222
+ }
223
+ if (!!formId) {
224
+ oldStyle = document.getElementById("vform-custom-css" + "-" + formId);
225
+ !!oldStyle && head.removeChild(oldStyle); //先清除后插入!!
226
+ }
227
+
228
+ let newStyle = document.createElement("style");
229
+ newStyle.type = "text/css";
230
+ newStyle.rel = "stylesheet";
231
+ newStyle.id = !!formId
232
+ ? "vform-custom-css" + "-" + formId
233
+ : "vform-custom-css";
234
+ try {
235
+ newStyle.appendChild(document.createTextNode(cssCode));
236
+ } catch (ex) {
237
+ newStyle.styleSheet.cssText = cssCode;
238
+ }
239
+
240
+ head.appendChild(newStyle);
241
+ };
242
+
243
+ /**
244
+ * 注入表单全局函数(formConfig.functions):把代码执行在【真实全局作用域】,
245
+ * 使表单各类事件脚本能引用到其中定义的函数。
246
+ *
247
+ * 为什么不再插 <script>:事件脚本一律由 new Function 创建,其作用域链恒为真实全局作用域;
248
+ * qiankun 沙箱 patch 了 head/body 的 appendChild,子应用里动态 script 不会进 DOM,
249
+ * 改由 execScripts 以 (function(window){with(window){...}}).bind(proxy) 包裹执行——
250
+ * `function foo(){}` 落在包裹函数的作用域里、`window.foo=` 落在 proxy 上,两者在真实
251
+ * window 上都不存在,调用侧必然 ReferenceError 且被各处 try/catch 吞掉(静默失效)。
252
+ *
253
+ * 间接 eval 由规范保证在全局作用域、非严格模式下求值,函数声明因此成为真实 window 的属性,
254
+ * 与 new Function 的取值环境对齐;qiankun 对 `eval` 有显式特判(proxySandbox 返回原生 eval),
255
+ * 主应用形态与子应用形态行为一致。
256
+ *
257
+ * 函数名与 formId 参数保持不变:调用方(含 haier 分支)沿用此签名,改名只增加同步面。
258
+ * 现已不产生 DOM 节点、无需按 id 清理,formId 仅用于 sourceURL 定位。
259
+ */
260
+ export const insertGlobalFunctionsToHtml = function (
261
+ functionsCode,
262
+ formId = ""
263
+ ) {
264
+ if (!functionsCode || typeof functionsCode !== "string") {
265
+ return;
266
+ }
267
+ let sourceName = !!formId
268
+ ? "v_form_global_functions" + "-" + formId
269
+ : "v_form_global_functions";
270
+ try {
271
+ // (0, eval) 是间接调用形式,不可简写为 eval(...):直接 eval 会继承当前模块作用域,
272
+ // 函数声明将落在模块内而非真实 window 上。sourceURL 让 devtools 里可定位、可下断点。
273
+ (0, eval)(functionsCode + "\n//# sourceURL=" + sourceName + ".js");
274
+ } catch (e) {
275
+ // 原先 <script> 注入时语法/运行时错误只进 window.onerror、不影响表单渲染,
276
+ // 这里必须同样吞掉:否则会中断 initFormObject 整条表单初始化链路
277
+ console.error("[xform] 表单全局函数执行失败:" + sourceName, e);
278
+ }
279
+ };
280
+
281
+ export const optionExists = function (optionsObj, optionName) {
282
+ if (!optionsObj) {
283
+ return false;
284
+ }
285
+
286
+ return Object.keys(optionsObj).indexOf(optionName) > -1;
287
+ };
288
+
289
+ export const loadRemoteScript = function (srcPath, callback) {
290
+ /*加载远程js,加载成功后执行回调函数*/
291
+ let sid = encodeURIComponent(srcPath);
292
+ let oldScriptEle = document.getElementById(sid);
293
+
294
+ if (!oldScriptEle) {
295
+ let s = document.createElement("script");
296
+ s.src = srcPath;
297
+ s.id = sid;
298
+ document.body.appendChild(s);
299
+
300
+ s.onload = s.onreadystatechange = function (_, isAbort) {
301
+ /* 借鉴自ace.js */
302
+ if (
303
+ isAbort ||
304
+ !s.readyState ||
305
+ s.readyState === "loaded" ||
306
+ s.readyState === "complete"
307
+ ) {
308
+ s = s.onload = s.onreadystatechange = null;
309
+ if (!isAbort) {
310
+ callback();
311
+ }
312
+ }
313
+ };
314
+ }
315
+ };
316
+
317
+ export function traverseFieldWidgets(
318
+ widgetList,
319
+ handler,
320
+ parent = null,
321
+ staticWidgetsIncluded
322
+ ) {
323
+ if (!widgetList) {
324
+ return;
325
+ }
326
+
327
+ loopHandleWidget(widgetList, (w, parent) => {
328
+ if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
329
+ handler(w, parent);
330
+ }
331
+ });
332
+
333
+ /* widgetList.forEach((w) => {
334
+ if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
335
+ handler(w, parent);
336
+ } else if (w.type === "grid") {
337
+ w.cols.forEach((col) => {
338
+ traverseFieldWidgets(col.widgetList, handler, w, staticWidgetsIncluded);
339
+ });
340
+ } else if (w.type === "table") {
341
+ w.rows.forEach((row) => {
342
+ row.cols.forEach((cell) => {
343
+ traverseFieldWidgets(
344
+ cell.widgetList,
345
+ handler,
346
+ w,
347
+ staticWidgetsIncluded
348
+ );
349
+ });
350
+ });
351
+ } else if (w.type === "tab") {
352
+ w.tabs.forEach((tab) => {
353
+ traverseFieldWidgets(tab.widgetList, handler, w, staticWidgetsIncluded);
354
+ });
355
+ } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
356
+ traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
357
+ } else if (w.category === "container") {
358
+ //自定义容器
359
+ traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
360
+ }
361
+ }); */
362
+ }
363
+
364
+ export function traverseContainerWidgets(
365
+ widgetList,
366
+ handler,
367
+ skipDialogAndDrawer
368
+ ) {
369
+ if (!widgetList) {
370
+ return;
371
+ }
372
+
373
+ loopHandleWidget(widgetList, (w, parent) => {
374
+ if (w.category === "container") {
375
+ if (
376
+ skipDialogAndDrawer &&
377
+ (w.type === "vf-dialog" || w.type === "vf-drawer")
378
+ ) {
379
+ //什么也不做
380
+ } else {
381
+ handler(w);
382
+ }
383
+ }
384
+ });
385
+
386
+ /* widgetList.forEach((w) => {
387
+ if (w.category === "container") {
388
+ if (
389
+ skipDialogAndDrawer &&
390
+ (w.type === "vf-dialog" || w.type === "vf-drawer")
391
+ ) {
392
+ //什么也不做
393
+ } else {
394
+ handler(w);
395
+ }
396
+ }
397
+
398
+ if (w.type === "grid") {
399
+ w.cols.forEach((col) => {
400
+ traverseContainerWidgets(col.widgetList, handler);
401
+ });
402
+ } else if (w.type === "table") {
403
+ w.rows.forEach((row) => {
404
+ row.cols.forEach((cell) => {
405
+ traverseContainerWidgets(cell.widgetList, handler);
406
+ });
407
+ });
408
+ } else if (w.type === "tab") {
409
+ w.tabs.forEach((tab) => {
410
+ traverseContainerWidgets(tab.widgetList, handler);
411
+ });
412
+ } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
413
+ traverseContainerWidgets(w.widgetList, handler);
414
+ } else if (w.category === "container") {
415
+ //自定义容器
416
+ if (
417
+ skipDialogAndDrawer &&
418
+ (w.type === "vf-dialog" || w.type === "vf-drawer")
419
+ ) {
420
+ //什么也不做
421
+ } else {
422
+ traverseContainerWidgets(w.widgetList, handler);
423
+ }
424
+ }
425
+ }); */
426
+ }
427
+
428
+ export function traverseAllWidgetsNew(widgetList, callback) {
429
+ if (!widgetList) {
430
+ return;
431
+ }
432
+ let columnLoopDo = (t, parentWidget) => {
433
+ if (t.children && t.children.length) {
434
+ t.children.forEach((item) => {
435
+ columnLoopDo(item, parentWidget);
436
+ });
437
+ } else {
438
+ if (t.widget) {
439
+ callback && callback(t.widget, parentWidget);
440
+ }
441
+ if (t.editWidget) {
442
+ callback && callback(t.editWidget, parentWidget);
443
+ }
444
+ if (t.widgetList && t.widgetList.length) {
445
+ loopHandleWidget(t.widgetList, (widget) => {
446
+ callback && callback(widget, parentWidget);
447
+ });
448
+ }
449
+ }
450
+ };
451
+ loopHandleWidget(widgetList, (widget, parentWidget) => {
452
+ if (callback) {
453
+ callback(widget, parentWidget);
454
+ if (widget.type === "data-table") {
455
+ for (let item of widget.options.tableColumns) {
456
+ columnLoopDo(item, parentWidget);
457
+ }
458
+ }
459
+ }
460
+ });
461
+ }
462
+
463
+ export function traverseAllWidgets(widgetList, handler) {
464
+ if (!widgetList) {
465
+ return;
466
+ }
467
+
468
+ loopHandleWidget(widgetList, (w, parentWidget) => {
469
+ handler(w, parentWidget);
470
+ });
471
+
472
+ /* widgetList.forEach((w) => {
473
+ handler(w);
474
+
475
+ if (w.type === "grid") {
476
+ w.cols.forEach((col) => {
477
+ handler(col);
478
+ traverseAllWidgets(col.widgetList, handler);
479
+ });
480
+ } else if (w.type === "table") {
481
+ w.rows.forEach((row) => {
482
+ row.cols.forEach((cell) => {
483
+ handler(cell);
484
+ traverseAllWidgets(cell.widgetList, handler);
485
+ });
486
+ });
487
+ } else if (w.type === "tab") {
488
+ w.tabs.forEach((tab) => {
489
+ traverseAllWidgets(tab.widgetList, handler);
490
+ });
491
+ } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
492
+ traverseAllWidgets(w.widgetList, handler);
493
+ } else if (w.category === "container") {
494
+ //自定义容器
495
+ traverseAllWidgets(w.widgetList, handler);
496
+ }
497
+ }); */
498
+ }
499
+
500
+ function handleWidgetForTraverse(
501
+ widget,
502
+ handler,
503
+ staticWidgetsIncluded = false
504
+ ) {
505
+ if (!!widget.category && widget.category === "container") {
506
+ traverseFieldWidgetsOfContainer(widget, handler);
507
+ } else if (widget.formItemFlag) {
508
+ handler(widget);
509
+ }
510
+ }
511
+
512
+ export const itemFieldMap = {
513
+ grid: "cols",
514
+ table: "rows",
515
+ "table-cell": "widgetList",
516
+ "h5-table": "rows",
517
+ "h5-table-cell": "widgetList",
518
+ tab: "tabs",
519
+ "tab-pane": "widgetList",
520
+ "grid-col": "widgetList",
521
+ "vf-box": "widgetList",
522
+ card: "widgetList",
523
+ detail: "panes",
524
+ "detail-pane": "widgetList",
525
+ "detail-h5": "panes",
526
+ "h5-card": "panes",
527
+ "h5-card-pane": "widgetList",
528
+ };
529
+
530
+ /**
531
+ * 遍历容器内的字段组件
532
+ * @param con
533
+ * @param handler
534
+ * @param staticWidgetsIncluded
535
+ */
536
+ export function traverseFieldWidgetsOfContainer(
537
+ con,
538
+ handler,
539
+ staticWidgetsIncluded = false
540
+ ) {
541
+ /*loopHandleWidget([con],(w, parent)=>{
542
+ handleWidgetForTraverse(w, handler, staticWidgetsIncluded);
543
+ });*/
544
+ if (con.type === "grid") {
545
+ con.cols.forEach((col) => {
546
+ col.widgetList.forEach((cw) => {
547
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
548
+ });
549
+ });
550
+ } else if (con.type === "table") {
551
+ con.rows.forEach((row) => {
552
+ row.cols.forEach((cell) => {
553
+ cell.widgetList.forEach((cw) => {
554
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
555
+ });
556
+ });
557
+ });
558
+ } else if (con.type === "tab") {
559
+ con.tabs.forEach((tab) => {
560
+ tab.widgetList.forEach((cw) => {
561
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
562
+ });
563
+ });
564
+ } else if (con.type === "sub-form" || con.type === "grid-sub-form") {
565
+ con.widgetList.forEach((cw) => {
566
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
567
+ });
568
+ } else if (con.type === "data-table") {
569
+ /*con.widgetList.forEach((cw) => {
570
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
571
+ });*/
572
+ if (!!con.widgetList) {
573
+ con.widgetList.forEach((childItem) => {
574
+ loopHandleWidgetItem(childItem, con, handler);
575
+ });
576
+ }
577
+ if (!!con.buttons) {
578
+ con.buttons.forEach((childItem) => {
579
+ loopHandleWidgetItem(childItem, con, handler);
580
+ });
581
+ }
582
+ for (let column of con.options.tableColumns) {
583
+ if (column.widget) {
584
+ handleWidgetForTraverse(column.widget, handler, staticWidgetsIncluded);
585
+ }
586
+ if (column.widgetList) {
587
+ column.widgetList.forEach((cw) => {
588
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
589
+ });
590
+ /*loopHandleWidget(column.widgetList, (cw) => {
591
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
592
+ });*/
593
+ }
594
+ }
595
+ } else if (con.category === "container") {
596
+ //自定义容器
597
+ /*let key = itemFieldMap[con.type]
598
+ con[key].forEach((cw) => {
599
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
600
+ });*/
601
+
602
+ /*con.widgetList.forEach(cw => {
603
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded)
604
+ })*/
605
+ loopHandleWidgetItem(con, null, (w) => {
606
+ if (con.id != w.id)
607
+ handleWidgetForTraverse(w, handler, staticWidgetsIncluded);
608
+ });
609
+ }
610
+ }
611
+
612
+ function handleContainerTraverse(
613
+ widget,
614
+ fieldHandler,
615
+ containerHandler,
616
+ internalContainerCallFlag,
617
+ staticWidgetsIncluded
618
+ ) {
619
+ if (!!widget.category && widget.category === "container") {
620
+ traverseWidgetsOfContainer(
621
+ widget,
622
+ fieldHandler,
623
+ containerHandler,
624
+ internalContainerCallFlag,
625
+ staticWidgetsIncluded
626
+ );
627
+ } else if (widget.formItemFlag) {
628
+ fieldHandler(widget);
629
+ } else if (staticWidgetsIncluded) {
630
+ fieldHandler(widget);
631
+ }
632
+ }
633
+
634
+ /**
635
+ * 遍历容器内部的字段组件和容器组件
636
+ * @param con
637
+ * @param fieldHandler
638
+ * @param containerHandler
639
+ * @param internalContainerCallFlag 是否需要处理内部容器组件,默认不处理
640
+ * @param staticWidgetsIncluded 是否需要处理静态非表单交互类组件
641
+ */
642
+ export function traverseWidgetsOfContainer(
643
+ con,
644
+ fieldHandler,
645
+ containerHandler,
646
+ internalContainerCallFlag,
647
+ staticWidgetsIncluded
648
+ ) {
649
+ if (con.category === "container") {
650
+ containerHandler(con);
651
+ }
652
+
653
+ /*loopHandleWidget([con], (cw, parent) => {
654
+ if (con.id !== cw.id) {
655
+ handleContainerTraverse(
656
+ cw,
657
+ fieldHandler,
658
+ containerHandler,
659
+ internalContainerCallFlag,
660
+ staticWidgetsIncluded
661
+ );
662
+ }
663
+ });*/
664
+
665
+ if (con.type === "grid") {
666
+ con.cols.forEach((col) => {
667
+ if (internalContainerCallFlag) {
668
+ containerHandler(col);
669
+ }
670
+ col.widgetList.forEach((cw) => {
671
+ handleContainerTraverse(
672
+ cw,
673
+ fieldHandler,
674
+ containerHandler,
675
+ internalContainerCallFlag,
676
+ staticWidgetsIncluded
677
+ );
678
+ });
679
+ });
680
+ } else if (con.type === "table") {
681
+ con.rows.forEach((row) => {
682
+ if (internalContainerCallFlag) {
683
+ containerHandler(row);
684
+ }
685
+ row.cols.forEach((cell) => {
686
+ if (internalContainerCallFlag) {
687
+ containerHandler(cell);
688
+ }
689
+ cell.widgetList.forEach((cw) => {
690
+ handleContainerTraverse(
691
+ cw,
692
+ fieldHandler,
693
+ containerHandler,
694
+ internalContainerCallFlag,
695
+ staticWidgetsIncluded
696
+ );
697
+ });
698
+ });
699
+ });
700
+ } else if (con.type === "tab") {
701
+ con.tabs.forEach((tab) => {
702
+ if (internalContainerCallFlag) {
703
+ containerHandler(tab);
704
+ }
705
+ tab.widgetList.forEach((cw) => {
706
+ handleContainerTraverse(
707
+ cw,
708
+ fieldHandler,
709
+ containerHandler,
710
+ internalContainerCallFlag,
711
+ staticWidgetsIncluded
712
+ );
713
+ });
714
+ });
715
+ } else if (con.type === "sub-form" || con.type === "grid-sub-form") {
716
+ con.widgetList.forEach((cw) => {
717
+ handleContainerTraverse(
718
+ cw,
719
+ fieldHandler,
720
+ containerHandler,
721
+ internalContainerCallFlag,
722
+ staticWidgetsIncluded
723
+ );
724
+ });
725
+ } else if (con.category === "container") {
726
+ //自定义容器
727
+ let key = itemFieldMap[con.type];
728
+ con[key].forEach((cw) => {
729
+ handleContainerTraverse(
730
+ cw,
731
+ fieldHandler,
732
+ containerHandler,
733
+ internalContainerCallFlag,
734
+ staticWidgetsIncluded
735
+ );
736
+ });
737
+ }
738
+ }
739
+
740
+ export function traverseWidgetsOfGridCol(
741
+ gridCol,
742
+ fieldHandler,
743
+ containerHandler
744
+ ) {
745
+ // if (gridCol.category === 'container') {
746
+ // containerHandler(gridCol)
747
+ // }
748
+
749
+ if (gridCol.type === "grid-col") {
750
+ gridCol.widgetList.forEach((cw) => {
751
+ handleContainerTraverse(cw, fieldHandler, containerHandler);
752
+ });
753
+ }
754
+ }
755
+
756
+ /**
757
+ * 获取所有字段组件
758
+ * @param widgetList
759
+ * @param staticWidgetsIncluded 是否包含按钮等静态组件,默认不包含
760
+ * @returns {[]}
761
+ */
762
+ export function getAllFieldWidgets(widgetList, staticWidgetsIncluded) {
763
+ if (!widgetList) {
764
+ return [];
765
+ }
766
+
767
+ let result = [];
768
+ let handlerFn = (w) => {
769
+ result.push({
770
+ type: w.type,
771
+ name: w.options.name,
772
+ field: w,
773
+ });
774
+ };
775
+ traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
776
+
777
+ return result;
778
+ }
779
+
780
+ /**
781
+ * 获取所有容器组件
782
+ * @param widgetList
783
+ * @param skipDialogAndDrawer 是否跳过弹窗和抽屉内部组件,默认不跳过
784
+ * @returns {[]}
785
+ */
786
+ export function getAllContainerWidgets(widgetList, skipDialogAndDrawer) {
787
+ if (!widgetList) {
788
+ return [];
789
+ }
790
+
791
+ let result = [];
792
+ let handlerFn = (w) => {
793
+ result.push({
794
+ type: w.type,
795
+ name: w.options.name,
796
+ container: w,
797
+ });
798
+ };
799
+ traverseContainerWidgets(widgetList, handlerFn, skipDialogAndDrawer);
800
+
801
+ return result;
802
+ }
803
+
804
+ export function getFieldWidgetByName(
805
+ widgetList,
806
+ fieldName,
807
+ staticWidgetsIncluded
808
+ ) {
809
+ if (!widgetList) {
810
+ return null;
811
+ }
812
+
813
+ let foundWidget = null;
814
+ let handlerFn = (widget) => {
815
+ if (widget.options.name === fieldName) {
816
+ foundWidget = widget;
817
+ }
818
+ };
819
+
820
+ traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
821
+ return foundWidget;
822
+ }
823
+
824
+ export const columnFormatMap = {
825
+ editInput: "input",
826
+ editNumber: "number",
827
+ editDate: "date",
828
+ editSelect: "select",
829
+ editSearch: "vabsearch",
830
+ editAttachment: "baseAttachment",
831
+ editStatus: "status",
832
+ aText: "a-text",
833
+ aLink: "a-link",
834
+ editDelete: "a-link",
835
+ editButton: "a-link",
836
+ button: "button",
837
+ addSiblingEditRow: "a-link",
838
+ addChildTreeRow: "a-link",
839
+ moveUpRow: "a-link",
840
+ moveDownRow: "a-link",
841
+ removeTreeRow: "a-link",
842
+ text: "text",
843
+ checkbox: "checkbox",
844
+ radio: "radio",
845
+ dropdown: "dropdown",
846
+ textarea: "textarea",
847
+ editScriptInput: "script-input",
848
+ };
849
+
850
+ /** widget 扩展选项:动态列 widgetOptions;设计器静态列 columnOption */
851
+ export function getColumnWidgetOptions(row, isEdit = false) {
852
+ if (!row) {
853
+ return undefined;
854
+ }
855
+ if (isEdit) {
856
+ return row.editWidgetOptions ?? row.editColumnOption;
857
+ }
858
+ return row.widgetOptions ?? row.columnOption;
859
+ }
860
+
861
+ /**
862
+ * 复制列内 field widget,用于展示组件与编辑组件同类型、只配置了其中一方的列。
863
+ * 另一方若按类型新建空白 schema,只配在已有一方的 defaultValue / optionItems /
864
+ * searchDialogConfig 等会全部丢失(编辑表新增行取默认值同样受影响)。
865
+ * 字段绑定 keyName 保持不变;id 与 name 必须重新生成——refList 按
866
+ * options.name + 行键 注册,fieldSchemaMap 按 id 索引,两个组件同名会互相覆盖。
867
+ */
868
+ export function cloneColumnFieldWidget(fieldWidget) {
869
+ if (!fieldWidget) {
870
+ return null;
871
+ }
872
+ let newWidget = deepClone(fieldWidget);
873
+ newWidget.id = String(newWidget.type).replace(/-/g, "") + generateId();
874
+ if (newWidget.hasOwnProperty("tableField")) {
875
+ newWidget.tableField = newWidget.id;
876
+ }
877
+ newWidget.options.name = newWidget.id;
878
+ return newWidget;
879
+ }
880
+
881
+ /**
882
+ * 展平数据表格列配置,只返回叶子列。
883
+ * tableColumns 里带 children 的是分组表头(自身 prop 为空),真正的业务字段挂在 children 上,
884
+ * 因此凡是按 prop 取字段的逻辑都必须先展平,不能只看顶层。
885
+ */
886
+ export function flattenLeafColumns(columns) {
887
+ let result = [];
888
+ let loopDo = (cols) => {
889
+ (cols || []).forEach((item) => {
890
+ if (!item) {
891
+ return;
892
+ }
893
+ if (item.children && item.children.length) {
894
+ loopDo(item.children);
895
+ } else {
896
+ result.push(item);
897
+ }
898
+ });
899
+ };
900
+ loopDo(columns);
901
+ return result;
902
+ }
903
+
904
+ /** 将列级 label / keyName / required 同步到列内 field widget(动态列 label 在列顶层) */
905
+ export function applyColumnMetaToFieldWidget(fieldWidget, row, isEdit = false) {
906
+ if (!fieldWidget || !row) {
907
+ return fieldWidget;
908
+ }
909
+ const widgetOptions = getColumnWidgetOptions(row, isEdit);
910
+ if (fieldWidget.options.hasOwnProperty("required")) {
911
+ fieldWidget.options.required = !!(row.required || widgetOptions?.required);
912
+ }
913
+ if (!fieldWidget.options.label && row.label) {
914
+ fieldWidget.options.label = row.label;
915
+ }
916
+ if (row.prop) {
917
+ if (fieldWidget.options.hasOwnProperty("keyName")) {
918
+ fieldWidget.options.keyName = row.prop;
919
+ fieldWidget.options.keyNameEnabled = true;
920
+ } else if (!fieldWidget.options.name) {
921
+ fieldWidget.options.name = row.prop;
922
+ }
923
+ }
924
+ if (fieldWidget.type !== "button" && fieldWidget.type !== "a-link") {
925
+ fieldWidget.options.labelHidden = true;
926
+ }
927
+ return fieldWidget;
928
+ }
929
+
930
+ /** 同步列 widget / editWidget 的列级元数据(含 labelHidden) */
931
+ export function applyColumnMetaToColumnRow(row) {
932
+ if (!row) {
933
+ return;
934
+ }
935
+ if (row.widget) {
936
+ applyColumnMetaToFieldWidget(row.widget, row, false);
937
+ }
938
+ if (row.editWidget) {
939
+ applyColumnMetaToFieldWidget(row.editWidget, row, true);
940
+ }
941
+ }
942
+
943
+ export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
944
+ if (!widgetList) {
945
+ return null;
946
+ }
947
+
948
+ let foundWidget = null;
949
+ let handlerFn = (widget) => {
950
+ if (widget.id === fieldId) {
951
+ foundWidget = widget;
952
+ } else if (widget.type === "data-table") {
953
+ for (let column of widget.options.tableColumns) {
954
+ if (column?.widget?.id + "" === fieldId) {
955
+ foundWidget = column.widget;
956
+ break;
957
+ } else if (column.widgetList) {
958
+ loopHandleWidget(column.widgetList, (item1) => {
959
+ if (item1.id === fieldId) {
960
+ foundWidget = item1;
961
+ }
962
+ });
963
+ }
964
+ }
965
+ }
966
+ };
967
+
968
+ traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
969
+ return foundWidget;
970
+ }
971
+
972
+ export function getContainerWidgetByName(widgetList, containerName) {
973
+ if (!widgetList) {
974
+ return null;
975
+ }
976
+
977
+ let foundContainer = null;
978
+ let handlerFn = (con) => {
979
+ if (con.options.name === containerName) {
980
+ foundContainer = con;
981
+ }
982
+ };
983
+
984
+ traverseContainerWidgets(widgetList, handlerFn);
985
+ return foundContainer;
986
+ }
987
+
988
+ export function getContainerWidgetById(widgetList, containerId) {
989
+ if (!widgetList) {
990
+ return null;
991
+ }
992
+
993
+ let foundContainer = null;
994
+ let handlerFn = (con) => {
995
+ if (con.id === containerId) {
996
+ foundContainer = con;
997
+ }
998
+ };
999
+
1000
+ traverseContainerWidgets(widgetList, handlerFn);
1001
+ return foundContainer;
1002
+ }
1003
+
1004
+ export function copyToClipboard(
1005
+ content,
1006
+ clickEvent,
1007
+ $message,
1008
+ successMsg,
1009
+ errorMsg
1010
+ ) {
1011
+ const clipboard = new Clipboard(clickEvent.target, {
1012
+ text: () => content,
1013
+ });
1014
+
1015
+ clipboard.on("success", () => {
1016
+ $message.success(successMsg);
1017
+ clipboard.destroy();
1018
+ });
1019
+
1020
+ clipboard.on("error", () => {
1021
+ $message.error(errorMsg);
1022
+ clipboard.destroy();
1023
+ });
1024
+
1025
+ clipboard.onClick(clickEvent);
1026
+ }
1027
+
1028
+ export function getQueryParam(variable) {
1029
+ let query = window.location.search.substring(1);
1030
+ let vars = query.split("&");
1031
+ for (let i = 0; i < vars.length; i++) {
1032
+ let pair = vars[i].split("=");
1033
+ if (pair[0] === variable) {
1034
+ return pair[1];
1035
+ }
1036
+ }
1037
+
1038
+ return undefined;
1039
+ }
1040
+
1041
+ export function getDefaultFormConfig() {
1042
+ return {
1043
+ modelName: "formData",
1044
+ refName: "vForm",
1045
+ rulesName: "rules",
1046
+ labelWidth: 80,
1047
+ labelPosition: "left",
1048
+ size: "",
1049
+ labelAlign: "label-right-align",
1050
+ cssCode: "",
1051
+ customClass: "",
1052
+ functions: "",
1053
+ layoutType: "PC",
1054
+ dataSources: [],
1055
+ onBeforeCreated: "",
1056
+ onFormCreated: "",
1057
+ onFormBeforeMounted: "",
1058
+ onFormMounted: "",
1059
+ onFormDataChange: "",
1060
+ gridConfig: {
1061
+ accessReturnType: 1,
1062
+ isLoadDataByAccess: false,
1063
+ },
1064
+ getConfig: {
1065
+ accessType: "1",
1066
+ accessUrl: null,
1067
+ accessParam: null,
1068
+ accessCallback: null,
1069
+ scriptName: null,
1070
+ scriptCode: null,
1071
+ },
1072
+ saveConfig: {
1073
+ accessType: "1",
1074
+ accessUrl: null,
1075
+ accessParam: null,
1076
+ accessCallback: null,
1077
+ scriptName: null,
1078
+ scriptCode: null,
1079
+ },
1080
+ scriptList: [],
1081
+ formType: 0,
1082
+ entityTableCode: null,
1083
+ entityTableDesc: null,
1084
+ editFormCode: null,
1085
+ editFormName: null,
1086
+ searchDialogNameField: null,
1087
+ searchDialogUniqueField: null,
1088
+ entity: null,
1089
+ wfEnabled: false,
1090
+ isLoadEntity: false,
1091
+ formScriptCode: "getOne",
1092
+ formScriptParam: null,
1093
+ formScriptSuccess: null,
1094
+ saveScriptCode: "saveUpdate",
1095
+ wfConfig: null,
1096
+ wfStartBindSave: false,
1097
+ wfStartConfirmText: null,
1098
+ // 「保存并提交流程」内建按钮:由 detail-item 渲染,只在新增页(dataId 为空)显示。
1099
+ // 按钮名不在此处配,统一由后台 wf_diy_attribute(param18) 下发,见 components/wf/wfButtonName.js
1100
+ saveSubmitEnabled: false,
1101
+ // 「提交流程」「保存并提交流程」共用的提交前置处理脚本:校验通过后、确认框之前执行
1102
+ onBeforeSubmitWf: null,
1103
+ // 「提交流程」按钮显隐脚本:return false 隐藏,不配则显示
1104
+ wfStartBtnShow: null,
1105
+ wfAgreenBindSave: false,
1106
+ wfAgreeConfigData: [],
1107
+ wfConfigDataEnabled: false,
1108
+ wfConfigData: [],
1109
+ multiTabEnabled: false,
1110
+ multiTabLabelField: null,
1111
+ addTabEnabled: false, // 新增打开独立页签(不走「常规」页签)
1112
+ submitBehavior: "refreshCurrent", // 提交后行为: refreshCurrent(默认,留在详情页) | closeToList
1113
+ billNavEnabled: false, // 详情页签显示「上一单/下一单」翻单按钮
1114
+ addFormCode: null,
1115
+ addFormName: null,
1116
+ wfTheme: null,
1117
+ otherTabEnabled: false,
1118
+ otherTabList: [],
1119
+ hideNormalTab: false,
1120
+ customListTabLabel: null,
1121
+ globalConfig: null,
1122
+ // 表单级动态字段规则:按本地规则/后台脚本动态控制整个表单内任意字段/容器的显隐/必填/只读/禁用/取值
1123
+ dynamicFieldEnabled: false,
1124
+ dynamicFieldSourceType: "local",
1125
+ dynamicFieldRules: [],
1126
+ dynamicFieldScriptCode: null,
1127
+ dynamicFieldScriptParam: null,
1128
+ dynamicFieldTriggerFields: [],
1129
+ };
1130
+ }
1131
+
1132
+ export function buildDefaultFormJson() {
1133
+ return {
1134
+ widgetList: [],
1135
+ formConfig: deepClone(getDefaultFormConfig()),
1136
+ };
1137
+ }
1138
+
1139
+ export function cloneFormConfigWithoutEventHandler(e) {
1140
+ var t = deepClone(e);
1141
+ return (
1142
+ (t.onFormCreated = ""),
1143
+ (t.onFormBeforeMounted = ""),
1144
+ (t.onFormMounted = ""),
1145
+ (t.onFormDataChange = ""),
1146
+ t
1147
+ );
1148
+ }
1149
+
1150
+ export function translateOptionItems(rawData, widgetType, labelKey, valueKey) {
1151
+ if (widgetType === "cascader") {
1152
+ // 级联选择不转译
1153
+ return deepClone(rawData);
1154
+ }
1155
+
1156
+ let result = [];
1157
+ if (!!rawData && rawData.length > 0) {
1158
+ result = deepClone(rawData);
1159
+ result.forEach((ri) => {
1160
+ ri[labelKey] = ri[labelKey] ?? null;
1161
+ ri[valueKey] = ri[valueKey] ?? null;
1162
+ });
1163
+ }
1164
+
1165
+ return result;
1166
+ }
1167
+
1168
+ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
1169
+ var result = {};
1170
+ if (arrayObj && arrayObj.length) {
1171
+ arrayObj.map(function (ai) {
1172
+ if ("String" === ai.type) {
1173
+ result[ai.name] = String(ai.value);
1174
+ } else if ("Number" === ai.type) {
1175
+ result[ai.name] = Number(ai.value);
1176
+ } else if ("Boolean" === ai.type) {
1177
+ "false" === ai.value.toLowerCase() || "0" === ai.value
1178
+ ? (result[ai.name] = !1)
1179
+ : "true" === ai.value.toLowerCase() || "1" === ai.value
1180
+ ? (result[ai.name] = !0)
1181
+ : (result[ai.name] = null);
1182
+ } else if ("Variable" === ai.type) {
1183
+ result[ai.name] = eval(ai.value);
1184
+ } else if ("FormData" === ai.type) {
1185
+ if (VFR.formDataModel.hasOwnProperty(ai.value)) {
1186
+ result[ai.name] = VFR.formDataModel[ai.value];
1187
+ } else {
1188
+ let parentForm = VFR.parentForm;
1189
+ if (parentForm && parentForm.formDataModel.hasOwnProperty(ai.value)) {
1190
+ result[ai.name] = parentForm.formDataModel[ai.value];
1191
+ }
1192
+ }
1193
+ }
1194
+ });
1195
+ }
1196
+ return result;
1197
+ }
1198
+
1199
+ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
1200
+ var config = {};
1201
+ /* "String" === dataSource.requestaccessType ? config.url = dataSource.requestURL : config.url = eval(dataSource
1202
+ .requestURL), */
1203
+ let requestAccess = DSV.requestAccess;
1204
+ // config.url = dataSource.requestURL;
1205
+ config.url = getAccessUrl();
1206
+ (config.method = dataSource.requestMethod || "post"),
1207
+ (config.headers = assembleAxiosConfig(dataSource.headers, DSV, VFR)),
1208
+ (config.params = assembleAxiosConfig(dataSource.params, DSV, VFR));
1209
+ // config.data = assembleAxiosConfig(dataSource.data, DSV, VFR);
1210
+ let data = {};
1211
+ let conditions = assembleAxiosConfig(dataSource.data, DSV, VFR);
1212
+
1213
+ let globalReqData = getReportGlobalMap(); //全局请求参数
1214
+ Object.assign(conditions, globalReqData);
1215
+
1216
+ let doms = VFR.getWidgetRef(DSV.widgetName);
1217
+ let extraAccessData = doms.extraAccessData || {};
1218
+
1219
+ data.accessCode = requestAccess.accessCode;
1220
+ data.conditions = conditions;
1221
+ Object.assign(data.conditions, extraAccessData);
1222
+
1223
+ config.data = data;
1224
+ var chFn = new Function(
1225
+ "config",
1226
+ "isSandbox",
1227
+ "DSV",
1228
+ "VFR",
1229
+ dataSource.configHandlerCode
1230
+ );
1231
+ return chFn.call(null, config, isSandbox, DSV, VFR);
1232
+ }
1233
+
1234
+ export function runDataSourceRequest(e, t, i, n, o) {
1235
+ return _runDataSourceRequest.apply(this, arguments);
1236
+ }
1237
+
1238
+ export function _runDataSourceRequest() {
1239
+ let _runDataSourceRequestN = function (t, i, n, o, a) {
1240
+ var l, s, r, d;
1241
+ (l = buildRequestConfig(t, i, n, o)),
1242
+ (r = new Function(
1243
+ "result",
1244
+ "isSandbox",
1245
+ "DSV",
1246
+ "VFR",
1247
+ t.dataHandlerCode
1248
+ )),
1249
+ (d = new Function(
1250
+ "error",
1251
+ "isSandbox",
1252
+ "DSV",
1253
+ "$message",
1254
+ "VFR",
1255
+ t.errorHandlerCode
1256
+ ));
1257
+
1258
+ return new Promise((resolve, reject) => {
1259
+ request({
1260
+ ...l,
1261
+ callback: (res) => {
1262
+ resolve(r.call(null, res, o, i, n));
1263
+ },
1264
+ error: (error) => {
1265
+ d.call(null, error, o, i, a, n);
1266
+ reject(error);
1267
+ },
1268
+ });
1269
+ });
1270
+ };
1271
+ return _runDataSourceRequestN.apply(this, arguments);
1272
+ }
1273
+
1274
+ export function getDSByName(e, t) {
1275
+ var i = null;
1276
+ return (
1277
+ t &&
1278
+ e.dataSources &&
1279
+ e.dataSources.forEach(function (e) {
1280
+ e.uniqueName === t && (i = e);
1281
+ }),
1282
+ i
1283
+ );
1284
+ }
1285
+
1286
+ export function setReportGlobalParam(value) {
1287
+ sessionStorage.setItem("reportGlobalParam", value);
1288
+ }
1289
+
1290
+ export function getReportGlobalMap() {
1291
+ let param = sessionStorage.getItem("reportGlobalParam");
1292
+ if (param) {
1293
+ let globalReqData = JSON.parse(decode(param));
1294
+ return globalReqData;
1295
+ }
1296
+ }
1297
+
1298
+ export function getSubFormNameByFieldId(o, e) {
1299
+ let n = null;
1300
+ return (
1301
+ getAllContainerWidgets(o).forEach((s) => {
1302
+ const c = (u) => {
1303
+ u.id === e && (n = s.name);
1304
+ };
1305
+ (s.type === "sub-form" || s.type === "grid-sub-form") &&
1306
+ traverseFieldWidgetsOfContainer(s.container, c);
1307
+ }),
1308
+ n
1309
+ );
1310
+ }
1311
+
1312
+ export const FORMULA_REG_EXP = /\{\{(\w+\.[^.]+\.\w+)}}/g;
1313
+
1314
+ export function fieldIsUsedInFormula(o, e, n) {
1315
+ const l = e.match(FORMULA_REG_EXP);
1316
+ if (!l) return !1;
1317
+ let s = !1;
1318
+ return (
1319
+ l.forEach((c) => {
1320
+ const u = c.split(".")[2];
1321
+ if (u.substring(0, u.length - 2) === "func") return;
1322
+ const g = c.split(".")[0],
1323
+ y = g.substring(2, g.length);
1324
+ getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options.name === o &&
1325
+ (s = !0);
1326
+ }),
1327
+ s
1328
+ );
1329
+ }
1330
+
1331
+ export function calculateFormula(o, e, n, l, s) {
1332
+ if (
1333
+ !!l.subFormItemFlag &&
1334
+ !!s.subFormItemFlag &&
1335
+ s.subFormRowId !== l.subFormRowId
1336
+ )
1337
+ return;
1338
+ let c = l.field.options.formula;
1339
+ c = replaceFieldsAndFunctionsOfFormula(o, l);
1340
+ const u = c.match(/[A-Za-z]*/g);
1341
+ u &&
1342
+ u.forEach((g) => {
1343
+ if (!!g && findCalFunStartIndex(g) !== -1) {
1344
+ const y = g.toUpperCase();
1345
+ c = c.replace(g, "formulaJs." + y);
1346
+ }
1347
+ }),
1348
+ console.log("formula: ", c),
1349
+ console.log("formulaFieldRef: ", l);
1350
+ const $ = evalFn(c, e, o, n);
1351
+ l.setValue($);
1352
+ }
1353
+
1354
+ export function replaceFieldsAndFunctionsOfFormula(o, e) {
1355
+ let n = e.field.options.formula;
1356
+ const l = n.match(FORMULA_REG_EXP);
1357
+ if (!l) return n;
1358
+ let s = n;
1359
+ return (
1360
+ l.forEach((c) => {
1361
+ const u = c.split(".")[2];
1362
+ if (u.substring(0, u.length - 2) === "func") {
1363
+ const v = c.split(".")[1];
1364
+ s = s.replace(c, v);
1365
+ return;
1366
+ }
1367
+ const g = c.split(".")[0],
1368
+ y = g.substring(2, g.length),
1369
+ f = getFieldWidgetById(o.formJsonObj.widgetList, y, !1);
1370
+ if (f) {
1371
+ let v = o.getWidgetRef(f.options.name);
1372
+ if (v) s = s.replace(c, v.getValue());
1373
+ else {
1374
+ const w = o.getSubFormNameOfWidget(f.options.name);
1375
+ if (e.subFormItemFlag)
1376
+ w === e.subFormName
1377
+ ? ((v = o.getWidgetRef(f.options.name + "@row" + e.subFormRowId)),
1378
+ v && (s = s.replaceAll(c, v.getValue())))
1379
+ : console.error("Invalid formula!");
1380
+ else {
1381
+ const _ = o.formDataModel[w];
1382
+ let O = "";
1383
+ const S = f.options.name;
1384
+ _.forEach((x, E) => {
1385
+ O = E === 0 ? x[S] : O + ", " + x[S];
1386
+ }),
1387
+ (s = s.replaceAll(c, O));
1388
+ }
1389
+ }
1390
+ }
1391
+ }),
1392
+ s
1393
+ );
1394
+ }
1395
+
1396
+ export function findCalFunStartIndex(o) {
1397
+ let e = -1;
1398
+ for (let n = 0; n < FORMULA_JS_FUNCTIONS.length; n++) {
1399
+ let l = o.indexOf(FORMULA_JS_FUNCTIONS[n]);
1400
+ if (l !== -1) return l;
1401
+ }
1402
+ return e;
1403
+ }
1404
+
1405
+ export const FORMULA_JS_FUNCTIONS = [
1406
+ "INT",
1407
+ "SUM",
1408
+ "AVERAGE",
1409
+ "MAX",
1410
+ "MIN",
1411
+ "ABS",
1412
+ "ROUND",
1413
+ "CEILING",
1414
+ "LOG",
1415
+ "MOD",
1416
+ "POWER",
1417
+ "AND",
1418
+ "IF",
1419
+ "IFS",
1420
+ "IFERROR",
1421
+ "IFNA",
1422
+ "NOT",
1423
+ "OR",
1424
+ "SWITCH",
1425
+ "XOR",
1426
+ "YEAR",
1427
+ "MONTH",
1428
+ "DAY",
1429
+ "TODAY",
1430
+ "NOW",
1431
+ "EMONTH",
1432
+ "EDAY",
1433
+ "FIND",
1434
+ "LEFT",
1435
+ "RIGHT",
1436
+ "LEN",
1437
+ "LOWER",
1438
+ "UPPER",
1439
+ "MID",
1440
+ "TRIM",
1441
+ ],
1442
+ formulas = [
1443
+ {
1444
+ fClass: "designer.hint.formulaFunctionMaths",
1445
+ flist: [
1446
+ {
1447
+ fName: "INT",
1448
+ fType: "designer.hint.formulaNumber",
1449
+ fIntro: "designer.hint.formulaINT",
1450
+ },
1451
+ {
1452
+ fName: "SUM",
1453
+ fType: "designer.hint.formulaNumber",
1454
+ fIntro: "designer.hint.formulaSUM",
1455
+ },
1456
+ {
1457
+ fName: "AVERAGE",
1458
+ fType: "designer.hint.formulaNumber",
1459
+ fIntro: "designer.hint.formulaAVERAGE",
1460
+ },
1461
+ {
1462
+ fName: "MAX",
1463
+ fType: "designer.hint.formulaNumber",
1464
+ fIntro: "designer.hint.formulaMAX",
1465
+ },
1466
+ {
1467
+ fName: "MIN",
1468
+ fType: "designer.hint.formulaNumber",
1469
+ fIntro: "designer.hint.formulaMIN",
1470
+ },
1471
+ {
1472
+ fName: "ABS",
1473
+ fType: "designer.hint.formulaNumber",
1474
+ fIntro: "designer.hint.formulaABS",
1475
+ },
1476
+ {
1477
+ fName: "ROUND",
1478
+ fType: "designer.hint.formulaNumber",
1479
+ fIntro: "designer.hint.formulaROUND",
1480
+ },
1481
+ {
1482
+ fName: "CEILING",
1483
+ fType: "designer.hint.formulaNumber",
1484
+ fIntro: "designer.hint.formulaCEILING",
1485
+ },
1486
+ {
1487
+ fName: "LOG",
1488
+ fType: "designer.hint.formulaNumber",
1489
+ fIntro: "designer.hint.formulaLOG",
1490
+ },
1491
+ {
1492
+ fName: "MOD",
1493
+ fType: "designer.hint.formulaNumber",
1494
+ fIntro: "designer.hint.formulaMOD",
1495
+ },
1496
+ {
1497
+ fName: "POWER",
1498
+ fType: "designer.hint.formulaNumber",
1499
+ fIntro: "designer.hint.formulaPOWER",
1500
+ },
1501
+ ],
1502
+ },
1503
+ ];
1504
+
1505
+ export function evalFn(o, e = null, n = null, l = null) {
1506
+ return new Function("DSV", "VFR", "LS", "formulaJs", "return " + o)(
1507
+ e,
1508
+ n,
1509
+ localStorage,
1510
+ l
1511
+ );
1512
+ }
1513
+
1514
+ export function trimEx(o, e, n) {
1515
+ return e
1516
+ ? n === "left"
1517
+ ? o.replace(new RegExp("^%%" + e + "+", "g"), "")
1518
+ : n === "right"
1519
+ ? o.replace(new RegExp("%%" + e + "+$", "g"), "")
1520
+ : o.replace(new RegExp("^%%" + e + "+|%%" + e + "+$", "g"), "")
1521
+ : o.replace(/^%s+|%s+$/g, "");
1522
+ }
1523
+
1524
+ export function hasPropertyOfObject(o, e) {
1525
+ const n = e.split(".");
1526
+ let l = o,
1527
+ s = !0;
1528
+ for (const c of n)
1529
+ if (l.hasOwnProperty(c)) l = l[c];
1530
+ else {
1531
+ s = !1;
1532
+ break;
1533
+ }
1534
+ return s;
1535
+ }
1536
+
1537
+ export function objectKeysToArray(o) {
1538
+ if (!o) return [];
1539
+ const e = [];
1540
+ return (
1541
+ Object.keys(o).forEach((n) => {
1542
+ e.push(n);
1543
+ }),
1544
+ e
1545
+ );
1546
+ }
1547
+
1548
+ //begin
1549
+ export function loopHandleWidget(widgetList, callback) {
1550
+ widgetList &&
1551
+ widgetList.length > 0 &&
1552
+ widgetList.forEach(function (e) {
1553
+ loopHandleWidgetItem(e, null, callback);
1554
+ });
1555
+ }
1556
+
1557
+ function loopHandleWidgetItem(e, p, callback) {
1558
+ if ("container" === e.category) {
1559
+ callback(e, p);
1560
+ if ("vf-dialog" === e.type || "vf-drawer" === e.type);
1561
+ else if ("data-table" === e.type) {
1562
+ if (!!e.widgetList) {
1563
+ e.widgetList.forEach((childItem) => {
1564
+ loopHandleWidgetItem(childItem, e, callback);
1565
+ });
1566
+ }
1567
+ if (!!e.buttons) {
1568
+ e.buttons.forEach((childItem) => {
1569
+ loopHandleWidgetItem(childItem, e, callback);
1570
+ });
1571
+ }
1572
+ } else if ("list-h5" === e.type) {
1573
+ if (!!e.widgetList && e.widgetList.length > 0) {
1574
+ e.widgetList.forEach((childItem) => {
1575
+ loopHandleWidgetItem(childItem, e, callback);
1576
+ });
1577
+ }
1578
+ } else if ("grid" === e.type) {
1579
+ e.cols &&
1580
+ e.cols.length > 0 &&
1581
+ e.cols.forEach(function (childItem) {
1582
+ loopHandleWidgetItem(childItem, e, callback);
1583
+ });
1584
+ } else if ("table" === e.type) {
1585
+ e.rows &&
1586
+ e.rows.length > 0 &&
1587
+ e.rows.forEach(function (rowItem) {
1588
+ rowItem.cols &&
1589
+ rowItem.cols.length > 0 &&
1590
+ rowItem.cols.forEach(function (childItem) {
1591
+ loopHandleWidgetItem(childItem, e, callback);
1592
+ });
1593
+ });
1594
+ } else if ("h5-table" === e.type) {
1595
+ e.rows &&
1596
+ e.rows.length > 0 &&
1597
+ e.rows.forEach(function (rowItem) {
1598
+ rowItem.cols &&
1599
+ rowItem.cols.length > 0 &&
1600
+ rowItem.cols.forEach(function (childItem) {
1601
+ loopHandleWidgetItem(childItem, e, callback);
1602
+ });
1603
+ });
1604
+ } else if ("tab" === e.type) {
1605
+ e.tabs &&
1606
+ e.tabs.length > 0 &&
1607
+ e.tabs.forEach(function (tabItem) {
1608
+ tabItem.widgetList &&
1609
+ tabItem.widgetList.length > 0 &&
1610
+ tabItem.widgetList.forEach(function (childItem) {
1611
+ loopHandleWidgetItem(childItem, e, callback);
1612
+ });
1613
+ });
1614
+ } else if ("detail" === e.type || "detail-plain" === e.type) {
1615
+ if (e.panes) {
1616
+ e.panes.forEach(function (childItem) {
1617
+ loopHandleWidgetItem(childItem, e, callback);
1618
+ });
1619
+ }
1620
+ if (e.widgetList) {
1621
+ e.widgetList.forEach(function (childItem) {
1622
+ loopHandleWidgetItem(childItem, e, callback);
1623
+ });
1624
+ }
1625
+ } else if ("detail-pane" === e.type) {
1626
+ if (e.widgetList) {
1627
+ e.widgetList.forEach(function (childItem) {
1628
+ loopHandleWidgetItem(childItem, e, callback);
1629
+ });
1630
+ }
1631
+ if (e.buttonWidgetList) {
1632
+ e.buttonWidgetList.forEach(function (childItem) {
1633
+ loopHandleWidgetItem(childItem, e, callback);
1634
+ });
1635
+ }
1636
+ } else {
1637
+ "grid-col" === e.type || e.type,
1638
+ e.widgetList &&
1639
+ e.widgetList.length > 0 &&
1640
+ e.widgetList.forEach(function (childItem) {
1641
+ loopHandleWidgetItem(childItem, e, callback);
1642
+ });
1643
+ }
1644
+ } else {
1645
+ callback && callback(e);
1646
+ if (e.widgetList) {
1647
+ e.widgetList.forEach(function (childItem) {
1648
+ loopHandleWidgetItem(childItem, e, callback);
1649
+ });
1650
+ }
1651
+ }
1652
+ }
1653
+
1654
+ //end
1655
+
1656
+ export function trim(value) {
1657
+ if (isNull(value)) return value;
1658
+ if (value.trim) {
1659
+ return value.trim();
1660
+ } else {
1661
+ return value;
1662
+ }
1663
+ }