imatrix-ui 0.0.1-dsn

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 (393) hide show
  1. package/README.md +7 -0
  2. package/index.html +13 -0
  3. package/lib/super-ui.css +1 -0
  4. package/lib/super-ui.js +117579 -0
  5. package/lib/super-ui.umd.cjs +204 -0
  6. package/lib/vite.svg +1 -0
  7. package/package.json +35 -0
  8. package/packages/IntervalSelection/index.js +6 -0
  9. package/packages/IntervalSelection/src/quarterScope.vue +405 -0
  10. package/packages/IntervalSelection/src/sectionDate.vue +475 -0
  11. package/packages/breadcrumb/index.js +6 -0
  12. package/packages/breadcrumb/src/breadcrumb.vue +81 -0
  13. package/packages/department-tree/index.js +6 -0
  14. package/packages/department-tree/src/department-tree.vue +114 -0
  15. package/packages/department-tree-inline/index.js +6 -0
  16. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +494 -0
  17. package/packages/department-tree-inline/src/department-single-tree-inline.vue +367 -0
  18. package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
  19. package/packages/department-tree-inline/src/department-tree-service.js +344 -0
  20. package/packages/department-tree-inline/src/search-result.vue +238 -0
  21. package/packages/department-user-tree/index.js +6 -0
  22. package/packages/department-user-tree/src/department-user-multiple-tree.vue +133 -0
  23. package/packages/department-user-tree/src/department-user-single-tree.vue +96 -0
  24. package/packages/department-user-tree/src/department-user-tree.vue +115 -0
  25. package/packages/department-user-tree-inline/index.js +9 -0
  26. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +757 -0
  27. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +357 -0
  28. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +87 -0
  29. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +309 -0
  30. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +180 -0
  31. package/packages/department-user-tree-inline/src/search-result.vue +277 -0
  32. package/packages/directives/prevent-reclick.js +22 -0
  33. package/packages/dynamic-source-select/index.js +6 -0
  34. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +106 -0
  35. package/packages/dynamic-source-select/src/dynamic-source-select.vue +701 -0
  36. package/packages/dynamic-source-select/src/events.js +78 -0
  37. package/packages/fs-preview/index.js +6 -0
  38. package/packages/fs-preview/src/fs-preview.vue +287 -0
  39. package/packages/fs-upload/index.js +6 -0
  40. package/packages/fs-upload/src/fs-upload-multi.vue +448 -0
  41. package/packages/fs-upload/src/fs-upload-single.vue +353 -0
  42. package/packages/fs-upload/src/fs-upload.vue +191 -0
  43. package/packages/fs-upload/src/see-big-picture.vue +67 -0
  44. package/packages/fs-upload-list/index.js +6 -0
  45. package/packages/fs-upload-list/src/fs-upload-list.vue +375 -0
  46. package/packages/hamburger/index.js +6 -0
  47. package/packages/hamburger/src/hamburger.vue +42 -0
  48. package/packages/index.js +124 -0
  49. package/packages/multipart-upload/index.js +6 -0
  50. package/packages/multipart-upload/src/index.vue +66 -0
  51. package/packages/multipart-upload/src/multipart-upload-form.vue +383 -0
  52. package/packages/multipart-upload/src/multipart-upload-list.vue +527 -0
  53. package/packages/organization-input/index.js +6 -0
  54. package/packages/organization-input/src/organization-input.vue +579 -0
  55. package/packages/plugins/export-data-new.js +630 -0
  56. package/packages/plugins/export-data.js +431 -0
  57. package/packages/plugins/index.js +15 -0
  58. package/packages/plugins/public-method.js +47 -0
  59. package/packages/remove-department/index.js +6 -0
  60. package/packages/remove-department/src/remove-department.vue +201 -0
  61. package/packages/remove-department/src/remove-dept-service.js +31 -0
  62. package/packages/remove-user/index.js +6 -0
  63. package/packages/remove-user/src/remove-user-service.js +31 -0
  64. package/packages/remove-user/src/remove-user.vue +227 -0
  65. package/packages/remove-workgroup/index.js +6 -0
  66. package/packages/remove-workgroup/src/remove-workgroup-service.js +31 -0
  67. package/packages/remove-workgroup/src/remove-workgroup.vue +184 -0
  68. package/packages/rich-editor/index.js +7 -0
  69. package/packages/rich-editor/index.vue +314 -0
  70. package/packages/rich-editor/tinymce/icons/default/icons.min.js +1 -0
  71. package/packages/rich-editor/tinymce/langs/README.md +3 -0
  72. package/packages/rich-editor/tinymce/langs/zh-Hans.js +1 -0
  73. package/packages/rich-editor/tinymce/license.txt +21 -0
  74. package/packages/rich-editor/tinymce/models/dom/model.min.js +4 -0
  75. package/packages/rich-editor/tinymce/plugins/accordion/plugin.min.js +4 -0
  76. package/packages/rich-editor/tinymce/plugins/advlist/plugin.min.js +4 -0
  77. package/packages/rich-editor/tinymce/plugins/anchor/plugin.min.js +4 -0
  78. package/packages/rich-editor/tinymce/plugins/autolink/plugin.min.js +4 -0
  79. package/packages/rich-editor/tinymce/plugins/autoresize/plugin.min.js +4 -0
  80. package/packages/rich-editor/tinymce/plugins/autosave/plugin.min.js +4 -0
  81. package/packages/rich-editor/tinymce/plugins/charmap/plugin.min.js +4 -0
  82. package/packages/rich-editor/tinymce/plugins/code/plugin.min.js +4 -0
  83. package/packages/rich-editor/tinymce/plugins/codesample/plugin.min.js +4 -0
  84. package/packages/rich-editor/tinymce/plugins/directionality/plugin.min.js +4 -0
  85. package/packages/rich-editor/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
  86. package/packages/rich-editor/tinymce/plugins/emoticons/js/emojiimages.min.js +3 -0
  87. package/packages/rich-editor/tinymce/plugins/emoticons/js/emojis.js +1 -0
  88. package/packages/rich-editor/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
  89. package/packages/rich-editor/tinymce/plugins/emoticons/plugin.min.js +4 -0
  90. package/packages/rich-editor/tinymce/plugins/fullscreen/plugin.min.js +4 -0
  91. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ar.js +90 -0
  92. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
  93. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ca.js +90 -0
  94. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/cs.js +90 -0
  95. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/da.js +90 -0
  96. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/de.js +90 -0
  97. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/el.js +90 -0
  98. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/en.js +90 -0
  99. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/es.js +90 -0
  100. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/eu.js +90 -0
  101. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/fa.js +90 -0
  102. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/fi.js +90 -0
  103. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
  104. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/he_IL.js +90 -0
  105. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/hi.js +90 -0
  106. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/hr.js +90 -0
  107. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
  108. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/id.js +90 -0
  109. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/it.js +90 -0
  110. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ja.js +90 -0
  111. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/kk.js +90 -0
  112. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
  113. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ms.js +90 -0
  114. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
  115. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/nl.js +90 -0
  116. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/pl.js +90 -0
  117. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
  118. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
  119. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ro.js +90 -0
  120. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/ru.js +90 -0
  121. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/sk.js +90 -0
  122. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
  123. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
  124. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/th_TH.js +90 -0
  125. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/tr.js +90 -0
  126. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/uk.js +90 -0
  127. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/vi.js +90 -0
  128. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
  129. package/packages/rich-editor/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
  130. package/packages/rich-editor/tinymce/plugins/help/plugin.min.js +4 -0
  131. package/packages/rich-editor/tinymce/plugins/image/plugin.min.js +4 -0
  132. package/packages/rich-editor/tinymce/plugins/importcss/plugin.min.js +4 -0
  133. package/packages/rich-editor/tinymce/plugins/insertdatetime/plugin.min.js +4 -0
  134. package/packages/rich-editor/tinymce/plugins/link/plugin.min.js +4 -0
  135. package/packages/rich-editor/tinymce/plugins/lists/plugin.min.js +4 -0
  136. package/packages/rich-editor/tinymce/plugins/media/plugin.min.js +4 -0
  137. package/packages/rich-editor/tinymce/plugins/nonbreaking/plugin.min.js +4 -0
  138. package/packages/rich-editor/tinymce/plugins/pagebreak/plugin.min.js +4 -0
  139. package/packages/rich-editor/tinymce/plugins/preview/plugin.min.js +4 -0
  140. package/packages/rich-editor/tinymce/plugins/quickbars/plugin.min.js +4 -0
  141. package/packages/rich-editor/tinymce/plugins/save/plugin.min.js +4 -0
  142. package/packages/rich-editor/tinymce/plugins/searchreplace/plugin.min.js +4 -0
  143. package/packages/rich-editor/tinymce/plugins/table/plugin.min.js +4 -0
  144. package/packages/rich-editor/tinymce/plugins/template/plugin.min.js +4 -0
  145. package/packages/rich-editor/tinymce/plugins/visualblocks/plugin.min.js +4 -0
  146. package/packages/rich-editor/tinymce/plugins/visualchars/plugin.min.js +4 -0
  147. package/packages/rich-editor/tinymce/plugins/wordcount/plugin.min.js +4 -0
  148. package/packages/rich-editor/tinymce/skins/content/dark/content.js +2 -0
  149. package/packages/rich-editor/tinymce/skins/content/dark/content.min.css +1 -0
  150. package/packages/rich-editor/tinymce/skins/content/default/content.js +2 -0
  151. package/packages/rich-editor/tinymce/skins/content/default/content.min.css +1 -0
  152. package/packages/rich-editor/tinymce/skins/content/document/content.js +2 -0
  153. package/packages/rich-editor/tinymce/skins/content/document/content.min.css +1 -0
  154. package/packages/rich-editor/tinymce/skins/content/tinymce-5/content.js +2 -0
  155. package/packages/rich-editor/tinymce/skins/content/tinymce-5/content.min.css +1 -0
  156. package/packages/rich-editor/tinymce/skins/content/tinymce-5-dark/content.js +2 -0
  157. package/packages/rich-editor/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
  158. package/packages/rich-editor/tinymce/skins/content/writer/content.js +2 -0
  159. package/packages/rich-editor/tinymce/skins/content/writer/content.min.css +1 -0
  160. package/packages/rich-editor/tinymce/skins/ui/oxide/content.inline.js +2 -0
  161. package/packages/rich-editor/tinymce/skins/ui/oxide/content.inline.min.css +1 -0
  162. package/packages/rich-editor/tinymce/skins/ui/oxide/content.js +2 -0
  163. package/packages/rich-editor/tinymce/skins/ui/oxide/content.min.css +1 -0
  164. package/packages/rich-editor/tinymce/skins/ui/oxide/skin.js +2 -0
  165. package/packages/rich-editor/tinymce/skins/ui/oxide/skin.min.css +1 -0
  166. package/packages/rich-editor/tinymce/skins/ui/oxide/skin.shadowdom.js +2 -0
  167. package/packages/rich-editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  168. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.inline.js +2 -0
  169. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -0
  170. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.js +2 -0
  171. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/content.min.css +1 -0
  172. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.js +2 -0
  173. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
  174. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +2 -0
  175. package/packages/rich-editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  176. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.inline.js +2 -0
  177. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
  178. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.js +2 -0
  179. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
  180. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.js +2 -0
  181. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
  182. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +2 -0
  183. package/packages/rich-editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  184. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.inline.js +2 -0
  185. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  186. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.js +2 -0
  187. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
  188. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.js +2 -0
  189. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  190. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +2 -0
  191. package/packages/rich-editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  192. package/packages/rich-editor/tinymce/themes/silver/theme.min.js +4 -0
  193. package/packages/rich-editor/tinymce/tinymce.d.ts +3238 -0
  194. package/packages/rich-editor/tinymce/tinymce.min.js +4 -0
  195. package/packages/rich-editor/tinymce/zh_CN.js +418 -0
  196. package/packages/rich-editor/viewer.vue +105 -0
  197. package/packages/scan-code-input/index.js +6 -0
  198. package/packages/scan-code-input/src/events.js +34 -0
  199. package/packages/scan-code-input/src/scan-code-input-colse.vue +140 -0
  200. package/packages/scan-code-input/src/scan-code-input.vue +132 -0
  201. package/packages/secret-info/index.js +7 -0
  202. package/packages/secret-info/index.vue +100 -0
  203. package/packages/super-grid/index.js +7 -0
  204. package/packages/super-grid/src/apis.js +1189 -0
  205. package/packages/super-grid/src/columns-config.vue +429 -0
  206. package/packages/super-grid/src/custom-formatter.js +430 -0
  207. package/packages/super-grid/src/dynamic-input.vue +1443 -0
  208. package/packages/super-grid/src/eventBus.js +10 -0
  209. package/packages/super-grid/src/events.js +56 -0
  210. package/packages/super-grid/src/formValidatorUtil.js +300 -0
  211. package/packages/super-grid/src/formatter.js +196 -0
  212. package/packages/super-grid/src/group-column.vue +99 -0
  213. package/packages/super-grid/src/header-context-menu.vue +82 -0
  214. package/packages/super-grid/src/index-column.vue +69 -0
  215. package/packages/super-grid/src/normal-column.vue +1233 -0
  216. package/packages/super-grid/src/public-methods.js +30 -0
  217. package/packages/super-grid/src/row-operation.vue +193 -0
  218. package/packages/super-grid/src/search-button.vue +79 -0
  219. package/packages/super-grid/src/search-condition-input.vue +74 -0
  220. package/packages/super-grid/src/search-condition-list.vue +70 -0
  221. package/packages/super-grid/src/search-form-advancedQuery.vue +833 -0
  222. package/packages/super-grid/src/search-form-dialog.vue +77 -0
  223. package/packages/super-grid/src/search-form-item.vue +496 -0
  224. package/packages/super-grid/src/search-form-number.vue +111 -0
  225. package/packages/super-grid/src/search-form-open.vue +178 -0
  226. package/packages/super-grid/src/search-form-ordinarySearch.vue +248 -0
  227. package/packages/super-grid/src/search-form.vue +767 -0
  228. package/packages/super-grid/src/search-methods.js +591 -0
  229. package/packages/super-grid/src/selection-column.vue +46 -0
  230. package/packages/super-grid/src/store.js +3 -0
  231. package/packages/super-grid/src/super-grid-service.js +728 -0
  232. package/packages/super-grid/src/super-grid.vue +2941 -0
  233. package/packages/super-grid/src/utils.js +880 -0
  234. package/packages/super-grid/src/view-image-dialog.vue +177 -0
  235. package/packages/super-nine-grid/index.js +7 -0
  236. package/packages/super-nine-grid/src/apis.js +108 -0
  237. package/packages/super-nine-grid/src/custom-formatter.js +73 -0
  238. package/packages/super-nine-grid/src/formatter.js +134 -0
  239. package/packages/super-nine-grid/src/search-form-number.vue +35 -0
  240. package/packages/super-nine-grid/src/search-form.vue +704 -0
  241. package/packages/super-nine-grid/src/search-methods.js +151 -0
  242. package/packages/super-nine-grid/src/store.js +3 -0
  243. package/packages/super-nine-grid/src/super-grid-service.js +107 -0
  244. package/packages/super-nine-grid/src/super-nine-grid.vue +1191 -0
  245. package/packages/super-nine-grid/src/utils.js +264 -0
  246. package/packages/svg-icon/index.js +6 -0
  247. package/packages/svg-icon/src/svg-icon.vue +43 -0
  248. package/packages/utils/date-util.js +292 -0
  249. package/packages/utils/dom.js +227 -0
  250. package/packages/utils/gogocodeTransfer.js +59 -0
  251. package/packages/utils/memory-cache-utils.js +117 -0
  252. package/packages/utils/utils.js +180 -0
  253. package/packages/utils/value-set.js +97 -0
  254. package/packages/valid-code/index.js +7 -0
  255. package/packages/valid-code/src/valid-code.vue +104 -0
  256. package/packages/workflow-button/index.js +6 -0
  257. package/packages/workflow-button/src/workflow-button.vue +553 -0
  258. package/packages/workflow-history-list/index.js +6 -0
  259. package/packages/workflow-history-list/src/api.js +7 -0
  260. package/packages/workflow-history-list/src/workflow-history-list.vue +291 -0
  261. package/packages/workgroup-tree/index.js +6 -0
  262. package/packages/workgroup-tree/src/workgroup-tree.vue +87 -0
  263. package/packages/workgroup-tree-inline/index.js +6 -0
  264. package/packages/workgroup-tree-inline/src/search-result.vue +226 -0
  265. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +539 -0
  266. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +93 -0
  267. package/packages/workgroup-user-tree/index.js +6 -0
  268. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +104 -0
  269. package/packages/workgroup-user-tree-inline/index.js +9 -0
  270. package/packages/workgroup-user-tree-inline/src/search-result.vue +270 -0
  271. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +239 -0
  272. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +681 -0
  273. package/packages/year-range-picker/index.js +6 -0
  274. package/packages/year-range-picker/src/year-range-picker.vue +53 -0
  275. package/public/vite.svg +1 -0
  276. package/src/api/sso-service.js +178 -0
  277. package/src/api/tab.js +36 -0
  278. package/src/api/user-service.js +11 -0
  279. package/src/assets/401/401.gif +0 -0
  280. package/src/assets/404/404-cloud.png +0 -0
  281. package/src/assets/404/404.png +0 -0
  282. package/src/assets/cloud.png +0 -0
  283. package/src/directives/permission/index.js +13 -0
  284. package/src/directives/permission/permission.js +20 -0
  285. package/src/i18n/i18n.js +16 -0
  286. package/src/i18n/langs/cn.js +265 -0
  287. package/src/i18n/langs/en.js +275 -0
  288. package/src/index.js +93 -0
  289. package/src/permission.js +182 -0
  290. package/src/plugins.js +18 -0
  291. package/src/router/index.js +92 -0
  292. package/src/store/getters.js +15 -0
  293. package/src/store/index.js +19 -0
  294. package/src/store/modules/app.js +54 -0
  295. package/src/store/modules/permission.js +145 -0
  296. package/src/store/modules/tab-content.js +36 -0
  297. package/src/store/modules/user.js +298 -0
  298. package/src/styles/display-layout.scss +34 -0
  299. package/src/styles/element-ui.scss +29 -0
  300. package/src/styles/index.scss +157 -0
  301. package/src/styles/mixin.scss +27 -0
  302. package/src/styles/theme/black/font-style.scss +70 -0
  303. package/src/styles/theme/black/index.scss +306 -0
  304. package/src/styles/theme/black/sidebar.scss +189 -0
  305. package/src/styles/theme/blue/font-style.scss +46 -0
  306. package/src/styles/theme/blue/index.scss +172 -0
  307. package/src/styles/theme/blue/sidebar.scss +171 -0
  308. package/src/styles/theme/blue2/font-style.scss +70 -0
  309. package/src/styles/theme/blue2/index.scss +188 -0
  310. package/src/styles/theme/blue2/sidebar.scss +201 -0
  311. package/src/styles/theme/dark-blue/button.scss +78 -0
  312. package/src/styles/theme/dark-blue/card.scss +62 -0
  313. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  314. package/src/styles/theme/dark-blue/dark-blue-var.scss +9 -0
  315. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  316. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  317. package/src/styles/theme/dark-blue/font.scss +71 -0
  318. package/src/styles/theme/dark-blue/form.scss +51 -0
  319. package/src/styles/theme/dark-blue/index.scss +273 -0
  320. package/src/styles/theme/dark-blue/input.scss +15 -0
  321. package/src/styles/theme/dark-blue/message.scss +8 -0
  322. package/src/styles/theme/dark-blue/pagination.scss +18 -0
  323. package/src/styles/theme/dark-blue/radio.scss +13 -0
  324. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  325. package/src/styles/theme/dark-blue/sidebar.scss +268 -0
  326. package/src/styles/theme/dark-blue/tab.scss +83 -0
  327. package/src/styles/theme/dark-blue/table.scss +60 -0
  328. package/src/styles/theme/dark-blue/tree.scss +57 -0
  329. package/src/styles/theme/dark-blue/var.scss +1028 -0
  330. package/src/styles/theme/gray/card-style.scss +54 -0
  331. package/src/styles/theme/gray/font-style.scss +70 -0
  332. package/src/styles/theme/gray/index.scss +172 -0
  333. package/src/styles/theme/gray/input-style.scss +19 -0
  334. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  335. package/src/styles/theme/gray/sidebar.scss +243 -0
  336. package/src/styles/theme/gray/tab-style.scss +81 -0
  337. package/src/styles/transition.scss +47 -0
  338. package/src/utils/auth-api.js +206 -0
  339. package/src/utils/auth.js +85 -0
  340. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  341. package/src/utils/calculator/calculator-factory.js +145 -0
  342. package/src/utils/calculator/calculator-util.js +166 -0
  343. package/src/utils/common-util.js +467 -0
  344. package/src/utils/eventBus.js +10 -0
  345. package/src/utils/iconUtils.js +37 -0
  346. package/src/utils/index.js +102 -0
  347. package/src/utils/jump-page-utils.js +824 -0
  348. package/src/utils/local-storage.js +33 -0
  349. package/src/utils/menu.js +19 -0
  350. package/src/utils/permission.js +31 -0
  351. package/src/utils/permissionAuth.js +98 -0
  352. package/src/utils/range-selector.js +188 -0
  353. package/src/utils/request.js +269 -0
  354. package/src/utils/restful-interface-utils.js +57 -0
  355. package/src/utils/util.js +742 -0
  356. package/src/utils/validate.js +34 -0
  357. package/src/utils/watermark.js +108 -0
  358. package/src/utils/workflow-util.js +104 -0
  359. package/src/views/404.vue +248 -0
  360. package/src/views/dsc-component/Sidebar/Item.vue +81 -0
  361. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  362. package/src/views/dsc-component/Sidebar/SidebarItem.vue +197 -0
  363. package/src/views/dsc-component/Sidebar/index.vue +229 -0
  364. package/src/views/dsc-component/tabs/tab-content.vue +203 -0
  365. package/src/views/error-page/401.vue +106 -0
  366. package/src/views/error-page/404.vue +248 -0
  367. package/src/views/layout/EmptyLayout.vue +3 -0
  368. package/src/views/layout/Layout.vue +81 -0
  369. package/src/views/layout/NewLayout.vue +18 -0
  370. package/src/views/layout/components/AppMain.vue +39 -0
  371. package/src/views/layout/components/Breadcrumb/index.vue +158 -0
  372. package/src/views/layout/components/Menubar/Item.vue +79 -0
  373. package/src/views/layout/components/Menubar/Link.vue +38 -0
  374. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  375. package/src/views/layout/components/Menubar/index.vue +210 -0
  376. package/src/views/layout/components/Sidebar/Item.vue +53 -0
  377. package/src/views/layout/components/Sidebar/Link.vue +38 -0
  378. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -0
  379. package/src/views/layout/components/Sidebar/index.vue +141 -0
  380. package/src/views/layout/components/iframe-page.vue +38 -0
  381. package/src/views/layout/components/index.js +4 -0
  382. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  383. package/src/views/layout/mixin/ResizeHandler.js +41 -0
  384. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  385. package/src/views/layout/tab-content-index.vue +93 -0
  386. package/src/views/login/authredirect.vue +10 -0
  387. package/src/views/login/index.vue +296 -0
  388. package/src/views/login/update-password.vue +243 -0
  389. package/src/views/redirect/index.vue +14 -0
  390. package/src/views/svg-icon/index.js +6 -0
  391. package/src/views/svg-icon/src/svg-icon.vue +46 -0
  392. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  393. package/vite.config.js +37 -0
@@ -0,0 +1,2941 @@
1
+ <template>
2
+ <div>
3
+ <search-form
4
+ v-if="
5
+ !isFormSubTable &&
6
+ hasLoadedColumns &&
7
+ query &&
8
+ query.showType === 'embedded'
9
+ "
10
+ ref="sf"
11
+ :columns="columns"
12
+ :code="code"
13
+ :url="url"
14
+ :pagination="pagination"
15
+ :query="query"
16
+ :search-form-info="searchFormInfo"
17
+ :search-param="searchFormContent"
18
+ :init-search-props="initSearchProps"
19
+ :list-toolbar-form-data="listToolbarFormData"
20
+ :load-complete-query="loadCompleteQuery"
21
+ @search="doSearch"
22
+ @reset="resetSearch"
23
+ @open-fold="openFold"
24
+ />
25
+ <search-form-dialog
26
+ v-if="hasLoadedColumns && query && query.showType === 'popup'"
27
+ ref="sfDialog"
28
+ :columns="columns"
29
+ :code="code"
30
+ :url="url"
31
+ :pagination="pagination"
32
+ :query="query"
33
+ :search-param="searchFormContent"
34
+ :init-search-props="initSearchProps"
35
+ @search="doSearchDialog"
36
+ @reset="resetSearch"
37
+ @close="closeSearchFormDialog"
38
+ />
39
+ <div :class="'grid-area ' + code">
40
+ <el-table
41
+ v-if="refreshGrid && hasLoadedColumns"
42
+ ref="superGrid"
43
+ :data="gridData"
44
+ :row-key="getRowKeyProp"
45
+ :show-summary="showSummary"
46
+ :summary-method="getSummaries"
47
+ style="width: 100%"
48
+ :stripe="stripe"
49
+ :border="true"
50
+ :default-expand-all="defaultExpandAll"
51
+ :lazy="isLazy"
52
+ :load="loadChildren"
53
+ :row-style="changeRowStyle"
54
+ :cell-style="changeCellStyle"
55
+ :header-cell-style="changeHeaderStyle"
56
+ :highlight-current-row="true"
57
+ :span-method="rowSpan"
58
+ :max-height="maxHeight"
59
+ :height="height"
60
+ class="elTable"
61
+ :tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
62
+ @sort-change="handleSortChange"
63
+ @select="select"
64
+ @select-all="selectAll"
65
+ @row-click="rowClickEvent"
66
+ @row-dblclick="rowDblclickEvent"
67
+ @expand-change="expandChange"
68
+ @header-click="headerClick"
69
+ @header-dragend="changeHederWidth"
70
+ @header-contextmenu="headerContextmenu"
71
+ @cell-click="selectCell"
72
+ >
73
+ <template v-if="myCustomFormatter">
74
+ <component
75
+ :is="getComponentType(column.prop)"
76
+ v-for="(column, index) in visibleColumns"
77
+ :ref="column.prop"
78
+ :key="column.label + index"
79
+ :column="column"
80
+ :is-sql="isSql"
81
+ :list-code="code"
82
+ :custom-format="
83
+ getComponentType(column.prop) === 'GroupColumn'
84
+ ? myCustomFormatter
85
+ : myCustomFormatter[column.prop]
86
+ "
87
+ :new-width="newWidth"
88
+ :drag-column-prop="dragColumnProp"
89
+ :right-click-menu-arr="options.rightClickMenuArr"
90
+ :table-name="tableName"
91
+ :page-code="pageCode"
92
+ :list-name="listName"
93
+ :options="options"
94
+ :pagination="pagination"
95
+ :current-page="currentPage"
96
+ :grid-data="isSubTableShowPage ? subTableData : gridData"
97
+ :page-grid-data="
98
+ isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
99
+ "
100
+ @open-page="openPageDialog"
101
+ @refresPortData="refresPortData"
102
+ @refresPortsData="refresPortsData"
103
+ @refresMainTableFields="refresMainTableFields"
104
+ @prohibitToEdit="prohibitToEdit"
105
+ />
106
+ </template>
107
+ <template v-else>
108
+ <component
109
+ :is="getComponentType(column.prop)"
110
+ v-for="(column, index) in visibleColumns"
111
+ :ref="column.prop"
112
+ :key="column.label + index"
113
+ :is-sql="isSql"
114
+ :column="column"
115
+ :list-code="code"
116
+ :is-line-edit="lineEdit !== null && lineEdit.editable"
117
+ :new-width="newWidth"
118
+ :drag-column-prop="dragColumnProp"
119
+ :right-click-menu-arr="options.rightClickMenuArr"
120
+ :table-name="tableName"
121
+ :page-code="pageCode"
122
+ :list-toolbar-form-data="listToolbarFormData"
123
+ :list-name="listName"
124
+ :options="options"
125
+ :current-page="currentPage"
126
+ :pagination="pagination"
127
+ :grid-data="isSubTableShowPage ? subTableData : gridData"
128
+ :page-grid-data="
129
+ isSubTableShowPage ? getSubTableGridData(subTableData) : gridData
130
+ "
131
+ @open-page="openPageDialog"
132
+ @refresData="refresData"
133
+ @refresPortData="refresPortData"
134
+ @refresPortsData="refresPortsData"
135
+ @refresMainTableFields="refresMainTableFields"
136
+ @prohibitToEdit="prohibitToEdit"
137
+ />
138
+ </template>
139
+ </el-table>
140
+ <div v-if="showPagination" style="position: relative; margin-top: 5px">
141
+ <el-row>
142
+ <!-- <el-col
143
+ v-if="
144
+ !(
145
+ typeof options.isAdministerListView !== 'undefined' &&
146
+ options.isAdministerListView != null &&
147
+ options.isAdministerListView === true
148
+ )
149
+ "
150
+ :span="2"
151
+ > -->
152
+ <el-icon v-if="basicInfo.customConfig && !isFormSubTable" class="el-icon-setting" :title="$t('superGrid.columnConfig')" @click="configColumns" style="float: left; padding: 10px 0px; color: #777"
153
+ ><el-icon-setting
154
+ /></el-icon>
155
+ <el-icon v-if="!isFormSubTable" class="el-icon-refresh" :title="$t('superGrid.refresh')" @click="refreshGridData" style="float: left; padding: 10px 0px; color: #777"
156
+ ><el-icon-refresh
157
+ /></el-icon>
158
+ <!-- </el-col> -->
159
+ <el-col
160
+ :span="
161
+ !(
162
+ typeof options.isAdministerListView !== 'undefined' &&
163
+ options.isAdministerListView != null &&
164
+ options.isAdministerListView === true
165
+ )
166
+ ? 22
167
+ : 24
168
+ "
169
+ >
170
+ <el-pagination
171
+ v-if="pagination && isShowPage"
172
+ v-model:current-page="currentPage"
173
+ v-model:page-size="pagination.pageSize"
174
+ background
175
+ :page-sizes="pagination.pageSizes"
176
+ :layout="pagination.layout"
177
+ :total="pagination.showTotal?(pagination.total!==undefined&&pagination.total!==''&&pagination.total!==null?pagination.total:0):100000000000"
178
+ @size-change="handleSizeChange"
179
+ @current-change="handleCurrentChange"
180
+ />
181
+ </el-col>
182
+ </el-row>
183
+ </div>
184
+ </div>
185
+
186
+ <columns-config
187
+ v-if="showColumnConfig"
188
+ :columns="columns"
189
+ :list-code="code"
190
+ :is-sql="isSql"
191
+ @close="closeCustomConfig($event)"
192
+ @reset="resetCustomConfig($event)"
193
+ />
194
+ <header-context-menu
195
+ v-if="showHeaderContextmenu"
196
+ ref="headerMenu"
197
+ :buttom-arr="options.rightClickMenuArr"
198
+ :column="rightClickColumn"
199
+ @clearHeaderContextmenu="clearHeaderContextmenu"
200
+ />
201
+ <!-- <super-page-dialog
202
+ v-if="isShowPageDialog"
203
+ :dev-mode="pageDevMode"
204
+ :jump-page-setting="jumpPageSetting"
205
+ :source-page-code="pageCode"
206
+ @close="closePageDialog"
207
+ @update-value="updateValues"
208
+ /> -->
209
+ </div>
210
+ </template>
211
+
212
+ <script>
213
+ import {
214
+ Setting as ElIconSetting,
215
+ Refresh as ElIconRefresh,
216
+ } from '@element-plus/icons-vue'
217
+ import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
218
+ import IndexColumn from './index-column.vue'
219
+ import SelectionColumn from './selection-column.vue'
220
+ import NormalColumn from './normal-column.vue'
221
+ import GroupColumn from './group-column.vue'
222
+ import ColumnsConfig from './columns-config.vue'
223
+ import SearchForm from './search-form.vue'
224
+ import searchFormDialog from './search-form-dialog.vue'
225
+ import { setEntityFieldValue } from '../../../src/utils/util'
226
+ import eventBus from './eventBus'
227
+ import {
228
+ getSpanValuesForColumn,
229
+ getFirstEditableColumn,
230
+ getGridParams,
231
+ getTableHeight,
232
+ isObjectValueEqual,
233
+ isHasEditOption,
234
+ isHasOptionFunction,
235
+ isCanRefreshGrid,
236
+ isEditOptionFunction,
237
+ getExtraParam,
238
+ getLastPageNum,
239
+ } from './utils'
240
+ import Sortable from 'sortablejs'
241
+ import store from './store'
242
+ import events from './events'
243
+ import publicMethods from './public-methods'
244
+ import superGridService from './super-grid-service'
245
+ import formValidatorService from './formValidatorUtil'
246
+ import { getSystemCode } from '../../../src/utils/permissionAuth'
247
+ import apis from './apis'
248
+ import headerContextMenu from './header-context-menu.vue'
249
+ import { addDynamicProp } from './utils'
250
+ import { getEntityFieldValueWithOutCase } from '../../../src/utils/util'
251
+ import { isPromise } from '../../../src/utils/common-util'
252
+ import { checkPermission } from '../../../src/utils/permission'
253
+ import * as Vue from 'vue'
254
+ export default {
255
+ components: {
256
+ IndexColumn,
257
+ SelectionColumn,
258
+ NormalColumn,
259
+ GroupColumn,
260
+ ColumnsConfig,
261
+ SearchForm,
262
+ headerContextMenu,
263
+ searchFormDialog,
264
+ ElIconSetting,
265
+ ElIconRefresh,
266
+ },
267
+ name: 'SuperGrid',
268
+ props: {
269
+ code: {
270
+ type: String,
271
+ default: '',
272
+ },
273
+ url: {
274
+ type: String,
275
+ default: '',
276
+ },
277
+ options: {
278
+ type: Object,
279
+ default: function () {
280
+ return {}
281
+ },
282
+ },
283
+ // 为了兼容平台的旧写法,暂不删除以下属性
284
+ // 操作列、占位符列内容显示的函数,格式为:{'属性名':方法},例如:{'name':viewUser,'operation':showOperation}
285
+ customFormatter: {
286
+ type: Object,
287
+ default: null,
288
+ },
289
+ searchFormInfo: {
290
+ type: Object,
291
+ default: () => {
292
+ return {}
293
+ },
294
+ },
295
+ // 是否显示分页器
296
+ showPagination: {
297
+ type: Boolean,
298
+ default: true,
299
+ },
300
+ listToolbarFormData: {
301
+ type: Object,
302
+ default: null,
303
+ },
304
+ },
305
+ data() {
306
+ let parentProp
307
+ const parentPropSetting = this.options.parentProp
308
+ if (
309
+ typeof parentPropSetting !== 'undefined' &&
310
+ parentPropSetting !== '' &&
311
+ parentPropSetting !== null
312
+ ) {
313
+ parentProp = parentPropSetting
314
+ }
315
+ let mergeFields = []
316
+ if (
317
+ this.options &&
318
+ this.options.mergeFields &&
319
+ this.options.mergeFields !== ''
320
+ ) {
321
+ mergeFields = this.options.mergeFields.split(',')
322
+ }
323
+ let optionTableHeight
324
+ if (
325
+ this.options &&
326
+ this.options.optionTableHeight &&
327
+ this.options.optionTableHeight !== ''
328
+ ) {
329
+ optionTableHeight = this.options.optionTableHeight
330
+ }
331
+ let pageCode
332
+ if (this.options && this.options.pageCode) {
333
+ pageCode = this.options.pageCode
334
+ }
335
+ let pageHeight
336
+ if (this.options && this.options.pageHeight) {
337
+ pageHeight = this.options.pageHeight
338
+ }
339
+ let isLazy = true
340
+ if (this.options && this.options.lazy !== undefined) {
341
+ isLazy = this.options.lazy
342
+ }
343
+ let defaultExpandAll = true
344
+ if (this.options && this.options.defaultExpandAll !== undefined) {
345
+ defaultExpandAll = this.options.defaultExpandAll
346
+ }
347
+ // 数据库类型,值为mysql、oracle、sqlserver,默认是mysql,树形表格时需要使用
348
+ let dataSourceType = 'mysql'
349
+ if (window.$vueApp.config.globalProperties.dataSourceType) {
350
+ dataSourceType =
351
+ window.$vueApp.config.globalProperties.dataSourceType.toLowerCase()
352
+ }
353
+ let pageDevMode = this.options.pageDevMode
354
+ if (pageDevMode === undefined) {
355
+ pageDevMode = false
356
+ }
357
+ return {
358
+ isLoading: false,
359
+ currentPage: 1,
360
+ showColumnConfig: false,
361
+ basicInfo: {
362
+ summary: 'no',
363
+ },
364
+ columns: [],
365
+ loadCompleteQuery: false,
366
+ pagination: null,
367
+ query: null,
368
+ lineEdit: null,
369
+ gridData: [],
370
+ summaries: null,
371
+ sortInfo: null,
372
+ pageSize: null,
373
+ showSearch: false,
374
+ myCustomFormatter: null,
375
+ height: null,
376
+ timer: null,
377
+ timer2: null,
378
+ isSql: false, // 是否是sql查询
379
+ parentProp, // 树状结构数据时,父字段名,默认是id
380
+ hasLoadData: false,
381
+ mergeFields,
382
+ newWidth: null,
383
+ dragColumnProp: null,
384
+ hasLoadedColumns: false, // 是否已经加载了列配置
385
+ backgroundColorMap: {},
386
+ showHeaderContextmenu: false,
387
+ rightClickColumn: null,
388
+ externalClickFlag: false, // 是否是外部点击
389
+ dataTableCode: null,
390
+ dynamicColumnInfo: null, // 列表管理/字段配置/动态列配置中解析的动态列集合,在获得列表数据和行编辑保存动态列时使用
391
+ mainDefaultValueColumns: null, // 当前列表对应的数据表的字段配置有默认值的字段集合,动态列insert插入主表记录时使用
392
+ dynamicServiceName: null, // 动态列展示及行编辑时数据保存的service处理类,可以不填,使用平台默认的处理类
393
+ searchFormContent: null,
394
+ initSearchProps: [], // 初始查询的字段属性名集合
395
+ refreshGrid: true, // 字段配置刷新列表时用于重新渲染列表的状态位
396
+ optionTableHeight, // option传递的table高度
397
+ isFormSubTable: false,
398
+ isShowPageDialog: false, // 是否显示弹框
399
+ jumpPageSetting: null,
400
+ pageCode,
401
+ maxHeight: null,
402
+ pageHeight, // 页面高度
403
+ currentSelectCell: null,
404
+ isLazy, // 树形结构时是否懒加载,默认是懒加载的
405
+ defaultExpandAll, // 树形结构是否默认展开所有节点
406
+ parentFormData: null, // 父表单实体信息
407
+ stripe: true,
408
+ dataSourceType,
409
+ pageDevMode,
410
+ toolbarFieldParam: [],
411
+ tableName: null,
412
+ listName: null,
413
+ subTableData: [],
414
+ isShowPage: false, // 子表或普通列表是否显示分页
415
+ isSubTableShowPage: false, // 子表是否显示分页
416
+ isDelete: false, // 获取请求参数是否删除后
417
+ }
418
+ },
419
+ computed: {
420
+ visibleColumns() {
421
+ const gridParams = store.get(this.code)
422
+ const operations = this.getOptionOperations()
423
+ gridParams.canntEdit = false
424
+ if (
425
+ operations &&
426
+ operations.operation &&
427
+ operations.operation.length > 0
428
+ ) {
429
+ operations.operation.forEach((buttonInfo) => {
430
+ if (buttonInfo.props.code === 'lineEditUpdate') {
431
+ if (checkPermission(buttonInfo.props.functionCode)) {
432
+ gridParams.canntEdit = true
433
+ }
434
+ }
435
+ })
436
+ }
437
+ if (
438
+ typeof this.options.isAdministerListView !== 'undefined' &&
439
+ this.options.isAdministerListView != null &&
440
+ this.options.isAdministerListView === true
441
+ ) {
442
+ return this.columns
443
+ } else {
444
+ return this.columns.filter((column) => {
445
+ if (
446
+ typeof this.options.multiple !== 'undefined' &&
447
+ this.options.multiple === false &&
448
+ column.prop === '$selection'
449
+ ) {
450
+ // 表示不显示“多选”列
451
+ return false
452
+ }
453
+ if (
454
+ typeof this.options.showIndex !== 'undefined' &&
455
+ this.options.showIndex === false &&
456
+ column.prop === '$index'
457
+ ) {
458
+ // 表示不显示“序号”列
459
+ return false
460
+ }
461
+ let isVisible
462
+ if (column.show === undefined || column.show) {
463
+ isVisible = true
464
+ const hiddenColumns = this.options.hiddenColumns
465
+ if (
466
+ hiddenColumns &&
467
+ hiddenColumns.length > 0 &&
468
+ hiddenColumns.indexOf(column.prop) !== -1
469
+ ) {
470
+ // 如果当前字段包含在隐藏字段集合中,则不显示该字段
471
+ isVisible = false
472
+ return isVisible
473
+ }
474
+ // 给列配置操作属性
475
+ this.initColumnOperation(column, operations)
476
+ if (!gridParams.$dataTypeMap) {
477
+ gridParams.$dataTypeMap = {}
478
+ }
479
+ // sql时行编辑保存后台代码需要
480
+ gridParams.$dataTypeMap[column.prop] = column.dataType
481
+ } else {
482
+ isVisible = false
483
+ }
484
+ // 存储有默认值的字段集合
485
+ this.storeHasDefaultValueColumns(column, gridParams)
486
+ return isVisible
487
+ })
488
+ }
489
+ },
490
+ spanArr() {
491
+ const spanArr = []
492
+ for (const column of this.columns) {
493
+ if (
494
+ column.span ||
495
+ (this.mergeFields && this.mergeFields.indexOf(column.prop) !== -1)
496
+ ) {
497
+ spanArr[column.prop] = getSpanValuesForColumn(
498
+ this.gridData,
499
+ column.prop,
500
+ column.mergerCellBasis
501
+ )
502
+ }
503
+ }
504
+ return spanArr
505
+ },
506
+ showSummary() {
507
+ return (
508
+ this.basicInfo.summary !== undefined && this.basicInfo.summary !== 'no'
509
+ )
510
+ },
511
+ // 返回table用来确定唯一的字段。必须配置,否则树形结构时无法显示子集合。
512
+ getRowKeyProp() {
513
+ const gridParams = store.get(this.code)
514
+ if (gridParams && gridParams.options && gridParams.options.rowKeyProp) {
515
+ return gridParams.options.rowKeyProp
516
+ } else {
517
+ if (this.dataSourceType === 'oracle') {
518
+ return 'ID'
519
+ } else {
520
+ return 'id'
521
+ }
522
+ }
523
+ },
524
+ // ,
525
+ // hasLoadMainTable() {
526
+ // const hasLoadMainTable = store.get('hasLoadMainTable')
527
+ // if (typeof (hasLoadMainTable) === 'undefined') {
528
+ // return false
529
+ // }
530
+ // return hasLoadMainTable
531
+ // }
532
+ },
533
+ watch: {
534
+ 'options.SuperGrid': {
535
+ deep: true,
536
+ handler: function () {
537
+ this.externalClickFlag = true
538
+ console.log('监听到数据改变')
539
+ this.initSetting()
540
+ this.initialize()
541
+ },
542
+ },
543
+ // 监控列表数据修改,列表作为表单编辑器中子表时使用
544
+ gridData: {
545
+ deep: true,
546
+ immediate: true,
547
+ handler: function (Val) {
548
+ if (!this.isSubTableShowPage) {
549
+ // 列表子表不分页时使用
550
+ $emit(this, 'change-grid-data', this.gridData)
551
+ }
552
+ },
553
+ },
554
+ // 监控列表数据修改,列表作为表单编辑器中子表时使用
555
+ subTableData: {
556
+ deep: true,
557
+ immediate: true,
558
+ handler: function () {
559
+ if (this.isSubTableShowPage) {
560
+ // 列表子表分页时使用
561
+ const gridParams = store.get(this.code)
562
+ $emit(this, 'change-grid-data', this.subTableData)
563
+ if (
564
+ gridParams.isChangePage !== undefined &&
565
+ gridParams.isChangePage
566
+ ) {
567
+ // 表示新建记录时
568
+ // 新建记录时跳转到最后一页
569
+ const lastPageNum = getLastPageNum(
570
+ this.subTableData.length,
571
+ this.pageSize
572
+ )
573
+ // 表示最后一页页码和当前页不同时需要切换页码
574
+ if (lastPageNum !== this.currentPage) {
575
+ // 切换当前页码为最后一页
576
+ this.currentPage = lastPageNum
577
+ // 切换当前页码到最后一页的数据
578
+ this.changePage()
579
+ } else {
580
+ // 表示不需要切换页码
581
+ this.gridData = this.getSubTableGridData(this.subTableData)
582
+ gridParams.gridData = this.gridData // 完成深拷贝,复制一份对象,行编辑时使用
583
+ gridParams.orgGridData = [].concat(
584
+ JSON.parse(JSON.stringify(this.gridData))
585
+ )
586
+ }
587
+ if (gridParams.lineEdit.editingCell) {
588
+ gridParams.lineEdit.editingCell.row = this.gridData.length
589
+ }
590
+ // 使用完状态还原
591
+ gridParams.isChangePage = false
592
+ } else {
593
+ // 表示不是子表新建记录
594
+ this.gridData = this.getSubTableGridData(this.subTableData)
595
+ gridParams.gridData = this.gridData
596
+ // 完成深拷贝,复制一份对象,行编辑时使用
597
+ gridParams.orgGridData = [].concat(
598
+ JSON.parse(JSON.stringify(this.gridData))
599
+ )
600
+ }
601
+ }
602
+ },
603
+ },
604
+ currentSelectCell: {
605
+ deep: true,
606
+ handler: function (newVal, oldVal) {
607
+ this.$nextTick(() => {
608
+ if (newVal) {
609
+ // 手动触发新单元格的点击事件
610
+ newVal.click()
611
+ }
612
+ if (oldVal) {
613
+ // 清空上一个单元格的选中样式
614
+ oldVal.style.border = ''
615
+ }
616
+ })
617
+ },
618
+ },
619
+ 'options.validateRules': {
620
+ deep: true,
621
+ handler: function () {
622
+ this.externalClickFlag = true
623
+ console.log(
624
+ '监听到数据改变================',
625
+ this.options.validateRules
626
+ )
627
+ const gridParams = store.get(this.code)
628
+ if (gridParams && gridParams.options) {
629
+ gridParams.options.validateRules = this.options.validateRules
630
+ store.set(this.code, gridParams)
631
+ }
632
+ // this.initSetting()
633
+ // this.initialize()
634
+ },
635
+ },
636
+ 'options.subTableCanAdd': {
637
+ deep: true,
638
+ handler: function () {
639
+ const gridParams = store.get(this.code)
640
+ if (gridParams && gridParams.options) {
641
+ gridParams.options.subTableCanAdd = this.options.subTableCanAdd
642
+ store.set(this.code, gridParams)
643
+ }
644
+ },
645
+ },
646
+ // pageSize每页显示多少条,改变时抛出事件,配置出来的流程表单子表验证提示信息时使用,例如:“第x页第x条记录,xxx必填”,获得页数时需要使用
647
+ pageSize: {
648
+ deep: true,
649
+
650
+ handler(newValue, oldValue) {
651
+ $emit(this, 'change-rows-per-page', this.pageSize)
652
+ },
653
+ },
654
+ // 更新parent值
655
+ 'options.extraParam.entityMap': {
656
+ deep: true,
657
+ handler(newValue, oldValue) {
658
+ console.log('watch====options.extraParam.entityMap===改变==', newValue)
659
+ this.parentFormData = newValue
660
+ }
661
+ }
662
+ },
663
+ provide() {
664
+ return {}
665
+ },
666
+ created() {
667
+ store.set(this.code, getGridParams())
668
+ store.set('_list_code', this.code)
669
+ this.initSetting()
670
+ this.judgeIsFormSubTable()
671
+ let stripe = true
672
+ if (isHasOptionFunction('rowStyleRender', this.code)) {
673
+ // 当行需要自定义样式时,斑马线样式会影响效果,所以需要去掉斑马线配置
674
+ stripe = false
675
+ }
676
+ this.stripe = stripe
677
+
678
+ // if (this.parentProp) {
679
+ // // 表示配置了树形配置
680
+ // this.treeProps = this.getTreeProps()
681
+ // }
682
+ // this.showDemo()
683
+ },
684
+ mounted() {
685
+ this.initialize().then(() => {
686
+ const gridParams = store.get(this.code)
687
+ if (
688
+ gridParams &&
689
+ gridParams.basicInfo &&
690
+ gridParams.basicInfo.tableName
691
+ ) {
692
+ this.tableName = gridParams.basicInfo.tableName
693
+ }
694
+ if (gridParams && gridParams.basicInfo && gridParams.basicInfo.name) {
695
+ this.listName = gridParams.basicInfo.name
696
+ }
697
+ this.$nextTick(() => {
698
+ // 将子表选项组值传递super-pages中,解决到处报告时子表选项组赋值问题
699
+ this.columns.forEach((column) => {
700
+ if (column.valueSet) {
701
+ $emit(this, 'set-select-options', {
702
+ prop: this.code + '.' + column.prop,
703
+ valueSet: column.valueSet,
704
+ })
705
+ }
706
+ })
707
+ this.rowDrop()
708
+ this.columnDrop()
709
+ store.get(this.code).superGrid = this.$refs.superGrid
710
+ if (this.query && this.query.showType === 'embedded') {
711
+ // 嵌入查询时,刚进台账要计算一次列表高度
712
+ this.resizeTableHeight()
713
+ } else {
714
+ this.$watch(
715
+ 'showSearch',
716
+ function (newVal, oldVal) {
717
+ this.resizeTableHeight()
718
+ },
719
+ {
720
+ immediate: true,
721
+ deep: true,
722
+ }
723
+ )
724
+ }
725
+
726
+ this.$watch(
727
+ 'hasLoadData',
728
+ function (newVal, oldVal) {
729
+ if (newVal === true) {
730
+ this.$nextTick(() => {
731
+ const gridParams = store.get(this.code)
732
+ if (isHasOptionFunction('gridComplete', this.code)) {
733
+ gridParams.options.gridComplete.call(this, {
734
+ gridData: this.isSubTableShowPage
735
+ ? this.subTableData
736
+ : this.gridData,
737
+ columns: gridParams.columns,
738
+ superGrid: this.$refs.superGrid,
739
+ pageGridData: this.isSubTableShowPage
740
+ ? this.gridData
741
+ : null,
742
+ additionalParamMap: gridParams.additionalParamMap,
743
+ })
744
+ }
745
+ })
746
+ }
747
+ },
748
+ {
749
+ immediate: true,
750
+ deep: true,
751
+ }
752
+ )
753
+
754
+ const that = this
755
+ const isShowUserTreeDialog =
756
+ document.querySelector('.user-tree') !== null
757
+ // 当前页面监视键盘输入
758
+ document.querySelector('.' + this.code).onkeydown = function (e) {
759
+ if (!that.isShowPageDialog && !isShowUserTreeDialog) {
760
+ // 当前列表页面没有弹框或选人弹框,才走键盘监视事件
761
+ // 事件对象兼容
762
+ // eslint-disable-next-line no-caller
763
+ const e1 =
764
+ e || event || window.event || arguments.callee.caller.arguments[0]
765
+ // 处于行编辑状态时,左右上下箭头事件不需要生效
766
+ const isEdit = that.isEditRow(that)
767
+ // 键盘按键判断:左箭头-37;上箭头-38;右箭头-39;下箭头-40
768
+ // 左
769
+ if (e1 && e1.keyCode === 37) {
770
+ // 左箭头
771
+ if (!isEdit) {
772
+ that.selectLeftCell(that)
773
+ }
774
+ } else if (e1 && e1.keyCode === 38) {
775
+ // 上箭头
776
+ if (!isEdit) {
777
+ that.selectUpCell(that)
778
+ }
779
+ } else if (e1 && e1.keyCode === 39) {
780
+ // 右箭头
781
+ if (!isEdit) {
782
+ that.selectRightCell(that)
783
+ }
784
+ } else if (e1 && e1.keyCode === 40) {
785
+ // 下箭头
786
+ if (!isEdit) {
787
+ that.selectDownCell(that)
788
+ }
789
+ } else if (e1 && e1.keyCode === 13) {
790
+ // 回车
791
+ if (that.isCallEnterEvent(that)) {
792
+ // 不是子表时,才需要回车事件,子表时不处理回车事件,扫码枪回车事件和平台的回车事件冲突了。子表时用户一般不会主动回车取消行编辑。
793
+ that.enterOperation(that)
794
+ }
795
+ } else if (e1 && e1.keyCode === 27) {
796
+ // ESC
797
+ that.escOperation(that)
798
+ }
799
+ }
800
+ }
801
+ })
802
+ if (this.query && this.query.showType === 'popup') {
803
+ $emit(this, 'setSearchType', true)
804
+ }
805
+ this.$watch(
806
+ 'options.extraParam',
807
+ function (newValue, oldVal) {
808
+ this.options['extraParam'] = newValue
809
+ const gridParams = store.get(this.code)
810
+ gridParams.options.extraParam = newValue
811
+ },
812
+ {
813
+ deep: true,
814
+ }
815
+ )
816
+ })
817
+ },
818
+ methods: {
819
+ ...events,
820
+ ...publicMethods,
821
+ ...superGridService,
822
+ ...apis,
823
+ isDeleteChange(boole) {
824
+ this.isDelete = boole
825
+ },
826
+ // 是否触发回车事件
827
+ isCallEnterEvent(that) {
828
+ let canCall = true
829
+ if (
830
+ that.options.isEnableEnterEvent !== undefined &&
831
+ that.options.isEnableEnterEvent === false
832
+ ) {
833
+ canCall = false
834
+ }
835
+ console.log(
836
+ 'super-grid-----isEnableEnterEvent=',
837
+ that.options.isEnableEnterEvent,
838
+ 'canCall=',
839
+ canCall
840
+ )
841
+ const gridParams = store.get(that.code)
842
+ if (canCall && gridParams.options && gridParams.options.isFormSubTable) {
843
+ canCall = false
844
+ }
845
+ return canCall
846
+ },
847
+ isShowPageArea() {
848
+ if (this.isFormSubTable) {
849
+ return (
850
+ this.options.showPageArea !== undefined &&
851
+ this.options.showPageArea === true
852
+ )
853
+ } else {
854
+ return true
855
+ }
856
+ },
857
+ resizeTableHeight() {
858
+ this.$nextTick(() => {
859
+ let tableHeight = getTableHeight(
860
+ this.$refs.superGrid,
861
+ this.code,
862
+ this.pageHeight
863
+ )
864
+ const gridParams = store.get(this.code)
865
+ if (isHasOptionFunction('resizeHeight', this.code)) {
866
+ let searchHeight = 0
867
+ if (this.$refs.sf) {
868
+ // 获得查询区高度
869
+ searchHeight = this.$refs.sf.$el.offsetHeight
870
+ }
871
+ const newHeight = gridParams.options.resizeHeight.call(this, {
872
+ code: this.code,
873
+ height: tableHeight,
874
+ searchHeight: searchHeight,
875
+ additionalParamMap: gridParams.additionalParamMap,
876
+ })
877
+ if (newHeight) {
878
+ tableHeight = newHeight
879
+ }
880
+ }
881
+ let tempHeight = tableHeight
882
+ if (this.optionTableHeight) {
883
+ tempHeight = this.optionTableHeight
884
+ } else if (
885
+ gridParams.options &&
886
+ gridParams.options.isFormSubTable &&
887
+ gridParams.options.isPdfEditor
888
+ ) {
889
+ tempHeight = null
890
+ } else if (
891
+ gridParams.options &&
892
+ gridParams.options.isFormSubTable &&
893
+ gridParams.options.formSetHeight
894
+ ) {
895
+ tempHeight = gridParams.options.formSetHeight
896
+ } else if (
897
+ !this.basicInfo.displayEffect ||
898
+ this.basicInfo.displayEffect === '' ||
899
+ this.basicInfo.displayEffect === 'default'
900
+ ) {
901
+ tempHeight = null
902
+ }
903
+ this.tableHeight = tempHeight
904
+ let tempMaxHeight = tableHeight
905
+ tempMaxHeight = tableHeight
906
+ if (
907
+ gridParams.options &&
908
+ gridParams.options.isFormSubTable &&
909
+ gridParams.options.isPdfEditor
910
+ ) {
911
+ tempMaxHeight = null
912
+ } else if (
913
+ gridParams.options &&
914
+ gridParams.options.isFormSubTable &&
915
+ gridParams.options.formSetMaxHeight
916
+ ) {
917
+ tempMaxHeight = gridParams.options.formSetMaxHeight
918
+ }
919
+ if(tempHeight === undefined || tempHeight === null){
920
+ // el-table的height和maxHeight不能同时设值,会导致列表渲染失败,报脚本错
921
+ this.maxHeight = tempMaxHeight
922
+ }
923
+ })
924
+ },
925
+ // 回车键
926
+ enterOperation(that) {
927
+ const gridParams = store.get(that.code)
928
+ if (gridParams.options && gridParams.options.isFormSubTable) {
929
+ // 如果是子表,只是取消行编辑状态
930
+ const editRow = gridParams.$editRow
931
+ if (editRow) {
932
+ setEntityFieldValue(editRow, '$editing', false)
933
+ gridParams.$editRow = null
934
+ }
935
+ } else {
936
+ // 不是子表
937
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
938
+ const currentSelectCell = that.currentSelectCell
939
+ if (currentSelectCell) {
940
+ const textAreaCell = currentSelectCell.querySelector('.el-textarea')
941
+ if (textAreaCell) {
942
+ return
943
+ }
944
+ }
945
+ // 表示不是表单子表时,才需要回车保存
946
+ const rowIndex = gridParams.$rowIndex
947
+ if (rowIndex !== undefined && rowIndex !== null) {
948
+ const row = gridParams.gridData[rowIndex]
949
+ if (isEditOptionFunction('enter', that.listCode)) {
950
+ gridParams.options.lineEditOptions.enter.call(
951
+ that,
952
+ rowIndex,
953
+ that.column,
954
+ row,
955
+ gridParams.orgGridData[rowIndex],
956
+ gridParams.additionalParamMap
957
+ )
958
+ } else {
959
+ that.saveRow(rowIndex, that.code)
960
+ }
961
+ }
962
+ }
963
+ }
964
+ },
965
+ // ESC键取消行编辑
966
+ escOperation(that) {
967
+ const gridParams = store.get(that.code)
968
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
969
+ // 表示不是表单子表时,才需要处理ESC取消操作
970
+ const rowIndex = gridParams.$rowIndex
971
+ if (rowIndex !== undefined && rowIndex !== null) {
972
+ that.restoreRow(rowIndex, that.code)
973
+ const row = gridParams.gridData[rowIndex]
974
+ if (isEditOptionFunction('esc', that.listCode)) {
975
+ gridParams.options.lineEditOptions.esc.call(
976
+ that,
977
+ rowIndex,
978
+ that.column,
979
+ row,
980
+ gridParams.orgGridData[rowIndex],
981
+ gridParams.additionalParamMap
982
+ )
983
+ } else {
984
+ that.restoreRow(rowIndex, that.code)
985
+ }
986
+ }
987
+ }
988
+ },
989
+ // 是否正在编辑行,如果正在编辑左右上下箭头事件不需要生效
990
+ isEditRow(that) {
991
+ const currentSelectCell = that.currentSelectCell
992
+ if (currentSelectCell) {
993
+ const inputInner = currentSelectCell.querySelector('.el-input__inner')
994
+ if (inputInner) {
995
+ return true
996
+ }
997
+ }
998
+ return false
999
+ },
1000
+ // 选中上方单元格
1001
+ selectUpCell(that) {
1002
+ const currentSelectCell = that.currentSelectCell
1003
+ if (currentSelectCell) {
1004
+ const trDom = currentSelectCell.parentNode
1005
+ if (trDom) {
1006
+ let tdClass = null
1007
+ let classes = null
1008
+ const classObj = currentSelectCell.attributes['class']
1009
+ if (classObj) {
1010
+ classes = classObj['nodeValue']
1011
+ }
1012
+ if (classes && classes.indexOf(' ') > 0) {
1013
+ const classArr = classes.split(' ')
1014
+ tdClass = classArr[0]
1015
+ }
1016
+ const preTr = trDom['previousSibling']
1017
+ if (preTr) {
1018
+ const targetCell = preTr.querySelector('.' + tdClass)
1019
+ that.currentSelectCell = targetCell
1020
+ }
1021
+ }
1022
+ }
1023
+ },
1024
+ // 选中下方单元格
1025
+ selectDownCell(that) {
1026
+ const currentSelectCell = that.currentSelectCell
1027
+ if (currentSelectCell) {
1028
+ const trDom = currentSelectCell.parentNode
1029
+ if (trDom) {
1030
+ let tdClass = null
1031
+ let classes = null
1032
+ const classObj = currentSelectCell.attributes['class']
1033
+ if (classObj) {
1034
+ classes = classObj['nodeValue']
1035
+ }
1036
+ if (classes && classes.indexOf(' ') > 0) {
1037
+ const classArr = classes.split(' ')
1038
+ tdClass = classArr[0]
1039
+ }
1040
+ const preTr = trDom['nextSibling']
1041
+ if (preTr) {
1042
+ const targetCell = preTr.querySelector('.' + tdClass)
1043
+ that.currentSelectCell = targetCell
1044
+ }
1045
+ }
1046
+ }
1047
+ },
1048
+ // 选中右侧单元格
1049
+ selectRightCell(that) {
1050
+ if (that.currentSelectCell) {
1051
+ const nextCell = that.currentSelectCell['nextSibling']
1052
+ if (nextCell) {
1053
+ let classes
1054
+ const classObj = nextCell.attributes['class']
1055
+ if (classObj) {
1056
+ classes = classObj['nodeValue']
1057
+ }
1058
+ if (classes && classes.indexOf(' is-hidden') > 0) {
1059
+ // 表示需要处理冻结列情况
1060
+ that.getTargetCellWithFixTable(that, classes, nextCell)
1061
+ } else {
1062
+ that.currentSelectCell = nextCell
1063
+ }
1064
+ }
1065
+ }
1066
+ },
1067
+ // 选中左侧单元格
1068
+ selectLeftCell(that) {
1069
+ if (that.currentSelectCell) {
1070
+ const preCell = that.currentSelectCell['previousSibling']
1071
+ if (preCell) {
1072
+ let classes
1073
+ const classObj = preCell.attributes['class']
1074
+ if (classObj) {
1075
+ classes = classObj['nodeValue']
1076
+ }
1077
+ if (classes && classes.indexOf(' is-hidden') > 0) {
1078
+ // 表示需要处理冻结列情况
1079
+ that.getTargetCellWithFixTable(that, classes, preCell)
1080
+ } else {
1081
+ that.currentSelectCell = preCell
1082
+ }
1083
+ }
1084
+ }
1085
+ },
1086
+ // 左右箭头时,有冻结列时,获得目的单元格
1087
+ getTargetCellWithFixTable(that, classes, currentCell) {
1088
+ const tr = currentCell.parentNode
1089
+ if (tr) {
1090
+ const tbody = tr.parentNode
1091
+ if (tbody) {
1092
+ const table = tbody.parentNode
1093
+ if (table) {
1094
+ const tableDiv = table.parentNode
1095
+ if (tableDiv) {
1096
+ const classObj = tableDiv.attributes['class']
1097
+ if (classObj) {
1098
+ const tableDivClasses = classObj['nodeValue']
1099
+ if (
1100
+ tableDivClasses &&
1101
+ tableDivClasses.indexOf('el-table__fixed-body-wrapper') >= 0
1102
+ ) {
1103
+ // 表示当前单元格是冻结列中的,需要在非冻结列中获得该单元格
1104
+ let tdClass = null
1105
+ if (classes && classes.indexOf(' ') > 0) {
1106
+ const classArr = classes.split(' ')
1107
+ tdClass = classArr[0]
1108
+ }
1109
+ if (tdClass) {
1110
+ const targetCell = document.querySelector(
1111
+ '.' +
1112
+ this.code +
1113
+ ' .el-table__body-wrapper .current-row .' +
1114
+ tdClass
1115
+ )
1116
+ that.currentSelectCell = targetCell
1117
+ }
1118
+ } else if (
1119
+ tableDivClasses &&
1120
+ tableDivClasses.indexOf('el-table__body-wrapper') >= 0
1121
+ ) {
1122
+ // 表示当前单元格是非冻结列中的,需要在冻结列中获得该单元格
1123
+ let tdClass = null
1124
+ if (classes && classes.indexOf(' ') > 0) {
1125
+ const classArr = classes.split(' ')
1126
+ tdClass = classArr[0]
1127
+ }
1128
+ if (tdClass) {
1129
+ const targetCell = document.querySelector(
1130
+ '.' +
1131
+ this.code +
1132
+ ' .el-table__fixed-body-wrapper .current-row .' +
1133
+ tdClass
1134
+ )
1135
+ that.currentSelectCell = targetCell
1136
+ }
1137
+ }
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ }
1143
+ },
1144
+ // 存储有默认值的字段集合
1145
+ storeHasDefaultValueColumns(column, gridParams) {
1146
+ if (
1147
+ column.defaultValue !== undefined &&
1148
+ column.defaultValue !== null &&
1149
+ column.defaultValue !== ''
1150
+ ) {
1151
+ if (
1152
+ gridParams.defaultValueColumns === undefined ||
1153
+ gridParams.defaultValueColumns === null
1154
+ ) {
1155
+ gridParams.defaultValueColumns = []
1156
+ }
1157
+ gridParams.defaultValueColumns.push(column)
1158
+ }
1159
+ },
1160
+ // 判断是不是表单子表的使用
1161
+ judgeIsFormSubTable() {
1162
+ // 没有分页
1163
+ // 没有排序
1164
+ const gridParams = store.get(this.code)
1165
+ if (
1166
+ gridParams &&
1167
+ gridParams.options &&
1168
+ gridParams.options.isFormSubTable !== undefined &&
1169
+ gridParams.options.isFormSubTable === true
1170
+ ) {
1171
+ this.isFormSubTable = true
1172
+ }
1173
+ },
1174
+ /**
1175
+ * 给列设置操作信息
1176
+ * @param operationSetting 操作列设置,{prop:[{按钮组件},{按钮组件},{link组件}],prop:[{},{}]}
1177
+ */
1178
+ initColumnOperation(column, operationSetting) {
1179
+ if (operationSetting && operationSetting[column.prop]) {
1180
+ const prop = column.prop
1181
+ column.operations = operationSetting[prop]
1182
+ }
1183
+ },
1184
+ // 获得属性列操作信息
1185
+ getOptionOperations() {
1186
+ if (
1187
+ typeof this.options['operations'] !== 'undefined' &&
1188
+ this.options['operations'] !== null
1189
+ ) {
1190
+ return this.options['operations']
1191
+ }
1192
+ },
1193
+ initSetting() {
1194
+ const gridParams = store.get(this.code)
1195
+ if (typeof this.options !== 'undefined') {
1196
+ Object.assign(gridParams.options, this.options)
1197
+ if (!gridParams.options.lineEditOptions) {
1198
+ gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
1199
+ }
1200
+ if (
1201
+ typeof this.options['customFormatter'] !== 'undefined' &&
1202
+ this.options['customFormatter'] !== null
1203
+ ) {
1204
+ this.myCustomFormatter = this.options['customFormatter']
1205
+ }
1206
+ } else {
1207
+ gridParams.options = {}
1208
+ gridParams.options.lineEditOptions = gridParams.defaultLineEditOptions
1209
+ }
1210
+ if (!isHasEditOption('input', this.code)) {
1211
+ gridParams.options.lineEditOptions.input =
1212
+ gridParams.defaultLineEditOptions.input
1213
+ }
1214
+ if (
1215
+ !this.myCustomFormatter &&
1216
+ typeof this.customFormatter !== 'undefined' &&
1217
+ this.customFormatter !== null
1218
+ ) {
1219
+ this.myCustomFormatter = this.customFormatter
1220
+ }
1221
+ if (
1222
+ this.options &&
1223
+ this.options.dynamicServiceName &&
1224
+ this.options.dynamicServiceName !== undefined
1225
+ ) {
1226
+ this.dynamicServiceName = this.options.dynamicServiceName
1227
+ gridParams.dynamicServiceName = this.dynamicServiceName
1228
+ }
1229
+ if (
1230
+ this.options &&
1231
+ this.options.system &&
1232
+ this.options.system !== undefined
1233
+ ) {
1234
+ gridParams.system = this.options.system
1235
+ }
1236
+ if (
1237
+ this.options &&
1238
+ this.options.additionalParamMap &&
1239
+ this.options.additionalParamMap !== undefined
1240
+ ) {
1241
+ gridParams.additionalParamMap = this.options.additionalParamMap
1242
+ }
1243
+ },
1244
+ changeRowStyle(param) {
1245
+ // param的格式:{row, rowIndex}
1246
+ const gridParams = store.get(this.code)
1247
+ if (this.lineEdit && this.lineEdit.editable) {
1248
+ if (param.rowIndex === gridParams.$rowIndex) {
1249
+ if (
1250
+ !isObjectValueEqual(
1251
+ param.row,
1252
+ gridParams.orgGridData[gridParams.$rowIndex]
1253
+ )
1254
+ ) {
1255
+ // return { 'background': 'rgb(245, 181, 203)' }
1256
+ }
1257
+ }
1258
+ }
1259
+ if (isHasOptionFunction('rowStyleRender', this.code)) {
1260
+ param.additionalParamMap = gridParams.additionalParamMap
1261
+ return gridParams.options.rowStyleRender.call(this, param)
1262
+ }
1263
+ if (
1264
+ this.options &&
1265
+ this.options.renderRow &&
1266
+ this.options.renderRow.hasOwnProperty(param.rowIndex)
1267
+ ) {
1268
+ return { background: this.options.renderRow[param.rowIndex] }
1269
+ }
1270
+ },
1271
+ changeCellStyle(param) {
1272
+ const gridParams = store.get(this.code)
1273
+ let funName = null
1274
+ let columnOptions = null
1275
+ if (param && param.column && param.column.property) {
1276
+ if (gridParams && gridParams.columnOptionMap) {
1277
+ if (gridParams.columnOptionMap[param.column.property]) {
1278
+ columnOptions = gridParams.columnOptionMap[param.column.property]
1279
+ if (columnOptions.events && columnOptions.events.cellStyle) {
1280
+ funName = columnOptions.events.cellStyle
1281
+ }
1282
+ }
1283
+ }
1284
+ }
1285
+ // {row, column, rowIndex, columnIndex}
1286
+ // 获取对应单元格配置
1287
+ if (isHasOptionFunction('cellStyleRender', this.code)) {
1288
+ param.additionalParamMap = gridParams.additionalParamMap
1289
+ return gridParams.options.cellStyleRender.call(this, param)
1290
+ } else if (
1291
+ funName !== null &&
1292
+ columnOptions !== null &&
1293
+ gridParams.options &&
1294
+ gridParams.options['eventCallBack'] &&
1295
+ gridParams.options['eventCallBack'][funName] &&
1296
+ typeof gridParams.options['eventCallBack'][funName] === 'function'
1297
+ ) {
1298
+ const params = {
1299
+ value: param.row[param.column.property],
1300
+ row: param.row,
1301
+ column: columnOptions,
1302
+ prop: param.column.property,
1303
+ additionalParamMap: gridParams.additionalParamMap,
1304
+ }
1305
+ return gridParams.options['eventCallBack'][funName].call(this, params)
1306
+ }
1307
+ },
1308
+ changeHeaderStyle(param) {
1309
+ // param的格式:{row, column, rowIndex, columnIndex}
1310
+ // 区分是编辑模式还是应用模式
1311
+ if (
1312
+ typeof this.options.isAdministerListView !== 'undefined' &&
1313
+ this.options.isAdministerListView != null &&
1314
+ this.options.isAdministerListView === true
1315
+ ) {
1316
+ // 编辑模式
1317
+ const column = param.column
1318
+ if (column.type === 'selection') {
1319
+ if (this.backgroundColorMap['$selection']) {
1320
+ return { background: this.backgroundColorMap['$selection'] }
1321
+ }
1322
+ } else if (
1323
+ column.type &&
1324
+ column.type === 'default' &&
1325
+ !column.property
1326
+ ) {
1327
+ if (this.backgroundColorMap['$index']) {
1328
+ return { background: this.backgroundColorMap['$index'] }
1329
+ }
1330
+ } else {
1331
+ if (column.property && this.backgroundColorMap[column.property]) {
1332
+ return { background: this.backgroundColorMap[column.property] }
1333
+ }
1334
+ }
1335
+ } else {
1336
+ const gridParams = store.get(this.code)
1337
+ let funName = null
1338
+ let columnOptions = null
1339
+ if (param && param.column && param.column.property) {
1340
+ if (gridParams && gridParams.columnOptionMap) {
1341
+ if (gridParams.columnOptionMap[param.column.property]) {
1342
+ columnOptions = gridParams.columnOptionMap[param.column.property]
1343
+ if (
1344
+ columnOptions.events &&
1345
+ columnOptions.events.headerCellStyle
1346
+ ) {
1347
+ funName = columnOptions.events.headerCellStyle
1348
+ }
1349
+ }
1350
+ }
1351
+ }
1352
+ // 应用模式
1353
+ // 修改表头样式,当某些字段需要编辑时,某些字段不需要编辑时,为了突出显示有权限编辑的字段,可以使用该功能
1354
+ if (
1355
+ gridParams.options.renderHeader &&
1356
+ gridParams.options.renderHeader.props
1357
+ ) {
1358
+ const column = param.column
1359
+ const props = gridParams.options.renderHeader.props
1360
+ const propsArr = props.split(',')
1361
+ for (let i = 0; i < propsArr.length; i++) {
1362
+ const prop = propsArr[i]
1363
+ if (column.property === prop.trim()) {
1364
+ let backgroundColor = '#c3f4e2'
1365
+ if (
1366
+ typeof gridParams.options.renderHeader.color !== 'undefined'
1367
+ ) {
1368
+ backgroundColor = gridParams.options.renderHeader.color
1369
+ }
1370
+ return { background: backgroundColor }
1371
+ }
1372
+ }
1373
+ } else if (
1374
+ funName !== null &&
1375
+ columnOptions !== null &&
1376
+ gridParams.options &&
1377
+ gridParams.options['eventCallBack'] &&
1378
+ gridParams.options['eventCallBack'][funName] &&
1379
+ typeof gridParams.options['eventCallBack'][funName] === 'function'
1380
+ ) {
1381
+ // const param = { value: param.row[param.column.property], row: param.row, column: columnOptions, prop: param.column.property }
1382
+ param.additionalParamMap = gridParams.additionalParamMap
1383
+ return gridParams.options['eventCallBack'][funName].call(this, param)
1384
+ }
1385
+ }
1386
+ },
1387
+ fetchData(searchParam, isSearch, parentRowIds, resove) {
1388
+ const gridParams = store.get(this.code)
1389
+ // 查询数据需要区分,如果时列表管理编辑模式,使用静态数据
1390
+ if (gridParams.options && gridParams.options.isPageInfo) {
1391
+ // 预览模式且从表单子表进入
1392
+ } else {
1393
+ if (gridParams.options && gridParams.options.isAdministerListView) {
1394
+ // 根据类型生成静态数据
1395
+ if (
1396
+ gridParams.options.SuperGrid &&
1397
+ gridParams.options.SuperGrid.simulationDate
1398
+ ) {
1399
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1400
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1401
+ gridData: gridParams.options.SuperGrid.simulationDate,
1402
+ columns: gridParams.columns,
1403
+ additionalParamMap: gridParams.additionalParamMap,
1404
+ })
1405
+ if (gridData) {
1406
+ this.gridData = gridData
1407
+ } else {
1408
+ this.gridData = gridParams.options.SuperGrid.simulationDate
1409
+ }
1410
+ } else {
1411
+ this.gridData = gridParams.options.SuperGrid.simulationDate
1412
+ }
1413
+ gridParams.gridData = this.gridData
1414
+ }
1415
+ } else if (
1416
+ gridParams.options &&
1417
+ gridParams.options.isFormSubTable &&
1418
+ gridParams.options.subTableData &&
1419
+ gridParams.options.subTableData.length > 0
1420
+ ) {
1421
+ this.packageSubTableData(gridParams, gridParams.options.subTableData)
1422
+ } else {
1423
+ const isCanRefreshTableData = this.canRefreshTableData(gridParams)
1424
+ if (isCanRefreshTableData) {
1425
+ // 可以刷新表格记录
1426
+ return this.fetchListData(
1427
+ searchParam,
1428
+ isSearch,
1429
+ parentRowIds,
1430
+ resove
1431
+ )
1432
+ } else {
1433
+ // 子表无记录时不需要刷新子表记录。表示是新建或修改时子表无记录,且不需要刷新子表。
1434
+ if (this.isSubTableEmpty(gridParams)) {
1435
+ // 表示是新建表单时,子表记录集合是空数组
1436
+ console.log('子表无记录----code=', this.code, gridParams)
1437
+ const subTableData = []
1438
+ this.packageSubTableData(gridParams, subTableData)
1439
+ }
1440
+ this.hasLoadData = true
1441
+ gridParams.loaded = true
1442
+ }
1443
+ }
1444
+ }
1445
+ },
1446
+ isSubTableEmpty(gridParams) {
1447
+ return (
1448
+ gridParams.options &&
1449
+ gridParams.options.isFormSubTable &&
1450
+ (gridParams.options.subTableData === undefined ||
1451
+ gridParams.options.subTableData === null ||
1452
+ gridParams.options.subTableData.length === 0)
1453
+ )
1454
+ },
1455
+ packageSubTableData(gridParams, initSubTableData) {
1456
+ this.hasLoadData = false
1457
+ gridParams.loaded = true
1458
+ let subTableData = []
1459
+ // 如果有子表数据,则展示传递的子表数据
1460
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1461
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1462
+ gridData: initSubTableData,
1463
+ columns: gridParams.columns,
1464
+ additionalParamMap: gridParams.additionalParamMap,
1465
+ })
1466
+ if (gridData) {
1467
+ subTableData = gridData
1468
+ this.hasLoadData = true
1469
+ } else {
1470
+ subTableData = initSubTableData
1471
+ this.hasLoadData = true
1472
+ }
1473
+ } else {
1474
+ subTableData = initSubTableData
1475
+ this.hasLoadData = true
1476
+ }
1477
+ if (subTableData) {
1478
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1479
+ subTableData.forEach((item) => {
1480
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1481
+ })
1482
+ }
1483
+ if (this.pagination && this.isSubTableShowPage === true) {
1484
+ // 表示子表需要显示分页
1485
+ this.subTableData = subTableData
1486
+ // 更新记录总条数
1487
+ this.pagination.total = this.subTableData.length
1488
+ gridParams.subTableData = this.subTableData
1489
+ this.gridData = this.getSubTableGridData(this.subTableData)
1490
+ } else {
1491
+ this.gridData = subTableData
1492
+ }
1493
+ gridParams.gridData = this.gridData
1494
+ // 完成深拷贝,复制一份对象,行编辑时使用
1495
+ gridParams.orgGridData = [].concat(
1496
+ JSON.parse(JSON.stringify(this.gridData))
1497
+ )
1498
+ },
1499
+ canRefreshTableData(gridParams) {
1500
+ let isCanRefreshTableData = false
1501
+ if (gridParams.options && !gridParams.options.isFormSubTable) {
1502
+ // 如果不是子表时
1503
+ isCanRefreshTableData = true
1504
+ } else if (
1505
+ gridParams.options &&
1506
+ gridParams.options.isFormSubTable &&
1507
+ gridParams.options.canRrefreshSubtableData !== undefined &&
1508
+ gridParams.options.canRrefreshSubtableData === true
1509
+ ) {
1510
+ // 是子表,且配置了子表无记录时更新子表记录集合
1511
+ isCanRefreshTableData = true
1512
+ }
1513
+ return isCanRefreshTableData
1514
+ },
1515
+ getSubTableGridData(subTableData) {
1516
+ let gridData = subTableData
1517
+ if (this.isSubTableShowPage === true) {
1518
+ if (subTableData && subTableData.length > 0) {
1519
+ // const subTableData = JSON.parse(JSON.stringify(this.subTableData))
1520
+ this.pagination.total = subTableData.length
1521
+ // 当前是第几页
1522
+ let currentPage = this.currentPage
1523
+ if (currentPage === undefined || currentPage === null) {
1524
+ currentPage = 1
1525
+ }
1526
+ // 每页显示多少条记录
1527
+ let pageSize = this.pageSize
1528
+ if (pageSize === null && this.pagination) {
1529
+ pageSize = this.pagination.pageSize
1530
+ }
1531
+ if (pageSize === undefined || pageSize === null) {
1532
+ pageSize = 20
1533
+ }
1534
+ // 当前页的第一条记录的数组下标
1535
+ const startRowIndex = (currentPage - 1) * pageSize
1536
+ // 当前页的最后一条记录的数组下标
1537
+ let lastRowIndex = startRowIndex + pageSize
1538
+ if (subTableData.length > startRowIndex) {
1539
+ // 表示当前页有记录
1540
+ if (lastRowIndex > subTableData.length) {
1541
+ // 表示最后一条记录超过下标了
1542
+ lastRowIndex = subTableData.length
1543
+ }
1544
+ // 前包,后不包
1545
+ gridData = subTableData.slice(startRowIndex, lastRowIndex)
1546
+ }
1547
+ }
1548
+ }
1549
+ if (gridData === undefined || gridData === null) {
1550
+ gridData = []
1551
+ }
1552
+ return gridData
1553
+ },
1554
+ fetchListData(searchParam, isSearch, parentRowIds, resove) {
1555
+ return new Promise((resolve, reject) => {
1556
+ this.isLoading = true
1557
+ this.hasLoadData = false
1558
+ if (isSearch === undefined || isSearch === false) {
1559
+ // 如果不是查询时才需要从缓存中获得结果
1560
+ // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
1561
+ const isRefreshList = window.sessionStorage.getItem(
1562
+ 'refreshList-' + this.code
1563
+ )
1564
+ // console.log('fetchData--isRefreshList--', isRefreshList)
1565
+ if (isRefreshList !== undefined && isRefreshList === 'true') {
1566
+ const searchParamJson = window.sessionStorage.getItem(
1567
+ 'searchParam-' + this.code
1568
+ )
1569
+ // console.log('fetchData--searchParamJson--', searchParamJson)
1570
+ // console.log('fetchData--pagination--', this.pagination)
1571
+ if (
1572
+ searchParamJson !== undefined &&
1573
+ searchParamJson !== null &&
1574
+ searchParamJson !== ''
1575
+ ) {
1576
+ searchParam = JSON.parse(searchParamJson)
1577
+ const pagination = searchParam.pagination
1578
+ if (pagination) {
1579
+ this.currentPage = pagination.currentPage
1580
+ this.pagination.pageSize = pagination.pageSize
1581
+ this.pagination.showTotal = pagination.showTotal
1582
+ }
1583
+ this.getInitSearchForm(searchParam.searchForm)
1584
+ // this.searchFormContent = searchParam.searchForm
1585
+ }
1586
+ }
1587
+ }
1588
+ window.sessionStorage.removeItem('refreshList-' + this.code)
1589
+ if (searchParam === undefined) {
1590
+ searchParam = this.getSearchParam()
1591
+ }
1592
+ const gridParams = store.get(this.code)
1593
+ let param = searchParam
1594
+
1595
+ if (gridParams.options.extraParam || parentRowIds !== undefined) {
1596
+ param = getExtraParam(searchParam, gridParams)
1597
+ }
1598
+ // 导出需要这两个参数
1599
+ gridParams.searchParam = searchParam
1600
+ gridParams.url = this.url
1601
+ let requestUrl = this.url
1602
+ if (parentRowIds !== undefined && parentRowIds !== null) {
1603
+ // 表示是查询子集合时
1604
+ param = Object.assign({}, param)
1605
+ // 清空查询子集合时,分页信息,即不需要分页查询子集合
1606
+ param.searchParam.pagination = null
1607
+ // 父节点id传给后台
1608
+ param['parentIds'] = parentRowIds
1609
+ // 父级字段名,例如:parentId 或 fk_parent_id
1610
+ param['parentProp'] = this.parentProp
1611
+ // 传入系统code
1612
+ param.systemCode = getSystemCode()
1613
+
1614
+ requestUrl = this.options.subRowUrl
1615
+ }
1616
+ // 解决新建后,查询,再点新建报“有未保存的行”问题,解决方案是一旦刷新列表,就还原这些状态
1617
+ gridParams.isCreateRow = false
1618
+ gridParams.isEditRow = false
1619
+ gridParams.$lastSaveRowIndex = null
1620
+ gridParams.$rowIndex = null
1621
+ gridParams.canSaveRow = true
1622
+ // 是否根据权限显示数据
1623
+ gridParams.withDataPermission = gridParams.options.isWithDataPermission
1624
+ // 对象是否是流程实体
1625
+ gridParams.isWorkflowEntity = gridParams.options.isWorkflowEntity
1626
+ // 缓存查询条件及当前页数
1627
+ window.sessionStorage.setItem(
1628
+ 'searchParam-' + this.code,
1629
+ JSON.stringify(param)
1630
+ )
1631
+ if (
1632
+ this.parentProp &&
1633
+ searchParam.searchForm &&
1634
+ searchParam.searchForm.length > 0
1635
+ ) {
1636
+ // 表示是树形列表的查询时,查询结果不需要树形显示,后台处理的数据没有加has_children来实现的
1637
+ param.listViewTreeSetting = null
1638
+ }
1639
+ this.$http
1640
+ .post(requestUrl, param)
1641
+ .then((data) => {
1642
+ if (typeof parentRowIds === 'undefined' || parentRowIds === null) {
1643
+ let tableData = []
1644
+ // 对数据做序列化,比如:处理xss攻击
1645
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1646
+ const gridDataLoadedParam = {
1647
+ gridData: data.data,
1648
+ columns: gridParams.columns,
1649
+ additionalParamMap: gridParams.additionalParamMap,
1650
+ }
1651
+ if (searchParam) {
1652
+ gridDataLoadedParam.searchForm = searchParam.searchForm
1653
+ gridDataLoadedParam.additionalParamMap =
1654
+ searchParam.additionalParamMap
1655
+ }
1656
+ const gridData = gridParams.options.gridDataLoaded.call(
1657
+ this,
1658
+ gridDataLoadedParam
1659
+ )
1660
+ if (gridData) {
1661
+ tableData = gridData
1662
+ } else {
1663
+ tableData = data.data
1664
+ }
1665
+ } else {
1666
+ tableData = data.data
1667
+ }
1668
+ if (!tableData) {
1669
+ tableData = []
1670
+ }
1671
+ if (gridParams.options.isFormSubTable) {
1672
+ // 子表时默认不全部行编辑
1673
+ if (tableData) {
1674
+ // 子表时所有记录的所有字段设置默认值null,优化子表编辑时性能
1675
+ tableData.forEach((item) => {
1676
+ this.setColumnsDefaultValue(gridParams.allColumns, item)
1677
+ })
1678
+ }
1679
+ // console.log('子表数据循环', this.gridData)
1680
+ // this.gridData.forEach(item => {
1681
+ // item.$editing = true
1682
+ // })
1683
+ if (this.pagination && this.isSubTableShowPage === true) {
1684
+ // 表示子表需要显示分页
1685
+ this.subTableData = tableData
1686
+ this.gridData = this.getSubTableGridData(this.subTableData)
1687
+ gridParams.subTableData = this.subTableData
1688
+ } else {
1689
+ this.gridData = tableData
1690
+ }
1691
+ if (this.pagination) {
1692
+ this.pagination.total = tableData.length
1693
+ }
1694
+ } else {
1695
+ this.gridData = tableData
1696
+
1697
+ if (this.pagination) {
1698
+ this.pagination.total = data.total
1699
+ }
1700
+ }
1701
+ if (data.summaries && Object.keys(data.summaries).length > 0) {
1702
+ this.summaries = data.summaries
1703
+ }
1704
+
1705
+ gridParams.gridData = this.gridData
1706
+
1707
+ // 完成深拷贝,复制一份对象,行编辑时使用
1708
+ gridParams.orgGridData = [].concat(
1709
+ JSON.parse(JSON.stringify(this.gridData))
1710
+ )
1711
+
1712
+ gridParams.pagination = this.pagination
1713
+ gridParams.loaded = true
1714
+
1715
+ // TODO: 输入焦点默认停在第一个可编辑的单元格
1716
+ if (this.lineEdit.editable) {
1717
+ if (typeof isSearch === 'undefined' || isSearch === false) {
1718
+ // 不是查询时,才需要创建第一行记录
1719
+ if (this.gridData.length === 0) {
1720
+ if (
1721
+ this.options &&
1722
+ this.options.isDefaultShowEdit !== null &&
1723
+ this.options.isDefaultShowEdit !== undefined &&
1724
+ this.options.isDefaultShowEdit === true
1725
+ ) {
1726
+ this.createRow(this.code, null, this.gridData)
1727
+ }
1728
+ }
1729
+ if (this.gridData.length > 0) {
1730
+ this.lineEdit['editingCell'] = {
1731
+ row: 0,
1732
+ prop: getFirstEditableColumn(this.code),
1733
+ }
1734
+ }
1735
+ }
1736
+ }
1737
+ this.hasLoadData = true
1738
+ } else {
1739
+ // 对数据做序列化,比如:处理xss攻击
1740
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1741
+ gridParams.options.gridDataLoaded.call(this, {
1742
+ gridData: data,
1743
+ additionalParamMap: gridParams.additionalParamMap,
1744
+ })
1745
+ }
1746
+
1747
+ if (isHasOptionFunction('loadChildrenComplete', this.code)) {
1748
+ gridParams.options.loadChildrenComplete.call(this, {
1749
+ parentRowIds: parentRowIds,
1750
+ gridData: data,
1751
+ columns: gridParams.columns,
1752
+ additionalParamMap: gridParams.additionalParamMap,
1753
+ })
1754
+ }
1755
+ if (typeof resove !== 'undefined' && resove !== null) {
1756
+ // 首次加载或点击三角展开父节点时走该分支
1757
+ // 刷新数据后,移除该父节点下的所有已选中的子节点记录。
1758
+ // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1759
+ this.removeGridStoreSelection(parentRowIds)
1760
+ resove(data[parentRowIds[0]])
1761
+ } else {
1762
+ // 刷新父记录对应的子记录集合时需要,例如:删除时
1763
+ parentRowIds.forEach((parentRowId) => {
1764
+ // 单行父记录id
1765
+ this.$refs.superGrid.store.states.lazyTreeNodeMap[
1766
+ parentRowId
1767
+ ] = data[parentRowId]
1768
+ this.$refs.superGrid.store.states.treeData[
1769
+ parentRowId
1770
+ ].children = data[parentRowId]
1771
+ })
1772
+ // 刷新数据后,移除该父节点下的所有已选中的子节点记录
1773
+ // 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
1774
+ this.removeGridStoreSelection(parentRowIds)
1775
+ }
1776
+ this.hasLoadData = true
1777
+ }
1778
+ resolve()
1779
+ })
1780
+ .catch((error) => {
1781
+ if (isHasOptionFunction('loadError', this.code)) {
1782
+ gridParams.options.loadError.call(this, this.code, error)
1783
+ }
1784
+ reject(error)
1785
+ })
1786
+ })
1787
+ },
1788
+ // 获得初始查询条件对象
1789
+ getInitSearchForm(searchFormArr) {
1790
+ const gridParams = store.get(this.code)
1791
+ if (searchFormArr && searchFormArr.length > 0) {
1792
+ this.searchFormContent = {}
1793
+ searchFormArr.forEach((item) => {
1794
+ // 获得的是"isDeleted"
1795
+ let prop = item.propName
1796
+ // 获得的是“deleted”
1797
+ const columnProp = item.columnProp
1798
+ const dataType = item.dataType
1799
+ if (dataType && dataType === 'BOOLEAN') {
1800
+ prop = columnProp
1801
+ }
1802
+ this.initSearchProps.push(prop)
1803
+ const propValue = item.propValue
1804
+ if (prop && prop.indexOf('.') > 0) {
1805
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
1806
+ addDynamicProp(this.searchFormContent, prop, propValue)
1807
+ } else {
1808
+ this.searchFormContent[prop] = propValue
1809
+ }
1810
+ })
1811
+ gridParams.searchForm = searchFormArr
1812
+ // 调用查询api方法,该方法中调用了@showSearch方法,用于控制“查询”按钮改名为“取消查询”
1813
+ this.showSearchForm()
1814
+ } else {
1815
+ gridParams.searchForm = null
1816
+ }
1817
+ },
1818
+ showDemo() {
1819
+ this.isLoading = true
1820
+ this.$http
1821
+ .get(this.url)
1822
+ .then((data) => {
1823
+ // 根据this.options.showColumns设置显示的字段
1824
+ this.getShowColumns(data)
1825
+
1826
+ Object.assign(this, data)
1827
+ const gridParams = store.get(this.code)
1828
+ gridParams.listCode = this.code
1829
+
1830
+ gridParams.columns = this.columns
1831
+ if (gridParams.columns && this.options.dynamicColumns) {
1832
+ for (var i = 0; i < this.options.dynamicColumns.length; i++) {
1833
+ this.options.dynamicColumns[i].dynamic = true
1834
+ gridParams.columns.push(this.options.dynamicColumns[i])
1835
+ }
1836
+ }
1837
+ gridParams.lineEdit = this.lineEdit
1838
+ gridParams.basicInfo = this.basicInfo
1839
+ gridParams.pagination = this.pagination
1840
+ gridParams.query = this.query
1841
+
1842
+ this.gridData = data.gridData
1843
+ // 对数据做序列化,比如:处理xss攻击
1844
+ if (isHasOptionFunction('gridDataLoaded', this.code)) {
1845
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
1846
+ gridData: data.gridData,
1847
+ additionalParamMap: gridParams.additionalParamMap,
1848
+ })
1849
+ if (gridData) {
1850
+ this.gridData = gridData
1851
+ } else {
1852
+ this.gridData = data.gridData
1853
+ }
1854
+ } else {
1855
+ this.gridData = data.gridData
1856
+ }
1857
+
1858
+ if (this.pagination) {
1859
+ this.pagination.total = data.total
1860
+ }
1861
+ if (!this.gridData) {
1862
+ this.gridData = []
1863
+ }
1864
+ gridParams.gridData = this.gridData
1865
+ // 完成深拷贝,复制一份对象,行编辑时使用
1866
+ gridParams.orgGridData = [].concat(
1867
+ JSON.parse(JSON.stringify(this.gridData))
1868
+ )
1869
+ gridParams.pagination = this.pagination
1870
+
1871
+ // TODO: 输入焦点默认停在第一个可编辑的单元格
1872
+ if (this.lineEdit.editable) {
1873
+ if (this.gridData.length === 0) {
1874
+ this.createRow(this.code, null, this.gridData)
1875
+ }
1876
+ this.lineEdit['editingCell'] = {
1877
+ row: 0,
1878
+ prop: getFirstEditableColumn(this.code),
1879
+ }
1880
+ }
1881
+ if (isHasOptionFunction('gridComplete', this.code)) {
1882
+ gridParams.options.gridComplete.call(
1883
+ this,
1884
+ this.gridData,
1885
+ gridParams.columns
1886
+ )
1887
+ }
1888
+ })
1889
+ .catch((error) => {
1890
+ if (isHasOptionFunction('loadError', this.code)) {
1891
+ const gridParams = store.get(this.code)
1892
+ gridParams.options.loadError.call(this, this.code, error)
1893
+ }
1894
+ })
1895
+ },
1896
+ doSearch(searchForm) {
1897
+ // 修改当前页为第1页
1898
+ this.currentPage = 1
1899
+ // 将toolbar 参数和查询表单参数合并
1900
+ if (searchForm && searchForm.length > 0) {
1901
+ if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
1902
+ if (searchForm.length === 1) {
1903
+ searchForm[0].leftBracket = '('
1904
+ searchForm[0].rightBracket = ')'
1905
+ }
1906
+ if (searchForm[searchForm.length - 1].joinSign === 'or') {
1907
+ searchForm[searchForm.length - 1].joinSign = 'and'
1908
+ }
1909
+ // 拼接
1910
+ // param.concat(toolbarFieldParam)
1911
+ Array.prototype.push.apply(searchForm, this.toolbarFieldParam)
1912
+ }
1913
+ } else {
1914
+ if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
1915
+ searchForm = this.toolbarFieldParam
1916
+ }
1917
+ }
1918
+ this.search(searchForm, true)
1919
+ },
1920
+ doSearchDialog(searchForm) {
1921
+ // 修改当前页为第1页
1922
+ this.currentPage = 1
1923
+ this.search(searchForm, true)
1924
+ this.closeSearchFormDialog()
1925
+ },
1926
+ // cs123
1927
+ search(searchForm, isSearch, parentRowIds) {
1928
+ // 重新查询列表数据时,抛出refresh事件,供父组件捕获做自己的业务处理
1929
+ $emit(this, 'refresh')
1930
+ const vm = this
1931
+ return new Promise((resolve, reject) => {
1932
+ const gridParams = store.get(vm.code)
1933
+ if (typeof searchForm !== 'undefined' && searchForm !== null) {
1934
+ gridParams.searchForm = searchForm
1935
+ } else {
1936
+ gridParams.searchForm = null
1937
+ }
1938
+ if (gridParams.options && gridParams.options.isAdministerListView) {
1939
+ // 根据类型生成静态数据
1940
+ if (
1941
+ gridParams.options.SuperGrid &&
1942
+ gridParams.options.SuperGrid.simulationDate
1943
+ ) {
1944
+ let gridData
1945
+ if (isHasOptionFunction('gridDataLoaded', vm.code)) {
1946
+ gridData = gridParams.options.gridDataLoaded.call(this, {
1947
+ gridData: gridParams.options.SuperGrid.simulationDate,
1948
+ columns: gridParams.columns,
1949
+ additionalParamMap: gridParams.additionalParamMap,
1950
+ })
1951
+ if (!gridData) {
1952
+ gridData = gridParams.options.SuperGrid.simulationDate
1953
+ }
1954
+ } else {
1955
+ gridData = gridParams.options.SuperGrid.simulationDate
1956
+ }
1957
+ resolve(gridData)
1958
+ }
1959
+ } else if (
1960
+ gridParams.options &&
1961
+ gridParams.options.isFormSubTable &&
1962
+ gridParams.options.subTableData &&
1963
+ gridParams.options.subTableData.length > 0
1964
+ ) {
1965
+ let gridData
1966
+ vm.hasLoadData = false
1967
+ gridParams.loaded = true
1968
+ // 如果有子表数据,则展示传递的子表数据
1969
+ if (isHasOptionFunction('gridDataLoaded', vm.code)) {
1970
+ gridData = gridParams.options.gridDataLoaded.call(this, {
1971
+ gridData: gridParams.options.subTableData,
1972
+ columns: gridParams.columns,
1973
+ additionalParamMap: gridParams.additionalParamMap,
1974
+ })
1975
+ if (!gridData) {
1976
+ gridData = gridParams.options.subTableData
1977
+ vm.hasLoadData = true
1978
+ }
1979
+ } else {
1980
+ gridData = gridParams.options.subTableData
1981
+ vm.hasLoadData = true
1982
+ }
1983
+ resolve(gridData)
1984
+ } else {
1985
+ vm.fetchData(vm.getSearchParam(), isSearch, parentRowIds)
1986
+ .then((data) => {
1987
+ console.log('打印1====', gridParams)
1988
+ if (
1989
+ gridParams !== undefined &&
1990
+ gridParams.options !== undefined &&
1991
+ gridParams.options.isHiddenSearchForm !== undefined &&
1992
+ gridParams.options.isHiddenSearchForm === true
1993
+ ) {
1994
+ // 查询时,是否隐藏查询区域,默认是不隐藏查询区域
1995
+ console.log('打印2====', vm)
1996
+ vm.showSearch = false
1997
+ $emit(vm, 'cancel-search')
1998
+ }
1999
+ console.log('打印3====', vm)
2000
+ console.log('打印4====', vm.$refs)
2001
+ if (vm.$refs && vm.$refs.sf) {
2002
+ console.log('打印5====', vm.$refs.sf)
2003
+ vm.$refs.sf.loading = false
2004
+ vm.$refs.sf.searchComplete()
2005
+ }
2006
+ console.log('打印6====', vm)
2007
+ // 重新计算列表高度
2008
+ this.resizeTableHeight()
2009
+ resolve(data)
2010
+ })
2011
+ .catch((error) => {
2012
+ if (vm.$refs.sf) {
2013
+ vm.$refs.sf.loading = false
2014
+ vm.$refs.sf.searchComplete()
2015
+ }
2016
+ reject(error)
2017
+ })
2018
+ }
2019
+ })
2020
+ },
2021
+ // addSearchParam(searchData) {
2022
+ // if (searchData && searchData.length > 0) {
2023
+ // const gridParams = store.get(this.code)
2024
+ // if (typeof (gridParams.searchForm) !== 'undefined') {
2025
+ // const searchForm = gridParams.searchForm
2026
+ // searchForm.concat()
2027
+ // searchParam.searchForm = gridParams.searchForm
2028
+ // } else {
2029
+ // searchParam.searchForm = []
2030
+ // }
2031
+ // }
2032
+ // },
2033
+ getPaginationInfo() {
2034
+ const gridParams = store.get(this.code)
2035
+ if (this.pagination) {
2036
+ // 判断是否删除后请求数据
2037
+ if (this.isDelete && this.currentPage > 1) {
2038
+ const pageNum = Math.ceil(
2039
+ (this.pagination.total - this.gridData.length) /
2040
+ this.pagination.pageSize
2041
+ )
2042
+ this.currentPage =
2043
+ this.currentPage > pageNum ? pageNum : this.currentPage
2044
+ this.isDelete = false
2045
+ }
2046
+ const pagination = {
2047
+ currentPage: this.currentPage,
2048
+ pageSize: this.pagination.pageSize,
2049
+ showTotal: this.pagination.showTotal,
2050
+ }
2051
+ if (this.pageSize !== null) {
2052
+ // 表示更改了每页显示的数据条数
2053
+ pagination.pageSize = this.pageSize
2054
+ }
2055
+ if (
2056
+ typeof gridParams.currentPage !== 'undefined' &&
2057
+ gridParams.currentPage !== null
2058
+ ) {
2059
+ // 保持页数时使用
2060
+ pagination.currentPage = gridParams.currentPage
2061
+ // 必须清空一下,否则会导致翻页有问题
2062
+ gridParams.currentPage = null
2063
+ }
2064
+ return pagination
2065
+ } else {
2066
+ // TODO 临时解决列表工具栏有默认值时触发查询,查询没有分页问题,
2067
+ // 因为获取页面默认值后触发查询时候,列表的配置信息,比如分页是否编辑等元数据还没有查询过来
2068
+ return {
2069
+ currentPage: 1,
2070
+ pageSize: 20,
2071
+ showTotal: true,
2072
+ }
2073
+ }
2074
+ },
2075
+ getSearchParam() {
2076
+ const searchParam = {
2077
+ code: this.code,
2078
+ }
2079
+ const gridParams = store.get(this.code)
2080
+ const pagination = this.getPaginationInfo()
2081
+ if (pagination && pagination !== null) {
2082
+ searchParam.pagination = pagination
2083
+ }
2084
+ // 排序信息
2085
+ if (this.sortInfo !== null) {
2086
+ // 表示更改了排序信息
2087
+ searchParam.sorts = this.sortInfo
2088
+ }
2089
+ if (this.mergeFields && this.mergeFields.length > 0) {
2090
+ if (!searchParam.sorts) {
2091
+ searchParam.sorts = []
2092
+ }
2093
+ const mergeFieldsArr = []
2094
+ for (const mergeField of this.mergeFields) {
2095
+ let flag = true
2096
+ for (const so of searchParam.sorts) {
2097
+ if (so.prop === mergeField) {
2098
+ flag = false
2099
+ break
2100
+ }
2101
+ }
2102
+ if (flag) {
2103
+ mergeFieldsArr.push({
2104
+ prop: mergeField,
2105
+ order: 'ascending',
2106
+ })
2107
+ }
2108
+ }
2109
+ mergeFieldsArr.push(...searchParam.sorts)
2110
+ searchParam.sorts = mergeFieldsArr
2111
+ }
2112
+ // 是否有初始过滤条件
2113
+ if (
2114
+ gridParams.options &&
2115
+ typeof gridParams.options.initSearchForm !== 'undefined'
2116
+ ) {
2117
+ searchParam.initSearchForm = gridParams.options.initSearchForm
2118
+ }
2119
+ if (
2120
+ gridParams.query &&
2121
+ typeof gridParams.query.defaultQueryCriteria !== 'undefined'
2122
+ ) {
2123
+ // json字符串转数组
2124
+ searchParam.defaultQueryCriteria = JSON.parse(
2125
+ gridParams.query.defaultQueryCriteria
2126
+ )
2127
+ }
2128
+ if (typeof gridParams.searchForm !== 'undefined') {
2129
+ searchParam.searchForm = gridParams.searchForm
2130
+ } else {
2131
+ searchParam.searchForm = []
2132
+ }
2133
+ if (this.dynamicColumnInfo) {
2134
+ searchParam.dynamicColumnInfo = this.dynamicColumnInfo
2135
+ }
2136
+ if (this.dynamicServiceName) {
2137
+ searchParam.dynamicServiceName = this.dynamicServiceName
2138
+ }
2139
+ const additionalParamMap = gridParams.additionalParamMap
2140
+ if (additionalParamMap) {
2141
+ if (additionalParamMap && typeof additionalParamMap === 'object') {
2142
+ searchParam.additionalParamMap = additionalParamMap
2143
+ } else if (additionalParamMap && additionalParamMap !== '') {
2144
+ searchParam.additionalParamMap = JSON.parse(additionalParamMap)
2145
+ }
2146
+ }
2147
+ return searchParam
2148
+ },
2149
+ getComponentType(prop) {
2150
+ let type = 'NormalColumn'
2151
+ if (prop === '$index') {
2152
+ type = 'IndexColumn'
2153
+ } else if (prop === '$selection') {
2154
+ // 设置选中行时使用
2155
+ store.get(this.code).isMulitiSelect = true
2156
+ type = 'SelectionColumn'
2157
+ } else if (prop === undefined) {
2158
+ type = 'GroupColumn'
2159
+ }
2160
+ // console.log('%c描述-180428','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',this.myCustomFormatter);
2161
+ // console.log('%c描述-155704','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',type);
2162
+ return type
2163
+ },
2164
+ focusOnFirstEditableInput() {
2165
+ if (this.basicInfo.editable) {
2166
+ this.lineEdit.editingCell.row = 0
2167
+ this.lineEdit.editingCell.prop = getFirstEditableColumn(this.code)
2168
+ }
2169
+ },
2170
+ handleSizeChange(val) {
2171
+ if (!this.options || !this.options.isPageShow) {
2172
+ // console.log(`每页 ${val} 条`)
2173
+ this.currentPage = 1
2174
+ this.pageSize = val
2175
+ this.pagination.pageSize = val
2176
+ this.changePage()
2177
+ }
2178
+ },
2179
+ handleCurrentChange(val) {
2180
+ if (!this.options || !this.options.isPageShow) {
2181
+ // 翻页操作会导致筛选项发生变化,所以需要清空已有的
2182
+ this.changePage()
2183
+ }
2184
+ },
2185
+ changePage() {
2186
+ // 翻页操作会导致筛选项发生变化,所以需要清空已有的
2187
+ this.$refs.superGrid.clearFilter()
2188
+ // TODO: 把当前页数、每页条数、查询条件、排序信息传回后台
2189
+ if (this.isSubTableShowPage) {
2190
+ this.gridData = this.getSubTableGridData(this.subTableData)
2191
+ const gridParams = store.get(this.code)
2192
+ gridParams.gridData = this.gridData
2193
+ // 完成深拷贝,复制一份对象,行编辑时使用
2194
+ gridParams.orgGridData = [].concat(
2195
+ JSON.parse(JSON.stringify(this.gridData))
2196
+ )
2197
+ } else {
2198
+ this.fetchData(this.getSearchParam())
2199
+ }
2200
+ },
2201
+ handleSortChange({ column, prop, order }) {
2202
+ if (!this.options || !this.options.isPageShow) {
2203
+ let columnSetting = null
2204
+ const items = this.visibleColumns.filter((item) => {
2205
+ return column.property === item.prop
2206
+ })
2207
+ if (items && items.length > 0) {
2208
+ columnSetting = items[0]
2209
+ }
2210
+ if (!isCanRefreshGrid(this.code)) {
2211
+ // 如果最后编辑行没有保存或撤销编辑,则给出提示
2212
+ const gridParams = store.get(this.code)
2213
+ console.log(
2214
+ '请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序'
2215
+ )
2216
+ this.$refs.superGrid.clearSort()
2217
+ } else {
2218
+ // TODO: 应该调用fetchData来获取信息,把当前页数、查询条件、排序信息传回后台
2219
+ if (prop !== null && columnSetting && columnSetting !== null) {
2220
+ // 当点击第3次时,prop会是空,表示清空排序字段,还原原顺序
2221
+ let orgProp = columnSetting.orgProp
2222
+ // sql查询时,会把点“.”改为两个下划线"__"
2223
+ const replaceDot = '__'
2224
+ if (orgProp && orgProp.indexOf(replaceDot) > 0) {
2225
+ // 表示包括点“.”,需要把两个下划线"__"重新改为点“.”,否则会导致查询报500错误
2226
+ orgProp = orgProp.replace(replaceDot, '.')
2227
+ }
2228
+ this.sortInfo = [
2229
+ {
2230
+ prop: orgProp,
2231
+ order: order,
2232
+ },
2233
+ ]
2234
+ } else {
2235
+ this.sortInfo = null
2236
+ }
2237
+ this.fetchData(this.getSearchParam())
2238
+ this.focusOnFirstEditableInput()
2239
+ $emit(this, 'sort-change', { columnSetting, prop, order, column })
2240
+ }
2241
+ }
2242
+ },
2243
+ isMergeable(prop) {
2244
+ for (const column of this.columns) {
2245
+ if (column.prop === prop) {
2246
+ if (
2247
+ this.mergeFields &&
2248
+ this.mergeFields.indexOf(column.prop) !== -1
2249
+ ) {
2250
+ return true
2251
+ } else {
2252
+ return column.span
2253
+ }
2254
+ }
2255
+ }
2256
+ },
2257
+ rowSpan({ row, column, rowIndex, columnIndex }) {
2258
+ if (this.isMergeable(column.property)) {
2259
+ const row = this.spanArr[column.property][rowIndex]
2260
+ const col = row > 0 ? 1 : 0
2261
+ return {
2262
+ rowspan: row,
2263
+ colspan: col,
2264
+ }
2265
+ }
2266
+ },
2267
+ packageSummaryColumnProps() {
2268
+ const summaryColumnProps = []
2269
+ this.visibleColumns.forEach((item) => {
2270
+ if (item.total !== undefined && item.total === true) {
2271
+ summaryColumnProps.push(item.prop)
2272
+ }
2273
+ })
2274
+ return summaryColumnProps
2275
+ },
2276
+ getSummaries(param) {
2277
+ // 后台返回时需要处理好序号列和多选列
2278
+ if (this.basicInfo.summary !== 'no') {
2279
+ const summaryMap = this.summaries
2280
+ if (summaryMap) {
2281
+ return this.getCustomSummaries(param, summaryMap)
2282
+ } else {
2283
+ return this.getDefaultSummaries(param)
2284
+ }
2285
+ } else {
2286
+ return []
2287
+ }
2288
+ },
2289
+ getCustomSummaries(param, summaryMap) {
2290
+ // key为字段名,value为
2291
+ const { columns } = param
2292
+ const sums = []
2293
+ columns.forEach((column, index) => {
2294
+ const prop = column.property
2295
+ const summaryVal = summaryMap[prop]
2296
+ if (summaryVal !== undefined && summaryVal !== null) {
2297
+ sums[index] = summaryVal
2298
+ } else {
2299
+ sums[index] = ''
2300
+ }
2301
+ })
2302
+ return sums
2303
+ },
2304
+ getDefaultSummaries(param) {
2305
+ const sums = []
2306
+ const summaryColumnProps = this.packageSummaryColumnProps()
2307
+ if (summaryColumnProps.length > 0) {
2308
+ const { columns, data } = param
2309
+ let totalColIndex = null
2310
+ columns.forEach((column, index) => {
2311
+ let colTotal = 0
2312
+ const prop = column.property
2313
+ if (prop && prop !== '$selection' && prop !== '$index') {
2314
+ // 设置合计列
2315
+ if (totalColIndex === undefined || totalColIndex === null) {
2316
+ totalColIndex = index
2317
+ sums[index] = '合计'
2318
+ return
2319
+ }
2320
+ }
2321
+ if (summaryColumnProps.indexOf(prop) >= 0) {
2322
+ // 表示该列需要合计
2323
+ if (data) {
2324
+ data.forEach((row) => {
2325
+ let fieldValue = getEntityFieldValueWithOutCase(row, prop)
2326
+ let numberValue
2327
+ if (fieldValue !== undefined && fieldValue !== null) {
2328
+ // 表示值存在,不需要转换
2329
+ numberValue = Number(fieldValue)
2330
+ } else {
2331
+ // 表示值不存在,需要转小写,再获得一遍
2332
+ const reg1 = /[A-Z]+/ // 大写字母
2333
+ if (this.isSql && reg1.test(prop)) {
2334
+ fieldValue = getEntityFieldValueWithOutCase(
2335
+ row,
2336
+ prop.toLowerCase()
2337
+ )
2338
+ if (fieldValue !== undefined && fieldValue !== null) {
2339
+ numberValue = Number(fieldValue)
2340
+ }
2341
+ }
2342
+ }
2343
+ if (
2344
+ numberValue !== undefined &&
2345
+ numberValue !== null &&
2346
+ !isNaN(numberValue)
2347
+ ) {
2348
+ colTotal += numberValue
2349
+ }
2350
+ })
2351
+ }
2352
+ sums[index] = colTotal
2353
+ } else {
2354
+ sums[index] = ''
2355
+ }
2356
+ })
2357
+ }
2358
+ return sums
2359
+ },
2360
+ configColumns() {
2361
+ this.showColumnConfig = true
2362
+ // 完成深拷贝,复制一份对象,行编辑时使用
2363
+ this.orgColumnConfig = [].concat(JSON.parse(JSON.stringify(this.columns)))
2364
+ },
2365
+ // 行拖拽
2366
+ rowDrop() {
2367
+ if (this.lineEdit && this.lineEdit.urlToSaveOrder) {
2368
+ const tbody = document.querySelector('.el-table__body-wrapper tbody')
2369
+ if (tbody != null) {
2370
+ const vm = this
2371
+ Sortable.create(tbody, {
2372
+ onEnd({ newIndex, oldIndex }) {
2373
+ const params = {
2374
+ oldIndex: oldIndex,
2375
+ newIndex: newIndex,
2376
+ }
2377
+ this.$http
2378
+ .post(this.lineEdit.urlToSaveOrder, params)
2379
+ .then((data) => {
2380
+ const currRow = vm.gridData.splice(oldIndex, 1)[0]
2381
+ vm.gridData.splice(newIndex, 0, currRow)
2382
+ })
2383
+ },
2384
+ })
2385
+ }
2386
+ }
2387
+ },
2388
+ closeCustomConfig(isRefreshGrid) {
2389
+ if (isRefreshGrid !== undefined && isRefreshGrid === true) {
2390
+ this.refreshGridInitialize()
2391
+ }
2392
+ this.showColumnConfig = false
2393
+ },
2394
+ resetCustomConfig() {
2395
+ this.refreshGridInitialize()
2396
+ },
2397
+ refreshGridInitialize() {
2398
+ this.initialize().then(() => {
2399
+ // 添加该代码是为了解决保存字段个性化配置后,重新渲染列表问题,例如:列宽重新计算问题
2400
+ this.refreshGrid = false
2401
+ const vm = this
2402
+ setTimeout(function () {
2403
+ vm.refreshGrid = true
2404
+ }, 100)
2405
+ })
2406
+ },
2407
+ loadChildren(row, treeNode, resove) {
2408
+ if (this.isLazy) {
2409
+ this.loadChildrenNode(row, treeNode, resove)
2410
+ }
2411
+ },
2412
+ loadChildrenNode(row, treeNode, resove) {
2413
+ const subRowUrl = this.options.subRowUrl
2414
+ if (
2415
+ typeof subRowUrl !== 'undefined' &&
2416
+ subRowUrl !== '' &&
2417
+ subRowUrl !== null
2418
+ ) {
2419
+ const parentRowIds = []
2420
+ parentRowIds.push(row.id ? row.id : row.ID)
2421
+ this.fetchData(this.getSearchParam(), false, parentRowIds, resove)
2422
+ }
2423
+ },
2424
+ expandChange(row, expanded) {
2425
+ if (this.isLazy) {
2426
+ // console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid.store.states)
2427
+ if (expanded === false) {
2428
+ // 折叠时清空表格缓存的已加载的标识位,使其能够动态更新子集合
2429
+ // 必须添加这句,否则不会重新走load
2430
+ if (this.$refs.superGrid.store.states.treeData) {
2431
+ this.$refs.superGrid.store.states.treeData[
2432
+ row.id ? row.id : row.ID
2433
+ ].loaded = false
2434
+ }
2435
+ } else {
2436
+ // console.log('expandChange=this.$refs.superGrid.store.states.lazyTreeNodeMap', this.$refs.superGrid.store.states.lazyTreeNodeMap)
2437
+ // console.log('expandChange=this.$refs.superGrid.store.states.treeData', this.$refs.superGrid.store.states.treeData)
2438
+ // console.log('expandChange=this.$refs.superGrid.store.states.selection', this.$refs.superGrid.store.states.selection)
2439
+ }
2440
+ }
2441
+ },
2442
+ removeGridStoreSelection(parentRowIds) {
2443
+ let selection = []
2444
+ if (this.$refs.superGrid.store.states.selection) {
2445
+ selection = [].concat(
2446
+ JSON.parse(
2447
+ JSON.stringify(this.$refs.superGrid.store.states.selection)
2448
+ )
2449
+ )
2450
+ }
2451
+ for (let i = 0; i < selection.length; i++) {
2452
+ if (
2453
+ parentRowIds &&
2454
+ parentRowIds.indexOf(selection[i][this.parentProp]) >= 0
2455
+ ) {
2456
+ // 移除第i个元素
2457
+ this.$refs.superGrid.store.states.selection.splice(i, 1)
2458
+ if (this.$refs.superGrid.store.states.selection.length > 0) {
2459
+ this.removeGridStoreSelection(parentRowIds)
2460
+ }
2461
+ break
2462
+ }
2463
+ }
2464
+ },
2465
+ changeHederWidth(newWidth, oldWidth, column, event) {
2466
+ const newCellWidth = newWidth - 5
2467
+ let myNewWidth = newCellWidth
2468
+ this.dragColumnProp = column.property
2469
+ const gridParams = store.get(this.code)
2470
+ if (isHasOptionFunction('resizeColumn', this.code)) {
2471
+ const newWidth = gridParams.options.resizeColumn.call(this, {
2472
+ code: this.code,
2473
+ newWidth: newWidth,
2474
+ oldWidth: oldWidth,
2475
+ column: column,
2476
+ additionalParamMap: gridParams.additionalParamMap,
2477
+ })
2478
+ if (newWidth) {
2479
+ myNewWidth = newWidth
2480
+ }
2481
+ }
2482
+ this.newWidth = Math.ceil(myNewWidth)
2483
+ if (
2484
+ typeof this.options.isAdministerListView !== 'undefined' &&
2485
+ this.options.isAdministerListView != null &&
2486
+ this.options.isAdministerListView === true
2487
+ ) {
2488
+ // 表示是列表字段配置时
2489
+ $emit(this, 'changeHederWidth', this.newWidth)
2490
+ } else {
2491
+ // 应用模式时
2492
+ // 保存拖动后的列宽
2493
+ this.saveColumnWidth(this.dragColumnProp, this.newWidth).then(() => {
2494
+ const items = this.getColumnByElementColumn(column)
2495
+ if (items && items.length > 0) {
2496
+ items[0].widthType = 'custom'
2497
+ items[0].width = this.newWidth + ''
2498
+ }
2499
+ })
2500
+ }
2501
+ },
2502
+ resetSearch() {
2503
+ let searchForm = null
2504
+ if (this.toolbarFieldParam && this.toolbarFieldParam.length > 0) {
2505
+ searchForm = this.toolbarFieldParam
2506
+ }
2507
+ // 修改当前页为第1页
2508
+ this.currentPage = 1
2509
+ this.search(searchForm, false)
2510
+ },
2511
+ // 获取列信息
2512
+ getColumnInformation() {
2513
+ return this.visibleColumns
2514
+ },
2515
+ // 点击表头触发回调
2516
+ headerClick(column, event) {
2517
+ // 三种类型
2518
+ const items = this.getColumnByElementColumn(column)
2519
+ if (items && items.length > 0) {
2520
+ $emit(this, 'header-click', items[0])
2521
+ this.changeHeaderStyleTwo(items[0])
2522
+ } else {
2523
+ $emit(this, 'header-click', null)
2524
+ }
2525
+ this.clearHeaderContextmenu()
2526
+ },
2527
+ changeHeaderStyleTwo(item) {
2528
+ // 改变options中的配置
2529
+ // 还原所有颜色(隐藏字段判断,设置为灰色;选中字段设置为蓝色)
2530
+ if (
2531
+ typeof this.options.isAdministerListView !== 'undefined' &&
2532
+ this.options.isAdministerListView != null &&
2533
+ this.options.isAdministerListView === true
2534
+ ) {
2535
+ this.createBackgroundColorMap()
2536
+ this.backgroundColorMap[item.prop] = '#409EFF'
2537
+ if (this.$refs && this.$refs.superGrid) {
2538
+ this.$refs.superGrid.doLayout()
2539
+ }
2540
+ }
2541
+ },
2542
+ // 编辑模式下创建一个对象,存储各个表头的背景色
2543
+ createBackgroundColorMap() {
2544
+ const items = this.getColumnInformation()
2545
+ const backgroundColorMap = {}
2546
+ if (items && items.length > 0) {
2547
+ for (var i = 0; i < items.length; i++) {
2548
+ const item = items[i]
2549
+ if (item.show === undefined || item.show) {
2550
+ // 表示显示
2551
+ } else {
2552
+ backgroundColorMap[item.prop] = '#808080'
2553
+ }
2554
+ if (
2555
+ this.backgroundColorMap &&
2556
+ this.backgroundColorMap[item.prop] === '#409EFF' &&
2557
+ this.externalClickFlag
2558
+ ) {
2559
+ backgroundColorMap[item.prop] = '#409EFF'
2560
+ }
2561
+ }
2562
+ }
2563
+ this.backgroundColorMap = backgroundColorMap
2564
+ this.externalClickFlag = false
2565
+ if (this.$refs && this.$refs.superGrid) {
2566
+ this.$refs.superGrid.doLayout()
2567
+ }
2568
+ },
2569
+ // 根据element事件传递的column来获取自定义封装的column
2570
+ getColumnByElementColumn(column) {
2571
+ let items = null
2572
+ if (column.type && column.type === 'selection') {
2573
+ // 表示为选择框
2574
+ items = this.visibleColumns.filter((item) => {
2575
+ return item.prop === '$selection'
2576
+ })
2577
+ } else if (column.type && column.type === 'default' && !column.property) {
2578
+ // 表示为序号
2579
+ items = this.visibleColumns.filter((item) => {
2580
+ return item.prop === '$index'
2581
+ })
2582
+ } else if (column.property) {
2583
+ // 表示为普通字段
2584
+ items = this.visibleColumns.filter((item) => {
2585
+ return column.property === item.prop
2586
+ })
2587
+ }
2588
+ return items
2589
+ },
2590
+ // 右键表头
2591
+ headerContextmenu(column, event) {
2592
+ // 阻止鼠标的默认事件
2593
+ event.preventDefault()
2594
+ const items = this.getColumnByElementColumn(column)
2595
+ if (items && items.length > 0) {
2596
+ const item = items[0]
2597
+ $emit(this, 'header-click', items[0])
2598
+ this.changeHeaderStyleTwo(items[0])
2599
+ this.showHeaderContextmenu = true
2600
+ this.rightClickColumn = item
2601
+ this.$nextTick(() => {
2602
+ const menu = this.$refs.headerMenu.$el
2603
+ const scrollTop =
2604
+ document.documentElement.scrollTop || document.body.scrollTop
2605
+ menu.style.display = 'block'
2606
+ menu.style.left = event.clientX + 'px'
2607
+ // 当滑动滚动条时也能准确获取菜单位置
2608
+ menu.style.top = event.clientY + scrollTop - 10 + 'px'
2609
+ })
2610
+ }
2611
+ },
2612
+ // 清除右键菜单显示
2613
+ clearHeaderContextmenu() {
2614
+ this.showHeaderContextmenu = false
2615
+ this.rightClickColumn = null
2616
+ },
2617
+ // 返回表单子表模式下数据
2618
+ validatorSunTableListData() {
2619
+ // 返回之前需要进行规则校验
2620
+ let gridData = this.gridData
2621
+ if (this.isSubTableShowPage) {
2622
+ gridData = this.subTableData
2623
+ }
2624
+ if (gridData && gridData.length > 0) {
2625
+ const pageSize = this.pagination && this.pagination.pageSize
2626
+ const validateRules = formValidatorService.getValidator(this.code)
2627
+ for (let i = 0; i < gridData.length; i++) {
2628
+ const row = gridData[i]
2629
+ // 取消最后一个编辑行的状态
2630
+ if (row.$editing !== undefined && row.$editing === true) {
2631
+ setEntityFieldValue(row, '$editing', false)
2632
+ // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
2633
+ $emit(eventBus, 'un-edit', { row: row })
2634
+ }
2635
+ let needValidate = true
2636
+ if (isHasEditOption('isEnableValidate', this.code)) {
2637
+ // 表示配置了是否启用必填验证
2638
+ needValidate =
2639
+ this.gridParams.options.lineEditOptions['isEnableValidate']
2640
+ }
2641
+ let validateResult = true
2642
+ if (needValidate === true) {
2643
+ let pageNum
2644
+ // 每页的记录下标,提示时使用
2645
+ let pageRowIndex
2646
+ if (
2647
+ this.isSubTableShowPage &&
2648
+ pageSize !== undefined &&
2649
+ pageSize > 0
2650
+ ) {
2651
+ pageNum = Math.ceil((i + 1) / pageSize)
2652
+ pageRowIndex = i + 1 - (pageNum - 1) * pageSize
2653
+ }
2654
+ validateResult = formValidatorService.validator(
2655
+ row,
2656
+ this.code,
2657
+ i,
2658
+ validateRules,
2659
+ this.isSubTableShowPage,
2660
+ pageNum,
2661
+ pageRowIndex
2662
+ )
2663
+ }
2664
+ if (validateResult !== null && validateResult !== undefined) {
2665
+ if (
2666
+ typeof validateResult === 'string' ||
2667
+ validateResult === false
2668
+ ) {
2669
+ return false
2670
+ }
2671
+ }
2672
+ }
2673
+ return true
2674
+ }
2675
+ return true
2676
+ },
2677
+ getSunTableListData() {
2678
+ return this.isSubTableShowPage ? this.subTableData : this.gridData
2679
+ },
2680
+ rowDblclickEvent(row, column, event) {
2681
+ const gridParams = store.get(this.code)
2682
+ if (
2683
+ gridParams.options &&
2684
+ gridParams.options.isFormSubTable &&
2685
+ gridParams.options.isPdfEditor
2686
+ ) {
2687
+ // 如果是子表并且是pdf模式
2688
+ } else if (this.isFormSubTable) {
2689
+ // 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
2690
+ if (column.property &&
2691
+ column.property !== 'operation') {
2692
+ let canEdit = true
2693
+ const gridParams = store.get(this.code)
2694
+ if (isEditOptionFunction('beforeEdit', this.code)) {
2695
+ const isSubTableShowPage = gridParams.isSubTableShowPage
2696
+ // 每页显示多少条
2697
+ const pageSize = gridParams.pagination && gridParams.pagination.pageSize
2698
+ canEdit = gridParams.options.lineEditOptions.beforeEdit.call(this, {
2699
+ gridData: isSubTableShowPage ? gridParams.subTableData : gridParams.gridData,
2700
+ listCode: this.code,
2701
+ entity: row,
2702
+ columns: gridParams.columns,
2703
+ isMobile: false,
2704
+ pageGridData: isSubTableShowPage ? gridParams.gridData : null,
2705
+ pageSize,
2706
+ additionalParamMap: gridParams.additionalParamMap
2707
+ })
2708
+ }
2709
+ if (isPromise(canEdit)) {
2710
+ canEdit.then((result) => {
2711
+ if (result === undefined || result === true) {
2712
+ this.rowDbClickEditRow(gridParams, row)
2713
+ }
2714
+ })
2715
+ } else {
2716
+ if (canEdit === undefined || canEdit === true) {
2717
+ this.rowDbClickEditRow(gridParams, row)
2718
+ }
2719
+ }
2720
+ }
2721
+ } else {
2722
+ if (row) {
2723
+ if (
2724
+ gridParams &&
2725
+ gridParams.lineEdit &&
2726
+ gridParams.lineEdit.editable &&
2727
+ gridParams.canntEdit
2728
+ ) {
2729
+ let index = this.gridData.findIndex(function (item) {
2730
+ return (
2731
+ (item.id && item.id === row.id) ||
2732
+ (item.ID && item.ID === row.ID)
2733
+ )
2734
+ })
2735
+ if (index < 0) {
2736
+ index = 0
2737
+ }
2738
+ this.editRow(index)
2739
+ }
2740
+ }
2741
+ }
2742
+ this.rowDblClick(row, column, event)
2743
+ },
2744
+ rowDbClickEditRow(gridParams, row) {
2745
+ // 取消上一行的编辑状态
2746
+ let editRows
2747
+ if (this.isSubTableShowPage) {
2748
+ editRows = this.subTableData.filter(
2749
+ row => row.$editing !== undefined && row.$editing === true
2750
+ )
2751
+ } else {
2752
+ editRows = this.gridData.filter(
2753
+ row => row.$editing !== undefined && row.$editing === true
2754
+ )
2755
+ }
2756
+ if (editRows && editRows.length > 0) {
2757
+ editRows.forEach(editRow => {
2758
+ setEntityFieldValue(editRow, '$editing', false)
2759
+ // 取消上一行选中状态时,触发un-edit事件,处理下拉多选选项组问题
2760
+ eventBus.$emit('un-edit', { row: editRow })
2761
+ // this.$set(editRow, '$editing', false)
2762
+ })
2763
+ }
2764
+ gridParams.isEditRow = false
2765
+ setEntityFieldValue(row, '$editing', true)
2766
+ gridParams.$editRow = row
2767
+ // this.$set(row, '$editing', true)
2768
+ gridParams.isEditRow = true
2769
+ },
2770
+ rowClickEvent(row, column, event) {
2771
+ // if (
2772
+ // this.isFormSubTable &&
2773
+ // column.property &&
2774
+ // column.property !== 'operation'
2775
+ // ) {
2776
+ // // 表示是表单的子表,点击时需要将当前行设为行编辑状态,并保存上一行的记录(不是保存到数据库,只是把编辑状态改为false)
2777
+ // // 取消上一行的编辑状态
2778
+ // const gridParams = store.get(this.code)
2779
+ // const editRows = this.gridData.filter(
2780
+ // row => row.$editing !== undefined && row.$editing === true
2781
+ // )
2782
+ // if (editRows && editRows.length > 0) {
2783
+ // editRows.forEach(editRow => {
2784
+ // this.$set(editRow, '$editing', false)
2785
+ // })
2786
+ // }
2787
+ // gridParams.isEditRow = false
2788
+ // this.$set(row, '$editing', true)
2789
+ // gridParams.isEditRow = true
2790
+ // }
2791
+ // this.rowClick(row, column, event)
2792
+ },
2793
+ openPageDialog(openPageParams) {
2794
+ let jumpMode
2795
+ if (openPageParams) {
2796
+ jumpMode = openPageParams.jumpMode
2797
+ }
2798
+ const popPageSetting = openPageParams
2799
+ if (jumpMode === 'popup') {
2800
+ // 弹出页面
2801
+ this.jumpPageSetting = popPageSetting
2802
+ this.$emit('open-grid-dialog', this.jumpPageSetting)
2803
+ this.isShowPageDialog = true
2804
+ } else if (jumpMode === 'refresh') {
2805
+ this.$router.push({ path: '/dsc/page', query: popPageSetting })
2806
+ }
2807
+ },
2808
+ closeSearchFormDialog() {
2809
+ this.showSearch = false
2810
+ },
2811
+ // 获取当前列表的查询方式,page项目使用
2812
+ getQueryMode() {
2813
+ if (this.query && this.query.showType === 'popup') {
2814
+ return 'popup'
2815
+ } else {
2816
+ return 'embedded'
2817
+ }
2818
+ },
2819
+ selectCell(row, column, cell, event) {
2820
+ if (cell) {
2821
+ this.cellClick(row, column, cell, event)
2822
+ this.$nextTick(() => {
2823
+ cell.style['border'] = '2px solid #409EFF'
2824
+ this.currentSelectCell = cell
2825
+ })
2826
+ }
2827
+ },
2828
+ // 刷新列表数据
2829
+ refreshGridData() {
2830
+ this.refresh(false, true)
2831
+ },
2832
+ // 刷新列表数据
2833
+ refresData(data) {
2834
+ const gridParams = store.get(this.code)
2835
+ gridParams.gridData = data
2836
+ store.set(this.code, gridParams)
2837
+ this['gridData'] = data
2838
+ },
2839
+ refresPortData(port, value, index) {
2840
+ if (this.gridData[index]) {
2841
+ this.gridData[index][port] = value
2842
+ this.$forceUpdate()
2843
+ }
2844
+ },
2845
+
2846
+ refresPortsData(entity, index) {
2847
+ if (entity) {
2848
+ for (const key in entity) {
2849
+ if (this.gridData[index]) {
2850
+ this.gridData[index][key] = entity[key]
2851
+ this.$forceUpdate()
2852
+ console.log('this.$forceUpdate()', this.$refs[key])
2853
+ }
2854
+ }
2855
+ // entity.forEach(item => {
2856
+ // if (this.gridData[index]) {
2857
+ // this.$set(this.gridData[index], item.prop, item.value)
2858
+ // }
2859
+ // })
2860
+ }
2861
+ },
2862
+ refresMainTableFields(map) {
2863
+ $emit(this, 'refresMainTableFields', map)
2864
+ },
2865
+ openFold(isOpen) {
2866
+ this.resizeTableHeight()
2867
+ },
2868
+ // 设置字段禁止编辑
2869
+ fnProhibitToEdit(entity) {
2870
+ if (entity) {
2871
+ for (const key in entity) {
2872
+ // console.log('key', key)
2873
+ // console.log('this.$refs[key]', this.$refs)
2874
+ if (this.$refs[key]) {
2875
+ this.$refs[key][0].fnProhibitToEdit(entity[key])
2876
+ }
2877
+ }
2878
+ }
2879
+ },
2880
+ // 设置字段禁止编辑
2881
+ prohibitToEdit(entity) {
2882
+ this.fnProhibitToEdit(entity)
2883
+ },
2884
+ // 树形结构时数据展示
2885
+ getTreeProps(parentProp, isSql, isLazy, dataSourceType) {
2886
+ let treeProps = {
2887
+ children: 'children',
2888
+ hasChildren: '_has_children',
2889
+ }
2890
+ if (parentProp) {
2891
+ treeProps = {
2892
+ children: 'children',
2893
+ }
2894
+ let hasChildren = 'hasChildren'
2895
+ if (isLazy) {
2896
+ if (isSql) {
2897
+ if (dataSourceType === 'oracle') {
2898
+ hasChildren = 'HAS_CHILDREN'
2899
+ } else {
2900
+ hasChildren = 'has_children'
2901
+ }
2902
+ }
2903
+ }
2904
+ treeProps.hasChildren = hasChildren
2905
+ }
2906
+ return treeProps
2907
+ },
2908
+ refreshSubTableData(data) {
2909
+ const gridParams = store.get(this.code)
2910
+ gridParams.subTableData = data
2911
+ store.set(this.code, gridParams)
2912
+ this['subTableData'] = data
2913
+ },
2914
+ },
2915
+ emits: [
2916
+ 'change-grid-data',
2917
+ 'change-rows-per-page',
2918
+ 'set-select-options',
2919
+ 'setSearchType',
2920
+ 'sort-change',
2921
+ 'changeHederWidth',
2922
+ 'header-click',
2923
+ 'un-edit',
2924
+ 'refresMainTableFields',
2925
+ 'refresh',
2926
+ 'cancel-search',
2927
+ ,
2928
+ ],
2929
+ }
2930
+ </script>
2931
+
2932
+ <style lang="scss" rel="stylesheet/scss" scoped>
2933
+ .grid-area {
2934
+ .elTable th {
2935
+ padding: 2px 0 !important;
2936
+ }
2937
+ .elTable td {
2938
+ padding: 2px 0 !important;
2939
+ }
2940
+ }
2941
+ </style>