sohelp-eleplus 1.1.1-8.beta.1

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 (298) hide show
  1. package/README.md +35 -0
  2. package/cache/DictCache.js +58 -0
  3. package/cache/ModuleCache.js +322 -0
  4. package/components.js +46 -0
  5. package/core-export.js +4 -0
  6. package/http/CrudHttp.js +115 -0
  7. package/http/DictHttp.js +12 -0
  8. package/http/ModuleHttp.js +68 -0
  9. package/http/SohelpHttp.js +125 -0
  10. package/index.js +6 -0
  11. package/installer.js +8 -0
  12. package/lang/en_US.js +4 -0
  13. package/lang/zh_CN.js +4 -0
  14. package/lang/zh_TW.js +4 -0
  15. package/package.json +9 -0
  16. package/sohelp-ace-editor/index.vue +198 -0
  17. package/sohelp-application-select/index.vue +15 -0
  18. package/sohelp-autocode/index.vue +53 -0
  19. package/sohelp-calendar-view/index.vue +11 -0
  20. package/sohelp-card-view/index.vue +11 -0
  21. package/sohelp-condition/index.vue +210 -0
  22. package/sohelp-cry-input/index.vue +64 -0
  23. package/sohelp-date/index.vue +27 -0
  24. package/sohelp-datetime/index.vue +44 -0
  25. package/sohelp-datetime-picker/index.vue +86 -0
  26. package/sohelp-datetime-range/index.vue +59 -0
  27. package/sohelp-dict/index.vue +206 -0
  28. package/sohelp-dict/props.js +68 -0
  29. package/sohelp-drawer/index.vue +50 -0
  30. package/sohelp-drop-card/index.vue +94 -0
  31. package/sohelp-drop-card/props.js +68 -0
  32. package/sohelp-dyn-select/index.vue +99 -0
  33. package/sohelp-dyn-select/props.js +67 -0
  34. package/sohelp-dyn-tree/index.vue +82 -0
  35. package/sohelp-dyn-tree-select/index.vue +114 -0
  36. package/sohelp-entity-form/index.vue +524 -0
  37. package/sohelp-entity-grid/index.vue +30 -0
  38. package/sohelp-file-upload/index.vue +218 -0
  39. package/sohelp-filter-scheme/components/condition.vue +102 -0
  40. package/sohelp-filter-scheme/components/filter.vue +45 -0
  41. package/sohelp-filter-scheme/components/keywords.vue +15 -0
  42. package/sohelp-filter-scheme/components/scheme.vue +49 -0
  43. package/sohelp-filter-scheme/index.vue +113 -0
  44. package/sohelp-grid/SohelpGridConfig.js~ +408 -0
  45. package/sohelp-grid/components/filter-condition-item.vue +298 -0
  46. package/sohelp-grid/index.vue +1965 -0
  47. package/sohelp-grid/js/ConditionType.js +101 -0
  48. package/sohelp-grid/js/DefaultGridOptions.js +145 -0
  49. package/sohelp-grid/js/DefaultProps.js +27 -0
  50. package/sohelp-grid/js/SohelpConfigFunction.js +0 -0
  51. package/sohelp-grid/js/SohelpGridConfig.js +101 -0
  52. package/sohelp-grid/js/useSohelpGridConfig.js +525 -0
  53. package/sohelp-grid-select/index.vue +245 -0
  54. package/sohelp-grid-view/filter/config/grid-filter-condition.vue +221 -0
  55. package/sohelp-grid-view/filter/config/grid-filter-config.vue +27 -0
  56. package/sohelp-grid-view/filter/config/grid-filter-field.vue +378 -0
  57. package/sohelp-grid-view/filter/config/grid-filter-keywords.vue +310 -0
  58. package/sohelp-grid-view/filter/config/grid-filter-list.vue +313 -0
  59. package/sohelp-grid-view/filter/config/grid-filter-scheme.vue +264 -0
  60. package/sohelp-grid-view/filter/config/grid-filter-sort.vue +310 -0
  61. package/sohelp-grid-view/filter/config/index.vue +206 -0
  62. package/sohelp-grid-view/filter/filter-form.vue +446 -0
  63. package/sohelp-grid-view/filter/filter-toolbar.vue +110 -0
  64. package/sohelp-grid-view/filter/index.vue +160 -0
  65. package/sohelp-grid-view/index.vue +379 -0
  66. package/sohelp-grid-view-select/index.vue +141 -0
  67. package/sohelp-group-view/index.vue +11 -0
  68. package/sohelp-icon-select/icons/AnalysisOutlined.vue +22 -0
  69. package/sohelp-icon-select/icons/ApplicationOutlined.vue +21 -0
  70. package/sohelp-icon-select/icons/AppstoreAddOutlined.vue +28 -0
  71. package/sohelp-icon-select/icons/AppstoreOutlined.vue +30 -0
  72. package/sohelp-icon-select/icons/ArrowDown.vue +21 -0
  73. package/sohelp-icon-select/icons/ArrowDownOutlined.vue +20 -0
  74. package/sohelp-icon-select/icons/ArrowLeft.vue +21 -0
  75. package/sohelp-icon-select/icons/ArrowLeftOutlined.vue +20 -0
  76. package/sohelp-icon-select/icons/ArrowRight.vue +21 -0
  77. package/sohelp-icon-select/icons/ArrowRightOutlined.vue +20 -0
  78. package/sohelp-icon-select/icons/ArrowUp.vue +21 -0
  79. package/sohelp-icon-select/icons/ArrowUpOutlined.vue +20 -0
  80. package/sohelp-icon-select/icons/BellOutlined.vue +21 -0
  81. package/sohelp-icon-select/icons/BookOutlined.vue +21 -0
  82. package/sohelp-icon-select/icons/CalendarOutlined.vue +19 -0
  83. package/sohelp-icon-select/icons/CaretDownFilled.vue +13 -0
  84. package/sohelp-icon-select/icons/CaretUpFilled.vue +13 -0
  85. package/sohelp-icon-select/icons/CheckCircleFilled.vue +15 -0
  86. package/sohelp-icon-select/icons/CheckCircleOutlined.vue +23 -0
  87. package/sohelp-icon-select/icons/CheckOutlined.vue +20 -0
  88. package/sohelp-icon-select/icons/CityOutlined.vue +22 -0
  89. package/sohelp-icon-select/icons/ClockCircleOutlined.vue +23 -0
  90. package/sohelp-icon-select/icons/CloseCircleFilled.vue +15 -0
  91. package/sohelp-icon-select/icons/CloseCircleOutlined.vue +22 -0
  92. package/sohelp-icon-select/icons/CloseOutlined.vue +20 -0
  93. package/sohelp-icon-select/icons/CloudUploadOutlined.vue +23 -0
  94. package/sohelp-icon-select/icons/ClusterOutlined.vue +21 -0
  95. package/sohelp-icon-select/icons/CodeOutlined.vue +22 -0
  96. package/sohelp-icon-select/icons/ColumnHeightOutlined.vue +18 -0
  97. package/sohelp-icon-select/icons/CompassOutlined.vue +22 -0
  98. package/sohelp-icon-select/icons/CompressOutlined.vue +23 -0
  99. package/sohelp-icon-select/icons/ConnectionOutlined.vue +24 -0
  100. package/sohelp-icon-select/icons/ControlOutlined.vue +27 -0
  101. package/sohelp-icon-select/icons/CopyOutlined.vue +22 -0
  102. package/sohelp-icon-select/icons/CpuOutlined.vue +22 -0
  103. package/sohelp-icon-select/icons/DashboardOutlined.vue +26 -0
  104. package/sohelp-icon-select/icons/DatabaseOutlined.vue +22 -0
  105. package/sohelp-icon-select/icons/DeleteOutlined.vue +22 -0
  106. package/sohelp-icon-select/icons/DesktopOutlined.vue +19 -0
  107. package/sohelp-icon-select/icons/DownloadOutlined.vue +21 -0
  108. package/sohelp-icon-select/icons/DragOutlined.vue +22 -0
  109. package/sohelp-icon-select/icons/EditOutlined.vue +21 -0
  110. package/sohelp-icon-select/icons/EllipsisOutlined.vue +15 -0
  111. package/sohelp-icon-select/icons/EnvironmentOutlined.vue +22 -0
  112. package/sohelp-icon-select/icons/ExclamationCircleFilled.vue +15 -0
  113. package/sohelp-icon-select/icons/ExpandOutlined.vue +23 -0
  114. package/sohelp-icon-select/icons/FileOutlined.vue +22 -0
  115. package/sohelp-icon-select/icons/FilterFilled.vue +15 -0
  116. package/sohelp-icon-select/icons/FolderAddOutlined.vue +20 -0
  117. package/sohelp-icon-select/icons/FolderOutlined.vue +19 -0
  118. package/sohelp-icon-select/icons/FormOutlined.vue +20 -0
  119. package/sohelp-icon-select/icons/FullscreenExitOutlined.vue +16 -0
  120. package/sohelp-icon-select/icons/FullscreenOutlined.vue +16 -0
  121. package/sohelp-icon-select/icons/FundOutlined.vue +20 -0
  122. package/sohelp-icon-select/icons/GlobalOutlined.vue +15 -0
  123. package/sohelp-icon-select/icons/HolderOutlined.vue +18 -0
  124. package/sohelp-icon-select/icons/HomeOutlined.vue +19 -0
  125. package/sohelp-icon-select/icons/IdcardOutlined.vue +25 -0
  126. package/sohelp-icon-select/icons/InfoCircleFilled.vue +15 -0
  127. package/sohelp-icon-select/icons/LinkOutlined.vue +15 -0
  128. package/sohelp-icon-select/icons/LoadingDotOutlined.vue +21 -0
  129. package/sohelp-icon-select/icons/LoadingOutlined.vue +19 -0
  130. package/sohelp-icon-select/icons/LockOutlined.vue +21 -0
  131. package/sohelp-icon-select/icons/LogOutlined.vue +22 -0
  132. package/sohelp-icon-select/icons/LogoutOutlined.vue +22 -0
  133. package/sohelp-icon-select/icons/MailOutlined.vue +19 -0
  134. package/sohelp-icon-select/icons/MenuFoldOutlined.vue +17 -0
  135. package/sohelp-icon-select/icons/MenuUnfoldOutlined.vue +17 -0
  136. package/sohelp-icon-select/icons/MessageOutlined.vue +22 -0
  137. package/sohelp-icon-select/icons/MinusCircleOutlined.vue +22 -0
  138. package/sohelp-icon-select/icons/MobileOutlined.vue +20 -0
  139. package/sohelp-icon-select/icons/MoonOutlined.vue +21 -0
  140. package/sohelp-icon-select/icons/MoreOutlined.vue +15 -0
  141. package/sohelp-icon-select/icons/PauseFilled.vue +14 -0
  142. package/sohelp-icon-select/icons/PieChartOutlined.vue +20 -0
  143. package/sohelp-icon-select/icons/PlayFilled.vue +13 -0
  144. package/sohelp-icon-select/icons/PlusCircleOutlined.vue +22 -0
  145. package/sohelp-icon-select/icons/PlusOutlined.vue +19 -0
  146. package/sohelp-icon-select/icons/ProtectOutlined.vue +21 -0
  147. package/sohelp-icon-select/icons/QuestionCircleFilled.vue +15 -0
  148. package/sohelp-icon-select/icons/QuestionCircleOutlined.vue +25 -0
  149. package/sohelp-icon-select/icons/ReloadOutlined.vue +22 -0
  150. package/sohelp-icon-select/icons/SearchOutlined.vue +21 -0
  151. package/sohelp-icon-select/icons/SettingOutlined.vue +24 -0
  152. package/sohelp-icon-select/icons/ShoppingOutlined.vue +19 -0
  153. package/sohelp-icon-select/icons/SortOutlined.vue +21 -0
  154. package/sohelp-icon-select/icons/StarFilled.vue +15 -0
  155. package/sohelp-icon-select/icons/StepBackwardFilled.vue +17 -0
  156. package/sohelp-icon-select/icons/StepForwardFilled.vue +17 -0
  157. package/sohelp-icon-select/icons/SuitcaseOutlined.vue +19 -0
  158. package/sohelp-icon-select/icons/SunOutlined.vue +29 -0
  159. package/sohelp-icon-select/icons/SwapOutlined.vue +21 -0
  160. package/sohelp-icon-select/icons/SyncOutlined.vue +21 -0
  161. package/sohelp-icon-select/icons/TableOutlined.vue +19 -0
  162. package/sohelp-icon-select/icons/TagOutlined.vue +20 -0
  163. package/sohelp-icon-select/icons/TimerOutlined.vue +22 -0
  164. package/sohelp-icon-select/icons/UndoOutlined.vue +22 -0
  165. package/sohelp-icon-select/icons/UnlockOutlined.vue +21 -0
  166. package/sohelp-icon-select/icons/UploadOutlined.vue +21 -0
  167. package/sohelp-icon-select/icons/UserOutlined.vue +21 -0
  168. package/sohelp-icon-select/icons/VerticalAlignMiddleOutlined.vue +15 -0
  169. package/sohelp-icon-select/icons/VerticalLeftOutlined.vue +13 -0
  170. package/sohelp-icon-select/icons/VerticalRightOutlined.vue +13 -0
  171. package/sohelp-icon-select/icons/WarningOutlined.vue +21 -0
  172. package/sohelp-icon-select/icons/ZoomInOutlined.vue +22 -0
  173. package/sohelp-icon-select/icons/ZoomOutOutlined.vue +22 -0
  174. package/sohelp-icon-select/icons/index.js +106 -0
  175. package/sohelp-icon-select/icons/index.ts +106 -0
  176. package/sohelp-icon-select/index.vue +95 -0
  177. package/sohelp-icon-select/vxeui-icon.js +90 -0
  178. package/sohelp-image-upload/index.vue +286 -0
  179. package/sohelp-input/index.vue +39 -0
  180. package/sohelp-modal/index.vue +72 -0
  181. package/sohelp-module/index.vue +54 -0
  182. package/sohelp-module/useModalManager.js +89 -0
  183. package/sohelp-module/useSohelpModule.js +64 -0
  184. package/sohelp-number-input/index.vue +32 -0
  185. package/sohelp-number-range/index.vue +135 -0
  186. package/sohelp-org-select/index.vue +30 -0
  187. package/sohelp-org-tree/index.vue +18 -0
  188. package/sohelp-org-tree-select/index.vue +93 -0
  189. package/sohelp-org-user-tree/index.vue +26 -0
  190. package/sohelp-org-user-tree-select/index.vue +11 -0
  191. package/sohelp-pagination/index.vue +11 -0
  192. package/sohelp-power/index.vue +105 -0
  193. package/sohelp-pro-form/components/pro-form-footer.vue +44 -0
  194. package/sohelp-pro-form/components/pro-form-item.vue +1133 -0
  195. package/sohelp-pro-form/index.vue +257 -0
  196. package/sohelp-pro-form/util.js +140 -0
  197. package/sohelp-pro-layout/index.vue +11 -0
  198. package/sohelp-pro-table/index.vue +14 -0
  199. package/sohelp-process/index.vue +216 -0
  200. package/sohelp-rate/index.vue +56 -0
  201. package/sohelp-rate/props.js +71 -0
  202. package/sohelp-relation/index.vue +11 -0
  203. package/sohelp-rich-text/index.vue +242 -0
  204. package/sohelp-rich-text/util.js +231 -0
  205. package/sohelp-richtext/index.vue +10 -0
  206. package/sohelp-role-select/index.vue +33 -0
  207. package/sohelp-search/components/search-config.vue +0 -0
  208. package/sohelp-search/index.vue +49 -0
  209. package/sohelp-search-pro-form/index.vue +11 -0
  210. package/sohelp-select/index.vue +120 -0
  211. package/sohelp-split-panel/index.vue +15 -0
  212. package/sohelp-switch/index.vue +56 -0
  213. package/sohelp-table/index.vue +151 -0
  214. package/sohelp-tenant-select/index.vue +128 -0
  215. package/sohelp-text/index.vue +14 -0
  216. package/sohelp-textarea-input/index.vue +36 -0
  217. package/sohelp-time/index.vue +10 -0
  218. package/sohelp-tree/index.vue +37 -0
  219. package/sohelp-tree-select/index.vue +18 -0
  220. package/sohelp-user-select/index.vue +44 -0
  221. package/sohelp-user-select/index.vue~ +53 -0
  222. package/sohelp-user-select/props.js +71 -0
  223. package/sohelp-user-tag/index.vue +12 -0
  224. package/sohelp-user-tree/index.vue +11 -0
  225. package/sohelp-vform-drawer/index.vue +40 -0
  226. package/sohelp-vform-eleplus/favicon.ico +0 -0
  227. package/sohelp-vform-eleplus/index.vue +297 -0
  228. package/sohelp-vform-eleplus/preview.html +91 -0
  229. package/sohelp-vform-eleplus/render.es.js +72433 -0
  230. package/sohelp-vform-eleplus/render.style.css +16 -0
  231. package/sohelp-vform-eleplus/render.umd.js +57 -0
  232. package/sohelp-vform-eleplus/tinymce/langs/zh_CN.js +462 -0
  233. package/sohelp-vform-eleplus/tinymce/langs/zh_TW.js +419 -0
  234. package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.css +72 -0
  235. package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.min.css +7 -0
  236. package/sohelp-vform-eleplus/tinymce/skins/content/default/content.css +67 -0
  237. package/sohelp-vform-eleplus/tinymce/skins/content/default/content.min.css +7 -0
  238. package/sohelp-vform-eleplus/tinymce/skins/content/document/content.css +72 -0
  239. package/sohelp-vform-eleplus/tinymce/skins/content/document/content.min.css +7 -0
  240. package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.css +68 -0
  241. package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.min.css +7 -0
  242. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.css +732 -0
  243. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.css +726 -0
  244. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.min.css +7 -0
  245. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.min.css +7 -0
  246. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.css +29 -0
  247. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.min.css +7 -0
  248. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
  249. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.css +3047 -0
  250. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.min.css +7 -0
  251. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.css +673 -0
  252. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.min.css +7 -0
  253. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.css +37 -0
  254. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.min.css +7 -0
  255. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.css +714 -0
  256. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.css +726 -0
  257. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.min.css +7 -0
  258. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.min.css +7 -0
  259. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.css +29 -0
  260. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.min.css +7 -0
  261. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
  262. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.css +3047 -0
  263. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.min.css +7 -0
  264. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.css +673 -0
  265. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +7 -0
  266. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +37 -0
  267. package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +7 -0
  268. package/sohelp-vform-modal/index.vue +41 -0
  269. package/sohelp-vform-select/index.vue +11 -0
  270. package/sohelp-vform-vant/favicon.ico +0 -0
  271. package/sohelp-vform-vant/render.es.js +14608 -0
  272. package/sohelp-vform-vant/render.style.css +1 -0
  273. package/sohelp-vform-vant/render.umd.js +22 -0
  274. package/sohelp-vxe-grid/DefaultGridOptions.js +90 -0
  275. package/sohelp-vxe-grid/DefaultProps.js +27 -0
  276. package/sohelp-vxe-grid/SohelpGridConfig.js +143 -0
  277. package/sohelp-vxe-grid/index.vue +475 -0
  278. package/sohelp-vxe-grid-select/index.vue +148 -0
  279. package/sohelp-vxe-table/index.vue +184 -0
  280. package/sohelp-workflow/index.vue +495 -0
  281. package/sohelp-workflow/nodeWrap.vue +53 -0
  282. package/sohelp-workflow/nodes/addNode.vue +27 -0
  283. package/sohelp-workflow/nodes/approver.vue +125 -0
  284. package/sohelp-workflow/nodes/branch.vue +434 -0
  285. package/sohelp-workflow/nodes/promoter.vue +80 -0
  286. package/sohelp-workflow/nodes/send.vue +95 -0
  287. package/sohelp-workflow-drawer/components/approval-modal.vue +182 -0
  288. package/sohelp-workflow-drawer/components/draw-box.vue +141 -0
  289. package/sohelp-workflow-drawer/components/form.vue +78 -0
  290. package/sohelp-workflow-drawer/components/table.vue +153 -0
  291. package/sohelp-workflow-drawer/components/timeline.vue +189 -0
  292. package/sohelp-workflow-drawer/components/workflow.vue +68 -0
  293. package/sohelp-workflow-drawer/index.vue +311 -0
  294. package/sohelp-workflow-drawer/js/index.js +119 -0
  295. package/utils/ProFormConvertUtil.js +76 -0
  296. package/utils/core.js +310 -0
  297. package/utils/use-form-data.js +48 -0
  298. package/utils/use-mobile.js +43 -0
@@ -0,0 +1,525 @@
1
+ import { reactive, ref } from "vue";
2
+ import _DefaultGridOptions from "../js/DefaultGridOptions";
3
+ import { moduleCache } from "../../cache/ModuleCache";
4
+ import { usePermission } from "@/utils/use-permission";
5
+ import { useMobile } from "@/utils/use-mobile";
6
+ import { useI18n } from "vue-i18n";
7
+
8
+ /**
9
+ * 深拷贝
10
+ * @param obj
11
+ * @returns {any}
12
+ */
13
+ function deepClone(obj) {
14
+ return JSON.parse(JSON.stringify(obj));
15
+ }
16
+
17
+ // 动态生成cellStyle函数
18
+ function createDynamicStyle(styleConfigs = [], isCell = true) {
19
+ // 预编译条件表达式为函数
20
+ const compiledConfigs = styleConfigs.map((config) => ({
21
+ ...config,
22
+ conditionFn: new Function("row", `return ${config.condition}`)
23
+ }));
24
+
25
+ return function({ row, column }) {
26
+ const _config = isCell ? compiledConfigs.filter((c) => c.name === column.field) : compiledConfigs;
27
+ if (!_config || !_config.length) return null;
28
+ try {
29
+ for (const config of _config) {
30
+ const conditionFn = new Function("row", `return ${config.condition}`);
31
+ if (conditionFn(row)) {
32
+ return {
33
+ color: config.fontColor,
34
+ backgroundColor: config.bgColor,
35
+ fontWeight: config?.bold ? "bold" : "",
36
+ fontStyle: config.italic ? "italic" : "",
37
+ textDecoration: config.strikethrough ? "line-through" : config.underline ? "underline" : ""
38
+ };
39
+ }
40
+ }
41
+ } catch (e) {
42
+ console.error("条件解析错误:", e);
43
+ }
44
+ return null;
45
+ };
46
+ }
47
+
48
+ const createDynamicCellStyle = (styleConfigs = []) => createDynamicStyle(styleConfigs, true);
49
+ const createDynamicRowStyle = (styleConfigs = []) => createDynamicStyle(styleConfigs, false);
50
+
51
+ /**
52
+ * 商邦网格列配置列转化成VxeGrid列配置
53
+ * @param property
54
+ * @param sortList
55
+ * @param f
56
+ * @param formulaMap
57
+ * @returns
58
+ **/
59
+ const switchVxeProperty = (property, sortList, f, formulaMap) => {
60
+ let editor = {
61
+ field: property.name,
62
+ title: property.label,
63
+ i18n: property.i18n,
64
+ query: property.query,
65
+ width: property.width || 120,
66
+ type: property.editor || property.type,
67
+ align: property.align || "left",
68
+ titleSuffix: property.tooltip ? { content: property.tooltip, placement: "top" } : "",
69
+
70
+ showOverflow: true,
71
+ editRender: {
72
+ enabled: property.edit,
73
+ edit: property.edit,
74
+ ...property.editorParam
75
+ },
76
+ fixed: !property.lock ? false : property.lockAlign,
77
+ slots: {
78
+ default: "default_" + property.name,
79
+ header: "header_" + property.name
80
+ },
81
+ contentRender: {
82
+ name: property.render,
83
+ props: property.renderParam || {},
84
+ event: "event"
85
+ }
86
+ };
87
+
88
+ if (property.length > 0) {
89
+ editor.editRender.maxlength = property.length;
90
+ }
91
+
92
+ if (property.dict) {
93
+ editor.editRender["code"] = property.dict;
94
+ }
95
+
96
+ // 取默认显示值
97
+ if (property.type === "RELATION" && editor.labelField === "") {
98
+ const fields = property.relationList?.split(",");
99
+ editor.labelField = fields.includes("id") && fields.length > 1 ? fields[1] : fields[0];
100
+ }
101
+
102
+ // 自定义编辑插槽
103
+ if (property.edit) {
104
+ editor.slots.edit = "edit_" + property.name;
105
+ }
106
+
107
+ if (
108
+ ["SohelpImageUpload", "SohelpFileUpload", "SohelpRate", "SohelpSwitch", "SohelpProcess"].includes(property.editor)
109
+ ) {
110
+ delete editor.slots.edit; //不渲染编辑
111
+ editor.editRender.enabled = false;
112
+ }
113
+
114
+ //筛选项配置
115
+ if (editor.query) {
116
+ switchFilterConfig(editor);
117
+ }
118
+
119
+ //是否统计
120
+ const isSummary = f.find((item) => item.field === property.name);
121
+
122
+ if (isSummary) {
123
+ editor.slots["footer"] = "footer_" + property.name;
124
+ }
125
+
126
+ // 排序
127
+ if (sortList?.includes(property.name)) {
128
+ editor["sortable"] = true;
129
+ }
130
+
131
+ if (property.name === "id") {
132
+ editor["width"] = 150;
133
+ }
134
+
135
+ return editor;
136
+ };
137
+
138
+ /**
139
+ * 筛选配置
140
+ */
141
+ const switchFilterConfig = (editor) => {
142
+ editor.filters = [{ data: "", checked: false }];
143
+ editor.filterRender = {};
144
+ editor.slots = {
145
+ ...editor.slots,
146
+ filter: "filter_" + editor.field
147
+ };
148
+ };
149
+
150
+ /**
151
+ * properties中过滤掉删除的属性
152
+ * @param {*} _filter
153
+ * @returns
154
+ */
155
+ const filterFieldsByProperties = (_data) => {
156
+ const data = { ..._data };
157
+ const properties = new Set(data.properties?.map((item) => item.name).filter(Boolean) || []);
158
+ const filterArray = (list, key) => {
159
+ return Array.isArray(list) ? list.filter((item) => properties.has(key ? item?.[key] : item)) : [];
160
+ };
161
+
162
+ let validProperties = Object.fromEntries(
163
+ data.properties.filter((item) => item.name && !item.hidden)?.map((item) => [item.name, item.label])
164
+ );
165
+
166
+ data.list = filterArray(data.list).filter((item) => {
167
+ return item in validProperties;
168
+ });
169
+
170
+ data.filter.keywords = filterArray(data.filter.keywords);
171
+ data.filter.field = filterArray(data.filter.field, "name");
172
+
173
+ //过滤掉不在列表中的sort属性
174
+ data.filter.sort = filterArray(data.filter.sort.filter((item) => data.filter.field.some((f) => f.name === item)));
175
+ data.properties = data.properties.filter((item) => item.name && !item.hidden);
176
+ return data;
177
+ };
178
+
179
+ /**
180
+ * 工具栏默认图标
181
+ */
182
+ const defaultIcons = {
183
+ "crud.edit": "vxe-icon-edit",
184
+ "crud.delete": "vxe-icon-delete",
185
+ "crud.create": "vxe-icon-add",
186
+ "crud.save": "vxe-icon-save",
187
+ "crud.view": "vxe-icon-eye-fill",
188
+ "workflow.submit": "vxe-icon-success-circle",
189
+ "workflow.view": "vxe-icon-file-txt",
190
+ "report.print": "vxe-icon-print"
191
+ };
192
+
193
+ /**
194
+ * 格式化工具栏
195
+ */
196
+ const getToolbarsButtons = (data) => {
197
+ if (data?.length) {
198
+ const groupedButtons = data.reduce((acc, button) => {
199
+ const { buttonType } = button;
200
+ if (!acc[buttonType]) {
201
+ acc[buttonType] = [];
202
+ }
203
+
204
+ acc[buttonType].push(button);
205
+ return acc;
206
+ }, {});
207
+
208
+ // 按钮格式化
209
+ const formatterButton = (arr, type) => {
210
+ return arr.map((item) => {
211
+ let params = {};
212
+ if (item.params && typeof item.params === "string") {
213
+ try {
214
+ params = JSON.parse(item.params);
215
+ } catch (e) {
216
+ console.error("FormatterButton Error:", e);
217
+ params = {};
218
+ }
219
+ }
220
+ let obj = {
221
+ code: item.type,
222
+ name: item.title || item,
223
+ id: item.id,
224
+ pno: item.pno,
225
+ handler: item.handler,
226
+ buttonType: item.buttonType,
227
+ icon: item.iconCls || defaultIcons[item.type],
228
+ refid: item.refid,
229
+ openType: item.openType,
230
+ params: params
231
+ };
232
+ return obj;
233
+ });
234
+ };
235
+
236
+ const { common = [], more = [], batch = [] } = groupedButtons;
237
+ let arr = [...formatterButton(common)];
238
+ if (more.length > 0) {
239
+ arr.push({
240
+ code: "more",
241
+ name: "更多操作",
242
+ dropdowns: formatterButton(more)
243
+ });
244
+ }
245
+ if (batch.length > 0) {
246
+ arr.push({
247
+ code: "batchMore",
248
+ name: "批量操作",
249
+ dropdowns: formatterButton(batch, "batch"),
250
+ disabled: true
251
+ });
252
+ }
253
+ return arr;
254
+ }
255
+ return [];
256
+ };
257
+
258
+ /**
259
+ * 网格列表配置
260
+ * @returns
261
+ */
262
+ export function useSohelpGridConfig() {
263
+ /**
264
+ * 商邦网格列表配置参数
265
+ * @type {UnwrapNestedRefs<{}>}
266
+ */
267
+ const SohelpConfig = reactive({});
268
+ /**
269
+ *
270
+ * @type {UnwrapNestedRefs<{}>}
271
+ */
272
+ const propertiesMap = reactive({});
273
+ /**
274
+ * 网格列表统计
275
+ */
276
+ const footerData = reactive([]);
277
+ /**
278
+ *
279
+ * @type {UnwrapNestedRefs<{}>}
280
+ */
281
+ const formulaMap = reactive({});
282
+ /**
283
+ * 配置是否加载完成
284
+ */
285
+ const isConfigInitialized = ref(false);
286
+ const { t } = useI18n();
287
+ /**
288
+ * 初始化商邦网格列表配置
289
+ */
290
+ const initial = async (isGridConfig, refid) => {
291
+ if (!refid) throw new Error("配置列表请配置地址!");
292
+ let _refid = refid;
293
+ if (_refid.indexOf("!") === -1) _refid = refid + "!default";
294
+
295
+ isConfigInitialized.value = false;
296
+ const permission = usePermission();
297
+ const { mobile } = useMobile();
298
+
299
+ var batchButtonsIndex = -1;
300
+ const DefaultGridOptions = reactive(deepClone(_DefaultGridOptions));
301
+ /**获取列表配置*/
302
+ const config = isGridConfig ? await moduleCache.getGrid(_refid) : await moduleCache.getEntityGrid(_refid);
303
+
304
+ if (!config) {
305
+ throw new Error(_refid + " : 没有发现网格列表配置!");
306
+ }
307
+
308
+ try {
309
+ Object.assign(SohelpConfig, filterFieldsByProperties(config));
310
+ Object.assign(
311
+ propertiesMap,
312
+ (SohelpConfig?.properties || []).reduce((acc, cur) => {
313
+ let param = {};
314
+ if (cur?.editorParam && typeof cur.editorParam === "string") {
315
+ try {
316
+ param = JSON.parse(cur.editorParam);
317
+ } catch (e) {
318
+ console.error("解析editorParam失败:", e);
319
+ }
320
+ }
321
+ acc[cur.name] = { ...cur, editorParam: param };
322
+ return acc;
323
+ }, {})
324
+ );
325
+
326
+ // 计算公式
327
+ if (config.formula && config.formula.length > 0) {
328
+ Object.assign(
329
+ formulaMap,
330
+ config.formula.reduce((a, c) => (a[c.formulaField] || (a[c.formulaField] = c), a), {})
331
+ );
332
+ }
333
+
334
+ // 按钮权限过滤
335
+ const permissionButtons = config.toolbars.filter((f) => {
336
+ if (!f.authority) {
337
+ return true;
338
+ }
339
+ return permission.hasPermission(f.authority);
340
+ });
341
+ const buttons = getToolbarsButtons(permissionButtons);
342
+ if (buttons && buttons.length > 0) {
343
+ DefaultGridOptions.toolbarConfig.buttons = buttons;
344
+ // 更多下拉菜单索引
345
+ batchButtonsIndex = buttons.reduce((acc, curr, index) => {
346
+ if (curr.code === "batchMore") acc.push(index);
347
+ return acc;
348
+ }, []);
349
+
350
+ //把标题转成国际化
351
+ buttons.forEach((item) => {
352
+ const code = item.code.replace(".", "-");
353
+ const i18nKey = item.i18n === "" || code !== "custom" ? "grid.toolbar." + code : item.i18n;
354
+ if (i18nKey) {
355
+ const i18n = t(i18nKey);
356
+ item.name = i18n ? i18n : item.name;
357
+ }
358
+ });
359
+ }
360
+
361
+ //初始化属性列表配置
362
+ let columns = [
363
+ {
364
+ field: "_checkbox",
365
+ title: "",
366
+ fixed: mobile.value ? false : "left",
367
+ type: "checkbox",
368
+ align: "center",
369
+ width: 40
370
+ },
371
+ {
372
+ field: "_seq",
373
+ type: "seq",
374
+ title: "#",
375
+ fixed: mobile.value ? false : "left",
376
+ align: "center",
377
+ width: 40
378
+ }
379
+ ];
380
+
381
+ const isRowDrag = config.rowDrag;
382
+ //是否支持拖动
383
+ if (isRowDrag) {
384
+ columns.unshift({
385
+ title: "",
386
+ fixed: mobile.value ? false : "left",
387
+ width: 40,
388
+ align: "center",
389
+ dragSort: true,
390
+ field: "_drag"
391
+ });
392
+ }
393
+
394
+ const requireData = {};
395
+ //商邦列转换成Vxe列
396
+ if (SohelpConfig.properties?.length > 0) {
397
+ SohelpConfig.properties.forEach((column, index) => {
398
+ let item = propertiesMap[column.name];
399
+ const row = switchVxeProperty(item, SohelpConfig.filter?.sort, footerData, formulaMap);
400
+
401
+ // 列表是否显示
402
+ row.visible = SohelpConfig.list.includes(item.name);
403
+ row.fixed = mobile.value ? false : row.fixed;
404
+ // 添加操作栏插槽
405
+ if (item.name === "_operation") {
406
+ row.visible = true;
407
+ row.slots = {
408
+ default: "_operation"
409
+ };
410
+ }
411
+
412
+ columns.push(row);
413
+
414
+ // 校验规则,非空字段必填
415
+ if (item.edit && item.notNull) {
416
+ requireData[item.name] = [
417
+ {
418
+ required: true,
419
+ message: row.title + "不能为空"
420
+ }
421
+ ];
422
+ }
423
+ });
424
+
425
+ //没有工具栏则不显示操作拦
426
+ if (config?.operationToolbars?.length == 0) {
427
+ columns = columns.filter((item) => item.field != "_operation");
428
+ }
429
+
430
+ //将columns按照fields排序
431
+ const sortColumns = columns
432
+ .sort((a, b) => {
433
+ if (a.field === "_operation") return 1;
434
+ if (b.field === "_operation") return -1;
435
+ return config.list.indexOf(a.field) - config.list.indexOf(b.field);
436
+ })
437
+ .sort((a, b) => {
438
+ return b.visible - a.visible;
439
+ });
440
+
441
+ //_operation列安排最后一列
442
+ DefaultGridOptions.columns = [
443
+ ...sortColumns.filter((col) => col.field !== "_operation"),
444
+ ...sortColumns.filter((col) => col.field === "_operation")
445
+ ];
446
+ DefaultGridOptions.editRules = { ...requireData };
447
+ }
448
+
449
+ //是否开启表尾
450
+ Object.assign(
451
+ footerData,
452
+ (config.properties || [])
453
+ .filter((item) => item.summaryType)
454
+ ?.map((item) => {
455
+ return {
456
+ [item.name]: 0,
457
+ summaryRender: item.summaryRender ? JSON.parse(item.summaryRender) : null,
458
+ field: item.name,
459
+ type: item.summaryType
460
+ };
461
+ })
462
+ );
463
+ DefaultGridOptions.showFooter = footerData?.length > 0;
464
+
465
+ // 拦截编辑
466
+ DefaultGridOptions.editConfig.beforeEditMethod = ({ row, column }) => {
467
+ if (column.type === "SohelpTextarea") {
468
+ return false;
469
+ }
470
+ return true;
471
+ };
472
+
473
+ // 设置分页数据
474
+ DefaultGridOptions.pagerConfig.enabled = config.paging;
475
+ DefaultGridOptions.pagerConfig.pageSize = config.limit || 50;
476
+
477
+ // 行列样式
478
+ if (config.colors && config.colors.length > 0) {
479
+ const rowData = config.colors.filter((item) => item.type !== "c");
480
+ const cellData = config.colors.filter((item) => item.type === "c");
481
+ if (rowData.length > 0) {
482
+ DefaultGridOptions.rowStyle = createDynamicRowStyle(rowData);
483
+ } else {
484
+ DefaultGridOptions.stripe = true;
485
+ }
486
+ if (cellData.length > 0) {
487
+ DefaultGridOptions.cellStyle = createDynamicCellStyle(cellData);
488
+ }
489
+ }
490
+ isConfigInitialized.value = true;
491
+ //转化初始化其他参数...
492
+ } catch (error) {
493
+ throw error; //重新抛出错误,以便调用者可以处理它
494
+ }
495
+
496
+ return {
497
+ gridOptions: DefaultGridOptions,
498
+ sohelpConfig: SohelpConfig,
499
+ propertiesMap: propertiesMap,
500
+ batchButtonsIndex: batchButtonsIndex,
501
+ footerData: footerData,
502
+ formulaMap: formulaMap
503
+ };
504
+ };
505
+
506
+ /**
507
+ * 配置是否加载完成
508
+ */
509
+ const isConfigDone = async () => {
510
+ return new Promise((resolve) => {
511
+ if (isConfigInitialized.value) {
512
+ resolve();
513
+ } else {
514
+ let timer = setInterval(() => {
515
+ if (isConfigInitialized.value) {
516
+ clearInterval(timer);
517
+ resolve();
518
+ }
519
+ }, 10);
520
+ }
521
+ });
522
+ };
523
+
524
+ return { SohelpConfig, initial, isConfigDone, isConfigInitialized, moduleCache };
525
+ }