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,1965 @@
1
+ <script setup>
2
+ import { Filter, Search, Sort, SortDown, SortUp,Setting,Tickets,Postcard, Files, Grid} from "@element-plus/icons-vue";
3
+ import { useMobile } from "@/utils/use-mobile";
4
+ import { usePermission } from "@/utils/use-permission";
5
+ import DefaultProps from "./js/DefaultProps";
6
+ import { computed, nextTick, reactive, ref, watch } from "vue";
7
+ import DefaultGridOptions from "./js/DefaultGridOptions";
8
+ import { calcSummary, switchGridValue } from "./js/SohelpGridConfig";
9
+ import { EleMessage } from "@/components/ele-admin-plus/components";
10
+ import { ElMessageBox } from "element-plus/es";
11
+ import { useFormData } from "@/utils/use-form-data";
12
+ import { resetCommonConfig, updateCommonConfig } from "../http/ModuleHttp.js";
13
+ import CrudHttp from "../http/CrudHttp.js";
14
+ import {merge, cloneDeep } from "lodash-es";
15
+
16
+ import ApprovalModal from "../sohelp-workflow-drawer/components/approval-modal.vue";
17
+ import WorkflowDrawer from "../sohelp-workflow-drawer/index.vue";
18
+
19
+ import SohelpTextareaInput from "../sohelp-textarea-input/index.vue";
20
+ import SohelpPower from "../sohelp-power/index.vue";
21
+ import FilterConditionItem from "./components/filter-condition-item.vue";
22
+ import { useSohelpGridConfig } from "./js/useSohelpGridConfig.js";
23
+ import { useI18n } from "vue-i18n";
24
+ import SohelpEntityForm from "../sohelp-entity-form/index.vue";
25
+ import * as ElementPlusIcons from '@element-plus/icons-vue';
26
+ import * as EleAdminPlusIcons from '@/components/icons';
27
+ import { moduleCache } from "../cache/ModuleCache.js";
28
+ import SohelpModal from "../sohelp-modal/index.vue";
29
+ import { useUserStore } from '@/store/modules/user';
30
+ import { Alert } from "vxe-pc-ui";
31
+ const { initial, isConfigDone } = useSohelpGridConfig();
32
+ const { t } = useI18n();
33
+ const { mobile } = useMobile();
34
+ const permission = usePermission();
35
+ const props = defineProps({ ...JSON.parse(JSON.stringify(DefaultProps)) });
36
+ const emit = defineEmits(["resetFilter", "checkboxAll", "checkboxChange", "toolbarButtonClick", "operationButtonClick", "menuRightClick", "showFilter", "editClosed", "currentColumnChange"]);
37
+ const drawerKey = ref(0);
38
+ const todoDrawerRef = ref(null);
39
+ const drawerVisible = ref(false);
40
+ const drawerData = ref(null);
41
+ const current = ref(null);
42
+ const isPage = ref(false);
43
+ const approvalModalVisible = ref(false);
44
+ const approvalData = ref({});
45
+ const userStore = useUserStore();
46
+
47
+ //报表打印
48
+ const currentReportValue = ref(null);
49
+ const visibleReport = ref(false);
50
+ const reportData = ref([]);
51
+ const currentRow = ref(null);
52
+ const loadReport = () => {
53
+ SohelpHttp.get("/engine/web/report/list", { refid: props.refid }).then(res => {
54
+ if (res.meta.success) {
55
+ reportData.value = res.data.map(item => ({
56
+ value: item.refid,
57
+ refid: item.refid,
58
+ name: item.name,
59
+ createDate: item.createDate
60
+ }));
61
+ if (reportData.value.length > 0) {
62
+ currentReportValue.value = reportData.value[0].refid;
63
+ }
64
+ } else {
65
+ EleMessage.error(res.meta.message);
66
+ }
67
+ });
68
+ };
69
+
70
+ const designReport = () => {
71
+ if (!currentReportValue.value || !currentRow?.value?.id) {
72
+ EleMessage.error("请选择报表模板或报表数据!");
73
+ return;
74
+ }
75
+ const baseURl = SohelpHttp.getBaseUrl();
76
+ const url = baseURl.endsWith("/") ? baseURl : baseURl + "/";
77
+ window.open(url + `ureport/designer?_u=${currentReportValue.value}&id=${currentRow?.value?.id}&refid=${currentReportValue?.value}`);
78
+ };
79
+ const openReport = () => {
80
+ if (!currentReportValue.value || !currentRow?.value?.id) {
81
+ EleMessage.error("请选择报表模板或报表数据!");
82
+ return;
83
+ }
84
+ const baseURl = SohelpHttp.getBaseUrl();
85
+ const url = baseURl.endsWith("/") ? baseURl : baseURl + "/";
86
+ window.open(url + `ureport/preview?_u=${currentReportValue.value}&id=${currentRow?.value?.id}&refid=${currentReportValue?.value}`);
87
+ };
88
+ const closeReport = () => {
89
+ visibleReport.value = false;
90
+ };
91
+
92
+ const loading = ref(false);
93
+ //显示实体表单
94
+ const visibleEntityForm = ref(false);
95
+ //当前工具栏配置信息
96
+ const toolbarButtonParams = ref({});
97
+ const entityFormRef = ref(null);
98
+ const entityFormData = ref({});
99
+ const entityFormValue = ref({});
100
+ const entityFormConfig = ref({});
101
+ const closeEntityForm = () => {
102
+ visibleEntityForm.value = false;
103
+ };
104
+ const saveEntityForm = () => {
105
+ loading.value = true;
106
+ entityFormRef.value.save({}, (res) => {
107
+ loading.value = false;
108
+ if (res.meta.success) {
109
+ refresh();
110
+ visibleEntityForm.value = false;
111
+ } else {
112
+ EleMessage.error(res.meta.message);
113
+ }
114
+ });
115
+ };
116
+
117
+
118
+ //配置加载状态
119
+ // Grid配置
120
+ const sohelpConfig = defineModel("config");
121
+ // 过滤条件数据
122
+ const filterValue = defineModel("filterValue", {
123
+ type: Object,
124
+ default: () => ({
125
+ keywords: "",
126
+ power: 0,
127
+ filter: [],
128
+ scheme: "",
129
+ sort: "",
130
+ order: ""
131
+ })
132
+ });
133
+
134
+ // 属性映射
135
+ const propertiesMap = defineModel("propertiesMap");
136
+
137
+ // Grid实例
138
+ const sohelpVxeGridRef = ref(null);
139
+ // GridOptions配置
140
+ const gridOptions = reactive(cloneDeep(DefaultGridOptions));
141
+ const batchButtonsIndex = ref(2);
142
+ const sortValue = ref("");
143
+ /**
144
+ * 缓存网格列表数据
145
+ * @type {UnwrapNestedRefs<*[]>}
146
+ */
147
+ const gridData = reactive([]);
148
+ /**
149
+ * 记忆原始过虑条件数据
150
+ * @type {Ref<UnwrapRef<string>>}
151
+ */
152
+ const originFilterValue = ref("");
153
+
154
+ /**
155
+ * 选中数据庥
156
+ * @type {Ref<UnwrapRef<*[]>>}
157
+ */
158
+ const selections = ref([]);
159
+ /**
160
+ * 网格列表底部数据
161
+ * @type {UnwrapNestedRefs<*[]>}
162
+ */
163
+ const footerData = reactive([]);
164
+ /**
165
+ * 定义计算公式
166
+ * @type {UnwrapNestedRefs<{}>}
167
+ */
168
+ const formulaMap = reactive({});
169
+ /**
170
+ * 定义合计数据
171
+ * @type {UnwrapNestedRefs<{}>}
172
+ */
173
+ const summaryData = reactive({});
174
+
175
+ /**
176
+ * 查看范围
177
+ * @type 类型
178
+ * @users 用户列表
179
+ */
180
+ const changePower = (type, users) => {
181
+ filterValue.value.power = type;
182
+ if (type == 9) {
183
+ filterValue.value.powerUsers = users;
184
+ }
185
+ filter();
186
+ };
187
+
188
+
189
+ const getCellValue = (rowIndex, name) => {
190
+ return (gridData[rowIndex] && gridData[rowIndex][name]) ? gridData[rowIndex][name] : "";
191
+ };
192
+
193
+ /**
194
+ * 获取关键字描述
195
+ */
196
+ const getKeywordsPlaceholder = computed(() => {
197
+ if (sohelpConfig.value?.filter?.keywords?.length) {
198
+ return t("grid.toolbar.keywords") + ",【" + sohelpConfig.value.filter?.keywords?.filter(key => propertiesMap.value[key]).map(key => t(propertiesMap.value[key].i18n) || propertiesMap.value[key].label).join("/") + "】";
199
+ }
200
+ return t("grid.toolbar.keywords");
201
+ });
202
+
203
+
204
+ /**
205
+ * SohelpTextareaInput弹窗标题
206
+ */
207
+ const getCurrentFieldLabel = computed(() => {
208
+ return (propertiesMap.value[textareaState["field"]]?.label || "") + "修改";
209
+ });
210
+
211
+ const keywordsChange = (val) => {
212
+ filterValue.value = {
213
+ ...filterValue.value,
214
+ keywords: val
215
+ };
216
+ };
217
+
218
+ /**
219
+ * 获取当前筛选
220
+ * @param field
221
+ */
222
+ const getCurrentFilter = (field) => {
223
+ return computed({
224
+ get: () => {
225
+ return filterValue.value.filter?.find(f => f.name === field);
226
+ },
227
+ set: (newValue) => {
228
+ const newFilters = [...(filterValue.value.filter || [])];
229
+ const index = newFilters.findIndex(f => f.name === field);
230
+ if (index >= 0) {
231
+ newFilters[index] = { ...newFilters[index], ...newValue };
232
+ }
233
+ filterValue.value = { ...filterValue.value, filter: newFilters };
234
+ }
235
+ });
236
+ };
237
+
238
+ /**
239
+ *获取外键标签
240
+ */
241
+ const getTableSelectLabel = (val, index, field, column) => {
242
+ if (!gridData[index] || !gridData[index][field]) {
243
+ return "";
244
+ }
245
+ let obj = gridData[index][field];
246
+ if (obj && typeof obj === "object") {
247
+ if (!Array.isArray(obj)) {
248
+ obj = [obj];
249
+ }
250
+ const { labelField = "label", valueField = "id" } = column.editRender;
251
+ const arr = Array.isArray(val) ? val : [val];
252
+ return obj.filter(item => arr.includes(item.id))?.map(row => row[labelField]).filter(Boolean).join(",");
253
+
254
+ } else {
255
+ return "";
256
+ }
257
+ };
258
+
259
+ /**
260
+ * 获取排序数据
261
+ */
262
+ const sortList = computed(() => {
263
+ return sohelpConfig.value.filter?.sort?.map((field) => {
264
+ let p = propertiesMap.value[field];
265
+ return {
266
+ title: p?.label || field,
267
+ field: field
268
+ };
269
+ });
270
+ });
271
+
272
+ /**
273
+ * 排序点击事件
274
+ */
275
+ const sortCommand = (field, order) => {
276
+ if (sohelpVxeGridRef.value) {
277
+ sohelpVxeGridRef.value.setSort({ field, order });
278
+ }
279
+ closeSortDropCard();
280
+ };
281
+
282
+ const isActiveSort = computed(() => {
283
+ return (field, order) => {
284
+ return sortValue.value === field + "!" + order ? "primary" : "";
285
+ };
286
+ });
287
+
288
+ /**
289
+ *
290
+ * @param val 监听高级筛选值变化
291
+ */
292
+ const filterValueChange = (val) => {
293
+ //console.log('v', val);
294
+ };
295
+
296
+ /**
297
+ * 初始化数据
298
+ */
299
+ const loadConfig = (param = {}) => {
300
+ initial(!props.isEntityGrid, props.refid)
301
+ .then((config) => {
302
+ /**配置刷新功能 */
303
+ config.gridOptions = {
304
+ ...config.gridOptions,
305
+ toolbarConfig: {
306
+ ...config.gridOptions?.toolbarConfig,
307
+ refresh: true,
308
+ zoom: true
309
+ },
310
+ proxyConfig: {
311
+ autoLoad: false,
312
+ ajax: {
313
+ query: () => refresh()
314
+ }
315
+ }
316
+ };
317
+
318
+ //工具栏按钮权限
319
+ Object.assign(formulaMap, config.formulaMap);
320
+ Object.assign(gridOptions, config.gridOptions);
321
+ // 过滤位置
322
+ config.sohelpConfig.filter.config._visibleFilter = config.sohelpConfig?.filter.config.visibleFilter || false;
323
+ sohelpConfig.value = { ...config.sohelpConfig };
324
+
325
+ Object.assign(propertiesMap.value, config.propertiesMap);
326
+
327
+ Object.assign(footerData, config.footerData);
328
+ batchButtonsIndex.value = config.batchButtonsIndex;
329
+ sohelpConfig.value.list = config.sohelpConfig.list;
330
+
331
+ if (!filterValue.value.filter) {
332
+ filterValue.value.filter = [];
333
+ }
334
+
335
+ Object.assign(filterValue.value.filter, config.sohelpConfig.filter?.field || []);
336
+ //存储原始查询数据,用于重置
337
+ originFilterValue.value = JSON.stringify(filterValue.value);
338
+
339
+ nextTick(() => {
340
+ if (sohelpVxeGridRef.value && props.autoLoad === true) {
341
+ sohelpVxeGridRef.value.commitProxy("query");
342
+ }
343
+ });
344
+ })
345
+ .catch((e) => {
346
+ console.error("Initial Configuration Error:", e);
347
+ EleMessage.error(e.message);
348
+ });
349
+ };
350
+
351
+
352
+ const gridValue = ref();
353
+
354
+
355
+ const load = async (params = {}, callback) => {
356
+ //清空选中
357
+ selections.value = [];
358
+ gridOptions.loading = true;
359
+ gridOptions.params = params;
360
+ await isConfigDone();
361
+ const $grid = sohelpVxeGridRef.value;
362
+ if ($grid) {
363
+ const url = props.url || sohelpConfig.value.requestValue;
364
+ if (sohelpConfig.value.requestType != "crud" && !url) {
365
+ gridOptions.loading = false;
366
+ return { results: [], total: 0 };
367
+ }
368
+
369
+ let pageConfig = {};
370
+ // 是否分页
371
+ if (gridOptions.pagerConfig?.enabled) {
372
+ pageConfig.page = gridOptions.pagerConfig?.currentPage ?? 1;
373
+ pageConfig.limit = gridOptions.pagerConfig?.pageSize ?? 50;
374
+ }
375
+
376
+ //过滤条件筛选
377
+ params["filter"] = filterValue.value.filter?.filter(item => (item.comparison === "EMPTY" || item.comparison === "NOT_EMPTY") || item.value?.length > 0);
378
+ const res = await SohelpHttp.get(url, {
379
+ refid: props.refid,
380
+ ...filterValue.value,
381
+ ...params,
382
+ ...pageConfig
383
+ });
384
+
385
+
386
+ if (res?.meta?.success) {
387
+ if (res.data) {
388
+ gridOptions.pagerConfig.total = Number(res.data.total);
389
+ Object.assign(gridData, JSON.parse(JSON.stringify(res.data.results)));
390
+ gridValue.value = switchGridValue(res.data.results);
391
+ $grid.loadData(gridValue.value);
392
+ Object.assign(summaryData, res.data?.summary || {});
393
+ updateColumnsFilter();
394
+ gridOptions.loading = false;
395
+ //统计
396
+ if (footerData.length > 0) {
397
+ gridOptions.footerData = updateSummary(res.data.results, res.data?.summary || {});
398
+ $grid?.refreshColumn();
399
+ }
400
+ }
401
+ } else {
402
+ EleMessage.error(res.meta.message);
403
+ }
404
+ gridOptions.loading = false;
405
+ //回调方法
406
+ if (callback && typeof callback === "function") {
407
+ callback(res);
408
+ }
409
+ }
410
+ };
411
+
412
+ /**
413
+ * 重新加载数据
414
+ */
415
+ const reload = async (params = {}) => {
416
+ Object.assign(gridOptions.params, params);
417
+ load(gridOptions.params);
418
+ };
419
+
420
+
421
+ /**
422
+ * 单元格点击更新 表尾统计
423
+ */
424
+ const cellClick = () => {
425
+ const data = sohelpVxeGridRef.value?.getFullData();
426
+ gridOptions.footerData = updateSummary(data, summaryData);
427
+ };
428
+
429
+ /**
430
+ * 统计
431
+ */
432
+ const updateSummary = (data, summaryMap = {}) => {
433
+ const arr = footerData.map(item => {
434
+ const field = data.map(f => {
435
+ let val = Number(f[item.field]);
436
+ return isNaN(val) ? 0 : val;
437
+ });
438
+
439
+ let value = calcSummary(field, item.type);
440
+ if (item.type === "remotesum") {
441
+ value = summaryMap[item.field] || "";
442
+ }
443
+
444
+ if (item.summaryRender) {
445
+ try {
446
+ const func = new Function("return " + item.summaryRender)();
447
+ value = func.call(sohelpVxeGridRef, value);
448
+ } catch (e) {
449
+ console.error("函数执行错误:", e);
450
+ }
451
+ }
452
+
453
+ return {
454
+ [item.field]: value
455
+ };
456
+ });
457
+
458
+ arr.unshift({ _seq: "统计" });
459
+ return [Object.assign({}, ...arr)];
460
+ };
461
+
462
+
463
+ /**
464
+ * 分页事件
465
+ */
466
+ const pageChangeEvent = (page) => {
467
+ isPage.value = true;
468
+ gridOptions.pagerConfig.currentPage = page.currentPage;
469
+ gridOptions.pagerConfig.pageSize = page.pageSize;
470
+ reload();
471
+ };
472
+
473
+
474
+ /**
475
+ * 获取Common类型操作栏 并根据flw_id判断是否显示
476
+ * @param row
477
+ */
478
+ const getOperationButtonsByType = (row, type = "common") => {
479
+ let common = getOperationToolbars.value?.[type] || [];
480
+ if (common.length > 0) {
481
+ if (row.hasOwnProperty("flw_id")) {
482
+ const field = row.flw_id === "0" ? "workflow.view" : "workflow.submit";
483
+ common = common.filter(f => f.code != field);
484
+ } else {
485
+ common = common.filter(f => (f.code != "workflow.submit" || f.code != "workflow.view"));
486
+ }
487
+ return common;
488
+ }
489
+ return [];
490
+ };
491
+
492
+ /**
493
+ * 获取操作栏
494
+ */
495
+ const getOperationToolbars = computed(() => {
496
+ const buttonsMap = {};
497
+ sohelpConfig.value.operationToolbars?.filter(f => !f.authority || permission.hasPermission(f.authority)).map(button => {
498
+ const type = button.buttonType || "common";
499
+ const code = button.type === "custom" ? button.id : button.type;
500
+ if (!buttonsMap[type]) {
501
+ buttonsMap[type] = [];
502
+ }
503
+ const title = (button.type === "custom") ? button.title : t("grid.toolbar." + button.type?.replaceAll(".", "-"));
504
+ let params = button.params || {};
505
+ if (button.params && typeof button.params === "string") {
506
+ try {
507
+ params = JSON.parse(button.params);
508
+ } catch (e) {
509
+ params = {};
510
+ EleMessage.error("button.params配置JSON参数格式错误");
511
+ }
512
+ }
513
+ buttonsMap[type].push({
514
+ title: title || button.title,
515
+ "id": button.id,
516
+ code: code,
517
+ handler: button.handler,
518
+ icon: button.iconCls,
519
+ params: params,
520
+ refid: button.refid,
521
+ openType: button.openType
522
+ });
523
+ });
524
+ return buttonsMap;
525
+ });
526
+
527
+
528
+ /**
529
+ * 行操作栏点击事件
530
+ * @param row
531
+ * @param item
532
+ */
533
+ const operationHandler = ({ item, row, $grid }) => {
534
+ //操作栏事件执行
535
+ if (item.handler && typeof item.handler === "string") {
536
+ try {
537
+ const func = new Function("row", "$grid", `return (async () => { ${item.handler} })()`);
538
+ (async () => {
539
+ const context = {
540
+ $message: EleMessage,
541
+ $SohelpModule: window.$SohelpModule,
542
+ $SohelpHttp: window.$SohelpHttp,
543
+ $confirm: (title, callback) => {
544
+ ElMessageBox.confirm(title, "提示", {
545
+ confirmButtonText: "确定",
546
+ cancelButtonText: "取消",
547
+ type: "warning"
548
+ }).then(() => {
549
+ callback && callback();
550
+ }).catch(() => {
551
+ });
552
+ }
553
+ };
554
+ await func.call(context, row, $grid); // 显式传递所有参数
555
+ })();
556
+ } catch (e) {
557
+ EleMessage.error(`操作栏事件出错:${e.message}`);
558
+ }
559
+ } else if (item.refid) {
560
+ if (item.openType === "tab") {
561
+ window.$SohelpModule.openTab(item.refid, { id: row.id }, item.params || {});
562
+ } else if (item.openType === "drawer") {
563
+ console.error("item", item.params);
564
+ window.$SohelpModule.openDrawer(item.refid, { id: row.id }, item.params || {});
565
+ } else {
566
+ window.$SohelpModule.openModal(item.refid, { id: row.id }, item.params || {});
567
+ }
568
+ } else {
569
+ switch (item.code) {
570
+ case "crud.edit":
571
+ visibleEntityForm.value = true;
572
+ toolbarButtonParams.value = item.params || {};
573
+ if (!toolbarButtonParams.value["title"]) {
574
+ toolbarButtonParams.value["title"] = t("grid.toolbar.edit");
575
+ }
576
+ loading.value = true;
577
+ CrudHttp.detail(props.refid, { id: row.id }).then(res => {
578
+ if (res.meta.success) {
579
+ setTimeout(() => {
580
+ entityFormRef.value.setFormData(res.data);
581
+ }, 10);
582
+ } else {
583
+ EleMessage.error(res.meta.message);
584
+ }
585
+ loading.value = false;
586
+ }).catch(e => {
587
+ loading.value = false;
588
+ });
589
+
590
+ break;
591
+ case "crud.view":
592
+ visibleEntityForm.value = true;
593
+ toolbarButtonParams.value = item.params || {};
594
+ if (!toolbarButtonParams.value["title"]) {
595
+ toolbarButtonParams.value["title"] = t("grid.toolbar.view");
596
+ }
597
+ toolbarButtonParams.value["readonly"] = true;
598
+ CrudHttp.detail(props.refid, { id: row.id }, (res) => {
599
+ if (res.meta.success) {
600
+ setTimeout(() => {
601
+ entityFormRef.value.setFormData(res.data);
602
+ }, 10);
603
+ } else {
604
+ EleMessage.error(res.meta.message);
605
+ }
606
+ });
607
+ break;
608
+ case "crud.delete" :
609
+ remove({ id: [row.id] });
610
+ break;
611
+ case "workflow.submit":
612
+ submitWorkflow({ id: [row.id] });
613
+ break;
614
+ case "workflow.view" :
615
+ viewWorkflow(row.id);
616
+ break;
617
+ case "report.print" :
618
+ visibleReport.value = true;
619
+ currentRow.value = row;
620
+ loadReport();
621
+ break;
622
+ default:
623
+ break;
624
+ }
625
+ }
626
+ emit("operationButtonClick", { item, row, $grid });
627
+ };
628
+
629
+ /**
630
+ * 获取表格数据
631
+ */
632
+ const getTableData = () => {
633
+ return sohelpVxeGridRef.value?.getTableData();
634
+ };
635
+
636
+ /**
637
+ * 获取处理过的数据
638
+ */
639
+ const getData = () => {
640
+ const { tableData } = getTableData();
641
+ return tableData;
642
+ };
643
+
644
+ /**
645
+ * 更新
646
+ */
647
+ const updateValue = () => {
648
+ emit("update:modelValue", getData());
649
+ emit("change", getData());
650
+ };
651
+ /**
652
+ * 指定index位置插入数据
653
+ * @param data
654
+ * @param index
655
+ */
656
+ const insertField = (data, index = -1) => {
657
+ if (sohelpVxeGridRef.value) {
658
+ sohelpVxeGridRef.value.insertAt(data, index);
659
+ sohelpVxeGridRef.value.clearEdit();
660
+ }
661
+ updateValue();
662
+ };
663
+
664
+
665
+ /**
666
+ * 刷新列表
667
+ */
668
+ const refresh = () => {
669
+ if (!isPage.value) {
670
+ if (gridOptions.pagerConfig && gridOptions.pagerConfig.enabled) {
671
+ gridOptions.pagerConfig.currentPage = 1;
672
+ }
673
+ emit("refresh");
674
+ }
675
+ isPage.value = false;
676
+ reload({ ...gridOptions.params });
677
+ };
678
+
679
+ /**
680
+ * 列表头右键菜单事件
681
+ * @param column
682
+ */
683
+ const headerCellMenu = ({ column }) => {
684
+ if (column.editRender?.edit && gridOptions.menuConfig.header.options.length > 0) {
685
+ // 只对特定类型的列显示菜单项
686
+ const visible = column && (column.type === "SohelpSwitch" || column.type === "SohelpCheckbox");
687
+ // 设置每个菜单项的可见性
688
+ gridOptions.menuConfig.header.options[0].forEach(item => {
689
+ item.visible = visible;
690
+ });
691
+ }
692
+ };
693
+
694
+ /**
695
+ * 右键菜单点击事件
696
+ * @param menu 菜单项
697
+ * @param row 行数据
698
+ * @param column 列配置
699
+ * @param rowIndex 行索引
700
+ */
701
+ const menuRightClick = async ({ menu, row, column, rowIndex }) => {
702
+ const $grid = sohelpVxeGridRef.value;
703
+ if ($grid) {
704
+ $grid.setCurrentRow(row);
705
+ const { fullData } = $grid.getTableData();
706
+ switch (menu.code) {
707
+ case "insert":
708
+ await $grid.insertAt({ role_name: "sales user" }, rowIndex);
709
+ break;
710
+ case "all-select":
711
+ fullData.forEach(row => {
712
+ row[column.field] = ["0", 0, "1", 1].includes(row[column.field]) ? 1 : true;
713
+ });
714
+ break;
715
+ case "revert-select":
716
+ fullData.forEach(row => {
717
+ if (["0", 0, "1", 1].includes(row[column.field])) {
718
+ row[column.field] = 1 - row[column.field];
719
+ } else {
720
+ row[column.field] = !row[column.field];
721
+ }
722
+ });
723
+ break;
724
+ default:
725
+ break;
726
+ }
727
+ }
728
+
729
+ // 执行右击事件
730
+ emit("menuRightClick", { menu, row, column, rowIndex });
731
+ };
732
+
733
+ const sohelpSortRef = ref(null);
734
+ const closeSortDropCard = () => {
735
+ if (sohelpSortRef.value) {
736
+ sohelpSortRef.value.close();
737
+ }
738
+ };
739
+
740
+ /**
741
+ * 获取用户数据源
742
+ */
743
+ const userDatasource = computed(async () => {
744
+ return await SohelpHttp.get("/engine/web/user/list")
745
+ .then((res) => {
746
+ if (res.data) {
747
+ return [...res.data];
748
+ }
749
+ })
750
+ .catch((err) => {
751
+ EleMessage.error(err.message || "error");
752
+ });
753
+ });
754
+
755
+ /**
756
+ * SohelpTextareaInput 弹窗
757
+ */
758
+ const [textareaState, resetTextareaState, setTextareaState] = useFormData({
759
+ visible: false,
760
+ value: "",
761
+ row: null,
762
+ field: ""
763
+ });
764
+
765
+ /**
766
+ * 显示 SohelpTextareaInput 弹窗
767
+ */
768
+ const showTextareaModal = (column, field, row) => {
769
+ if (column?.editRender?.enabled) {
770
+ setTextareaState({
771
+ visible: true,
772
+ value: row[field],
773
+ row,
774
+ field
775
+ });
776
+ }
777
+ };
778
+
779
+ /**
780
+ * 取消 SohelpTextareaInput 弹窗
781
+ */
782
+ const textareaCancel = () => {
783
+ resetTextareaState();
784
+ };
785
+
786
+ /**
787
+ * checkbox复选框
788
+ */
789
+ const onCheckboxChange = () => {
790
+ selections.value = sohelpVxeGridRef.value?.getCheckboxRecords() || [];
791
+ emit("checkbox-change", selections.value);
792
+ };
793
+
794
+
795
+ /**
796
+ * 确定 SohelpTextareaInput 弹窗
797
+ */
798
+ const textareaConfirm = () => {
799
+ const $grid = sohelpVxeGridRef.value;
800
+ if ($grid) {
801
+ $grid.setRow(textareaState.row, {
802
+ ...textareaState.row,
803
+ [textareaState.field]: textareaState.value
804
+ });
805
+ }
806
+ textareaCancel();
807
+ };
808
+
809
+ /**
810
+ * 获取组织数据源
811
+ */
812
+ const orgDatasource = computed(async () => {
813
+ return await SohelpHttp.get("/engine/web/org/list")
814
+ .then((res) => {
815
+ if (res.data) {
816
+ return [...res.data];
817
+ }
818
+ })
819
+ .catch((err) => {
820
+ EleMessage.error(err.message || "error");
821
+ });
822
+ });
823
+ /**
824
+ * 根据引擎表格获取更新数据
825
+ * @returns {{inserted: {}, deleted: {}, updated: {}}}
826
+ */
827
+ const getCrudUpdater = () => {
828
+ const $grid = sohelpVxeGridRef.value;
829
+ return {
830
+ "inserted": $grid?.getInsertRecords().map(item => {
831
+ return { ...item };
832
+ }) || [],
833
+ "updated": $grid?.getUpdateRecords(),
834
+ "deleted": $grid?.getRemoveRecords().map(item => item.id) || []
835
+ };
836
+ };
837
+
838
+ /**
839
+ * 删除记录
840
+ */
841
+ const remove = (params) => {
842
+ ElMessageBox.confirm("确定要删除吗?", "提示").then(() => {
843
+ CrudHttp.delete(props.refid, params, (res) => {
844
+ if (res.meta.success) {
845
+ EleMessage.success(res.meta.message);
846
+ refresh();
847
+ } else {
848
+ EleMessage.error(res.meta.message);
849
+ }
850
+ });
851
+ }).catch(() => {
852
+ });
853
+ };
854
+
855
+ /**
856
+ *
857
+ * @param handler
858
+ */
859
+ const executeToolbarCustomHandler = (button) => {
860
+ const $grid = sohelpVxeGridRef.value;
861
+ try {
862
+ let isRows = button.code.includes("batch.");
863
+ const func = new Function(isRows ? "rows" : "row", "$grid", `return (async () => { ${button.handler} })()`);
864
+ (async () => {
865
+ const context = {
866
+ $message: EleMessage,
867
+ $confirm: (title, callback) => {
868
+ ElMessageBox.confirm(title, "提示", {
869
+ confirmButtonText: "确定",
870
+ cancelButtonText: "取消",
871
+ type: "warning"
872
+ }).then(() => {
873
+ callback && callback();
874
+ }).catch(() => {
875
+ });
876
+ },
877
+ $grid: $grid,
878
+ getCrudUpdater: getCrudUpdater
879
+ };
880
+ $grid.refresh = refresh;
881
+ await func.call(context, isRows ? selections.value : current, $grid); // 显式传递所有参数
882
+ })();
883
+ } catch (e) {
884
+ EleMessage.error(`${e.message}`);
885
+ }
886
+ };
887
+ /**
888
+ * 工具栏点击事件
889
+ * @param param0
890
+ */
891
+ const toolbarClick = async ({ button }) => {
892
+ const $grid = sohelpVxeGridRef.value;
893
+ let rowIndex = -1;
894
+ const row = {};
895
+
896
+
897
+ const current = $grid?.getCurrentRecord();
898
+ if (current) {
899
+ rowIndex = $grid?.getVTRowIndex(current);
900
+ }
901
+
902
+ //工具栏事件执行
903
+ if (button?.handler) {
904
+ executeToolbarCustomHandler(button);
905
+ } else if (button.refid) {
906
+ if (button.openType === "tab") {
907
+ window.$SohelpModule.openTab(button.refid, {}, button.params || {});
908
+ } else if (button.openType === "drawer") {
909
+ window.$SohelpModule.openDrawer(button.refid, {}, button.params || {});
910
+ } else {
911
+ window.$SohelpModule.openModal(button.refid, {}, button.params || {});
912
+ }
913
+ } else {
914
+ switch (button.code) {
915
+ case "row.add":
916
+ insertField(row, -1);
917
+ break;
918
+ case "row.copy":
919
+ if (current) {
920
+ Object.assign(row, { ...current });
921
+ if (row?.name) {
922
+ row.name = "";
923
+ }
924
+ delete row._X_ROW_KEY;
925
+ }
926
+ break;
927
+ case "row.insert":
928
+ rowIndex = getData()?.length > 0 ? rowIndex : -1;
929
+ insertField(row, rowIndex);
930
+ break;
931
+ case "row.delete":
932
+ $grid.removeCheckboxRow();
933
+ break;
934
+ case "crud.create":
935
+ visibleEntityForm.value = true;
936
+ toolbarButtonParams.value = button.params || {};
937
+ if (!toolbarButtonParams.value["title"]) {
938
+ toolbarButtonParams.value["title"] = t("grid.toolbar.create");
939
+ }
940
+ CrudHttp.initial(props.refid, { id: row.id }, (res) => {
941
+ if (res.meta.success) {
942
+ setTimeout(() => {
943
+ entityFormRef.value.setFormData(res.data);
944
+ }, 10);
945
+ } else {
946
+ EleMessage.error(res.meta.message);
947
+ }
948
+ });
949
+ break;
950
+ case "crud.save":
951
+ CrudHttp.save(props.refid, { "default": getCrudUpdater() }, (res) => {
952
+ if (res.meta.success) {
953
+ EleMessage.success(res.meta.message);
954
+ refresh();
955
+ } else {
956
+ EleMessage.error(res.meta.message);
957
+ }
958
+ });
959
+ break;
960
+ case "crud.view":
961
+ break;
962
+ case "crud.delete":
963
+ remove({ id: selections.value.map(item => item.id) });
964
+ break;
965
+ case "workflow.submit":
966
+ submitWorkflow({ id: selections.value.map(item => item.id) });
967
+ break;
968
+ case "report.print":
969
+ break;
970
+ case "batch.import":
971
+ break;
972
+ case "batch.delete":
973
+ break;
974
+ case "batch.export":
975
+ break;
976
+ case "batch.print":
977
+ break;
978
+ default:
979
+ break;
980
+ }
981
+
982
+ }
983
+ };
984
+
985
+ /**
986
+ * grid事件
987
+ * 排序
988
+ */
989
+ const gridEvents = {
990
+ sortChange({ field = "", order = "" }) {
991
+ if (!order) {
992
+ field = order = "";
993
+ }
994
+ sortValue.value = field + "!" + order;
995
+ filterValue.value.sort = field;
996
+ filterValue.value.order = order;
997
+ filter({});
998
+ },
999
+
1000
+ toolbarButtonClick(config) {
1001
+ toolbarClick(config);
1002
+ emit("toolbarButtonClick", config);
1003
+ }
1004
+
1005
+ };
1006
+
1007
+ /**
1008
+ * 查询
1009
+ * param type:'filter' | 'column', default(filter) 区分是高级筛选,还是列筛选
1010
+ */
1011
+ const filter = (param = {}) => {
1012
+ gridOptions.pagerConfig.currentPage = 1;
1013
+ reload();
1014
+ };
1015
+
1016
+
1017
+ /**
1018
+ * 重置
1019
+ */
1020
+ const resetFilter = () => {
1021
+ filterValue.value = JSON.parse(originFilterValue.value);
1022
+ //重置列筛选
1023
+ if (sohelpVxeGridRef.value) {
1024
+ sohelpVxeGridRef.value.clearFilter();
1025
+ }
1026
+ filter();
1027
+ };
1028
+
1029
+ /**
1030
+ * 筛选弹窗
1031
+ */
1032
+ const showFilter = () => {
1033
+ if (sohelpConfig.value.filter?.config.filterPosition === "NONE") {
1034
+ sohelpConfig.value.filter.config.filterPosition = "TOP";
1035
+ sohelpConfig.value.filter.config.visibleFilter = false;
1036
+ }
1037
+ emit("showFilter", sohelpConfig.value.filter.config.filterPosition);
1038
+ };
1039
+
1040
+
1041
+ /**
1042
+ * 打开提交工作流界面
1043
+ */
1044
+ const submitWorkflow = (ids) => {
1045
+ approvalData.value = {
1046
+ refid: props.refid,
1047
+ ...ids
1048
+ };
1049
+ approvalModalVisible.value = true;
1050
+ };
1051
+
1052
+ /**
1053
+ * 查看工作流
1054
+ * @param row
1055
+ */
1056
+ const viewWorkflow = (id) => {
1057
+ drawerData.value = {
1058
+ id: id,
1059
+ refid: props.refid
1060
+ };
1061
+ drawerVisible.value = true;
1062
+ };
1063
+
1064
+ /**
1065
+ * 筛选
1066
+ */
1067
+ const changeNameFilter = (option, val, column) => {
1068
+ console.log("option", option, val, column);
1069
+ const $grid = sohelpVxeGridRef.value;
1070
+ if ($grid) {
1071
+ $grid.setFilter(column.field, [{
1072
+ data: val?.value || "",
1073
+ value: val.value || "",
1074
+ checked: true
1075
+ }]);
1076
+ $grid.updateFilterOptionStatus(option, true);
1077
+ }
1078
+ };
1079
+
1080
+ const filterVisible = ({ column, field, visible }) => {
1081
+ if (visible) {
1082
+ const hasField = filterValue.value.filter?.find(f => f.name === field);
1083
+ if (!hasField) {
1084
+ filterValue.value.filter = [...filterValue.value.filter, {
1085
+ comparison: "LIKE",
1086
+ name: field,
1087
+ value: ""
1088
+ }];
1089
+ }
1090
+ const $grid = sohelpVxeGridRef.value;
1091
+ if ($grid) {
1092
+ $grid.setFilter(field, [{
1093
+ data: "",
1094
+ value: "",
1095
+ checked: true
1096
+ }]);
1097
+ }
1098
+
1099
+ // $grid.updateFilterOptionStatus({
1100
+ // label: field,
1101
+ // value: "123",
1102
+ // data: 456
1103
+ // }, true);
1104
+
1105
+
1106
+ }
1107
+ };
1108
+
1109
+ /**
1110
+ *列筛选
1111
+ */
1112
+ const handleFilterChange = ({ field, datas }) => {
1113
+ filter();
1114
+ //重置功能 重置要清空filterValue.filter对象的项
1115
+ if (!datas?.length) {
1116
+ const map = new Map(filterValue.value.filter?.map(item => [item.name, item]));
1117
+ if (map.get(field)) {
1118
+ map.get(field).value = "";
1119
+ }
1120
+ }
1121
+ };
1122
+
1123
+ /**
1124
+ * 过滤掉对象中_开头的属性 _sqe、_checkbox、_operation
1125
+ * @param obj
1126
+ */
1127
+ const filterUnderscoreProps = (obj = {}) => {
1128
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
1129
+ return {};
1130
+ }
1131
+ return Object.entries(obj).reduce((acc, [key, value]) => {
1132
+ const filterKey = ["_checkbox", "_seq"];
1133
+ if (!filterKey.includes(key)) {
1134
+ acc[key] = typeof value === "object" ? filterUnderscoreProps(value) : value;
1135
+ }
1136
+ return acc;
1137
+ }, {});
1138
+ };
1139
+
1140
+
1141
+ /**
1142
+ * 根据 obj 对象的值修改 properties 数组中对应项的指定属性
1143
+ * @param {Object} obj
1144
+ * @param {Array} properties
1145
+ * @param {string} key
1146
+ */
1147
+ const updateProperties = (obj, properties, key, propertiesMap) => {
1148
+ if (!obj || Object.keys(obj).length === 0) return;
1149
+ const map = propertiesMap || new Map(properties.map((item, index) => [item.name, index]));
1150
+ Object.entries(obj).forEach(([name, value]) => {
1151
+ const index = map.get(name);
1152
+ if (index !== undefined && properties[index]) {
1153
+ properties[index][key] = value;
1154
+ //fixed
1155
+ if (key === "lockAlign") {
1156
+ properties[index]["lock"] = value ? true : false;
1157
+ }
1158
+ }
1159
+ });
1160
+ };
1161
+
1162
+
1163
+ /**
1164
+ * 属性根据sortData排序
1165
+ * @param {Array} properties
1166
+ * @param {Object} sortData
1167
+ */
1168
+ const sortPropertiesInPlace = (properties, sortData) => {
1169
+ const sortOrder = {};
1170
+ Object.entries(sortData || {})
1171
+ .sort((a, b) => a[1] - b[1])
1172
+ .forEach(([key], index) => {
1173
+ sortOrder[key] = index;
1174
+ });
1175
+
1176
+ properties.sort((a, b) => {
1177
+ const aOrder = sortOrder[a.name];
1178
+ const bOrder = sortOrder[b.name];
1179
+
1180
+ if (aOrder !== undefined && bOrder !== undefined) {
1181
+ return aOrder - bOrder;
1182
+ }
1183
+ if (aOrder !== undefined) return -1;
1184
+ if (bOrder !== undefined) return 1;
1185
+ return 0;
1186
+ });
1187
+ };
1188
+
1189
+ /**
1190
+ * 列设置操作
1191
+ */
1192
+ const handleCustom = async ({ type, $grid }) => {
1193
+ // 恢复默认
1194
+ if (type === "reset") {
1195
+ const loading = EleMessage.loading("恢复默认中..");
1196
+ const message = await resetCommonConfig({ refid: props.refid }).catch(err => {
1197
+ EleMessage.error(err.message);
1198
+ loading.close();
1199
+ });
1200
+ if (message) {
1201
+ EleMessage.success(message);
1202
+ }
1203
+ loading.close();
1204
+ }
1205
+
1206
+ //确认
1207
+ if (type === "confirm") {
1208
+ //获取当前列配置
1209
+ const { sortData, ...columnsData } = filterUnderscoreProps($grid?.getCustomStoreData());
1210
+
1211
+ const properties = JSON.parse(JSON.stringify([...sohelpConfig.value.properties])).map(item => {
1212
+ return {
1213
+ ...item,
1214
+ list: sohelpConfig.value.list.includes(item.name)
1215
+ };
1216
+ });
1217
+
1218
+ const propertiesMap = new Map(properties.map((item, index) => [item.name, index]));
1219
+
1220
+
1221
+ //修改对应的field
1222
+ const fieldMapping = {
1223
+ fixedData: "lockAlign",
1224
+ resizableData: "width",
1225
+ visibleData: "list"
1226
+ };
1227
+ // 修改属性
1228
+ Object.entries(columnsData).forEach(([key, value]) => {
1229
+ updateProperties(value, properties, fieldMapping[key], propertiesMap);
1230
+ });
1231
+ //根据sortData排序
1232
+ sortPropertiesInPlace(properties, sortData);
1233
+ const loading = EleMessage.loading("保存配置中..");
1234
+
1235
+ const message = await updateCommonConfig({
1236
+ refid: props.refid,
1237
+ properties: properties.map(item => {
1238
+ return {
1239
+ name: item.name,
1240
+ width: item.width,
1241
+ list: item.list,
1242
+ lockAlign: item.lockAlign,
1243
+ lock: item.lock
1244
+ };
1245
+ })
1246
+ }).catch(err => {
1247
+ EleMessage.error(err.message);
1248
+ loading.close();
1249
+ });
1250
+ if (message) {
1251
+ EleMessage.success(message);
1252
+ }
1253
+
1254
+ //清除缓存
1255
+ moduleCache?.clear();
1256
+ loadConfig();
1257
+
1258
+ localStorage.setItem("VXE_CUSTOM_STORE", "");
1259
+ loading.close();
1260
+ }
1261
+ };
1262
+
1263
+
1264
+ /**
1265
+ * 更新columns过滤状态
1266
+ */
1267
+ const updateColumnsFilter = () => {
1268
+ const $grid = sohelpVxeGridRef.value;
1269
+ if ($grid && filterValue.value.filter?.length) {
1270
+ filterValue.value.filter?.forEach((item) => {
1271
+ $grid.setFilter(item.name, [
1272
+ {
1273
+ checked: item.value?.length > 0
1274
+ }
1275
+ ]);
1276
+ });
1277
+ }
1278
+ };
1279
+
1280
+
1281
+ /**
1282
+ * 计算公式
1283
+ * @param row
1284
+ * @param column
1285
+ */
1286
+ const editClosed = (props) => {
1287
+ const { row, column } = props;
1288
+ Object.entries(formulaMap).forEach(([key, value]) => {
1289
+ try {
1290
+ const formulaValue = formulaMap[key]["formulaValue"];
1291
+ if (formulaValue.indexOf(column.field) > 0) {
1292
+ const str = formulaValue.replace(/\s+/g, "")
1293
+ .replace(/\${/g, "row.")
1294
+ .replace(/}/g, "");
1295
+ const v = new Function("row", `return ${str}`)(row);
1296
+ if (!Number.isNaN(v)) {
1297
+ row[key] = v;
1298
+ }
1299
+ }
1300
+ } catch (e) {
1301
+ console.error("计算公式错误:", e);
1302
+ EleMessage.error("计算公式错误:", e.message);
1303
+ }
1304
+ nextTick(() => {
1305
+ if (row[column.property] && row[column.property].toString().trim() !== "") {
1306
+ sohelpVxeGridRef.value?.clearValidate([column.property]);
1307
+ }
1308
+ });
1309
+ });
1310
+ emit("editClosed", props);
1311
+ };
1312
+
1313
+ const validate = async () => {
1314
+ const $grid = sohelpVxeGridRef.value;
1315
+ if ($grid) {
1316
+ const errMap = await $grid.fullValidate(true);
1317
+ return errMap || false;
1318
+ }
1319
+ };
1320
+
1321
+ const currentColumnChange = (props) => {
1322
+ emit("currentColumnChange", props);
1323
+ };
1324
+
1325
+ const columnCheckbox = ref(false);
1326
+ const toggleAllEvent = () => {
1327
+ const $grid = sohelpVxeGridRef.value
1328
+ if ($grid) {
1329
+ $grid.toggleCustomAllCheckbox()
1330
+ }
1331
+ }
1332
+
1333
+ const settingClick = (command) => {
1334
+ const baseUrl = SohelpHttp.getBaseUrl();
1335
+ const { refid,extendEntity,name } = sohelpConfig.value;
1336
+ if(refid && extendEntity && name){
1337
+ const url = {
1338
+ form: baseUrl + `/dev/index.html#/dev/form?datasource=${name}&name=${extendEntity}&refid=${refid}`,
1339
+ entity: baseUrl + `/dev/index.html#/dev/module/entity?datasource=${name}&name=${extendEntity}`,
1340
+ workflow: baseUrl + `/dev/index.html#/dev/form?datasource=${name}&name=${extendEntity}&refid=${refid}`,
1341
+ grid: baseUrl + `/dev/index.html#/dev/module/grid?refid=${refid}`
1342
+ }
1343
+ window.open(url[command],'_blank');
1344
+ }
1345
+ }
1346
+
1347
+ /**
1348
+ * 监听是否被选中,更新工具栏批量操作
1349
+ */
1350
+ watch(
1351
+ () => selections.value,
1352
+ (val) => {
1353
+ const isDisabled = val.length < 1;
1354
+ if (batchButtonsIndex.value?.length > 0) {
1355
+ batchButtonsIndex.value.forEach(idx => {
1356
+ gridOptions.toolbarConfig.buttons[idx].disabled = isDisabled;
1357
+ });
1358
+ }
1359
+ }
1360
+ );
1361
+
1362
+ watch(
1363
+ () => props.refid, (refid) => {
1364
+ //加载列表配置
1365
+ loadConfig();
1366
+ }, {
1367
+ immediate: true
1368
+ });
1369
+
1370
+ defineExpose({
1371
+ getData,
1372
+ getCrudUpdater,
1373
+ resetFilter,
1374
+ refresh,
1375
+ loadConfig,
1376
+ reload,
1377
+ load,
1378
+ validate,
1379
+ selections
1380
+ });
1381
+ </script>
1382
+
1383
+ <template>
1384
+ <vxe-grid
1385
+ v-bind="gridOptions"
1386
+ ref="sohelpVxeGridRef"
1387
+ @menuClick="menuRightClick"
1388
+ @checkboxChange="onCheckboxChange"
1389
+ @checkboxAll="onCheckboxChange"
1390
+ class="sohelp-grid-view"
1391
+ id="sohelp-grid"
1392
+ v-on="gridEvents"
1393
+ @filter-change="handleFilterChange"
1394
+ @custom="handleCustom"
1395
+ @cellClick="cellClick"
1396
+ @editClosed="editClosed"
1397
+ @header-cell-menu="headerCellMenu"
1398
+ :key="sohelpConfig.uuid"
1399
+ :keep-source="true"
1400
+ @currentColumnChange="currentColumnChange"
1401
+ @filter-visible="filterVisible"
1402
+ >
1403
+
1404
+ <template #setting>
1405
+ <div class="column-setting">
1406
+ <vxe-checkbox @change="toggleAllEvent" v-model="columnCheckbox">全选</vxe-checkbox>
1407
+ <vxe-pulldown trigger="click" :transfer="true" :show-popup-shadow="true" v-if="userStore.info.is_developer">
1408
+ <template #default>
1409
+ <el-link :icon="Setting" :underline="false"></el-link>
1410
+ </template>
1411
+ <template #dropdown>
1412
+ <ele-text @click="settingClick('grid')">数据列表配置</ele-text>
1413
+ <ele-text @click="settingClick('entity')">实体配置</ele-text>
1414
+ </template>
1415
+ </vxe-pulldown>
1416
+ </div>
1417
+ </template>
1418
+
1419
+ <!--定义国际化I18n-->
1420
+ <template
1421
+ v-for="item in sohelpConfig?.properties?.map(item => item)"
1422
+ v-slot:[`header_${item.name}`]="{ column, rowIndex }"
1423
+ :key="item.name"
1424
+ >
1425
+ {{ item.i18n ? t(item.i18n) : item.label }}
1426
+ </template>
1427
+
1428
+ <!--自定义定义分页--->
1429
+ <template #pager>
1430
+ <vxe-pager
1431
+ v-if="gridOptions.pagerConfig.enabled"
1432
+ v-model:currentPage="gridOptions.pagerConfig.currentPage"
1433
+ v-model:pageSize="gridOptions.pagerConfig.pageSize"
1434
+ :total="gridOptions.pagerConfig.total"
1435
+ @page-change="pageChangeEvent">
1436
+ </vxe-pager>
1437
+ </template>
1438
+
1439
+ <!-- 高级筛选 -->
1440
+ <template v-for="field in Object.values(propertiesMap).filter(item => item.query)" :key="field.name"
1441
+ #[`filter_${field.name}`]="{ column }">
1442
+ <div v-for="(option, index) in column.filters" :key="index" class="condition-box">
1443
+ <filter-condition-item
1444
+ :key="field.name"
1445
+ v-model="getCurrentFilter(field.name).value"
1446
+ :properties="propertiesMap[field.name]"
1447
+ :teleported="false"
1448
+ />
1449
+ </div>
1450
+ </template>
1451
+
1452
+ <!-- 工具栏 -->
1453
+ <template #toolbarTools>
1454
+ <div class="toolbar-box">
1455
+ <!-- 查看范围 -->
1456
+ <div class="power-box">
1457
+ <sohelp-power @change="changePower" v-if="sohelpConfig?.filter?.config?.visibleDataRange"></sohelp-power>
1458
+ </div>
1459
+
1460
+ <div class="search-box" v-if="sohelpConfig?.filter?.config?.visibleKeywords">
1461
+ <!-- 关键字 -->
1462
+ <ele-tooltip :content="getKeywordsPlaceholder" placement="top" :offset="3">
1463
+ <sohelp-input :model-value="filterValue.keywords" @update:model-value="keywordsChange"
1464
+ :placeholder="getKeywordsPlaceholder" clearable
1465
+ @keyup.enter="filter" size="small" style="width: 160px;">
1466
+ <template #append>
1467
+ <el-button :icon="Search" @click="filter" size="small" />
1468
+ </template>
1469
+ </sohelp-input>
1470
+ </ele-tooltip>
1471
+ <el-button size="small" @click="resetFilter">{{ t("grid.toolbar.reset") }}</el-button>
1472
+ </div>
1473
+
1474
+ <div class="tools-btns">
1475
+ <sohelp-drop-card :title="t('grid.toolbar.sort')" :icon="Sort" ref="sohelpSortRef"
1476
+ v-if="sohelpConfig?.filter?.config?.visibleSort && sortList.length > 0">
1477
+ <div class="sort-list">
1478
+ <ele-card v-for="item in sortList" :key="item.title" :header="item.title"
1479
+ :bodyStyle="{padding: '0'}"
1480
+ :headerStyle="{fontSize: '14px', fontWeight: 'normal', padding: '5px 0'}">
1481
+ <template #extra>
1482
+ <ele-text :icon="SortUp" style="cursor: pointer;" :underline="false" size="sm"
1483
+ @click="sortCommand(item.field,'asc')" plain :type="isActiveSort(item.field,'asc')">
1484
+ t("grid.toolbar.asc")
1485
+ </ele-text>
1486
+ <ele-text :icon="SortDown" style="cursor: pointer;margin-left:5px!important" :underline="false"
1487
+ size="sm" @click="sortCommand(item.field,'desc')" plain
1488
+ :type="isActiveSort(item.field,'desc')">t("grid.toolbar.desc")
1489
+ </ele-text>
1490
+ </template>
1491
+ </ele-card>
1492
+ </div>
1493
+ </sohelp-drop-card>
1494
+ <el-button :icon="Filter" size="small" @click="showFilter()"
1495
+ plain
1496
+ :type="(sohelpConfig?.filter?.config?.visibleFilter && sohelpConfig?.filter?.config?.filterPosition !== 'NONE')?'primary':''"
1497
+ v-if="sohelpConfig?.filter?.config?._visibleFilter">
1498
+ </el-button>
1499
+ </div>
1500
+ </div>
1501
+ </template>
1502
+
1503
+
1504
+ <!-- 未编辑状态 -->
1505
+ <template
1506
+ v-for="name in sohelpConfig?.properties?.map(item => item.name)"
1507
+ v-slot:[`default_${name}`]="{ row, column, rowIndex }"
1508
+ :key="name"
1509
+ >
1510
+
1511
+
1512
+ <sohelp-dict
1513
+ type="text"
1514
+ v-model="row[name]"
1515
+ v-if="column.type === 'SohelpDict'"
1516
+ v-bind="column.editRender"
1517
+ />
1518
+
1519
+ <!-- 图片 -->
1520
+ <sohelp-image-upload v-else-if="column.type === 'SohelpImageUpload'"
1521
+ v-model="row[name]"
1522
+ v-bind="column.editRender"
1523
+ :data="getCellValue(rowIndex,name)"
1524
+ :readonly="!column.editRender.edit">
1525
+ </sohelp-image-upload>
1526
+ <!-- 附件 -->
1527
+ <sohelp-file-upload
1528
+ v-else-if="column.type === 'SohelpFileUpload'"
1529
+ v-model="row[name]"
1530
+ v-bind="column.editRender"
1531
+ :data="getCellValue(rowIndex,name)"
1532
+ :readonly="!column.editRender.edit">
1533
+ </sohelp-file-upload>
1534
+
1535
+ <!-- 下拉选择表格 -->
1536
+ <div v-else-if="column.type === 'SohelpTableSelect' || column.type === 'ORG' || column.type ==='USER'">
1537
+ <span>{{ getTableSelectLabel(row[name], rowIndex, name, column) }}</span>
1538
+ </div>
1539
+
1540
+ <!-- 评分 -->
1541
+ <sohelp-rate
1542
+ v-else-if="column.type==='SohelpRate'"
1543
+ v-model="row[name]"
1544
+ v-bind="column.editRender"
1545
+ :disabled="!column.editRender.edit"
1546
+ show-score
1547
+ score-template="{value} 分"
1548
+ style="width: 100%;"
1549
+ />
1550
+
1551
+ <!-- 进度 -->
1552
+ <sohelp-process
1553
+ v-else-if="column.type==='SohelpProcess'"
1554
+ v-model="row[name]"
1555
+ v-bind="column.editRender"
1556
+ style="width: 100%"
1557
+ :readonly="!column.editRender.edit"
1558
+ ></sohelp-process>
1559
+
1560
+
1561
+ <!-- 下拉用户选择 -->
1562
+ <div v-else-if="column.type === 'SohelpUserSelect'">
1563
+ {{ gridData[rowIndex][name]?.["user_name"] }}
1564
+ </div>
1565
+
1566
+ <!-- 下拉组织选择 -->
1567
+ <div v-else-if="column.type === 'SohelpOrgTreeSelect'">
1568
+ {{ gridData[rowIndex][name]?.["org_name"] }}
1569
+ </div>
1570
+
1571
+ <!-- 开关 -->
1572
+ <div v-else-if="column.type==='SohelpSwitch' || column.type === 'SohelpCheckbox'">
1573
+ <span v-if="!column.editRender.edit">
1574
+ {{ !!row[name] ? "V" : "" }}
1575
+ </span>
1576
+ <sohelp-switch
1577
+ v-model="row[name]"
1578
+ v-bind="column.editRender"
1579
+ style="width: 100%;"
1580
+ v-else
1581
+ :activeValue="1"
1582
+ :inactiveValue="0"
1583
+ />
1584
+ </div>
1585
+
1586
+ <!-- 文本域 -->
1587
+ <p style="margin: 0;"
1588
+ class="textarea-reference"
1589
+ @click="showTextareaModal(column, name, row)"
1590
+ v-bind="column.editRender"
1591
+ v-else-if="column.type === 'SohelpTextarea'"
1592
+ >{{ row[name] }}
1593
+ </p>
1594
+
1595
+ <!-- 外键关联 -->
1596
+ <div v-else-if="column.type === 'RELATION' || column.type === 'SohelpTableSelect'">
1597
+ {{ gridData[rowIndex][name]?.[column?.editRender?.labelField] || "" }}
1598
+ </div>
1599
+
1600
+ <!-- 富文本 -->
1601
+ <div v-else-if="column.type === 'SohelpRichText'" v-html="row[name]"></div>
1602
+
1603
+ <div v-else>
1604
+ {{ row[name] }}
1605
+ </div>
1606
+
1607
+ </template>
1608
+
1609
+ <!-- 可编辑状态 -->
1610
+ <template
1611
+ v-for="name in sohelpConfig?.properties?.map(item => item.name)"
1612
+ v-slot:[`edit_${name}`]="{ row, column, rowIndex }"
1613
+ :key="name"
1614
+ >
1615
+ <div v-if="column.editRender.enabled">
1616
+ <!-- 字典 -->
1617
+ <!-- <sohelp-dict-->
1618
+ <!-- v-model="row[name]"-->
1619
+ <!-- :code="column.dict"-->
1620
+ <!-- v-if="column.type === 'SohelpDict'"-->
1621
+ <!-- v-bind="column.editRender"-->
1622
+ <!-- style="width: 100%;"-->
1623
+ <!-- :visible="true"-->
1624
+ <!-- />-->
1625
+ <div v-if="column.type === 'SohelpDict'">
1626
+ {{ column }}
1627
+ </div>
1628
+
1629
+ <!-- 下拉用户选择 -->
1630
+ <sohelp-number-input
1631
+ v-model="row[name]"
1632
+ v-else-if="column.type==='SohelpInputNumber'"
1633
+ v-bind="column.editRender"
1634
+ style="width: 100%;"
1635
+ />
1636
+
1637
+ <!-- 日期、日期时间 -->
1638
+ <sohelp-datetime
1639
+ v-model="row[name]"
1640
+ v-else-if="column.type==='SohelpDatetime' || column.type==='SohelpDate'"
1641
+ v-bind="column.editRender"
1642
+ style="width: 100%;"
1643
+ :focus="true"
1644
+ />
1645
+
1646
+ <!-- 下拉用户选择 -->
1647
+ <sohelp-user-select
1648
+ v-else-if="column.type==='SohelpUserSelect'"
1649
+ v-model="row[name]"
1650
+ v-bind="column.editRender"
1651
+ :datasource="userDatasource"
1652
+ />
1653
+
1654
+ <!-- 下拉组织机构 -->
1655
+ <sohelp-org-tree-select
1656
+ v-else-if="column.type==='SohelpOrgTreeSelect'"
1657
+ v-model="row[name]"
1658
+ v-bind="column.editRender"
1659
+ :datasource="orgDatasource"
1660
+ />
1661
+
1662
+ <!-- 外键关联 -->
1663
+ <sohelp-table-select v-else-if="column.type==='SohelpTableSelect'"
1664
+ v-model:value="row[name]"
1665
+ v-model:data="gridData[rowIndex][name]"
1666
+ v-bind="column.editRender"
1667
+ ></sohelp-table-select>
1668
+
1669
+ <!-- 数值 -->
1670
+ <sohelp-number-input
1671
+ v-model="row[name]"
1672
+ v-else-if="column.type==='SohelpNumberInput'"
1673
+ v-bind="column.editRender"
1674
+ style="width: 100%;"
1675
+ :autoFocus="true"
1676
+ />
1677
+
1678
+ <!-- 其他 -->
1679
+ <sohelp-input
1680
+ v-model="row[name]"
1681
+ v-bind="column.editRender"
1682
+ :autoFocus="true"
1683
+ v-else
1684
+ style="width: 100%;"
1685
+ :show-word-limit="false"
1686
+ />
1687
+ </div>
1688
+ </template>
1689
+
1690
+ <!-- 操作栏 -->
1691
+ <template #_operation="{ row }">
1692
+ <el-space :size="10">
1693
+ <el-link
1694
+ v-for="item in getOperationButtonsByType(row)"
1695
+ :key="item.code"
1696
+ :type="item.code === 'crud.delete' ? 'danger' : 'primary'"
1697
+ v-bind="item.params"
1698
+ @click="operationHandler({item:item, row:row,$grid:sohelpVxeGridRef})"
1699
+ >
1700
+ <el-icon v-if="item.icon" style="margin-right: 5px;">
1701
+ <component :is="ElementPlusIcons[item.icon]" v-if="ElementPlusIcons[item.icon]" />
1702
+ <component :is="EleAdminPlusIcons[item.icon]" v-else-if="EleAdminPlusIcons[item.icon]" />
1703
+ <span :class="item.icon" v-else></span>
1704
+ </el-icon>
1705
+ {{ item.title }}
1706
+ </el-link>
1707
+ <!-- 更多 -->
1708
+ <el-dropdown v-if="getOperationButtonsByType(row,'more')?.length > 0">
1709
+ <el-link :underline="false">
1710
+ <span>更多</span>
1711
+ <el-icon style="margin-left: 4px;">
1712
+ <arrow-down />
1713
+ </el-icon>
1714
+ </el-link>
1715
+ <template #dropdown>
1716
+ <el-dropdown-menu>
1717
+ <el-dropdown-item v-for="item in getOperationButtonsByType(row,'more')" :key="item.code"
1718
+ @click.stop="operationHandler({item:item, row:row,$grid:sohelpVxeGridRef})"
1719
+ v-bind="item.props">
1720
+ <el-icon v-if="item.icon">
1721
+ <component :is="ElementPlusIcons[item.icon]" v-if="ElementPlusIcons[item.icon]" />
1722
+ <component :is="EleAdminPlusIcons[item.icon]" v-else-if="EleAdminPlusIcons[item.icon]" />
1723
+ <span :class="item.icon" v-else></span>
1724
+ </el-icon>
1725
+ {{ item.title }}
1726
+ </el-dropdown-item>
1727
+ </el-dropdown-menu>
1728
+ </template>
1729
+ </el-dropdown>
1730
+ <slot name="_operation" :row="row"></slot>
1731
+ </el-space>
1732
+ </template>
1733
+
1734
+ <!-- 统计 -->
1735
+ <template
1736
+ v-for="field in footerData"
1737
+ v-slot:[`footer_${field["field"]}`]="{ row, column,rowIndex}"
1738
+ :key="field['field']"
1739
+ >
1740
+ <div v-html="row[column.field]"></div>
1741
+ </template>
1742
+
1743
+ <!-- 验证 -->
1744
+ <template #valid_slot="{content}">
1745
+ {{ content }}
1746
+ </template>
1747
+ </vxe-grid>
1748
+
1749
+ <!-- workflow -->
1750
+ <workflow-drawer
1751
+ :data="drawerData"
1752
+ v-model="drawerVisible"
1753
+ :showOpera="false"
1754
+ ref="todoDrawerRef"
1755
+ :key="drawerKey"
1756
+ ></workflow-drawer>
1757
+
1758
+ <!-- 提交审批 -->
1759
+ <approval-modal
1760
+ v-model="approvalModalVisible"
1761
+ type="submit"
1762
+ :data="approvalData"
1763
+ @confirm="reload"
1764
+ ></approval-modal>
1765
+
1766
+ <!-- SohelpTextareaInput 编辑弹窗 -->
1767
+ <ele-modal :width="460" v-model="textareaState['visible']" :title="getCurrentFieldLabel">
1768
+ <sohelp-textarea-input v-model="textareaState['value']" :rows="6"></sohelp-textarea-input>
1769
+ <template #footer>
1770
+ <el-button @click="textareaCancel">{{ t("common.cancel") }}</el-button>
1771
+ <el-button type="primary" @click="textareaConfirm(row, column)">{{ t("common.save") }}</el-button>
1772
+ </template>
1773
+ </ele-modal>
1774
+
1775
+ <!--实体表单-->
1776
+ <sohelp-modal
1777
+ :title="toolbarButtonParams?.title || ''"
1778
+ :width="toolbarButtonParams?.width || 860"
1779
+ :draggable="false"
1780
+ v-model="visibleEntityForm" v-loading="loading">
1781
+ <template #setting v-if="userStore.info.is_developer">
1782
+ <ele-dropdown
1783
+ :items="[
1784
+ { title: '表单配置', command: 'form' , icon:Postcard},
1785
+ { title: '实体配置', command: 'entity', icon:Tickets},
1786
+ { title: '流程配置', command: 'workflow', icon:Files }
1787
+ ]"
1788
+ @command="settingClick"
1789
+ >
1790
+ <el-link :icon="Setting" :underline="false"></el-link>
1791
+ </ele-dropdown>
1792
+ </template>
1793
+
1794
+ <sohelp-entity-form ref="entityFormRef"
1795
+ :refid="props.refid"
1796
+ v-model="entityFormValue"
1797
+ :data="entityFormData"
1798
+ :config="entityFormConfig"
1799
+ :readonly="toolbarButtonParams?.readonly"
1800
+ ></sohelp-entity-form>
1801
+ <template #footer v-if="!toolbarButtonParams?.readonly">
1802
+ <el-button @click="closeEntityForm()">{{ t("common.close") }}</el-button>
1803
+ <el-button type="primary" @click="saveEntityForm()" v-loading="loading">{{ t("common.save") }}</el-button>
1804
+ </template>
1805
+ </sohelp-modal>
1806
+ <!--打印报表-->
1807
+ <ele-modal :title="toolbarButtonParams?.title|| t('grid.report.title')" :width="toolbarButtonParams?.width|| 600"
1808
+ v-model="visibleReport">
1809
+
1810
+ <ele-check-card v-model="currentReportValue" :items="reportData" :row="{ gutter: 2 }">
1811
+ <template #item="{ item }">
1812
+ <ele-text size="md" style="padding:10px;">{{ item.name }}</ele-text>
1813
+ </template>
1814
+ </ele-check-card>
1815
+
1816
+ <template #footer>
1817
+ <el-button @click="closeReport()">{{ t("common.close") }}</el-button>
1818
+ <el-button @click="designReport()" v-if="reportData && reportData.length>0">{{ t("common.design") }}</el-button>
1819
+ <el-button type="primary" @click="openReport()" v-if="reportData && reportData.length>0">{{ t("common.print") }}
1820
+ </el-button>
1821
+ </template>
1822
+ </ele-modal>
1823
+ </template>
1824
+
1825
+ <style scoped lang="scss">
1826
+ .sohelp-grid-view {
1827
+ padding: 0px;
1828
+ display: flex;
1829
+ height: 100%;
1830
+ flex-direction: column;
1831
+
1832
+ :deep(.vxe-grid--table-wrapper) {
1833
+ .vxe-table {
1834
+ height: 100%;
1835
+ }
1836
+ }
1837
+
1838
+
1839
+ .toolbar-box {
1840
+ display: flex;
1841
+ gap: 10px;
1842
+ flex-wrap: wrap;
1843
+
1844
+ .tools-btns {
1845
+ display: flex;
1846
+ gap: 10px;
1847
+ margin-right: 10px;
1848
+
1849
+ :deep(.el-button) {
1850
+ margin-left: 0 !important;
1851
+ }
1852
+ }
1853
+ }
1854
+
1855
+ .ele-split-panel {
1856
+ :deep(.ele-split-panel-side) {
1857
+ border: none !important;
1858
+ }
1859
+ }
1860
+
1861
+ .vxe-grid {
1862
+ height: 100%;
1863
+
1864
+ :deep(.vxe-grid--layout-body-content-wrapper) {
1865
+ display: flex;
1866
+ flex-direction: column;
1867
+
1868
+ .vxe-grid--table-container {
1869
+ flex: 1;
1870
+ }
1871
+ }
1872
+
1873
+ :deep(.col--SohelpImageUpload) {
1874
+ .vxe-cell--wrapper {
1875
+ overflow: initial !important;
1876
+ }
1877
+ }
1878
+
1879
+ :deep(.vxe-table--render-default) {
1880
+ .vxe-body--row.row--stripe > .vxe-body--column {
1881
+ // background-color: transparent;
1882
+ }
1883
+ }
1884
+
1885
+ }
1886
+ }
1887
+
1888
+ .sort-list :deep(.el-button:focus),
1889
+ .sort-list :deep(.el-button:hover) {
1890
+ background-color: #e8f1ff !important;
1891
+ color: #1677ff !important;
1892
+ }
1893
+
1894
+ .filter-header {
1895
+ border-bottom: 1px solid #ddd;
1896
+ display: flex;
1897
+ width: 100%;
1898
+ height: 35px;
1899
+ line-height: 40px;
1900
+ box-sizing: border-box;
1901
+ margin: 0 0 0 10px;
1902
+ }
1903
+
1904
+ .sohelp-grid-view.right {
1905
+ .ele-split-panel {
1906
+ :deep(.ele-split-panel-side) {
1907
+ height: 100% !important;
1908
+ border: 0;
1909
+ display: flex;
1910
+ flex-direction: column;
1911
+ border-left: 1px solid #ddd !important;
1912
+ }
1913
+ }
1914
+ }
1915
+
1916
+ :deep(.tooltip-btn) {
1917
+ margin-left: 5px;
1918
+ height: 22px;
1919
+ line-height: 22px;
1920
+ margin-top: 2px;
1921
+ padding: 0px 5px !important;
1922
+ }
1923
+
1924
+ :deep(.vxe-cell--wrapper) {
1925
+ height: 100%;
1926
+ }
1927
+
1928
+ .textarea-reference {
1929
+ display: flex;
1930
+ height: 100%;
1931
+ }
1932
+
1933
+ :deep(.ele-split-panel.is-vertical) {
1934
+ .ele-split-panel-wrap > .ele-split-panel-space .ele-split-resize-line::after {
1935
+ background: #eee;
1936
+ }
1937
+ }
1938
+
1939
+ .condition-box {
1940
+ padding: 10px;
1941
+ }
1942
+
1943
+ .sohelp-filter-card.right {
1944
+ height: 100%;
1945
+ overflow: hidden;
1946
+
1947
+ :deep(.ele-card-header) {
1948
+ min-width: 230px;
1949
+ }
1950
+
1951
+ :deep(.ele-card-body) {
1952
+ height: 100% !important;
1953
+ }
1954
+ }
1955
+
1956
+ .column-setting{
1957
+ padding: 5px 10px;
1958
+ display: flex;
1959
+ align-items: center;
1960
+ justify-content: space-between;
1961
+ }
1962
+
1963
+
1964
+
1965
+ </style>