cloud-web-corejs 1.0.54-dev.54 → 1.0.54-dev.540

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 (427) hide show
  1. package/package.json +21 -3
  2. package/src/App.vue +30 -34
  3. package/src/api/user.js +16 -0
  4. package/src/components/Qrcode/fileParse.vue +0 -1
  5. package/src/components/Tinymce/index.vue +112 -71
  6. package/src/components/VabUpload/image-viewer.vue +2 -2
  7. package/src/components/VabUpload/index.js +2 -1
  8. package/src/components/VabUpload/mixins.js +2 -2
  9. package/src/components/VabUpload/privateProfileDialogMixins.js +1 -1063
  10. package/src/components/VabUpload/propertiesDialog.vue +1 -1
  11. package/src/components/VabUpload/view.vue +209 -120
  12. package/src/components/advancedSearchDialog/mixins.js +1 -1
  13. package/src/components/base-textarea/index.vue +104 -0
  14. package/src/components/baseAlert/mixins.js +1 -1
  15. package/src/components/baseAttachment/index.vue +49 -40
  16. package/src/components/baseAttachment/mixins.js +2 -1
  17. package/src/components/baseInputExport/index.vue +19 -12
  18. package/src/components/baseInputExport/mixins.js +1 -1
  19. package/src/components/baseTabs/mixins.js +1 -1
  20. package/src/components/code-editor/index.vue +102 -63
  21. package/src/components/confirmDialog/index.vue +24 -17
  22. package/src/components/confirmDialog/mixins.js +1 -1
  23. package/src/components/errorMsg/index.vue +42 -34
  24. package/src/components/errorMsg/mixins.js +6 -5
  25. package/src/components/excelExport/button.vue +57 -4
  26. package/src/components/excelExport/exportFieldDialog.vue +215 -81
  27. package/src/components/excelExport/index.js +6 -6
  28. package/src/components/excelExport/index.vue +56 -2
  29. package/src/components/excelExport/mixins.js +3 -2
  30. package/src/components/excelImport/mixins.js +2 -1
  31. package/src/components/fileLibrary/fileObjAuthDialog.vue +179 -89
  32. package/src/components/fileLibrary/fileObjAuthEditDialog.vue +6 -0
  33. package/src/components/fileLibrary/filterDialog.vue +454 -0
  34. package/src/components/fileLibrary/index.vue +599 -254
  35. package/src/components/fileLibrary/mixins/categoryMoveDialogMixins.js +1 -1
  36. package/src/components/fileLibrary/mixins/fileCategoryDialogMixins.js +1 -1
  37. package/src/components/fileLibrary/mixins/fileHistoryDialogMixins.js +2 -2
  38. package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +339 -211
  39. package/src/components/fileLibrary/mixins/fileObjAuthEditDialogMixin.js +31 -27
  40. package/src/components/fileLibrary/mixins/fileObjAuthEditMixin.js +4 -4
  41. package/src/components/fileLibrary/mixins/indexMixins.js +220 -101
  42. package/src/components/fileLibrary/mixins/propertiesDialogMixins.js +64 -4
  43. package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +3 -3
  44. package/src/components/fileLibrary/propertiesDialog.vue +113 -74
  45. package/src/components/fileLibrary/shareDialog.vue +1 -1
  46. package/src/components/formOplog/mixins.js +1 -1
  47. package/src/components/hiprint/css/bootstrap.min.css +6 -0
  48. package/src/components/hiprint/fonts/glyphicons-halflings-regular.eot +0 -0
  49. package/src/components/hiprint/fonts/glyphicons-halflings-regular.svg +288 -0
  50. package/src/components/hiprint/fonts/glyphicons-halflings-regular.ttf +0 -0
  51. package/src/components/hiprint/fonts/glyphicons-halflings-regular.woff +0 -0
  52. package/src/components/hiprint/fonts/glyphicons-halflings-regular.woff2 +0 -0
  53. package/src/components/hiprint/view/design/index.vue +1 -0
  54. package/src/components/jsonImport/index.js +1 -1
  55. package/src/components/jsonImport/mixins.js +2 -1
  56. package/src/components/langImport/mixins.js +17 -16
  57. package/src/components/obsUpload/index.js +1 -0
  58. package/src/components/obsUpload/index.vue +231 -0
  59. package/src/components/obsUpload/mixins.js +8 -0
  60. package/src/components/scriptDescription/button.vue +12 -4
  61. package/src/components/scriptTest/mixins.js +1 -1
  62. package/src/components/statusTag/mixins.js +1 -1
  63. package/src/components/table/CellSlot.vue +1 -0
  64. package/src/components/table/index.js +1055 -11
  65. package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.es6.min.js +11028 -0
  66. package/src/components/table/plugins/extend-cell-area/vxe-table-extend-cell-area.min.css +200 -0
  67. package/src/components/table/tableForm.vue +99 -63
  68. package/src/components/table/tableFormMixin.js +1 -1
  69. package/src/components/table/util/index.js +335 -0
  70. package/src/components/table/vxeFilter/mixin.js +6 -6
  71. package/src/components/tempStorage/index.vue +76 -55
  72. package/src/components/tempStorage/tempStorageDialog.vue +179 -54
  73. package/src/components/univer/button.vue +57 -0
  74. package/src/components/univer/dialog.vue +129 -0
  75. package/src/components/univer/index.js +95 -0
  76. package/src/components/univer/univerSheet.vue +200 -0
  77. package/src/components/vb-tabs/x-tabs.vue +56 -30
  78. package/src/components/wf/addOpinionButton.vue +57 -0
  79. package/src/components/wf/content.vue +834 -362
  80. package/src/components/wf/mixins/addOpinionButton.js +3 -0
  81. package/src/components/wf/mixins/setCandidateButton.js +6 -0
  82. package/src/components/wf/mixins/setCandidateDialog.js +2 -1
  83. package/src/components/wf/mixins/setCandidateDialog2.js +6 -0
  84. package/src/components/wf/mixins/wfFlowEleScriptDialog.js +3 -0
  85. package/src/components/wf/mixins/wfTaskUserRangeDialog.js +3 -0
  86. package/src/components/wf/setCandidateButton.vue +40 -0
  87. package/src/components/wf/setCandidateDialog.vue +10 -0
  88. package/src/components/wf/setCandidateDialog2.vue +105 -0
  89. package/src/components/wf/wf.js +2156 -1
  90. package/src/components/wf/wfFlowEleScriptDialog.vue +89 -0
  91. package/src/components/wf/wfStartDialog.vue +66 -42
  92. package/src/components/wf/wfTaskUserRangeDialog.vue +65 -0
  93. package/src/components/wf/wfUtil.js +279 -1
  94. package/src/components/xform/form-designer/designer.js +5 -3
  95. package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +434 -0
  96. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +3 -3
  97. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +9 -8
  98. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -1
  99. package/src/components/xform/form-designer/form-widget/container-widget/detail-widget.vue +3 -3
  100. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +971 -0
  101. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +971 -0
  102. package/src/components/xform/form-designer/form-widget/dialog/exportDialog.vue +13 -0
  103. package/src/components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +301 -0
  104. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +82 -49
  105. package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +5 -1
  106. package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +799 -0
  107. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +38 -7
  108. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin - /345/211/257/346/234/254.js" +1639 -0
  109. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +9 -8
  110. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +196 -73
  111. package/src/components/xform/form-designer/form-widget/dialog/univerDialog.vue +200 -0
  112. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +2 -2
  113. package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
  114. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +34 -5
  115. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  116. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +19 -1
  117. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +40 -28
  118. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +18 -7
  119. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +4 -1
  120. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +95 -0
  121. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +14 -2
  122. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +30 -4
  123. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +133 -0
  124. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +77 -0
  125. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-menu-widget.vue +106 -0
  126. package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
  127. package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
  128. package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
  129. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +1654 -16
  130. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +705 -379
  131. package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +964 -0
  132. package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +6 -2
  133. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +22 -11
  134. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +90 -0
  135. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +7 -2
  136. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-bar-mixin.js +49 -8
  137. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-category-mixin.js +61 -88
  138. package/src/components/xform/form-designer/form-widget/field-widget/mixins/echart-pie-mixin.js +13 -0
  139. package/src/components/xform/form-designer/form-widget/field-widget/mixins/vabsearch-mixin.js +179 -0
  140. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +53 -0
  141. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +114 -81
  142. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +186 -0
  143. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +54 -27
  144. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +120 -0
  145. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +154 -47
  146. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +26 -6
  147. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +2 -2
  148. package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +86 -0
  149. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +92 -0
  150. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +24 -9
  151. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +53 -0
  152. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -0
  153. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +12 -1
  154. package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +8 -3
  155. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +31 -17
  156. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +42 -37
  157. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +147 -0
  158. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +106 -33
  159. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +2 -2
  160. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +3 -171
  161. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +260 -58
  162. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +753 -0
  163. package/src/components/xform/form-designer/indexMixin.js +3 -772
  164. package/src/components/xform/form-designer/setting-panel/form-setting.vue +978 -169
  165. package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
  166. package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -1
  167. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +537 -302
  168. package/src/components/xform/form-designer/setting-panel/property-editor/a-link-editor.vue +4 -4
  169. package/src/components/xform/form-designer/setting-panel/property-editor/a-text-editor.vue +3 -3
  170. package/src/components/xform/form-designer/setting-panel/property-editor/autoValueEnabled-editor.vue +38 -0
  171. package/src/components/xform/form-designer/setting-panel/property-editor/censusClass-editor.vue +6 -0
  172. package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +28 -0
  173. package/src/components/xform/form-designer/setting-panel/property-editor/commonAttributeEnabled-editor.vue +41 -0
  174. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +125 -0
  175. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +953 -1042
  176. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +432 -0
  177. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/onCheckboxChange-editor.vue +1 -1
  178. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +1127 -512
  179. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +2 -2
  180. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-pane/detail-pane-editor.vue +3 -3
  181. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +1 -1
  182. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +1 -1
  183. package/src/components/xform/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +1 -1
  184. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +0 -8
  185. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree/tree-customClass-editor.vue +31 -2
  186. package/src/components/xform/form-designer/setting-panel/property-editor/copyButton-editor.vue +36 -0
  187. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +32 -0
  188. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +2 -2
  189. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onAfterConfirmFile-editor.vue +32 -0
  190. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +14 -7
  191. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +35 -20
  192. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +64 -5
  193. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultTime-editor.vue +27 -0
  194. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-item-editor.vue +21 -0
  195. package/src/components/xform/form-designer/setting-panel/property-editor/field-dropdown-menu/dropdown-menu-editor.vue +59 -0
  196. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +185 -69
  197. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +188 -86
  198. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +84 -39
  199. package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +36 -0
  200. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +77 -20
  201. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +96 -0
  202. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +44 -15
  203. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +115 -0
  204. package/src/components/xform/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +1 -1
  205. package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/preWrap-editor.vue +23 -0
  206. package/src/components/xform/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +1 -1
  207. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +67 -41
  208. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +56 -0
  209. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +71 -0
  210. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +26 -7
  211. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +13 -1
  212. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +33 -1
  213. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +66 -0
  214. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +89 -19
  215. package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +137 -0
  216. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +721 -466
  217. package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +20 -11
  218. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +1 -1
  219. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +1 -1
  220. package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +1 -1
  221. package/src/components/xform/form-designer/setting-panel/property-editor/limit-editor.vue +1 -1
  222. package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +19 -14
  223. package/src/components/xform/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  224. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +124 -50
  225. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +31 -0
  226. package/src/components/xform/form-designer/setting-panel/property-editor/precision-editor.vue +1 -1
  227. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +349 -0
  228. package/src/components/xform/form-designer/setting-panel/property-editor/required-editor.vue +10 -6
  229. package/src/components/xform/form-designer/setting-panel/property-editor/requiredHint-editor.vue +3 -3
  230. package/src/components/xform/form-designer/setting-panel/property-editor/showRuleFlag-editor.vue +1 -1
  231. package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +42 -0
  232. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +305 -19
  233. package/src/components/xform/form-designer/setting-panel/property-editor/validation-editor.vue +2 -2
  234. package/src/components/xform/form-designer/setting-panel/property-editor/validationHint-editor.vue +2 -2
  235. package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +372 -50
  236. package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +263 -0
  237. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +35 -11
  238. package/src/components/xform/form-designer/toolbar-panel/index.vue +12 -11
  239. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +1 -1
  240. package/src/components/xform/form-designer/widget-panel/index.vue +21 -1
  241. package/src/components/xform/form-designer/widget-panel/indexMixin.js +19 -18
  242. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +1710 -917
  243. package/src/components/xform/form-render/container-item/containerItemMixin.js +12 -11
  244. package/src/components/xform/form-render/container-item/data-table-item.vue +202 -199
  245. package/src/components/xform/form-render/container-item/data-table-mixin.js +3048 -18
  246. package/src/components/xform/form-render/container-item/detail-pane-item.vue +17 -3
  247. package/src/components/xform/form-render/container-item/grid-col-item.vue +10 -3
  248. package/src/components/xform/form-render/container-item/grid-item.vue +1 -1
  249. package/src/components/xform/form-render/container-item/list-h5-item.vue +1 -9
  250. package/src/components/xform/form-render/container-item/list-h5-item2.vue +1 -8
  251. package/src/components/xform/form-render/container-item/tab-item.vue +62 -25
  252. package/src/components/xform/form-render/container-item/table-cell-item.vue +38 -32
  253. package/src/components/xform/form-render/container-item/table-item.vue +4 -2
  254. package/src/components/xform/form-render/container-item/table2-cell-item.vue +53 -34
  255. package/src/components/xform/form-render/container-item/table2-item.vue +141 -88
  256. package/src/components/xform/form-render/container-item/tree-item.vue +32 -11
  257. package/src/components/xform/form-render/index.vue +83 -20
  258. package/src/components/xform/form-render/indexMixin.js +3700 -12
  259. package/src/components/xform/lang/zh-CN.js +29 -4
  260. package/src/components/xform/mixins/defaultHandle.js +1 -1
  261. package/src/components/xform/mixins/scriptHttp.js +174 -1
  262. package/src/components/xform/utils/emitter.js +4 -4
  263. package/src/components/xform/utils/format.js +35 -34
  264. package/src/components/xform/utils/formula-util copy 2.js +945 -0
  265. package/src/components/xform/utils/formula-util copy.js +856 -0
  266. package/src/components/xform/utils/formula-util.js +966 -0
  267. package/src/components/xform/utils/util.js +1 -1
  268. package/src/components/xform/utils/validators.js +1 -5
  269. package/src/components/xform/utils/vue2js-generator.js +2 -2
  270. package/src/index.js +215 -190
  271. package/src/lang/index.js +56 -51
  272. package/src/lang/locale/en/login.js +20 -0
  273. package/src/lang/locale/zh/login.js +20 -0
  274. package/src/layout/components/AppMain.vue +5 -1
  275. package/src/layout/components/Sidebar/default.vue +1423 -1222
  276. package/src/layout/components/TagsView/index.vue +37 -12
  277. package/src/layout/components/createCompany/createCompanyDialog.vue +157 -0
  278. package/src/layout/components/extractedCode/createDialog.vue +92 -0
  279. package/src/layout/components/extractedCode/queryDialog.vue +96 -0
  280. package/src/layout/components/extractedCode/viewDialog.vue +193 -0
  281. package/src/layout/components/watermark/index.vue +83 -0
  282. package/src/layout/defaultLayout.vue +1 -1
  283. package/src/layout/index.vue +3 -5
  284. package/src/mixins/selectDialog/index.js +1 -1
  285. package/src/mixins/table/index.js +151 -0
  286. package/src/mixins/tableTree/index.js +1 -1
  287. package/src/permission.js +1 -18
  288. package/src/router/modules/customer.js +125 -8
  289. package/src/store/config/index.js +1 -1
  290. package/src/store/getters.js +3 -1
  291. package/src/store/modules/permission.js +1 -1
  292. package/src/store/modules/settings.js +1 -1
  293. package/src/store/modules/tagsView.js +1 -14
  294. package/src/store/modules/user.js +1 -29
  295. package/src/utils/index.js +1 -7
  296. package/src/utils/pddLog.js +103 -0
  297. package/src/utils/pdfUtil.js +71 -0
  298. package/src/utils/request.js +1 -1
  299. package/src/utils/vab.js +19 -27
  300. package/src/views/bd/setting/bd_attach_setting/edit.vue +5 -5
  301. package/src/views/bd/setting/bd_attach_setting/list.vue +28 -55
  302. package/src/views/bd/setting/bd_attach_setting/mixins/edit.js +4 -5
  303. package/src/views/bd/setting/bd_attach_setting/mixins/list.js +239 -1
  304. package/src/views/bd/setting/bd_company_env/dialog.vue +174 -0
  305. package/src/views/bd/setting/bd_company_env/edit.vue +193 -0
  306. package/src/views/bd/setting/bd_company_env/list.vue +175 -0
  307. package/src/views/bd/setting/config_manage/list.vue +83 -0
  308. package/src/views/bd/setting/form_import_log/edit.vue +127 -0
  309. package/src/views/bd/setting/form_import_log/list.vue +206 -0
  310. package/src/views/bd/setting/form_script/edit.vue +9 -0
  311. package/src/views/bd/setting/form_script/edit1.vue +36 -3
  312. package/src/views/bd/setting/form_script/form_list.vue +99 -37
  313. package/src/views/bd/setting/form_script/list1.vue +181 -118
  314. package/src/views/bd/setting/form_script/mixins/dialog.js +130 -1
  315. package/src/views/bd/setting/form_script/mixins/edit.js +201 -1
  316. package/src/views/bd/setting/form_script/mixins/edit1.js +193 -1
  317. package/src/views/bd/setting/form_script/mixins/form_list.js +1 -1
  318. package/src/views/bd/setting/form_script/mixins/list.js +236 -1
  319. package/src/views/bd/setting/form_script/mixins/list1.js +423 -14
  320. package/src/views/bd/setting/form_script/mixins/otherAuthDialog.js +194 -0
  321. package/src/views/bd/setting/form_script/otherAuthDialog.vue +83 -0
  322. package/src/views/bd/setting/form_template/batchWfObjConfigDialog.vue +2 -2
  323. package/src/views/bd/setting/form_template/edit.vue +22 -1
  324. package/src/views/bd/setting/form_template/editWfObjConfigDialog.vue +2 -2
  325. package/src/views/bd/setting/form_template/list.vue +326 -214
  326. package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +11 -9
  327. package/src/views/bd/setting/form_template/mixins/edit.js +234 -9
  328. package/src/views/bd/setting/form_template/mixins/list.js +689 -22
  329. package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +193 -0
  330. package/src/views/bd/setting/form_template/mixins/wf_list.js +1 -423
  331. package/src/views/bd/setting/form_template/otherAuthDialog.vue +83 -0
  332. package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +4 -4
  333. package/src/views/bd/setting/form_template/wf_list.vue +1 -1
  334. package/src/views/bd/setting/logic_param/edit.vue +146 -0
  335. package/src/views/bd/setting/logic_param/edit1.vue +106 -0
  336. package/src/views/bd/setting/logic_param/edit2.vue +139 -0
  337. package/src/views/bd/setting/logic_param/list.vue +74 -0
  338. package/src/views/bd/setting/logic_param/list1.vue +12 -0
  339. package/src/views/bd/setting/logic_param/list2.vue +12 -0
  340. package/src/views/bd/setting/logic_param/mixins/edit.js +3 -0
  341. package/src/views/bd/setting/logic_param/mixins/list.js +9 -0
  342. package/src/views/bd/setting/menu_kind/list.vue +172 -83
  343. package/src/views/bd/setting/menu_kind/mixins/authDialog.js +300 -7
  344. package/src/views/bd/setting/menu_kind/mixins/list.js +201 -1
  345. package/src/views/bd/setting/push_data/edit.vue +139 -0
  346. package/src/views/bd/setting/push_data/list.vue +283 -0
  347. package/src/views/bd/setting/push_data_h/edit.vue +153 -0
  348. package/src/views/bd/setting/push_data_h/list.vue +293 -0
  349. package/src/views/bd/setting/request_async_setting/edit.vue +320 -0
  350. package/src/views/bd/setting/request_async_setting/list.vue +372 -0
  351. package/src/views/bd/setting/request_setting/edit.vue +300 -0
  352. package/src/views/bd/setting/request_setting/list.vue +311 -0
  353. package/src/views/bd/setting/table_model/edit.vue +875 -426
  354. package/src/views/bd/setting/table_model/list.vue +190 -128
  355. package/src/views/bd/setting/table_model/mixins/dialog.js +1 -1
  356. package/src/views/bd/setting/table_model/mixins/edit.js +1202 -13
  357. package/src/views/bd/setting/table_model/mixins/list.js +440 -14
  358. package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +201 -0
  359. package/src/views/bd/setting/table_model/otherAuthDialog.vue +83 -0
  360. package/src/views/user/access_log/list.vue +418 -349
  361. package/src/views/user/area/dialog.vue +223 -117
  362. package/src/views/user/area/list.vue +318 -0
  363. package/src/views/user/bill_setting/edit.vue +1 -1
  364. package/src/views/user/bill_setting/list.vue +1 -1
  365. package/src/views/user/common_attribute/itemEdit.vue +2 -2
  366. package/src/views/user/common_attribute/list.vue +5 -2
  367. package/src/views/user/common_script/edit.vue +1 -1
  368. package/src/views/user/common_script/list.vue +1 -1
  369. package/src/views/user/company_info/dialog.vue +195 -163
  370. package/src/views/user/company_info/edit.vue +1 -1
  371. package/src/views/user/extend_datasource/dialog.vue +4 -0
  372. package/src/views/user/extend_datasource/edit.vue +5 -1
  373. package/src/views/user/extend_datasource/list.vue +5 -1
  374. package/src/views/user/fieldTranslation/editDialog.vue +7 -7
  375. package/src/views/user/fieldTranslation/list.vue +32 -32
  376. package/src/views/user/form/vform/designer.vue +776 -749
  377. package/src/views/user/form/vform/out_render.vue +1 -1
  378. package/src/views/user/form/vform/render.vue +59 -37
  379. package/src/views/user/form/view/edit.vue +38 -37
  380. package/src/views/user/form/view/list.vue +261 -49
  381. package/src/views/user/home/bears/index.vue +1032 -0
  382. package/src/views/user/home/default.vue +1026 -979
  383. package/src/views/user/home/dev.vue +29 -0
  384. package/src/views/user/home/index.vue +16 -6
  385. package/src/views/user/home/taili/index.vue +1034 -0
  386. package/src/views/user/ledger_library/list.vue +10 -12
  387. package/src/views/user/login/default.vue +165 -36
  388. package/src/views/user/login/index.vue +4 -6
  389. package/src/views/user/login/indexMixin.js +184 -8
  390. package/src/views/user/menu/list.vue +24 -1
  391. package/src/views/user/notify_message/dialog.vue +44 -22
  392. package/src/views/user/notify_template/edit.vue +188 -187
  393. package/src/views/user/notify_template/edit2.vue +176 -0
  394. package/src/views/user/notify_template/list.vue +4 -1
  395. package/src/views/user/notify_template/list2.vue +190 -0
  396. package/src/views/user/outLink/form_view.vue +211 -184
  397. package/src/views/user/outLink/index.vue +67 -11
  398. package/src/views/user/outLink/view.vue +28 -23
  399. package/src/views/user/position/list.vue +128 -72
  400. package/src/views/user/project_tag/dialog.vue +9 -4
  401. package/src/views/user/project_tag/edit.vue +2 -2
  402. package/src/views/user/project_tag/list.vue +9 -4
  403. package/src/views/user/push_setting/list.vue +2 -2
  404. package/src/views/user/request_setting/edit.vue +258 -0
  405. package/src/views/user/request_setting/list.vue +248 -0
  406. package/src/views/user/role/authConfig.vue +89 -0
  407. package/src/views/user/role/dialog.vue +70 -48
  408. package/src/views/user/role/edit.vue +609 -429
  409. package/src/views/user/role/list.vue +4 -4
  410. package/src/views/user/sale_org/dialog.vue +1 -1
  411. package/src/views/user/sale_org/list.vue +4 -1
  412. package/src/views/user/user/dialog.vue +46 -23
  413. package/src/views/user/user/edit.vue +1290 -1021
  414. package/src/views/user/user/form_dialog.vue +158 -0
  415. package/src/views/user/user/form_info.vue +210 -0
  416. package/src/views/user/user/list.vue +652 -563
  417. package/src/views/user/user/modifyPasswordDialog.vue +64 -53
  418. package/src/views/user/wf/wfReport/index.vue +619 -0
  419. package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -0
  420. package/src/views/user/wf/wf_manage/list.vue +379 -250
  421. package/src/views/user/wf/wf_manage/wfContentDialog.vue +25 -22
  422. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +109 -0
  423. package/src/views/user/wf/wf_obj_config/itemEdit.vue +25 -1
  424. package/src/views/user/wf/wf_obj_config/list.vue +114 -9
  425. package/src/views/user/wf/wf_obj_config/wfBizDataSettingDialog.vue +2 -2
  426. package/src/views/user/wf/wf_transfer_setting/edit.vue +282 -0
  427. package/src/views/user/wf/wf_transfer_setting/list.vue +319 -0
@@ -0,0 +1,856 @@
1
+ // 计算公式相关工具方法
2
+ import {evalFn, getFieldWidgetById, traverseFieldWidgetsOfContainer} from "@base/components/xform/utils/util";
3
+ import * as formulajs from '@formulajs/formulajs'
4
+ import {EditorView} from "codemirror"
5
+ import {MatchDecorator, Decoration, ViewPlugin, WidgetType} from "@codemirror/view"
6
+ import {translate} from "@base/components/xform/utils/i18n";
7
+
8
+ class PlaceholderWidget extends WidgetType {
9
+ field;
10
+ text;
11
+ type;
12
+
13
+ constructor(text) {
14
+ super();
15
+ if (text) {
16
+ //type 仅用于区分颜色
17
+ const [field, mText, type] = text.split(".");
18
+ this.text = mText;
19
+ this.type = type;
20
+ this.field = field;
21
+ }
22
+ }
23
+
24
+ eq(other) {
25
+ return this.text === other.text;
26
+ }
27
+
28
+ // 此处是我们的渲染方法
29
+ toDOM() {
30
+ let elt = document.createElement('span');
31
+ if (!this.text) return elt;
32
+ elt.className = this.type === "func" ? "cm-function" : "cm-field";
33
+ elt.textContent = this.text;
34
+ return elt;
35
+ }
36
+
37
+ ignoreEvent() {
38
+ return true;
39
+ }
40
+ }
41
+
42
+ export const FORMULA_REG_EXP = /\{\{(\w+\.[^.]+\.\w+)}}/g
43
+
44
+ const placeholderMatcher = new MatchDecorator({
45
+ regexp: /\{\{(.+?)}}/g,
46
+ decoration: (match) =>
47
+ Decoration.replace({
48
+ widget: new PlaceholderWidget(match[1])
49
+ })
50
+ });
51
+
52
+
53
+ export const placeholders = ViewPlugin.fromClass(class {
54
+ placeholders
55
+
56
+ constructor(view) {
57
+ this.placeholders = placeholderMatcher.createDeco(view)
58
+ }
59
+
60
+ update(update) {
61
+ this.placeholders = placeholderMatcher.updateDeco(update, this.placeholders)
62
+ }
63
+ }, {
64
+ decorations: instance => instance.placeholders,
65
+ provide: plugin => EditorView.atomicRanges.of(view => {
66
+ return view.plugin(plugin)?.placeholders || Decoration.none
67
+ })
68
+ })
69
+
70
+ // 背景样式
71
+ export const baseTheme = EditorView.baseTheme({
72
+ ".cm-function": {
73
+ paddingLeft: "6px",
74
+ paddingRight: "6px",
75
+ paddingTop: "3px",
76
+ paddingBottom: "3px",
77
+ marginLeft: "3px",
78
+ marginRight: "3px",
79
+ backgroundColor: "#ffcdcc",
80
+ borderRadius: "4px",
81
+ },
82
+ ".cm-field": {
83
+ paddingLeft: "6px",
84
+ paddingRight: "6px",
85
+ paddingTop: "3px",
86
+ paddingBottom: "3px",
87
+ marginLeft: "3px",
88
+ marginRight: "3px",
89
+ backgroundColor: "#f8e7a0",
90
+ borderRadius: "4px",
91
+ }
92
+
93
+ });
94
+
95
+ export function calculateFormula(VFR, DSV, formulaJs, formulaFieldRef, changedFieldRef) {
96
+ if (formulaFieldRef.tableParam) {
97
+ } else if (!!formulaFieldRef.subFormItemFlag && !!changedFieldRef.subFormItemFlag) {
98
+ /* 子表单字段变化,只能触发子表单同一行字段的计算公式重新计算!! */
99
+ if (changedFieldRef.subFormRowId !== formulaFieldRef.subFormRowId) {
100
+ return
101
+ }
102
+ }
103
+
104
+ let formula = formulaFieldRef.field.options.formula
105
+ formula = replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, changedFieldRef) //替换字段值
106
+ if (!formula) {
107
+ return
108
+ }
109
+
110
+ //替换formula-js函数
111
+ const matchResult = formula.match(/[A-Za-z]*/g)
112
+ let matchedList = []
113
+ if (!!matchResult) {
114
+ matchResult.forEach(mi => {
115
+ if (!!mi && (findCalFunStartIndex(mi) !== -1) && !matchedList.includes(mi)) {
116
+ const funcName = mi.toUpperCase()
117
+ formula = formula.replaceAll(mi, 'formulaJs.' + funcName)
118
+ matchedList.push(mi)
119
+ }
120
+ })
121
+ }
122
+
123
+ const formulaValue = evalFn(formula, DSV, VFR, formulaJs)
124
+ if(formulaFieldRef)formulaFieldRef.setValue(formulaValue)
125
+ return formulaValue
126
+ }
127
+
128
+ export function baseCalculateFormula(that,formulaStr, row /* VFR, DSV, formulaJs, formulaFieldRef, changedFieldRef */) {
129
+ if(!formulaStr)return
130
+ let formula = formulaStr;
131
+ let VFR = that.getFormRef();
132
+ let DSV = that.getGlobalDsv()
133
+ let formulaJs = formulajs
134
+ let formulaFieldRef = that;
135
+ if (formulaFieldRef.tableParam) {
136
+ } else if (!!formulaFieldRef.subFormItemFlag && !!changedFieldRef.subFormItemFlag) {
137
+ /* 子表单字段变化,只能触发子表单同一行字段的计算公式重新计算!! */
138
+ /* if (changedFieldRef.subFormRowId !== formulaFieldRef.subFormRowId) {
139
+ return
140
+ } */
141
+ }
142
+
143
+ formula = baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef,formula,row) //替换字段值
144
+ if (!formula) {
145
+ return
146
+ }
147
+
148
+ //替换formula-js函数
149
+ const matchResult = formula.match(/[A-Za-z]*/g)
150
+ let matchedList = []
151
+ if (!!matchResult) {
152
+ matchResult.forEach(mi => {
153
+ if (!!mi && (findCalFunStartIndex(mi) !== -1) && !matchedList.includes(mi)) {
154
+ const funcName = mi.toUpperCase()
155
+ formula = formula.replaceAll(mi, 'formulaJs.' + funcName)
156
+ matchedList.push(mi)
157
+ }
158
+ })
159
+ }
160
+
161
+ const formulaValue = evalFn(formula, DSV, VFR, formulaJs)
162
+ return formulaValue
163
+ }
164
+
165
+
166
+ function getFieldKeyName(widget) {
167
+ let o = widget.options.name;
168
+ return (widget.options.keyNameEnabled && widget.options.keyName) || o;
169
+ }
170
+
171
+ function funOtherHanlde(){
172
+
173
+ }
174
+ /**
175
+ * 替换计算公式中的字段值
176
+ * @param VFR
177
+ * @param formulaFieldRef
178
+ * @returns {*}
179
+ */
180
+ export function baseReplaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef, formula, row) {
181
+ // let formula = formulaFieldRef.field.options.formula
182
+ const matchResult = formula.match(FORMULA_REG_EXP)
183
+ if (!matchResult) {
184
+ return formula
185
+ }
186
+
187
+ let resultFormula = formula
188
+ let quitFlag = false
189
+ matchResult.forEach(mi => {
190
+ const thirdPart = mi.split('.')[2]
191
+ const nodeType = thirdPart.substring(0, thirdPart.length - 2)
192
+ if (nodeType === 'func') {
193
+ const funcName = mi.split('.')[1]
194
+ resultFormula = resultFormula.replace(mi, funcName)
195
+ return
196
+ }
197
+
198
+ const firstPart = mi.split('.')[0]
199
+ const fieldId = firstPart.substring(2, firstPart.length)
200
+ const fieldSchema = getFieldWidgetById(VFR.formJsonObj.widgetList, fieldId, false)
201
+ if (!!fieldSchema) {
202
+ let fieldRef = VFR.getWidgetRef(fieldSchema.options.name)
203
+ if (!!fieldRef) {
204
+ //是否要考虑字符串值的替换??
205
+ // resultFormula = resultFormula.replace(mi, fieldRef.currentValue)
206
+ let fieldKeyName = getFieldKeyName(fieldSchema)
207
+ let value = fieldRef.formModel[fieldKeyName]??null;
208
+ resultFormula = resultFormula.replace(mi, value)
209
+ } else { //getWidgetRef找不到,则可能是子表单字段
210
+ const subFormNameOfField = VFR.getSubFormNameOfWidget(fieldSchema.options.name)
211
+ if (!!formulaFieldRef.subFormItemFlag || formulaFieldRef.tableParam || row) {
212
+ /* 如果当前计算字段是子表单字段,要判断公式中的子表单字段是否和当前计算字段是否属于同一子表单!! */
213
+ if(row){
214
+ let fieldKeyName = getFieldKeyName(fieldSchema)
215
+ let value = row[fieldKeyName]??null;
216
+ resultFormula = resultFormula.replaceAll(mi, value)
217
+ /*
218
+ let subFormRowId = row._X_ROW_KEY
219
+ fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
220
+ if (!!fieldRef) {
221
+ let value = fieldRef.currentValue;
222
+ resultFormula = resultFormula.replaceAll(mi, value)
223
+ } else {
224
+ de
225
+ quitFlag = true
226
+ console.error('Field not found: ' + fieldSchema.options.label)
227
+ } */
228
+ }else if (subFormNameOfField === formulaFieldRef?.parentWidget?.options?.name) {
229
+ let subFormRowId = formulaFieldRef.tableParam.row._X_ROW_KEY
230
+ fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
231
+ if (!!fieldRef) {
232
+ let value = fieldRef.currentValue??null;
233
+ resultFormula = resultFormula.replaceAll(mi, value)
234
+ } else {
235
+ quitFlag = true
236
+ console.error('Field not found: ' + fieldSchema.options.label)
237
+ }
238
+ } else if (subFormNameOfField === formulaFieldRef.subFormName) {
239
+ fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '@row' + formulaFieldRef.subFormRowId)
240
+ if (!!fieldRef) {
241
+ resultFormula = resultFormula.replaceAll(mi, fieldRef.currentValue)
242
+ } else {
243
+ quitFlag = true
244
+ console.error('Field not found: ' + fieldSchema.options.label)
245
+ }
246
+ }else {
247
+ console.error('Invalid formula!')
248
+ }
249
+ } else {
250
+ /* 在主表单字段的计算公式中使用子表单字段,应将子表单所有记录同字段的值代入!! */
251
+ // const subFormValue = VFR.formDataModel[subFormNameOfField]
252
+ let dataTableRef = VFR.getWidgetRef(subFormNameOfField)
253
+ const subFormValue = VFR.formDataModel[fieldKeyName(dataTableRef.widget)]
254
+ let allSubFieldValues = ''
255
+ // const subFieldName = fieldSchema.options.name
256
+ const subFieldName = fieldKeyName(fieldSchema)
257
+ subFormValue.forEach((vi, idx) => {
258
+ let val = vi[subFieldName]??null
259
+ allSubFieldValues = (idx === 0) ? val : allSubFieldValues + ', ' + val
260
+ })
261
+ resultFormula = resultFormula.replaceAll(mi, allSubFieldValues)
262
+ }
263
+ }
264
+ }
265
+ })
266
+
267
+ return quitFlag ? null : resultFormula
268
+ }
269
+
270
+ export function calculateFormula2(formulaStr, data, that) {
271
+ if(!formulaStr)return
272
+ let formula = formulaStr;
273
+ let VFR = that.getFormRef();
274
+ let DSV = that.getGlobalDsv()
275
+ let formulaJs = formulajs
276
+
277
+ if(data){
278
+ for(let key in data){
279
+ formula = formula.replaceAll(`[${key}]`,(data[key] || 0))
280
+ }
281
+ }
282
+
283
+ //替换formula-js函数
284
+ const matchResult = formula.match(/[A-Za-z]*/g)
285
+ let matchedList = []
286
+ if (!!matchResult) {
287
+ matchResult.forEach(mi => {
288
+ if (!!mi && (findCalFunStartIndex(mi) !== -1) && !matchedList.includes(mi)) {
289
+ const funcName = mi.toUpperCase()
290
+ formula = formula.replaceAll(mi, 'formulaJs.' + funcName)
291
+ matchedList.push(mi)
292
+ }
293
+ })
294
+ }
295
+
296
+ const formulaValue = evalFn(formula, DSV, VFR, formulaJs)
297
+ return formulaValue
298
+ }
299
+
300
+ /**
301
+ * 判断字段是否用在计算公式中
302
+ * @param fieldName
303
+ * @param formula
304
+ * @param VFR
305
+ */
306
+ export function fieldIsUsedInFormula(fieldName, formula, VFR, fieldTarget) {
307
+ const matchResult = formula.match(FORMULA_REG_EXP)
308
+ if (!matchResult) {
309
+ return false
310
+ }
311
+
312
+ let foundResult = false
313
+ matchResult.forEach(mi => {
314
+ const thirdPart = mi.split('.')[2]
315
+ const nodeType = thirdPart.substring(0, thirdPart.length - 2)
316
+ if (nodeType === 'func') {
317
+ return
318
+ }
319
+
320
+ const firstPart = mi.split('.')[0]
321
+ const fieldId = firstPart.substring(2, firstPart.length)
322
+ let fieldSchema = getFieldWidgetById(VFR.formJsonObj.widgetList, fieldId, false)
323
+ if (!fieldSchema) {
324
+ console.error('The field used by formula not found: ', fieldId)
325
+ console.error('The formula is: ', formula)
326
+ }
327
+ if (fieldSchema && (fieldSchema.options.name === fieldName)) {
328
+ foundResult = true
329
+ }
330
+ })
331
+
332
+ return foundResult
333
+ }
334
+
335
+
336
+ /**
337
+ * 替换计算公式中的字段值
338
+ * @param VFR
339
+ * @param formulaFieldRef
340
+ * @returns {*}
341
+ */
342
+ export function replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) {
343
+ let formula = formulaFieldRef.field.options.formula
344
+ const matchResult = formula.match(FORMULA_REG_EXP)
345
+ if (!matchResult) {
346
+ return formula
347
+ }
348
+
349
+ let resultFormula = formula
350
+ let quitFlag = false
351
+ matchResult.forEach(mi => {
352
+ const thirdPart = mi.split('.')[2]
353
+ const nodeType = thirdPart.substring(0, thirdPart.length - 2)
354
+ if (nodeType === 'func') {
355
+ const funcName = mi.split('.')[1]
356
+ resultFormula = resultFormula.replace(mi, funcName)
357
+ return
358
+ }
359
+
360
+ const firstPart = mi.split('.')[0]
361
+ const fieldId = firstPart.substring(2, firstPart.length)
362
+ const fieldSchema = getFieldWidgetById(VFR.formJsonObj.widgetList, fieldId, false)
363
+ if (!!fieldSchema) {
364
+ let fieldRef = VFR.getWidgetRef(fieldSchema.options.name)
365
+ if (!!fieldRef) {
366
+ //是否要考虑字符串值的替换??
367
+ resultFormula = resultFormula.replace(mi, fieldRef.currentValue)
368
+ } else { //getWidgetRef找不到,则可能是子表单字段
369
+ const subFormNameOfField = VFR.getSubFormNameOfWidget(fieldSchema.options.name)
370
+ if (!!formulaFieldRef.subFormItemFlag || formulaFieldRef.tableParam) {
371
+ /* 如果当前计算字段是子表单字段,要判断公式中的子表单字段是否和当前计算字段是否属于同一子表单!! */
372
+
373
+
374
+ if (subFormNameOfField === formulaFieldRef?.parentWidget?.options?.name) {
375
+ let subFormRowId = formulaFieldRef.tableParam.row._X_ROW_KEY
376
+ fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '_' + subFormRowId)
377
+ if (!!fieldRef) {
378
+ resultFormula = resultFormula.replaceAll(mi, fieldRef.currentValue)
379
+ } else {
380
+ quitFlag = true
381
+ console.error('Field not found: ' + fieldSchema.options.label)
382
+ }
383
+ } else if (subFormNameOfField === formulaFieldRef.subFormName) {
384
+ fieldRef = VFR.getWidgetRef(fieldSchema.options.name + '@row' + formulaFieldRef.subFormRowId)
385
+ if (!!fieldRef) {
386
+ resultFormula = resultFormula.replaceAll(mi, fieldRef.currentValue)
387
+ } else {
388
+ quitFlag = true
389
+ console.error('Field not found: ' + fieldSchema.options.label)
390
+ }
391
+ } else {
392
+ console.error('Invalid formula!')
393
+ }
394
+ } else {
395
+ /* 在主表单字段的计算公式中使用子表单字段,应将子表单所有记录同字段的值代入!! */
396
+ // const subFormValue = VFR.formDataModel[subFormNameOfField]
397
+ let dataTableRef = VFR.getWidgetRef(subFormNameOfField)
398
+ const subFormValue = VFR.formDataModel[fieldKeyName(dataTableRef.widget)]
399
+
400
+ let allSubFieldValues = ''
401
+ // const subFieldName = fieldSchema.options.name
402
+ const subFieldName = fieldKeyName(fieldSchema)
403
+ subFormValue.forEach((vi, idx) => {
404
+ allSubFieldValues = (idx === 0) ? vi[subFieldName] : allSubFieldValues + ', ' + vi[subFieldName]
405
+ })
406
+ resultFormula = resultFormula.replaceAll(mi, allSubFieldValues)
407
+ }
408
+ }
409
+ }
410
+ })
411
+
412
+ return quitFlag ? null : resultFormula
413
+ }
414
+
415
+ function fieldKeyName(widget) {
416
+ let o = widget.options.name;
417
+ return (
418
+ (widget.options.keyNameEnabled && widget.options.keyName) || o
419
+ );
420
+ }
421
+
422
+ /**
423
+ * 获取字段值
424
+ */
425
+ function getWidgetValue(VFR, formula, widgetName) {
426
+ const sIndex = formula.indexOf("(");
427
+ const func = formula.substring(0, sIndex);
428
+
429
+ const funcType = formulas.find(item => {
430
+ if (item.flist.some(fItem => {
431
+ return fItem.fName === func
432
+ })) {
433
+ return item;
434
+ }
435
+ });
436
+ if (translate(funcType.fClass) === "数学类型") {
437
+ return Number(VFR.getWidgetRef(widgetName).getValue());
438
+ } else {
439
+ return VFR.getWidgetRef(widgetName).getValue() + '';
440
+ }
441
+ }
442
+
443
+ // 查找公式中的函数是否在枚举中
444
+ export function hasFun(funName) {
445
+ for (let i = 0; i < FORMULA_JS_FUNCTIONS.length; i++) {
446
+ if (funName === FORMULA_JS_FUNCTIONS[i]) {
447
+ return true
448
+ }
449
+ }
450
+ return false
451
+ }
452
+
453
+ export function findCalFunStartIndex(formula) {
454
+ let startIndex = -1
455
+ for (let i = 0; i < FORMULA_JS_FUNCTIONS.length; i++) {
456
+ let index = formula.indexOf(FORMULA_JS_FUNCTIONS[i])
457
+ if (index !== -1) {
458
+ return index
459
+ }
460
+ }
461
+ return startIndex
462
+ }
463
+
464
+ /**
465
+ * 当删除子表单行时,重新计算相关联的计算字段
466
+ */
467
+ export function recalculateFormulaOnSubFormRowDelete(VFR, DSV, formulaJs, formulaFieldRef) {
468
+ if (!!formulaFieldRef.subFormItemFlag) {
469
+ return
470
+ }
471
+
472
+ let formula = formulaFieldRef.field.options.formula
473
+ formula = replaceFieldsAndFunctionsOfFormula(VFR, formulaFieldRef) //替换字段值
474
+ if (!formula) {
475
+ return
476
+ }
477
+
478
+ //替换formula-js函数
479
+ const matchResult = formula.match(/[A-Za-z]*/g)
480
+ let matchedList = []
481
+ if (!!matchResult) {
482
+ matchResult.forEach(mi => {
483
+ if (!!mi && (findCalFunStartIndex(mi) !== -1) && !matchedList.includes(mi)) {
484
+ const funcName = mi.toUpperCase()
485
+ formula = formula.replaceAll(mi, 'formulaJs.' + funcName)
486
+ matchedList.push(mi)
487
+ }
488
+ })
489
+ }
490
+
491
+ console.log('formula: ', formula)
492
+ const formulaValue = evalFn(formula, DSV, VFR, formulaJs)
493
+ formulaFieldRef.setValue(formulaValue)
494
+ }
495
+
496
+ export function broadcastFormulaRecalculateEvent(subFormRef) {
497
+ let fieldNames = []
498
+ let getFieldNamesFn = (fw) => {
499
+ fieldNames.push(fw.options.name)
500
+ }
501
+ traverseFieldWidgetsOfContainer(subFormRef.widget, getFieldNamesFn)
502
+ fieldNames.map(fieldName => {
503
+ subFormRef.getFormRef().broadcast('FieldWidget', 'calculate-formula-sfRowDeleted', [null, fieldName])
504
+ })
505
+ }
506
+
507
+ //--------------------- 以下为公式计算的API方法 start ------------------//
508
+ // 日期格式化
509
+ export function dateFormat(date, fmt) {
510
+ date = new Date(date)
511
+ let a = ['日', '一', '二', '三', '四', '五', '六']
512
+ let o = {
513
+ 'M+': date.getMonth() + 1, // 月份
514
+ 'd+': date.getDate(), // 日
515
+ 'h+': date.getHours(), // 小时
516
+ 'm+': date.getMinutes(), // 分
517
+ 's+': date.getSeconds(), // 秒
518
+ 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
519
+ 'S': date.getMilliseconds(), // 毫秒
520
+ 'w': date.getDay(), // 周
521
+ 'W': a[date.getDay()], // 大写周
522
+ 'T': 'T'
523
+ }
524
+ if (/(y+)/.test(fmt)) {
525
+ fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
526
+ }
527
+ for (let k in o) {
528
+ if (new RegExp('(' + k + ')').test(fmt)) {
529
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
530
+ }
531
+ }
532
+ return fmt
533
+ }
534
+
535
+ //月份加减
536
+ export function addMonths(yearMonthDay, monthNum) {
537
+ let arr = yearMonthDay.split('-'); //2020-08-19或2020-08
538
+ let year = parseInt(arr[0]);
539
+ let month = parseInt(arr[1]);
540
+ month = month + monthNum;
541
+ if (month > 12) { //月份加
542
+ let yearNum = parseInt((month - 1) / 12);
543
+ month = month % 12 === 0 ? 12 : month % 12;
544
+ year += yearNum;
545
+ } else if (month <= 0) { //月份减
546
+ month = Math.abs(month);
547
+ let yearNum = parseInt((month + 12) / 12);
548
+ year -= yearNum;
549
+ }
550
+ month = month < 10 ? "0" + month : month;
551
+ return year + "-" + month;
552
+ }
553
+
554
+ // 获取当前日期 yyyy-MM-dd
555
+ export function TODAY() {
556
+ // return this.FUNAPI.DODAY().toLocaleDateString().replaceAll("/","-")
557
+ return dateFormat(new Date(), "yyyy-MM-dd")
558
+ }
559
+
560
+ // 获取当前时间 yyyy-MM-dd hh:mm:ss
561
+ export function NOW() {
562
+ // return this.FUNAPI.NOW().toLocaleDateString().replaceAll("/","-")
563
+ return dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss")
564
+ }
565
+
566
+ /** 加减日期年
567
+ * @param {Object} date 日期
568
+ * @param {Object} month 加减的年
569
+ */
570
+ export function EYEAR(date, year) {
571
+ try {
572
+ let myDate = new Date(date)
573
+ let newDate = myDate.setYear(myDate.getFullYear() + year)
574
+ return dateFormat(new Date(newDate), "yyyy-MM-dd")
575
+ } catch (e) {
576
+ //TODO handle the exception
577
+ //console.log(this.i18nt('designer.hint.formulaDateError'), date)
578
+ //console.error(this.i18nt('designer.hint.formulaDateErrorMsg'), e);
579
+ }
580
+ }
581
+
582
+ /** 加减日期月份
583
+ * @param {Object} date 日期
584
+ * @param {Object} month 加减的月份
585
+ */
586
+ export function EMONTH(date, month) {
587
+ try {
588
+ let myDate = new Date(date)
589
+ let newDate = myDate.setMonth(myDate.getMonth() + month)
590
+ return dateFormat(new Date(newDate), "yyyy-MM-dd")
591
+ } catch (e) {
592
+ //TODO handle the exception
593
+ // console.log(this.i18nt('designer.hint.formulaDateError'), date)
594
+ // console.error(this.i18nt('designer.hint.formulaDateErrorMsg'), e);
595
+ }
596
+ }
597
+
598
+ /** 加减日期天数
599
+ * @param {Object} date
600
+ * @param {Object} day 加减天数
601
+ */
602
+ export function EDAY(date, day) {
603
+ try {
604
+ let myDate = new Date(date)
605
+ let newDate = myDate.setDate(myDate.getDate() + day)
606
+ return dateFormat(new Date(newDate), "yyyy-MM-dd")
607
+ } catch (e) {
608
+ //TODO handle the exception
609
+ }
610
+ }
611
+
612
+ const FORMULA_JS_FUNCTIONS = [
613
+ "INT",
614
+ "SUM",
615
+ "AVERAGE",
616
+ "MAX",
617
+ "MIN",
618
+ "ABS",
619
+ "ROUND",
620
+ "CEILING",
621
+ "LOG",
622
+ "MOD",
623
+ "POWER",
624
+ "AND",
625
+ "IF",
626
+ "IFS",
627
+ "IFERROR",
628
+ "IFNA",
629
+ "NOT",
630
+ "OR",
631
+ "SWITCH",
632
+ "XOR",
633
+ "YEAR",
634
+ "MONTH",
635
+ "DAY",
636
+ "TODAY",
637
+ "NOW",
638
+ "EMONTH",
639
+ "EDAY",
640
+ "FIND",
641
+ "LEFT",
642
+ "RIGHT",
643
+ "LEN",
644
+ "LOWER",
645
+ "UPPER",
646
+ "MID",
647
+ "TRIM",
648
+ ];
649
+
650
+ export const formulas = [
651
+ {
652
+ fClass: "designer.hint.formulaFunctionMaths",
653
+ flist: [
654
+ {
655
+ fName: "INT",
656
+ fType: "designer.hint.formulaNumber",
657
+ fIntro: "designer.hint.formulaINT",
658
+ },
659
+ {
660
+ fName: "SUM",
661
+ fType: "designer.hint.formulaNumber",
662
+ fIntro: "designer.hint.formulaSUM",
663
+ },
664
+ {
665
+ fName: "SUMIF",
666
+ fType: "designer.hint.formulaNumber",
667
+ fIntro: "designer.hint.formulaSUMIF",
668
+ },
669
+ {
670
+ fName: "SUMIFS",
671
+ fType: "designer.hint.formulaNumber",
672
+ fIntro: "designer.hint.formulaSUMIFS",
673
+ },
674
+ {
675
+ fName: "AVERAGE",
676
+ fType: "designer.hint.formulaNumber",
677
+ fIntro: "designer.hint.formulaAVERAGE",
678
+ },
679
+ {
680
+ fName: "MAX",
681
+ fType: "designer.hint.formulaNumber",
682
+ fIntro: "designer.hint.formulaMAX",
683
+ },
684
+ {
685
+ fName: "MIN",
686
+ fType: "designer.hint.formulaNumber",
687
+ fIntro: "designer.hint.formulaMIN",
688
+ },
689
+ {
690
+ fName: "ABS",
691
+ fType: "designer.hint.formulaNumber",
692
+ fIntro: "designer.hint.formulaABS",
693
+ },
694
+ {
695
+ fName: "ROUND",
696
+ fType: "designer.hint.formulaNumber",
697
+ fIntro: "designer.hint.formulaROUND",
698
+ },
699
+ {
700
+ fName: "CEILING",
701
+ fType: "designer.hint.formulaNumber",
702
+ fIntro: "designer.hint.formulaCEILING",
703
+ },
704
+ {
705
+ fName: "LOG",
706
+ fType: "designer.hint.formulaNumber",
707
+ fIntro: "designer.hint.formulaLOG",
708
+ },
709
+ {
710
+ fName: "MOD",
711
+ fType: "designer.hint.formulaNumber",
712
+ fIntro: "designer.hint.formulaMOD",
713
+ },
714
+ {
715
+ fName: "POWER",
716
+ fType: "designer.hint.formulaNumber",
717
+ fIntro: "designer.hint.formulaPOWER",
718
+ },
719
+ ],
720
+ },
721
+ {
722
+ fClass: "designer.hint.formulaFunctionLogic",
723
+ flist: [
724
+ {
725
+ fName: "AND",
726
+ fType: "designer.hint.formulaObject",
727
+ fIntro: "designer.hint.formulaAND",
728
+ },
729
+ {
730
+ fName: "IF",
731
+ fType: "designer.hint.formulaObject",
732
+ fIntro: "designer.hint.formulaIF",
733
+ },
734
+ {
735
+ fName: "IFS",
736
+ fType: "designer.hint.formulaObject",
737
+ fIntro: "designer.hint.formulaIFS",
738
+ },
739
+ {
740
+ fName: "IFERROR",
741
+ fType: "designer.hint.formulaObject",
742
+ fIntro: "designer.hint.formulaIFERROR",
743
+ },
744
+ {
745
+ fName: "IFNA",
746
+ fType: "designer.hint.formulaObject",
747
+ fIntro: "designer.hint.formulaIFNA",
748
+ },
749
+ {
750
+ fName: "NOT",
751
+ fType: "designer.hint.formulaObject",
752
+ fIntro: "designer.hint.formulaNOT",
753
+ },
754
+ {
755
+ fName: "OR",
756
+ fType: "designer.hint.formulaObject",
757
+ fIntro: "designer.hint.formulaOR",
758
+ },
759
+ {
760
+ fName: "SWITCH",
761
+ fType: "designer.hint.formulaObject",
762
+ fIntro: "designer.hint.formulaSWITCH",
763
+ },
764
+ {
765
+ fName: "XOR",
766
+ fType: "designer.hint.formulaObject",
767
+ fIntro: "designer.hint.formulaXOR",
768
+ },
769
+ ],
770
+ },
771
+ {
772
+ fClass: "designer.hint.formulaFunctionTime",
773
+ flist: [
774
+ {
775
+ fName: "YEAR",
776
+ fType: "designer.hint.formulaDate",
777
+ fIntro: "designer.hint.formulaYEAR",
778
+ },
779
+ {
780
+ fName: "MONTH",
781
+ fType: "designer.hint.formulaDate",
782
+ fIntro: "designer.hint.formulaMONTH",
783
+ },
784
+ {
785
+ fName: "DAY",
786
+ fType: "designer.hint.formulaDate",
787
+ fIntro: "designer.hint.formulaDAY",
788
+ },
789
+ {
790
+ fName: "TODAY",
791
+ fType: "designer.hint.formulaDate",
792
+ fIntro: "designer.hint.formulaTODAY",
793
+ },
794
+ {
795
+ fName: "NOW",
796
+ fType: "designer.hint.formulaDate",
797
+ fIntro: "designer.hint.formulaNOW",
798
+ },
799
+ {
800
+ fName: "EMONTH",
801
+ fType: "designer.hint.formulaDate",
802
+ fIntro: "designer.hint.formulaEMONTH",
803
+ },
804
+ {
805
+ fName: "EDAY",
806
+ fType: "designer.hint.formulaDate",
807
+ fIntro: "designer.hint.formulaEDAY",
808
+ },
809
+ ],
810
+ },
811
+ {
812
+ fClass: "designer.hint.formulaFunctionString",
813
+ flist: [
814
+ {
815
+ fName: "FIND",
816
+ fType: "designer.hint.formulaChar",
817
+ fIntro: "designer.hint.formulaFIND",
818
+ },
819
+ {
820
+ fName: "LEFT",
821
+ fType: "designer.hint.formulaChar",
822
+ fIntro: "designer.hint.formulaLEFT",
823
+ },
824
+ {
825
+ fName: "RIGHT",
826
+ fType: "designer.hint.formulaChar",
827
+ fIntro: "designer.hint.formulaRIGHT",
828
+ },
829
+ {
830
+ fName: "LEN",
831
+ fType: "designer.hint.formulaChar",
832
+ fIntro: "designer.hint.formulaLEN",
833
+ },
834
+ {
835
+ fName: "LOWER",
836
+ fType: "designer.hint.formulaChar",
837
+ fIntro: "designer.hint.formulaLOWER",
838
+ },
839
+ {
840
+ fName: "UPPER",
841
+ fType: "designer.hint.formulaChar",
842
+ fIntro: "designer.hint.formulaUPPER",
843
+ },
844
+ {
845
+ fName: "MID",
846
+ fType: "designer.hint.formulaChar",
847
+ fIntro: "designer.hint.formulaMID",
848
+ },
849
+ {
850
+ fName: "TRIM",
851
+ fType: "designer.hint.formulaChar",
852
+ fIntro: "designer.hint.formulaTRIM",
853
+ },
854
+ ],
855
+ },
856
+ ];