@utogether/udp-core 2.0.0-beta.1 → 2.0.0-beta.3

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 (182) hide show
  1. package/dist/{403-CTJDBjz7.js → 403-CxOqlq0f.js} +3 -3
  2. package/dist/403-WCboRvzZ-ZAPgYStl.js +65 -0
  3. package/dist/404-2V0Qi-d7-DkNwQggp.js +65 -0
  4. package/dist/{404-BFYkWIkQ.js → 404-xdB6lFeQ.js} +1 -1
  5. package/dist/500-BYfzvixf-CGpEieyQ.js +67 -0
  6. package/dist/{500-DGG3qadg.js → 500-C94bRK2S.js} +2 -2
  7. package/dist/AuthorityInfo-DBovfUjB-DpQwT9Q5.js +4 -0
  8. package/dist/{AuthorityInfo-ozZIo1Te.js → AuthorityInfo-Dy3b_nFN.js} +1 -1
  9. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-DujerENw.js → AuthorityInfo.vue_vue_type_style_index_0_lang-Bh7IbcdY.js} +2 -2
  10. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-D-l_Az3s-Cw7WmFxz.js +100 -0
  11. package/dist/AuthorityPanel-CRlAwbaI-G7pZXKdE.js +4 -0
  12. package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S-CJvk3pW8.js +114 -0
  13. package/dist/Company-B4vsXy2I-CkNCOqjJ.js +25 -0
  14. package/dist/{Company-6VJtwh23.js → Company-gKkfnhLt.js} +3 -3
  15. package/dist/{CompanyPanel-B2P488mq.js → CompanyPanel-BF5Pc35s.js} +7 -7
  16. package/dist/CompanyPanel-Czcx8Gyw-CvndXwB_.js +206 -0
  17. package/dist/DataSet-DT-rGICv-DaUfgbxk.js +147 -0
  18. package/dist/{Department-BnwoLEOC.js → Department-D0I3QVZe.js} +3 -3
  19. package/dist/Department-D0dVUrGC-C6HJcYI1.js +25 -0
  20. package/dist/{DepartmentPanel-CRrrmxtv.js → DepartmentPanel-2LHODgc7.js} +22 -22
  21. package/dist/DepartmentPanel-e91Lxr1j-BS_A-ILd.js +254 -0
  22. package/dist/{DesignPanel-CvbccgX2.js → DesignPanel-CtF3cAAQ.js} +1 -1
  23. package/dist/DesignPanel-DdFl_ohi-uCwFxcl1.js +4 -0
  24. package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BACPrfUI-cC7yL0uY.js +1013 -0
  25. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-Dz2tUszs.js → DesignPanel.vue_vue_type_style_index_0_lang-BCYgwoVt.js} +3 -3
  26. package/dist/DictView-BzQLOf_P-DDicwdmM.js +111 -0
  27. package/dist/{DictView-Ce1LoVHh.js → DictView-H3V5hxg3.js} +1 -1
  28. package/dist/{InvOrganization-BwCFZO1X.js → InvOrganization-BiGLnbqe.js} +2 -2
  29. package/dist/InvOrganization-atbhw0CI-BABbVt9V.js +74 -0
  30. package/dist/Org-BW1YHG-Q-Cow7JWlD.js +39 -0
  31. package/dist/{Org-0hzs6b0R.js → Org-DQTCQHNY.js} +2 -2
  32. package/dist/Preview-DJtVsoq1-CCGidQjJ.js +48 -0
  33. package/dist/{Preview--DnEAhwh.js → Preview-DXaiis29.js} +1 -1
  34. package/dist/{ReportDefine-Cu983bTN.js → ReportDefine-BLh4CiER.js} +1 -1
  35. package/dist/ReportDefine-CNx_ob99-6NQAHK-Q.js +10 -0
  36. package/dist/ReportDesign-FbQ6yTJS-C1pPAUSp.js +165 -0
  37. package/dist/{ReportDesign-QsWXXgvo.js → ReportDesign-Ni1YxrLC.js} +7 -7
  38. package/dist/ReportQuery-C5gz8Lgd-Eu2cQmda.js +75 -0
  39. package/dist/{ReportQuery-BjKIIhPu.js → ReportQuery-C8G88_qF.js} +1 -1
  40. package/dist/ReportQueryFrom-C7scua5v-uHXWq8Gy.js +4 -0
  41. package/dist/{ReportQueryFrom-DIjBO6Fx.js → ReportQueryFrom-CuZKPtB4.js} +1 -1
  42. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-0T62cUMK.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-BAn_siFW.js} +7 -7
  43. package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DCbz67Wa-vK6r2uCl.js +178 -0
  44. package/dist/ReportTemplate-BDANdIWv-D_IGjR1w.js +161 -0
  45. package/dist/{ReportTemplate-2uk9tJcy.js → ReportTemplate-DFnDXWmx.js} +8 -8
  46. package/dist/{Role-_QP8QEaI.js → Role-BQ7hsfPn.js} +3 -3
  47. package/dist/Role-ByB0WbxW-5E8Mb148.js +25 -0
  48. package/dist/RoleAssign-DW6iC_0v-Bis61auk.js +26 -0
  49. package/dist/{RoleAssign-C2gkcmEQ.js → RoleAssign-UPCg2d4G.js} +3 -3
  50. package/dist/RolePanel-BM2MaQPU-CgcsbfaX.js +4 -0
  51. package/dist/{RolePanel-vnl_lXNY.js → RolePanel-C-mQ5XRq.js} +1 -1
  52. package/dist/RolePanel-ClQy8DBL-DARL4O-o.js +4 -0
  53. package/dist/{RolePanel-B8FPNGaA.js → RolePanel-CoSXOCZN.js} +1 -1
  54. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-Bc_Ao_PU-DMmxr2iI.js +132 -0
  55. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-bxHXrBYl.js → RolePanel.vue_vue_type_script_setup_true_lang-Bg-t2UhF.js} +7 -7
  56. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-BuQbYEEI.js → RolePanel.vue_vue_type_script_setup_true_lang-D-o7HYZ8.js} +8 -8
  57. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-fthF1zkp-JsbQJoDy.js +154 -0
  58. package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-ByWIwajm-BsBf2Vs3.js +100 -0
  59. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-C6yZXBqB.js → ScrollPanel.vue_vue_type_style_index_0_lang-CCsoxDfk.js} +1 -1
  60. package/dist/Staff-CuxzvhD9-D0KTcyRh.js +25 -0
  61. package/dist/{Staff-CHWrMIEb.js → Staff-D-CmvG1R.js} +3 -3
  62. package/dist/StaffInfo-CY7gUICu-EZUhUwIp.js +4 -0
  63. package/dist/{StaffInfo-Cpq2eayz.js → StaffInfo-Idhvuc6e.js} +1 -1
  64. package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-Dd8gtQz8-Dlkt-eCn.js +108 -0
  65. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-BVCjF2i1.js → StaffInfo.vue_vue_type_script_setup_true_lang-MUGKjnHU.js} +1 -1
  66. package/dist/{StaffPanel-D2BMXt5p.js → StaffPanel-CDDmAYE5.js} +1 -1
  67. package/dist/StaffPanel-CwqG0_xr-CrvzLJoc.js +4 -0
  68. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-B6jAGo-g.js → StaffPanel.vue_vue_type_script_setup_true_lang-Bdilqbee.js} +42 -42
  69. package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-DCdBy8Hu-BXrueqi0.js +143 -0
  70. package/dist/SysUser-9Q2UJWhi-DprWXFlR.js +15 -0
  71. package/dist/{SysUser-om6H1BeC.js → SysUser-a-j5bppr.js} +2 -2
  72. package/dist/{SysUserPanel-CH0HPP7h.js → SysUserPanel-6V232wwB.js} +1 -1
  73. package/dist/SysUserPanel-bJy69O7x-BJtBgFEs.js +4 -0
  74. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-Dpl13ee0.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BOtHuMVy.js} +2 -2
  75. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DUPFqgz3-BSqRCMen.js +356 -0
  76. package/dist/{SystemMenu-BkG_DKxA.js → SystemMenu-BnVeOSOQ.js} +7 -7
  77. package/dist/SystemMenu-DGOAolc1-CJSLHP8i.js +156 -0
  78. package/dist/UserInfo-CKoOHkAM-DDWp0I_U.js +4 -0
  79. package/dist/{UserInfo-D9croxUe.js → UserInfo-Cax9b2nw.js} +1 -1
  80. package/dist/UserInfo.vue_vue_type_style_index_0_lang-BaT53SSu-DsNaAomO.js +160 -0
  81. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-DLIP8xpN.js → UserInfo.vue_vue_type_style_index_0_lang-D-cw11i9.js} +2 -2
  82. package/dist/await-to-js.es5-Bv3Eu4mi-UCggJjes.js +10 -0
  83. package/dist/await-to-js.es5-Bv3Eu4mi.js +10 -0
  84. package/dist/childView-0YZQ6GBn-CEqg7k5d.js +4 -0
  85. package/dist/{childView-BY_Ip-l1.js → childView-DKG3eZo8.js} +1 -1
  86. package/dist/childView-DKkgi3yo-D47ft-vi.js +4 -0
  87. package/dist/{childView-CHp_TueS.js → childView-siumuBz0.js} +1 -1
  88. package/dist/childView.vue_vue_type_style_index_0_lang-ABMrGInv-ClOdE_sa.js +143 -0
  89. package/dist/{childView.vue_vue_type_style_index_0_lang-BNHbDRjt.js → childView.vue_vue_type_style_index_0_lang-CUfXDS1q.js} +8 -8
  90. package/dist/{childView.vue_vue_type_style_index_0_lang-CbjGf7Z7.js → childView.vue_vue_type_style_index_0_lang-CW3EbAmW.js} +8 -8
  91. package/dist/childView.vue_vue_type_style_index_0_lang-CaW106ve-CClTM8PK.js +180 -0
  92. package/dist/{code-rule-Ce6yWqCq.js → code-rule-Dtoree6F.js} +2 -2
  93. package/dist/code-rule-wQyfgpNL-C4evD4Co.js +148 -0
  94. package/dist/core.es.js +10 -10
  95. package/dist/cron-task-C-kryDtd-C0NuGZCe.js +135 -0
  96. package/dist/{cron-task-DziaH0rI.js → cron-task-GSRgA7S5.js} +2 -2
  97. package/dist/flow-task-B07st2aD-CgQvagSQ.js +10 -0
  98. package/dist/frameView-BOGA3ezf-QoSxzmSQ.js +44 -0
  99. package/dist/{frameView-DNeCVQaY.js → frameView-Cy6wxW0K.js} +1 -1
  100. package/dist/{index-BabfUVv_.js → index-Dc7xWMiC.js} +1057 -1033
  101. package/dist/layout-home-3Dy4onl4.js +228 -0
  102. package/dist/layout-home-CYHksXN_-Basy-3IH.js +228 -0
  103. package/dist/layoutView-BaRvAbIa-xVgfqspc.js +3302 -0
  104. package/dist/{layoutView-12Mlp9A2.js → layoutView-DMjNscJ-.js} +8 -8
  105. package/dist/log-in-Cx1dGik8-BVeEHeZ8.js +117 -0
  106. package/dist/{log-in-1NGaA5OM.js → log-in-VAG6Cvcx.js} +8 -8
  107. package/dist/log-out-COYdxrNC-ftopGZdE.js +130 -0
  108. package/dist/{log-out-B8_atGcQ.js → log-out-DZGaMCjC.js} +4 -4
  109. package/dist/{login-5dydO6GR.js → login-CqVMdNHs.js} +16 -16
  110. package/dist/login-Dg9ofNS8-Bocp1XMA.js +241 -0
  111. package/dist/login-log-DJBGJVV0-AoOyj0jD.js +70 -0
  112. package/dist/lov-view-C0T5prk8-B2DBmn55.js +97 -0
  113. package/dist/{lov-view-DPvGUu3h.js → lov-view-Cc68_28B.js} +7 -7
  114. package/dist/{menuInfo-DVADYfEK.js → menuInfo-BIrIaJlH.js} +1 -1
  115. package/dist/menuInfo-BZJ_q7bz-Drho-_QC.js +4 -0
  116. package/dist/menuInfo.vue_vue_type_style_index_0_lang-BA8xjUo3-BCZ1wipf.js +363 -0
  117. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DgsifDrm.js → menuInfo.vue_vue_type_style_index_0_lang-DlE4w35X.js} +2 -2
  118. package/dist/{pda-app-BZXs-2BQ.js → pda-app-DnjphrRS.js} +9 -9
  119. package/dist/pda-app-m9hsppHo-B4xyja1o.js +710 -0
  120. package/dist/redirect-BqegffKC-CBCIuqmz.js +15 -0
  121. package/dist/resource-C6KEIXu--B_ddyecm.js +97 -0
  122. package/dist/{resource-BZA9NFKc.js → resource-DISgPDM7.js} +4 -4
  123. package/dist/su-welcome-BjbuSrBZ.js +49424 -0
  124. package/dist/su-welcome-CYYy-dzr-D3RKPoB0.js +42089 -0
  125. package/dist/sys-config-DCjJGtht-DARDjlrt.js +370 -0
  126. package/dist/{sys-config-DQmNjWH4.js → sys-config-Yc9vh1t1.js} +13 -13
  127. package/dist/udp-core.css +1 -1
  128. package/dist/utogether-MlnyYtNS-CGgjFNPS.js +4 -0
  129. package/package.json +5 -2
  130. package/src/App.vue +71 -71
  131. package/src/components/udp/content/index.vue +88 -88
  132. package/src/components/udp/form-upload/form-upload.vue +492 -492
  133. package/src/components/udp/grid/index.vue +524 -524
  134. package/src/components/udp/index.ts +6 -6
  135. package/src/components/udp/ut-stamp-badge/index.vue +271 -271
  136. package/src/components/udp/utils.ts +408 -408
  137. package/src/layout/components/lay-content/index.vue +136 -136
  138. package/src/layout/components/lay-search/components/SearchModal.vue +181 -189
  139. package/src/layout/components/lay-setting/index.vue +503 -503
  140. package/src/layout/components/lay-sidebar/sidebar-logo.vue +101 -101
  141. package/src/layout/components/lay-tag/index.vue +598 -598
  142. package/src/layout/hooks/useNav.ts +176 -176
  143. package/src/layout/hooks/useTag.ts +227 -227
  144. package/src/layout/layoutView.vue +216 -216
  145. package/src/layout/types.ts +93 -93
  146. package/src/main.ts +111 -112
  147. package/src/plugins/i18n/zh.ts +1 -0
  148. package/src/plugins/vxe-table/index.ts +116 -116
  149. package/src/plugins/vxe-table/render.tsx +968 -968
  150. package/src/router/index.ts +187 -187
  151. package/src/router/modules/home.ts +32 -32
  152. package/src/router/utils.ts +420 -420
  153. package/src/store/modules/epTheme.ts +48 -48
  154. package/src/style/vxetable.scss +364 -356
  155. package/src/utils/dataFormat/index.ts +222 -222
  156. package/src/utils/lifecycle.ts +39 -39
  157. package/src/views/organization/department/DepartmentPanel.vue +303 -303
  158. package/src/views/organization/staff/StaffInfo.vue +127 -127
  159. package/src/views/organization/staff/StaffPanel.vue +3 -3
  160. package/src/views/system/layout/layout-home.vue +45 -7
  161. package/src/views/system/menu/AuthorityPanel.vue +141 -141
  162. package/src/views/system/menu/SystemMenu.vue +194 -194
  163. package/src/views/system/menu/menuInfo.vue +1 -1
  164. package/src/views/system/sysUser/SysUserPanel.vue +363 -363
  165. package/src/views/udev/coderule/code-rule.vue +132 -132
  166. package/src/views/udev/dict/DictView.vue +118 -118
  167. package/src/views/udev/dict/childView.vue +184 -184
  168. package/src/views/udev/lov/childView.vue +174 -174
  169. package/src/views/uhome/components/common-menu.vue +118 -0
  170. package/src/views/uhome/components/dynamic-component.vue +66 -0
  171. package/src/views/uhome/components/home-todo.vue +170 -0
  172. package/src/views/uhome/components/menu-favorite.vue +315 -315
  173. package/src/views/uhome/dynamic-card.vue +18 -19
  174. package/src/views/uhome/su-welcome.vue +46 -116
  175. package/src/views/ulogin/login.vue +336 -336
  176. package/src/views/upms/interface/log-in.vue +100 -100
  177. package/src/views/upms/interface/log-out.vue +104 -104
  178. package/src/views/upms/user/login-log.vue +54 -54
  179. package/types/global.d.ts +232 -232
  180. package/dist/await-to-js.es5-BtRbN2QH.js +0 -10
  181. package/dist/layout-home-Cis1KlEr.js +0 -195
  182. package/dist/su-welcome-BXe6Cdp3.js +0 -580
@@ -1,408 +1,408 @@
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: 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
+ };