@utogether/udp-core 2.0.0-beta.4 → 2.0.0-beta.6

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 (207) hide show
  1. package/dist/{403-CekcmGOc.js → 403-FwkedC35.js} +1 -1
  2. package/dist/{404-DeSH9KnK.js → 404-fBOEoTA_.js} +1 -1
  3. package/dist/{500-DHOHlmtv.js → 500-iyNwORJV.js} +1 -1
  4. package/dist/{AuthorityInfo-BC8U3Zk4.js → AuthorityInfo-BTGUSDZ4.js} +1 -1
  5. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-DVFi0qOJ.js → AuthorityInfo.vue_vue_type_style_index_0_lang-DSxmqRu8.js} +1 -1
  6. package/dist/{Company-Byq4p14C.js → Company-ueSjOTse.js} +3 -3
  7. package/dist/{CompanyPanel-CIHP7rVd.js → CompanyPanel-CAhzxgMa.js} +7 -7
  8. package/dist/{Department-CxgSq34X.js → Department-fGiF2ia2.js} +3 -3
  9. package/dist/{DepartmentPanel-hYNqywSQ.js → DepartmentPanel-DW7RJCcR.js} +20 -20
  10. package/dist/{DesignPanel-GEhqXIAx.js → DesignPanel-CAQBm4D4.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DxA6H5Ts.js → DesignPanel.vue_vue_type_style_index_0_lang-5LGPeXPl.js} +2 -2
  12. package/dist/{DictView-tyGrHFO8.js → DictView-CvJgPLm3.js} +10 -10
  13. package/dist/{InvOrganization-DjJ4XkxN.js → InvOrganization-qlTFGd3Z.js} +1 -1
  14. package/dist/{Org-3eHX7nBU.js → Org-XLreDKod.js} +1 -1
  15. package/dist/{Preview-Cgc3O8vp.js → Preview-CPbzW7CO.js} +1 -1
  16. package/dist/{ReportDefine-FYxHLbPV.js → ReportDefine-Cb8Kr-eh.js} +1 -1
  17. package/dist/{ReportDesign-BTOVgMzz.js → ReportDesign-C7NEHxsF.js} +6 -6
  18. package/dist/{ReportQuery-Dhy9sk04.js → ReportQuery-DRHAlGXP.js} +1 -1
  19. package/dist/{ReportQueryFrom-B1TE8lOG.js → ReportQueryFrom-BVzD7HiO.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-D93NL2N7.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-B_lbUpW7.js} +7 -7
  21. package/dist/{ReportTemplate-C-EuU7mL.js → ReportTemplate-jvKZTiwg.js} +8 -8
  22. package/dist/{Role-Dc1dZ0o9.js → Role-BHHb-iLB.js} +3 -3
  23. package/dist/{RoleAssign-DDv65izq.js → RoleAssign-BTBTh4BY.js} +3 -3
  24. package/dist/{RolePanel-CiDM8OSr.js → RolePanel-BCi1rex2.js} +1 -1
  25. package/dist/{RolePanel-Dw_pTEGV.js → RolePanel-aV6bg80k.js} +1 -1
  26. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CG_KY7NS.js → RolePanel.vue_vue_type_script_setup_true_lang-BhFR-z17.js} +7 -7
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Ctq1lItN.js → RolePanel.vue_vue_type_script_setup_true_lang-C2b-FgFi.js} +7 -7
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CyU7XjI3.js → ScrollPanel.vue_vue_type_style_index_0_lang-BvNAonbh.js} +1 -1
  29. package/dist/{Staff-DMh451jL.js → Staff-CQqKHfmG.js} +3 -3
  30. package/dist/{StaffInfo-2PhYcVaz.js → StaffInfo-DBgWZZxQ.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-CrCFms3g.js → StaffInfo.vue_vue_type_script_setup_true_lang-DZSUQTor.js} +1 -1
  32. package/dist/{StaffPanel-BrvkXT68.js → StaffPanel-qhtv83q9.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DKr8VVOJ.js → StaffPanel.vue_vue_type_script_setup_true_lang-B3j8x4MN.js} +8 -8
  34. package/dist/{SysUser-DLDd5do7.js → SysUser-D-7c33EB.js} +2 -2
  35. package/dist/{SysUserPanel-DDQxi2Hk.js → SysUserPanel-t1ZR91oy.js} +1 -1
  36. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-DvOggZs6.js → SysUserPanel.vue_vue_type_script_setup_true_lang-Bz2s1QPZ.js} +1 -1
  37. package/dist/{SystemMenu-nFNfz4Nj.js → SystemMenu-DNffJRQo.js} +6 -6
  38. package/dist/{UserInfo-B9PLKur5.js → UserInfo-niYGSHmG.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-BwZNwtQH.js → UserInfo.vue_vue_type_style_index_0_lang-B8CRjdQG.js} +1 -1
  40. package/dist/{childView-BEDVB_RG.js → childView-Dn28g10M.js} +1 -1
  41. package/dist/{childView-BRa268Qh.js → childView-E2EnbUz2.js} +1 -1
  42. package/dist/{childView.vue_vue_type_style_index_0_lang-BcyosNSH.js → childView.vue_vue_type_style_index_0_lang-DFs-YATK.js} +30 -27
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-qsceJGeR.js → childView.vue_vue_type_style_index_0_lang-UzBSJ6wt.js} +7 -7
  44. package/dist/{code-rule-CJ4FuOo1.js → code-rule-D-RJozWD.js} +1 -1
  45. package/dist/core.es.js +10 -10
  46. package/dist/{cron-task-CXnv7hIa.js → cron-task-CPuU0Rc2.js} +1 -1
  47. package/dist/{frameView-g5e9PYdE.js → frameView-c4xFtvR6.js} +1 -1
  48. package/dist/{index-BEAth5RR.js → index-CPKIQXdI.js} +1224 -1215
  49. package/dist/{layout-home-bl3JShSF.js → layout-home-DrimiAWf.js} +1 -1
  50. package/dist/{layoutView-DmM9xk-X.js → layoutView-DPaKZNx5.js} +1 -1
  51. package/dist/{log-in-eGoxFTDE.js → log-in-BQiOfnXg.js} +8 -8
  52. package/dist/{log-out-CthD_tSk.js → log-out-BvlexfR3.js} +3 -3
  53. package/dist/{login-Dn7iO3SU.js → login-0R1puBOn.js} +15 -15
  54. package/dist/{login-log-DJBGJVV0.js → login-log-BEHYT0v0.js} +5 -5
  55. package/dist/{lov-view-Bt23RK6S.js → lov-view-DieM-cvR.js} +6 -6
  56. package/dist/{menuInfo-BEmcSaIX.js → menuInfo-Db7s_jX8.js} +1 -1
  57. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-CVuG-x2a.js → menuInfo.vue_vue_type_style_index_0_lang-QbKkjhUR.js} +1 -1
  58. package/dist/{pda-app-BKfXoKAs.js → pda-app-CCtwSfLe.js} +8 -8
  59. package/dist/{resource-CshrvEYp.js → resource-rliX23RM.js} +4 -4
  60. package/dist/{su-welcome-CYYy-dzr-D3RKPoB0-DhP783YJ.js → su-welcome-MLhkyOoQ.js} +20571 -20479
  61. package/dist/{sys-config-Jqj3l7NK.js → sys-config-Ci6UV7lE.js} +12 -12
  62. package/dist/udp-core.css +1 -1
  63. package/package.json +1 -1
  64. package/src/components/udp/form-upload/form-upload.vue +496 -492
  65. package/src/components/udp/utils.ts +414 -408
  66. package/src/plugins/i18n/zh.ts +1 -0
  67. package/src/plugins/vxe-table/index.ts +116 -116
  68. package/src/plugins/vxe-table/render.tsx +995 -968
  69. package/src/views/udev/dict/DictView.vue +118 -118
  70. package/src/views/udev/dict/childView.vue +185 -184
  71. package/src/views/ufile/aggregation/File.vue +87 -87
  72. package/src/views/uhome/components/home-todo.vue +11 -7
  73. package/src/views/uhome/su-welcome.vue +1 -3
  74. package/src/views/upms/user/login-log.vue +2 -2
  75. package/vite.config.ts +83 -84
  76. package/dist/403-CxOqlq0f-C28ufSE6.js +0 -65
  77. package/dist/403-WCboRvzZ-ZAPgYStl-Ck7rlpC9.js +0 -65
  78. package/dist/404-2V0Qi-d7-DkNwQggp-3kilva5o.js +0 -65
  79. package/dist/404-xdB6lFeQ-DRhUFuKU.js +0 -65
  80. package/dist/500-BYfzvixf-CGpEieyQ-DLrc9brB.js +0 -67
  81. package/dist/500-C94bRK2S-_XtNljMI.js +0 -67
  82. package/dist/AuthorityInfo-DBovfUjB-DpQwT9Q5-ChKFxbGl.js +0 -4
  83. package/dist/AuthorityInfo-Dy3b_nFN-BBC0HKlV.js +0 -4
  84. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-Bh7IbcdY-BgLN7Lgx.js +0 -100
  85. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-D-l_Az3s-Cw7WmFxz-B8tPqh_7.js +0 -100
  86. package/dist/AuthorityPanel-CRlAwbaI-G7pZXKdE-DAeYw45g.js +0 -4
  87. package/dist/AuthorityPanel-CRlAwbaI-G7pZXKdE.js +0 -4
  88. package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S-CJvk3pW8-C6jMEDJq.js +0 -114
  89. package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S-CJvk3pW8.js +0 -114
  90. package/dist/Company-B4vsXy2I-CkNCOqjJ-PjoD0ztY.js +0 -25
  91. package/dist/Company-gKkfnhLt-BReGxz7n.js +0 -25
  92. package/dist/CompanyPanel-BF5Pc35s-CtpymP6a.js +0 -206
  93. package/dist/CompanyPanel-Czcx8Gyw-CvndXwB_-mYpxegRQ.js +0 -206
  94. package/dist/DataSet-DT-rGICv-DaUfgbxk-YztlXv7w.js +0 -147
  95. package/dist/DataSet-DT-rGICv-DaUfgbxk.js +0 -147
  96. package/dist/Department-D0I3QVZe-CfWPT-lY.js +0 -25
  97. package/dist/Department-D0dVUrGC-C6HJcYI1-DhAtBQym.js +0 -25
  98. package/dist/DepartmentPanel-2LHODgc7--VCCaEsu.js +0 -254
  99. package/dist/DepartmentPanel-e91Lxr1j-BS_A-ILd-V3QvVWmJ.js +0 -254
  100. package/dist/DesignPanel-CtF3cAAQ-FM7zpexb.js +0 -4
  101. package/dist/DesignPanel-DdFl_ohi-uCwFxcl1-7p3ouXrw.js +0 -4
  102. package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BACPrfUI-cC7yL0uY-CoM_RAUN.js +0 -1013
  103. package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BCYgwoVt-CcCVpy0f.js +0 -1013
  104. package/dist/DictView-BzQLOf_P-DDicwdmM-B8CFC279.js +0 -111
  105. package/dist/DictView-H3V5hxg3-BQZWN2zT.js +0 -111
  106. package/dist/InvOrganization-BiGLnbqe-BK3vgYYR.js +0 -74
  107. package/dist/InvOrganization-atbhw0CI-BABbVt9V-BT8PkfWL.js +0 -74
  108. package/dist/Org-BW1YHG-Q-Cow7JWlD-C7ygI7jx.js +0 -39
  109. package/dist/Org-DQTCQHNY-CEEpGGlZ.js +0 -39
  110. package/dist/Preview-DJtVsoq1-CCGidQjJ-DQ_OC1-S.js +0 -48
  111. package/dist/Preview-DXaiis29-BYyNhC1p.js +0 -48
  112. package/dist/ReportDefine-BLh4CiER-D68a0DWB.js +0 -10
  113. package/dist/ReportDefine-CNx_ob99-6NQAHK-Q-BL5gB56o.js +0 -10
  114. package/dist/ReportDesign-FbQ6yTJS-C1pPAUSp-DTsrU_wq.js +0 -165
  115. package/dist/ReportDesign-Ni1YxrLC-DfziOJc3.js +0 -165
  116. package/dist/ReportQuery-C5gz8Lgd-Eu2cQmda-c9iy6TZ_.js +0 -75
  117. package/dist/ReportQuery-C8G88_qF-BKknwX1u.js +0 -75
  118. package/dist/ReportQueryFrom-C7scua5v-uHXWq8Gy-Cq4havLh.js +0 -4
  119. package/dist/ReportQueryFrom-CuZKPtB4-B_TaZr-N.js +0 -4
  120. package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-BAn_siFW-CdTqG6KF.js +0 -178
  121. package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DCbz67Wa-vK6r2uCl-kdXwDD3n.js +0 -178
  122. package/dist/ReportTemplate-BDANdIWv-D_IGjR1w-txJDRw_J.js +0 -161
  123. package/dist/ReportTemplate-DFnDXWmx-QQkaZRvV.js +0 -161
  124. package/dist/Role-BQ7hsfPn-BLwTiMMj.js +0 -25
  125. package/dist/Role-ByB0WbxW-5E8Mb148-WoZV4JKV.js +0 -25
  126. package/dist/RoleAssign-DW6iC_0v-Bis61auk-BB4DziuB.js +0 -26
  127. package/dist/RoleAssign-UPCg2d4G-g4V-duK9.js +0 -26
  128. package/dist/RolePanel-BM2MaQPU-CgcsbfaX-D28vR3Fh.js +0 -4
  129. package/dist/RolePanel-C-mQ5XRq-JQYWITkX.js +0 -4
  130. package/dist/RolePanel-ClQy8DBL-DARL4O-o-DrElGZ66.js +0 -4
  131. package/dist/RolePanel-CoSXOCZN-BdCEhz3b.js +0 -4
  132. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-Bc_Ao_PU-DMmxr2iI-Bsk0Mun8.js +0 -132
  133. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-Bg-t2UhF-CMTLt3Lp.js +0 -154
  134. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-D-o7HYZ8-DPs8J-8D.js +0 -132
  135. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-fthF1zkp-JsbQJoDy-vZfwM6bG.js +0 -154
  136. package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-ByWIwajm-BsBf2Vs3-CTeY23xN.js +0 -100
  137. package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-CCsoxDfk-D-4pB58A.js +0 -100
  138. package/dist/Staff-CuxzvhD9-D0KTcyRh-Cj8NbX79.js +0 -25
  139. package/dist/Staff-D-CmvG1R-uwSWH8-m.js +0 -25
  140. package/dist/StaffInfo-CY7gUICu-EZUhUwIp-C8POP58u.js +0 -4
  141. package/dist/StaffInfo-Idhvuc6e-COVQmEz0.js +0 -4
  142. package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-Dd8gtQz8-Dlkt-eCn-p0kltEdZ.js +0 -108
  143. package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-MUGKjnHU-Cj9lcXG6.js +0 -108
  144. package/dist/StaffPanel-CDDmAYE5-mLPGD2Nf.js +0 -4
  145. package/dist/StaffPanel-CwqG0_xr-CrvzLJoc-AX54GdZ3.js +0 -4
  146. package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-Bdilqbee-RiBDcMMj.js +0 -143
  147. package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-DCdBy8Hu-BXrueqi0-DFG90qAT.js +0 -143
  148. package/dist/SysUser-9Q2UJWhi-DprWXFlR-DUMl4Hfm.js +0 -15
  149. package/dist/SysUser-a-j5bppr-CpP0s5DW.js +0 -15
  150. package/dist/SysUserPanel-6V232wwB-DI8apzmL.js +0 -4
  151. package/dist/SysUserPanel-bJy69O7x-BJtBgFEs-DEXctwBe.js +0 -4
  152. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BOtHuMVy-CD9JQp9h.js +0 -356
  153. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DUPFqgz3-BSqRCMen-BBtBr0VU.js +0 -356
  154. package/dist/SystemMenu-BnVeOSOQ-6HW3jX57.js +0 -156
  155. package/dist/SystemMenu-DGOAolc1-CJSLHP8i-DIUNb03s.js +0 -156
  156. package/dist/UserInfo-CKoOHkAM-DDWp0I_U-DEerO-y3.js +0 -4
  157. package/dist/UserInfo-Cax9b2nw-DBResyaY.js +0 -4
  158. package/dist/UserInfo.vue_vue_type_style_index_0_lang-BaT53SSu-DsNaAomO-7IKIrGoq.js +0 -160
  159. package/dist/UserInfo.vue_vue_type_style_index_0_lang-D-cw11i9-B2nI6TLi.js +0 -160
  160. package/dist/await-to-js.es5-Bv3Eu4mi-UCggJjes-CRQnmLCs.js +0 -10
  161. package/dist/await-to-js.es5-Bv3Eu4mi-UCggJjes.js +0 -10
  162. package/dist/childView-0YZQ6GBn-CEqg7k5d-CDGM_XzZ.js +0 -4
  163. package/dist/childView-DKG3eZo8-CCtKjCU7.js +0 -4
  164. package/dist/childView-DKkgi3yo-D47ft-vi-B5yI8Dk7.js +0 -4
  165. package/dist/childView-siumuBz0-CyYKsSPy.js +0 -4
  166. package/dist/childView.vue_vue_type_style_index_0_lang-ABMrGInv-ClOdE_sa-BnvsyZ35.js +0 -143
  167. package/dist/childView.vue_vue_type_style_index_0_lang-CUfXDS1q-DNNy6Qe3.js +0 -180
  168. package/dist/childView.vue_vue_type_style_index_0_lang-CW3EbAmW-D6Jvom5y.js +0 -143
  169. package/dist/childView.vue_vue_type_style_index_0_lang-CaW106ve-CClTM8PK-ZSgCqafc.js +0 -180
  170. package/dist/code-rule-Dtoree6F-B4yeNvFw.js +0 -148
  171. package/dist/code-rule-wQyfgpNL-C4evD4Co-BOJCC1LY.js +0 -148
  172. package/dist/cron-task-C-kryDtd-C0NuGZCe-DIJuoNx-.js +0 -135
  173. package/dist/cron-task-GSRgA7S5-D_xfN2g_.js +0 -135
  174. package/dist/flow-task-B07st2aD-CgQvagSQ-BaPlX6ds.js +0 -10
  175. package/dist/flow-task-B07st2aD-CgQvagSQ.js +0 -10
  176. package/dist/frameView-BOGA3ezf-QoSxzmSQ-BWs9F5mT.js +0 -44
  177. package/dist/frameView-Cy6wxW0K-BLdNZaGh.js +0 -44
  178. package/dist/layout-home-3Dy4onl4-COK554mq.js +0 -228
  179. package/dist/layout-home-CYHksXN_-Basy-3IH-Dnun4YUs.js +0 -228
  180. package/dist/layoutView-BaRvAbIa-xVgfqspc-zL46XaoI.js +0 -3302
  181. package/dist/layoutView-DMjNscJ--DvK2S5BQ.js +0 -3302
  182. package/dist/log-in-Cx1dGik8-BVeEHeZ8-D7mV8pl4.js +0 -117
  183. package/dist/log-in-VAG6Cvcx-B6arurXx.js +0 -117
  184. package/dist/log-out-COYdxrNC-ftopGZdE-Ch_UgXZv.js +0 -130
  185. package/dist/log-out-DZGaMCjC-OztBlMPh.js +0 -130
  186. package/dist/login-CqVMdNHs-CRJ-LWAK.js +0 -241
  187. package/dist/login-Dg9ofNS8-Bocp1XMA-DY4y3cAG.js +0 -241
  188. package/dist/login-log-DJBGJVV0-AoOyj0jD-AoOyj0jD.js +0 -70
  189. package/dist/login-log-DJBGJVV0-AoOyj0jD.js +0 -70
  190. package/dist/lov-view-C0T5prk8-B2DBmn55-BvzOsVW8.js +0 -97
  191. package/dist/lov-view-Cc68_28B-y4f2SzBr.js +0 -97
  192. package/dist/menuInfo-BIrIaJlH-Bxn4KTWH.js +0 -4
  193. package/dist/menuInfo-BZJ_q7bz-Drho-_QC-BK5n3Shr.js +0 -4
  194. package/dist/menuInfo.vue_vue_type_style_index_0_lang-BA8xjUo3-BCZ1wipf-DEApwWGK.js +0 -363
  195. package/dist/menuInfo.vue_vue_type_style_index_0_lang-DlE4w35X-gWYo2VJe.js +0 -363
  196. package/dist/pda-app-DnjphrRS-4tIZDsnN.js +0 -710
  197. package/dist/pda-app-m9hsppHo-B4xyja1o-9mD3zI7J.js +0 -710
  198. package/dist/redirect-BqegffKC-CBCIuqmz-46JkXpSM.js +0 -15
  199. package/dist/redirect-BqegffKC-CBCIuqmz.js +0 -15
  200. package/dist/resource-C6KEIXu--B_ddyecm-CFF-A4cr.js +0 -97
  201. package/dist/resource-DISgPDM7-C4P8jqU0.js +0 -97
  202. package/dist/su-welcome-BjbuSrBZ-DrInu823.js +0 -49339
  203. package/dist/su-welcome-t7YusM3U.js +0 -49427
  204. package/dist/sys-config-DCjJGtht-DARDjlrt-Dx8559bf.js +0 -370
  205. package/dist/sys-config-Yc9vh1t1-B3bJPd9S.js +0 -370
  206. package/dist/utogether-MlnyYtNS-CGgjFNPS-CGgjFNPS.js +0 -4
  207. package/dist/utogether-MlnyYtNS-CGgjFNPS.js +0 -4
@@ -1,408 +1,414 @@
1
- /*
2
- * @Author: wei.li
3
- * @Date: 2022-06-23 17:29:11
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-12-02 18:32:18
6
- * @Description: file content
7
- */
8
- // @ts-nocheck
9
-
10
- import { clone, isString, orderBy, isEmpty, toDateString, isObject, isFunction } from 'xe-utils';
11
- import { cookies, storageLocal } from '@utogether/utils';
12
- /** 系统配置的key */
13
- const kSYSCONFIG = 'kSysConfig';
14
- const kCOOKIES = 'kCookies_param';
15
-
16
- const sysConfig = storageLocal.getItem(kSYSCONFIG);
17
-
18
- /** 工具栏按钮标准化 */
19
- export const formatButton = (buttons, auth?) => {
20
- buttons.forEach(btn => {
21
- btn.auth = auth ? auth[btn.code] || btn.auth : btn.auth;
22
- if (!btn.name) {
23
- btn.name = `message.btn.${btn.code}`;
24
- } else if (sysConfig?.i18nEnabled === 'Y' && !btn.name.startsWith('message.')) {
25
- btn.name = `message.btn.${btn.name}`;
26
- }
27
- if (btn.dropdowns?.length) {
28
- formatButton(btn.dropdowns, auth);
29
- }
30
- });
31
- return buttons;
32
- };
33
-
34
- /**
35
- * @description 查询10W数据,常用于Excel导出
36
- * @param props 查询接口的路径
37
- * @param http http实例
38
- * @param form 查询条件
39
- * @returns 查询返回的数据
40
- */
41
- export const queryAll = (props, http, form) => {
42
- const params = { pageNum: 1, pageSize: 100000 };
43
- const commonParam = getCookieParam();
44
- Object.assign(params, form, commonParam, props.defaultParams || {});
45
- let query = formatMultipleParams(params, props.items);
46
- query = formatDateRange(query, props.items);
47
-
48
- const { url } = props;
49
- if (!url) return null;
50
- const requestURL = isString(url) ? url : url.fetch || url.restful;
51
- if (!requestURL) return null;
52
- const method = url.fetch ? 'post' : 'get';
53
- return new Promise((resolve, reject) => {
54
- http[method](requestURL, query)
55
- .then((response: IResponseData) => {
56
- resolve(response.list);
57
- })
58
- .catch((e: any) => {
59
- reject(e);
60
- });
61
- });
62
- };
63
-
64
- /**
65
- * @description 查询服务
66
- * @param props 查询接口的路径
67
- * @param form 查询条件
68
- * @param page 分页参数
69
- * @param http http实例
70
- * @param isDoc doc文档
71
- * @returns Promise
72
- */
73
- export const query = (props, form, page, http, code, isDoc) => {
74
- if (isDoc) return getDocData();
75
- for (const key in form) {
76
- if (form[key] && isString(form[key])) {
77
- form[key] = form[key].trim();
78
- }
79
- }
80
- const params = { pageNum: page.currentPage, pageSize: page.pageSize };
81
- const commonParam = getCookieParam();
82
- Object.assign(params, commonParam, props.defaultParams || {}, form);
83
-
84
- let query = formatMultipleParams(params, props.items);
85
- query = formatDateRange(query, props.items);
86
- const { url } = props;
87
- if (!url) return null;
88
- const requestURL = isString(url) ? url : url.fetch || url.restful;
89
- const method = url.fetch ? 'post' : 'get';
90
- if (!requestURL) return null;
91
- return http[method](requestURL, query);
92
- };
93
-
94
- /**
95
- * @description 表格删除方法
96
- * @param http http实例
97
- * @param records 记录行
98
- * @param props 删除接口的路径
99
- * @returns Promise
100
- */
101
- export const del = (http, records, props) => {
102
- const { url } = props;
103
- if (!url) return null;
104
- const requestURL = isString(url) ? url : url.del || url.restful;
105
- if (!requestURL) return null;
106
- const method = url.del ? 'post' : 'delete';
107
- return http[method](requestURL, records);
108
- };
109
-
110
- /** 更新服务 */
111
- export const save = (http, body, props) => {
112
- const allService = [];
113
- const { url } = props;
114
- if (!url) return null;
115
-
116
- const { insertRecords, updateRecords } = body;
117
- if (!isEmpty(insertRecords)) {
118
- const commonParam = getCookieParam();
119
- insertRecords.forEach(m => {
120
- !isEmpty(props?.defaultValue) && Object.assign(m, props.defaultValue);
121
- Object.keys(commonParam)?.forEach(key => {
122
- m[key] = m[key] || commonParam[key];
123
- });
124
- });
125
- const requestURL = isString(url) ? url : url.add || url.restful;
126
- requestURL && allService.push(http.post(requestURL, insertRecords));
127
- }
128
- if (!isEmpty(updateRecords)) {
129
- const requestURL = isString(url) ? url : url.save || url.restful;
130
- const method = url.save ? 'post' : 'put';
131
- requestURL && allService.push(http[method](requestURL, updateRecords));
132
- }
133
- return allService;
134
- };
135
-
136
- /**
137
- * 多选数据优化
138
- * @param listQuery
139
- * @param items
140
- * @returns
141
- */
142
- const formatMultipleParams = (listQuery: any, items) => {
143
- const multipleItems = items.filter(f => f.itemRender?.props?.multiple || f.multiple);
144
- if (isEmpty(multipleItems)) return listQuery;
145
- const query = clone(listQuery, true);
146
- multipleItems.forEach((element: any) => {
147
- if (element.itemRender.name === '#select' && element.itemRender.props.multiple) {
148
- if (query[`_${element.field}`]?.length === 0) {
149
- // 重置后
150
- query[`${element.field}`] = null;
151
- }
152
- delete listQuery[`_${element.field}`];
153
- delete query[`_${element.field}`];
154
- }
155
- });
156
- return query;
157
- };
158
-
159
- const startFormatter = 'yyyy-MM-dd 00:00:00';
160
- const endFormatter = 'yyyy-MM-dd 23:59:59';
161
- // 时间范围优化
162
- const formatDateRange = (listQuery: any, items) => {
163
- const dateRanges = items.filter(f => ['#SuDateRange', 'VxeDateRangePicker'].includes(f.itemRender?.name));
164
- if (isEmpty(dateRanges)) return listQuery;
165
- const query = clone(listQuery, true);
166
- dateRanges.forEach((element: any) => {
167
- const val = query[element.field];
168
- if (val && element.itemRender.startField) {
169
- query[element.itemRender.startField] = toDateString(query[element.itemRender.startField], startFormatter);
170
- query[element.itemRender.endField] = toDateString(query[element.itemRender.endField], endFormatter);
171
- } else if (val) {
172
- query[`${element.field}From`] = toDateString(val[0], startFormatter);
173
- query[`${element.field}To`] = toDateString(val[1], endFormatter);
174
- }
175
- delete query[element.field];
176
- });
177
- return query;
178
- };
179
-
180
- const getCookieParam = () => {
181
- return cookies.get(kCOOKIES) ? JSON.parse(cookies.get(kCOOKIES)) : {};
182
- };
183
-
184
- /** 工具栏默认按钮组 */
185
- export const inlineButtons = [
186
- {
187
- code: 'insert_actived',
188
- name: 'add',
189
- status: 'u-cyan',
190
- icon: 'vxe-icon-add',
191
- auth: 'add',
192
- sort: 1
193
- },
194
- {
195
- code: 'delete',
196
- status: 'danger',
197
- icon: 'vxe-icon-delete',
198
- auth: 'del',
199
- sort: 2
200
- },
201
- {
202
- code: 'save',
203
- status: 'primary',
204
- icon: 'vxe-icon-save',
205
- auth: 'edit',
206
- sort: 3
207
- }
208
- ];
209
- // form 模式按钮
210
- export const dialogButtons = [
211
- {
212
- code: 'add',
213
- status: 'u-cyan',
214
- icon: 'vxe-icon-add',
215
- auth: 'add',
216
- sort: 1
217
- },
218
- {
219
- code: 'del',
220
- status: 'danger',
221
- icon: 'vxe-icon-delete',
222
- auth: 'del',
223
- sort: 2
224
- }
225
- ];
226
-
227
- export const defaultColums = [
228
- { field: 'createdByName', width: 90, visible: false },
229
- { field: 'creationDate', width: 140, visible: false },
230
- { field: 'lastUpdatedByName', width: 90, visible: false },
231
- { field: 'lastUpdateDate', width: 140, visible: false }
232
- ];
233
-
234
- /** 导出配置 */
235
- export const getExportConfig = attrs => {
236
- if (isObject(attrs.exportConfig)) return attrs.exportConfig;
237
- return {
238
- filename: attrs.fileName || '导出明细',
239
- type: 'xlsx',
240
- types: ['xlsx', 'csv'],
241
- modes: ['current', 'selected', 'all'],
242
- useStyle: true,
243
- sheetMethod: ({ worksheet }) => (attrs.onSheetMethod ? attrs.onSheetMethod(worksheet) : onSheetMethod(worksheet)),
244
- columnFilterMethod: ({ column }) =>
245
- attrs.columnFilter
246
- ? !!attrs.columnFilter(column)
247
- : !['operate'].includes(column.field) && column.type !== 'checkbox'
248
- };
249
- };
250
-
251
- export const getToolBarConfig = (data, props, attrs, hasAuthority) => {
252
- const refreshOptions = {
253
- icon: 'ri-refresh-line',
254
- iconLoading: 'vxe-icon-spinner roll vxe-loading--default-icon'
255
- };
256
- // 不可编辑时
257
- if (!props.editable) {
258
- data.editConfig.editable = props.editable;
259
- const hasExport = props.needExport && hasAuthority('export');
260
- if (hasExport) {
261
- data.exportConfig = getExportConfig(attrs);
262
- }
263
- data.toolbarConfig = {
264
- buttons: [],
265
- enabled: hasExport,
266
- refreshOptions,
267
- exportOptions: { icon: 'ri-download-2-line', code: 'export' },
268
- export: hasExport,
269
- custom: !!attrs.gridId,
270
- refresh: true,
271
- perfect: true
272
- };
273
- return data;
274
- }
275
-
276
- // 先设置传入的按钮
277
- let buttons = clone(attrs.buttons || [], true);
278
-
279
- buttons.forEach((button, idx) => {
280
- button.sort = button.sort || idx + 10;
281
- });
282
-
283
- // 获取默认的按钮
284
- const toolButtons = attrs.mode !== 'form' ? clone(inlineButtons, true) : clone(dialogButtons, true);
285
- // 判断传入的按钮是否有默认按钮的auth,有就不加入按钮组中,相当于重写了默认的按钮
286
- // reverse的原因是: 保持现有按钮顺序, 新增,保存,删除
287
- toolButtons.reverse().forEach(btn => {
288
- !buttons.some(s => s.code === btn.code) && buttons.unshift(btn);
289
- if (attrs.authPrefix && !['printer', 'export'].includes(btn.auth)) {
290
- btn.auth = attrs.authPrefix + btn.auth.slice(0, 1).toLocaleUpperCase() + btn.auth.slice(1).toLocaleLowerCase();
291
- }
292
- });
293
-
294
- buttons = formatButton(buttons, props.auth).filter(button => {
295
- const flag = button.auth ? hasAuthority(button.auth) : true;
296
- if (button.dropdowns?.length) {
297
- button.dropdowns = button.dropdowns.filter(btn => !btn.auth || (btn.auth && hasAuthority(btn.auth)));
298
- }
299
- return flag;
300
- });
301
- // inline 行内模式,单击行模式
302
- const editConfig = { trigger: 'dblclick', mode: 'row', showStatus: true };
303
- data.editConfig = attrs.mode !== 'form' ? editConfig : { enabled: false };
304
- // 导出权限
305
- const hasExport = props.needExport && hasAuthority('export');
306
- let exportBtn = null;
307
- if (hasExport) {
308
- data.exportConfig = getExportConfig(attrs);
309
- exportBtn = { icon: 'ri-download-2-line', code: 'export' };
310
- }
311
- data.toolbarConfig = {
312
- buttons: orderBy(buttons, 'sort'),
313
- enabled: true,
314
- refreshOptions,
315
- customOptions: attrs.gridId ? {} : null,
316
- exportOptions: exportBtn,
317
- custom: !!attrs.gridId,
318
- export: hasExport,
319
- refresh: true,
320
- perfect: true
321
- };
322
- return data;
323
- };
324
-
325
- /**
326
- * @description: 表格脚合并方法
327
- * @param {*} columns 列数据
328
- * @param {*} data 数据源
329
- * @param {*} sum 合并属性
330
- * @return {*} 合并脚方法
331
- */
332
- export const footerSumMethod = ({ columns, data }, sum) => {
333
- return [
334
- columns.map((column, columnIdx) => {
335
- if (columnIdx === (sum.index || 0)) {
336
- return sum.label || '合计';
337
- }
338
- if (sum.fields?.includes(column.property)) {
339
- const total = data.reduce((prev, cur) => {
340
- return prev + Number(cur[column.property] || 0);
341
- }, 0);
342
- return total ? Number(total.toFixed(sum.decimal || 2)) : total;
343
- }
344
- return '';
345
- })
346
- ];
347
- };
348
-
349
- /**
350
- * @description: checkbox是否可选
351
- */
352
- export const onCheckMethod = (row, props) => {
353
- if (isFunction(props.checkMethod)) {
354
- return props.checkMethod(row);
355
- }
356
- return true;
357
- };
358
-
359
- /*** excel样式重置 */
360
- const onSheetMethod = ws => {
361
- ws.eachRow((row, rowNumber) => {
362
- row.font = { name: '微软雅黑', size: 9 };
363
- row.border = {
364
- top: { style: 'thin' },
365
- left: { style: 'thin' },
366
- bottom: { style: 'thin' },
367
- right: { style: 'thin' }
368
- };
369
-
370
- if (rowNumber === 1) {
371
- row.fill = {
372
- type: 'pattern',
373
- pattern: 'solid',
374
- fgColor: { argb: '4F81BD' }
375
- };
376
- row.font = {
377
- name: '微软雅黑',
378
- size: 10,
379
- bold: true,
380
- color: { argb: 'FFFFFFFF' }
381
- };
382
- }
383
- });
384
- };
385
-
386
- const getDocData = () => {
387
- return new Promise(resolve => {
388
- setTimeout(() => {
389
- const list = [
390
- { id: 1, name: 'Test1', sex: 'Man', age: 28, address: 'Shenzhen' },
391
- { id: 2, name: 'Test2', sex: 'Women', age: 22, address: 'Guangzhou' },
392
- { id: 3, name: 'Test3', sex: 'Man', age: 32, address: 'Shanghai' },
393
- { id: 4, name: 'Test4', sex: 'Women', age: 23, address: 'test abc' },
394
- { id: 5, name: 'Test5', sex: 'Women', age: 30, address: 'Shanghai' }
395
- ];
396
- resolve({ list, total: 5 });
397
- }, 100);
398
- });
399
- };
400
-
401
- export const getAttrs = attrs => {
402
- const data = {};
403
- Object.keys(attrs).forEach(key => {
404
- const nKey = key.replace(/-(\w)/g, str => str.slice(1).toUpperCase());
405
- data[nKey] = attrs[key];
406
- });
407
- return data;
408
- };
1
+ /*
2
+ * @Author: wei.li
3
+ * @Date: 2022-06-23 17:29:11
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2026-01-12 10:07:54
6
+ * @Description: file content
7
+ */
8
+ // @ts-nocheck
9
+
10
+ import { clone, isString, orderBy, isEmpty, toDateString, isObject, isFunction } from 'xe-utils';
11
+ import { cookies, storageLocal } from '@utogether/utils';
12
+ /** 系统配置的key */
13
+ const kSYSCONFIG = 'kSysConfig';
14
+ const kCOOKIES = 'kCookies_param';
15
+
16
+ const sysConfig = storageLocal.getItem(kSYSCONFIG);
17
+
18
+ let exportOptions = null;
19
+
20
+ /** 工具栏按钮标准化 */
21
+ export const formatButton = (buttons, auth?) => {
22
+ buttons.forEach(btn => {
23
+ btn.auth = auth ? auth[btn.code] || btn.auth : btn.auth;
24
+ if (!btn.name) {
25
+ btn.name = `message.btn.${btn.code}`;
26
+ } else if (sysConfig?.i18nEnabled === 'Y' && !btn.name.startsWith('message.')) {
27
+ btn.name = `message.btn.${btn.name}`;
28
+ }
29
+ if (btn.dropdowns?.length) {
30
+ formatButton(btn.dropdowns, auth);
31
+ }
32
+ });
33
+ return buttons;
34
+ };
35
+
36
+ /**
37
+ * @description 查询10W数据,常用于Excel导出
38
+ * @param props 查询接口的路径
39
+ * @param http http实例
40
+ * @param form 查询条件
41
+ * @returns 查询返回的数据
42
+ */
43
+ export const queryAll = (props, http, form) => {
44
+ console.log('exportMethod', exportOptions);
45
+ const params = { pageNum: 1, pageSize: 100000 };
46
+ const commonParam = getCookieParam();
47
+ Object.assign(params, form, commonParam, props.defaultParams || {}, exportOptions.params);
48
+ let query = formatMultipleParams(params, props.items);
49
+ query = formatDateRange(query, props.items);
50
+
51
+ const { url } = props;
52
+ if (!url) return null;
53
+ const requestURL = isString(url) ? url : url.fetch || url.restful;
54
+ if (!requestURL) return null;
55
+ const method = url.fetch ? 'post' : 'get';
56
+ return new Promise((resolve, reject) => {
57
+ http[method](requestURL, query)
58
+ .then((response: IResponseData) => {
59
+ resolve(response.list);
60
+ })
61
+ .catch((e: any) => {
62
+ reject(e);
63
+ });
64
+ });
65
+ };
66
+
67
+ /**
68
+ * @description 查询服务
69
+ * @param props 查询接口的路径
70
+ * @param form 查询条件
71
+ * @param page 分页参数
72
+ * @param http http实例
73
+ * @param isDoc doc文档
74
+ * @returns Promise
75
+ */
76
+ export const query = (props, form, page, http, code, isDoc) => {
77
+ if (isDoc) return getDocData();
78
+ for (const key in form) {
79
+ if (form[key] && isString(form[key])) {
80
+ form[key] = form[key].trim();
81
+ }
82
+ }
83
+ const params = { pageNum: page.currentPage, pageSize: page.pageSize };
84
+ const commonParam = getCookieParam();
85
+ Object.assign(params, commonParam, props.defaultParams || {}, form);
86
+
87
+ let query = formatMultipleParams(params, props.items);
88
+ query = formatDateRange(query, props.items);
89
+ const { url } = props;
90
+ if (!url) return null;
91
+ const requestURL = isString(url) ? url : url.fetch || url.restful;
92
+ const method = url.fetch ? 'post' : 'get';
93
+ if (!requestURL) return null;
94
+ return http[method](requestURL, query);
95
+ };
96
+
97
+ /**
98
+ * @description 表格删除方法
99
+ * @param http http实例
100
+ * @param records 记录行
101
+ * @param props 删除接口的路径
102
+ * @returns Promise
103
+ */
104
+ export const del = (http, records, props) => {
105
+ const { url } = props;
106
+ if (!url) return null;
107
+ const requestURL = isString(url) ? url : url.del || url.restful;
108
+ if (!requestURL) return null;
109
+ const method = url.del ? 'post' : 'delete';
110
+ return http[method](requestURL, records);
111
+ };
112
+
113
+ /** 更新服务 */
114
+ export const save = (http, body, props) => {
115
+ const allService = [];
116
+ const { url } = props;
117
+ if (!url) return null;
118
+
119
+ const { insertRecords, updateRecords } = body;
120
+ if (!isEmpty(insertRecords)) {
121
+ const commonParam = getCookieParam();
122
+ insertRecords.forEach(m => {
123
+ !isEmpty(props?.defaultValue) && Object.assign(m, props.defaultValue);
124
+ Object.keys(commonParam)?.forEach(key => {
125
+ m[key] = m[key] || commonParam[key];
126
+ });
127
+ });
128
+ const requestURL = isString(url) ? url : url.add || url.restful;
129
+ requestURL && allService.push(http.post(requestURL, insertRecords));
130
+ }
131
+ if (!isEmpty(updateRecords)) {
132
+ const requestURL = isString(url) ? url : url.save || url.restful;
133
+ const method = url.save ? 'post' : 'put';
134
+ requestURL && allService.push(http[method](requestURL, updateRecords));
135
+ }
136
+ return allService;
137
+ };
138
+
139
+ /**
140
+ * 多选数据优化
141
+ * @param listQuery
142
+ * @param items
143
+ * @returns
144
+ */
145
+ const formatMultipleParams = (listQuery: any, items) => {
146
+ const multipleItems = items.filter(f => f.itemRender?.props?.multiple || f.multiple);
147
+ if (isEmpty(multipleItems)) return listQuery;
148
+ const query = clone(listQuery, true);
149
+ multipleItems.forEach((element: any) => {
150
+ if (element.itemRender.name === '#select' && element.itemRender.props.multiple) {
151
+ if (query[`_${element.field}`]?.length === 0) {
152
+ // 重置后
153
+ query[`${element.field}`] = null;
154
+ }
155
+ delete listQuery[`_${element.field}`];
156
+ delete query[`_${element.field}`];
157
+ }
158
+ });
159
+ return query;
160
+ };
161
+
162
+ const startFormatter = 'yyyy-MM-dd 00:00:00';
163
+ const endFormatter = 'yyyy-MM-dd 23:59:59';
164
+ // 时间范围优化
165
+ const formatDateRange = (listQuery: any, items) => {
166
+ const dateRanges = items.filter(f => ['#SuDateRange', 'VxeDateRangePicker'].includes(f.itemRender?.name));
167
+ if (isEmpty(dateRanges)) return listQuery;
168
+ const query = clone(listQuery, true);
169
+ dateRanges.forEach((element: any) => {
170
+ const val = query[element.field];
171
+ if (val && element.itemRender.startField) {
172
+ query[element.itemRender.startField] = toDateString(query[element.itemRender.startField], startFormatter);
173
+ query[element.itemRender.endField] = toDateString(query[element.itemRender.endField], endFormatter);
174
+ } else if (val) {
175
+ query[`${element.field}From`] = toDateString(val[0], startFormatter);
176
+ query[`${element.field}To`] = toDateString(val[1], endFormatter);
177
+ }
178
+ delete query[element.field];
179
+ });
180
+ return query;
181
+ };
182
+
183
+ const getCookieParam = () => {
184
+ return cookies.get(kCOOKIES) ? JSON.parse(cookies.get(kCOOKIES)) : {};
185
+ };
186
+
187
+ /** 工具栏默认按钮组 */
188
+ export const inlineButtons = [
189
+ {
190
+ code: 'insert_actived',
191
+ name: 'add',
192
+ status: 'u-cyan',
193
+ icon: 'vxe-icon-add',
194
+ auth: 'add',
195
+ sort: 1
196
+ },
197
+ {
198
+ code: 'delete',
199
+ status: 'danger',
200
+ icon: 'vxe-icon-delete',
201
+ auth: 'del',
202
+ sort: 2
203
+ },
204
+ {
205
+ code: 'save',
206
+ status: 'primary',
207
+ icon: 'vxe-icon-save',
208
+ auth: 'edit',
209
+ sort: 3
210
+ }
211
+ ];
212
+ // form 模式按钮
213
+ export const dialogButtons = [
214
+ {
215
+ code: 'add',
216
+ status: 'u-cyan',
217
+ icon: 'vxe-icon-add',
218
+ auth: 'add',
219
+ sort: 1
220
+ },
221
+ {
222
+ code: 'del',
223
+ status: 'danger',
224
+ icon: 'vxe-icon-delete',
225
+ auth: 'del',
226
+ sort: 2
227
+ }
228
+ ];
229
+
230
+ export const defaultColums = [
231
+ { field: 'createdByName', width: 90, visible: false },
232
+ { field: 'creationDate', width: 140, visible: false },
233
+ { field: 'lastUpdatedByName', width: 90, visible: false },
234
+ { field: 'lastUpdateDate', width: 140, visible: false }
235
+ ];
236
+
237
+ /** 导出配置 */
238
+ export const getExportConfig = attrs => {
239
+ if (isObject(attrs.exportConfig)) return attrs.exportConfig;
240
+ debugger;
241
+ return {
242
+ filename: attrs.fileName || '导出明细',
243
+ type: 'xlsx',
244
+ types: ['xlsx', 'csv'],
245
+ modes: ['current', 'selected', 'all'],
246
+ useStyle: true,
247
+ sheetMethod: ({ worksheet }) => (attrs.onSheetMethod ? attrs.onSheetMethod(worksheet) : onSheetMethod(worksheet)),
248
+ beforeExportMethod: options =>
249
+ attrs.beforeExportMethod ? (exportOptions = attrs.beforeExportMethod(options)) : null,
250
+ columnFilterMethod: ({ column }) =>
251
+ attrs.columnFilter
252
+ ? !!attrs.columnFilter(column)
253
+ : !['operate'].includes(column.field) && column.type !== 'checkbox'
254
+ };
255
+ };
256
+
257
+ export const getToolBarConfig = (data, props, attrs, hasAuthority) => {
258
+ const refreshOptions = {
259
+ icon: 'ri-refresh-line',
260
+ iconLoading: 'vxe-icon-spinner roll vxe-loading--default-icon'
261
+ };
262
+ // 不可编辑时
263
+ if (!props.editable) {
264
+ data.editConfig.editable = props.editable;
265
+ const hasExport = props.needExport && hasAuthority('export');
266
+ if (hasExport) {
267
+ data.exportConfig = getExportConfig(attrs);
268
+ }
269
+ data.toolbarConfig = {
270
+ buttons: [],
271
+ enabled: hasExport,
272
+ refreshOptions,
273
+ exportOptions: { icon: 'ri-download-2-line', code: 'export' },
274
+ export: hasExport,
275
+ custom: !!attrs.gridId,
276
+ refresh: true,
277
+ perfect: true
278
+ };
279
+ return data;
280
+ }
281
+
282
+ // 先设置传入的按钮
283
+ let buttons = clone(attrs.buttons || [], true);
284
+
285
+ buttons.forEach((button, idx) => {
286
+ button.sort = button.sort || idx + 10;
287
+ });
288
+
289
+ // 获取默认的按钮
290
+ const toolButtons = attrs.mode !== 'form' ? clone(inlineButtons, true) : clone(dialogButtons, true);
291
+ // 判断传入的按钮是否有默认按钮的auth,有就不加入按钮组中,相当于重写了默认的按钮
292
+ // reverse的原因是: 保持现有按钮顺序, 新增,保存,删除
293
+ toolButtons.reverse().forEach(btn => {
294
+ !buttons.some(s => s.code === btn.code) && buttons.unshift(btn);
295
+ if (attrs.authPrefix && !['printer', 'export'].includes(btn.auth)) {
296
+ btn.auth = attrs.authPrefix + btn.auth.slice(0, 1).toLocaleUpperCase() + btn.auth.slice(1).toLocaleLowerCase();
297
+ }
298
+ });
299
+
300
+ buttons = formatButton(buttons, props.auth).filter(button => {
301
+ const flag = button.auth ? hasAuthority(button.auth) : true;
302
+ if (button.dropdowns?.length) {
303
+ button.dropdowns = button.dropdowns.filter(btn => !btn.auth || (btn.auth && hasAuthority(btn.auth)));
304
+ }
305
+ return flag;
306
+ });
307
+ // inline 行内模式,单击行模式
308
+ const editConfig = { trigger: 'dblclick', mode: 'row', showStatus: true };
309
+ data.editConfig = attrs.mode !== 'form' ? editConfig : { enabled: false };
310
+ // 导出权限
311
+ const hasExport = props.needExport && hasAuthority('export');
312
+ let exportBtn = null;
313
+ if (hasExport) {
314
+ data.exportConfig = getExportConfig(attrs);
315
+ exportBtn = { icon: 'ri-download-2-line', code: 'export' };
316
+ }
317
+ data.toolbarConfig = {
318
+ buttons: orderBy(buttons, 'sort'),
319
+ enabled: true,
320
+ refreshOptions,
321
+ customOptions: attrs.gridId ? {} : null,
322
+ exportOptions: exportBtn,
323
+ custom: !!attrs.gridId,
324
+ export: hasExport,
325
+ refresh: true,
326
+ perfect: true
327
+ };
328
+ return data;
329
+ };
330
+
331
+ /**
332
+ * @description: 表格脚合并方法
333
+ * @param {*} columns 列数据
334
+ * @param {*} data 数据源
335
+ * @param {*} sum 合并属性
336
+ * @return {*} 合并脚方法
337
+ */
338
+ export const footerSumMethod = ({ columns, data }, sum) => {
339
+ return [
340
+ columns.map((column, columnIdx) => {
341
+ if (columnIdx === (sum.index || 0)) {
342
+ return sum.label || '合计';
343
+ }
344
+ if (sum.fields?.includes(column.property)) {
345
+ const total = data.reduce((prev, cur) => {
346
+ return prev + Number(cur[column.property] || 0);
347
+ }, 0);
348
+ return total ? Number(total.toFixed(sum.decimal || 2)) : total;
349
+ }
350
+ return '';
351
+ })
352
+ ];
353
+ };
354
+
355
+ /**
356
+ * @description: checkbox是否可选
357
+ */
358
+ export const onCheckMethod = (row, props) => {
359
+ if (isFunction(props.checkMethod)) {
360
+ return props.checkMethod(row);
361
+ }
362
+ return true;
363
+ };
364
+
365
+ /*** excel样式重置 */
366
+ const onSheetMethod = ws => {
367
+ ws.eachRow((row, rowNumber) => {
368
+ row.font = { name: '微软雅黑', size: 9 };
369
+ row.border = {
370
+ top: { style: 'thin' },
371
+ left: { style: 'thin' },
372
+ bottom: { style: 'thin' },
373
+ right: { style: 'thin' }
374
+ };
375
+
376
+ if (rowNumber === 1) {
377
+ row.fill = {
378
+ type: 'pattern',
379
+ pattern: 'solid',
380
+ fgColor: { argb: '4F81BD' }
381
+ };
382
+ row.font = {
383
+ name: '微软雅黑',
384
+ size: 10,
385
+ bold: true,
386
+ color: { argb: 'FFFFFFFF' }
387
+ };
388
+ }
389
+ });
390
+ };
391
+
392
+ const getDocData = () => {
393
+ return new Promise(resolve => {
394
+ setTimeout(() => {
395
+ const list = [
396
+ { id: 1, name: 'Test1', sex: 'Man', age: 28, address: 'Shenzhen' },
397
+ { id: 2, name: 'Test2', sex: 'Women', age: 22, address: 'Guangzhou' },
398
+ { id: 3, name: 'Test3', sex: 'Man', age: 32, address: 'Shanghai' },
399
+ { id: 4, name: 'Test4', sex: 'Women', age: 23, address: 'test abc' },
400
+ { id: 5, name: 'Test5', sex: 'Women', age: 30, address: 'Shanghai' }
401
+ ];
402
+ resolve({ list, total: 5 });
403
+ }, 100);
404
+ });
405
+ };
406
+
407
+ export const getAttrs = attrs => {
408
+ const data = {};
409
+ Object.keys(attrs).forEach(key => {
410
+ const nKey = key.replace(/-(\w)/g, str => str.slice(1).toUpperCase());
411
+ data[nKey] = attrs[key];
412
+ });
413
+ return data;
414
+ };