@utogether/udp-core 1.0.0 → 1.0.1-beta.10

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 (201) hide show
  1. package/build/plugins.ts +39 -26
  2. package/dist/{403-B1R-4vXw.js → 403-Ctxjn4q8.js} +9 -8
  3. package/dist/{404-fXPl8csw.js → 404-W5yzyiZ9.js} +15 -14
  4. package/dist/{500-eI5842YB.js → 500-DXuGEOm4.js} +11 -10
  5. package/dist/{AuthorityInfo-CfVH6PaB.js → AuthorityInfo-C2tflCt8.js} +1 -1
  6. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-SVgy3HX7.js +100 -0
  7. package/dist/{AuthorityPanel-BaLMwMgW.js → AuthorityPanel-BeBNiwqc.js} +1 -1
  8. package/dist/{AuthorityPanel.vue_vue_type_style_index_0_lang-C_bkqLD9.js → AuthorityPanel.vue_vue_type_style_index_0_lang-CIYmnP9-.js} +6 -6
  9. package/dist/{Company-CYC9Avfz.js → Company-PLez5GoH.js} +3 -3
  10. package/dist/{CompanyPanel-B4MzoqN_.js → CompanyPanel-CIGaQooL.js} +20 -20
  11. package/dist/{Department-B4BNSiYx.js → Department-B9wLsXFm.js} +3 -3
  12. package/dist/{DepartmentPanel-zJO89L2O.js → DepartmentPanel-DSM4lTaz.js} +23 -23
  13. package/dist/{DesignPanel-S8P0J97f.js → DesignPanel-B6a9wW_A.js} +1 -1
  14. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DW-_Vqrr.js → DesignPanel.vue_vue_type_style_index_0_lang-DtHfoDQk.js} +28 -30
  15. package/dist/DictView-DhFbQxdJ.js +110 -0
  16. package/dist/{InvOrganization-MuM2jtsG.js → InvOrganization-D90AbR3b.js} +2 -2
  17. package/dist/Org-DxBkYabD.js +39 -0
  18. package/dist/{Preview-CRyiwUIR.js → Preview-BFtRpBxw.js} +1 -1
  19. package/dist/{ReportDefine-WZYIx8Sm.js → ReportDefine-BIa2QryC.js} +1 -1
  20. package/dist/{ReportDesign-D-7GKgpb.js → ReportDesign-CnyjI-WD.js} +44 -44
  21. package/dist/{ReportQuery-BIIJny6w.js → ReportQuery-BiK7yEhV.js} +5 -5
  22. package/dist/{ReportQueryFrom-OoUl7N2O.js → ReportQueryFrom-C2rqdFTm.js} +1 -1
  23. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-B878fgj8.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-Ba9HLnXQ.js} +6 -5
  24. package/dist/{ReportTemplate-Cfeq9US-.js → ReportTemplate-DdkLscP3.js} +30 -30
  25. package/dist/{Role-BwTV2QMH.js → Role-BrsxgK8D.js} +6 -6
  26. package/dist/{RoleAssign-De1JjOun.js → RoleAssign-DiqwJqDa.js} +8 -8
  27. package/dist/{RolePanel-pUBXsqCM.js → RolePanel-BDusGyo7.js} +1 -1
  28. package/dist/{RolePanel-E3RcdByM.js → RolePanel-Dqx5dI3f.js} +1 -1
  29. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-2Z1q_5uW.js +132 -0
  30. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-B2pQwHb0.js → RolePanel.vue_vue_type_script_setup_true_lang-B5lUnaMI.js} +40 -34
  31. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-vMR1fBi0.js → ScrollPanel.vue_vue_type_style_index_0_lang-vSP23fEq.js} +23 -23
  32. package/dist/{Staff-Czm7A8vI.js → Staff-Cwi9LQiZ.js} +3 -3
  33. package/dist/StaffInfo-XjVtyaMv.js +4 -0
  34. package/dist/{StaffInfo.vue_vue_type_style_index_0_lang-DMTL7KCh.js → StaffInfo.vue_vue_type_script_setup_true_lang-wSrAuyet.js} +16 -16
  35. package/dist/{StaffPanel-CHk60LEz.js → StaffPanel-C-wYcFdv.js} +1 -1
  36. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-iPKLb5wG.js → StaffPanel.vue_vue_type_script_setup_true_lang-DZNArmnC.js} +46 -49
  37. package/dist/{SysUser-BGwbttRn.js → SysUser-O4tvr-Ur.js} +2 -2
  38. package/dist/{SysUserPanel-BCbKoLKt.js → SysUserPanel-B853docZ.js} +1 -1
  39. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DhiYYC97.js +294 -0
  40. package/dist/{SystemMenu-BkqZSDKl.js → SystemMenu-CXR6mrXr.js} +52 -50
  41. package/dist/{UserInfo-BsyAcT2d.js → UserInfo-BkP8pE2a.js} +1 -1
  42. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-D0-KDxAh.js → UserInfo.vue_vue_type_style_index_0_lang-D4r_umjV.js} +38 -36
  43. package/dist/{childView-CyuLTUqC.js → childView-D0HwbgDT.js} +1 -1
  44. package/dist/{childView-CF83nhxb.js → childView-TRqUkSDC.js} +1 -1
  45. package/dist/{childView.vue_vue_type_style_index_0_lang-CNSgGda3.js → childView.vue_vue_type_style_index_0_lang-BzISq0Jf.js} +43 -43
  46. package/dist/{childView.vue_vue_type_style_index_0_lang-Cch4lE-i.js → childView.vue_vue_type_style_index_0_lang-DQRgNsJY.js} +1 -1
  47. package/dist/{code-rule-Bz-gnktN.js → code-rule-BV7PQWhK.js} +13 -14
  48. package/dist/core.es.js +13 -10
  49. package/dist/{cron-task-CIifSUdW.js → cron-task-9ZS9bi7K.js} +11 -11
  50. package/dist/{frameView-_d2mqjjQ.js → frameView-DE83AN50.js} +15 -14
  51. package/dist/img/l_img.svg +1 -1
  52. package/dist/img/minicolors.png +0 -0
  53. package/dist/img/v_img.svg +1 -1
  54. package/dist/index-DVARtten.js +2623 -0
  55. package/dist/{layoutView-DLKVepB8.js → layoutView-D1U-c4By.js} +730 -724
  56. package/dist/{login-log-CvVnyGi3.js → login-log-kqKzKTto.js} +1 -1
  57. package/dist/{login-LREiDfFU.js → login-sPCEiTGT.js} +107 -113
  58. package/dist/{lov-view-DDrIVILB.js → lov-view-76NcYTYl.js} +5 -5
  59. package/dist/{menuInfo-B1FUV-Sk.js → menuInfo-CxjfjFpm.js} +1 -1
  60. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-Cnk3vdtD.js → menuInfo.vue_vue_type_style_index_0_lang-C2qahH3r.js} +98 -95
  61. package/dist/pda-app-BUH16bLj.js +710 -0
  62. package/dist/redirect-BqegffKC.js +15 -0
  63. package/dist/{resource-BCwx9fEv.js → resource-CCuHzoA6.js} +18 -18
  64. package/dist/{su-welcome-189A7N4r.js → su-welcome-mRArONsd.js} +133 -133
  65. package/dist/{sys-config-BZ3sejow.js → sys-config-Cvt05yF6.js} +21 -21
  66. package/dist/udp-core.css +2 -2
  67. package/dist/{utogether-r08LNiIZ.js → utogether-Dm_VBQHR.js} +6 -6
  68. package/index.ts +40 -36
  69. package/package.json +4 -2
  70. package/src/App.vue +65 -70
  71. package/src/api/index.ts +1 -1
  72. package/src/components/SuCharts/src/UserInfo.vue +78 -78
  73. package/src/components/SuScrollTree/ScrollPanel.vue +3 -3
  74. package/src/components/udp/count-down.vue +536 -0
  75. package/src/components/udp/flip-down/FlipCard/flip-card.vue +251 -0
  76. package/src/components/udp/flip-down/FlipCard/interfaces.ts +4 -0
  77. package/src/components/udp/flip-down/FlipClock/flip-clock.vue +113 -0
  78. package/src/components/udp/form-upload.vue +482 -0
  79. package/src/components/udp/form.vue +112 -0
  80. package/src/components/udp/grid.vue +495 -0
  81. package/src/components/udp/index.ts +10 -0
  82. package/src/components/udp/lov.vue +388 -0
  83. package/src/components/udp/modal-form.vue +189 -0
  84. package/src/components/udp/modal-grid.vue +288 -0
  85. package/src/components/udp/upload.vue +423 -0
  86. package/src/components/udp/utils.ts +447 -0
  87. package/src/directives/permission/index.ts +1 -1
  88. package/src/layout/components/lay-navbar/index.vue +1 -1
  89. package/src/layout/components/lay-panel/index.vue +150 -150
  90. package/src/layout/components/lay-search/index.vue +25 -25
  91. package/src/layout/components/lay-sidebar/breadCrumb.vue +1 -1
  92. package/src/layout/components/lay-tag/index.vue +625 -625
  93. package/src/layout/layoutView.vue +215 -215
  94. package/src/main.ts +25 -14
  95. package/src/plugins/i18n/en.ts +302 -289
  96. package/src/plugins/i18n/zh.ts +348 -337
  97. package/src/plugins/vxe-table/index.ts +53 -46
  98. package/src/plugins/vxe-table/render.tsx +956 -397
  99. package/src/router/index.ts +187 -183
  100. package/src/router/modules/remaining.ts +58 -83
  101. package/src/style/button.scss +85 -78
  102. package/src/style/tailwind.css +1 -68
  103. package/src/style/vxetable.scss +44 -11
  104. package/src/utils/authority/index.ts +1 -1
  105. package/src/utils/{http → udp/http}/index.ts +8 -24
  106. package/src/utils/{http → udp/http}/types.d.ts +8 -5
  107. package/src/utils/udp/useRender.ts +431 -0
  108. package/src/views/login/login-view.vue +2 -2
  109. package/src/views/organization/company/CompanyPanel.vue +259 -259
  110. package/src/views/organization/inv-org/InvOrganization.vue +1 -1
  111. package/src/views/organization/org/Org.vue +9 -5
  112. package/src/views/organization/staff/StaffInfo.vue +0 -30
  113. package/src/views/organization/staff/StaffPanel.vue +4 -3
  114. package/src/views/system/menu/AuthorityPanel.vue +2 -2
  115. package/src/views/system/menu/SystemMenu.vue +183 -191
  116. package/src/views/system/menu/menuInfo.vue +363 -368
  117. package/src/views/system/role/AuthorityInfo.vue +19 -33
  118. package/src/views/system/role/Role.vue +1 -5
  119. package/src/views/system/role/RolePanel.vue +11 -2
  120. package/src/views/system/role/UserInfo.vue +195 -193
  121. package/src/views/system/role-assign/RoleAssign.vue +57 -57
  122. package/src/views/system/role-assign/RolePanel.vue +139 -136
  123. package/src/views/system/sys/sys-config.vue +1 -1
  124. package/src/views/system/sysUser/SysUserPanel.vue +278 -278
  125. package/src/views/uapp/pda/pda-app.vue +208 -176
  126. package/src/views/udev/dict/DictView.vue +118 -106
  127. package/src/views/udev/dict/childView.vue +7 -7
  128. package/src/views/udev/lov/lov-view.vue +91 -91
  129. package/src/views/ufile/aggregation/File.vue +5 -5
  130. package/src/views/ufile/file/water-mark.vue +14 -14
  131. package/src/views/uhome/components/menu-favorite.vue +1 -1
  132. package/src/views/uhome/su-welcome.vue +4 -4
  133. package/src/views/ulogin/login.vue +15 -10
  134. package/src/views/upms/user/login-log.vue +1 -1
  135. package/src/views/urpt/design/DesignPanel.vue +507 -526
  136. package/src/views/urpt/design/ReportDesign.vue +15 -19
  137. package/src/views/urpt/static-resource/resource.vue +3 -3
  138. package/src/views/urpt/template/ReportTemplate.vue +7 -7
  139. package/types/global.d.ts +2 -2
  140. package/vite.config.ts +13 -2
  141. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-DbK-f8jH.js +0 -102
  142. package/dist/DictView-bIS5-rK-.js +0 -95
  143. package/dist/Org-kXHSjsgJ.js +0 -35
  144. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-CTIad9_Q.js +0 -126
  145. package/dist/StaffInfo-DJzvBuxy.js +0 -4
  146. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-0QUjnhjF.js +0 -289
  147. package/dist/core.umd.js +0 -173
  148. package/dist/index-BKIw8tSn.js +0 -9195
  149. package/dist/pda-app-CRhVGijN.js +0 -2209
  150. package/dist/redirect-DiaNDu8F.js +0 -15
  151. package/src/assets/images/empty.png +0 -0
  152. package/src/assets/images/logo.png +0 -0
  153. package/src/components/ReCountTo/README.md +0 -2
  154. package/src/components/ReCountTo/index.ts +0 -18
  155. package/src/components/ReCountTo/src/normal/index.tsx +0 -165
  156. package/src/components/ReCountTo/src/normal/props.ts +0 -37
  157. package/src/components/ReCountTo/src/rebound/index.tsx +0 -67
  158. package/src/components/ReCountTo/src/rebound/props.ts +0 -14
  159. package/src/components/ReCountTo/src/rebound/rebound.css +0 -77
  160. package/src/components/ReCropper/index.ts +0 -14
  161. package/src/components/ReCropper/src/index.tsx +0 -141
  162. package/src/components/ReFlicker/index.css +0 -39
  163. package/src/components/ReFlicker/index.ts +0 -50
  164. package/src/components/ReFlop/index.ts +0 -14
  165. package/src/components/ReFlop/src/Filpper.tsx +0 -99
  166. package/src/components/ReFlop/src/filpper.css +0 -184
  167. package/src/components/ReFlop/src/index.vue +0 -126
  168. package/src/components/ReFlowChart/index.ts +0 -24
  169. package/src/components/ReFlowChart/src/Control.vue +0 -139
  170. package/src/components/ReFlowChart/src/DataDialog.vue +0 -12
  171. package/src/components/ReFlowChart/src/NodePanel.vue +0 -151
  172. package/src/components/ReFlowChart/src/adpterForTurbo.ts +0 -160
  173. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.css +0 -49
  174. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.eot +0 -0
  175. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.js +0 -61
  176. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.json +0 -58
  177. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.svg +0 -47
  178. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.ttf +0 -0
  179. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.woff +0 -0
  180. package/src/components/ReFlowChart/src/assets/iconfont/iconfont.woff2 +0 -0
  181. package/src/components/ReFlowChart/src/config.ts +0 -62
  182. package/src/components/ReSplitPane/index.css +0 -49
  183. package/src/components/ReSplitPane/index.tsx +0 -119
  184. package/src/components/ReSplitPane/resizer.css +0 -45
  185. package/src/components/ReSplitPane/resizer.tsx +0 -30
  186. package/src/components/SuCommon/card/components/Card.vue +0 -148
  187. package/src/components/SuCommon/card/components/DialogForm.vue +0 -127
  188. package/src/components/SuCommon/card/index.vue +0 -142
  189. package/src/components/SuCommon/icon-select/index.vue +0 -241
  190. package/src/components/SuCommon/table/index.vue +0 -208
  191. package/src/components/SuCommon/utils/index.ts +0 -103
  192. package/src/components/SuCommon/utils/slot.tsx +0 -50
  193. package/src/views/components/contextmenu/basic.vue +0 -74
  194. package/src/views/components/contextmenu/context-menu.vue +0 -40
  195. package/src/views/components/contextmenu/menuDynamic.vue +0 -99
  196. package/src/views/components/contextmenu/menuGroup.vue +0 -71
  197. package/src/views/components/count-to/index.vue +0 -43
  198. package/src/views/components/cropping/index.vue +0 -59
  199. package/src/views/components/cropping/picture.jpeg +0 -0
  200. package/src/views/components/split-pane/index.vue +0 -82
  201. package/src/views/components/video/index.vue +0 -57
@@ -0,0 +1,447 @@
1
+ /*
2
+ * @Author: levi7754 levi7754@163.com
3
+ * @Date: 2025-07-14 17:38:38
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-08-21 10:57:00
6
+ * @FilePath: \udp-front\packages\udp-core\src\components\udp\utils.ts
7
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
+ */
9
+ import { clone, isString, isEmpty, toDateString, isObject, isFunction, merge } from 'xe-utils';
10
+ import { cookies, storageLocal, useRender } from '@utogether/utils';
11
+ /** 系统配置的key */
12
+ const kSYSCONFIG = 'kSysConfig';
13
+ const kCOOKIES = 'kCookies_param';
14
+
15
+ const sysConfig = storageLocal.getItem(kSYSCONFIG);
16
+
17
+ const renderHook = useRender();
18
+
19
+ /** 工具栏按钮标准化 */
20
+ export const formatButton = (buttons, auth?) => {
21
+ buttons.forEach(btn => {
22
+ btn.auth = auth ? auth[btn.code] || btn.auth : btn.auth;
23
+ debugger;
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
+ const params = { pageNum: 1, pageSize: 100000 };
45
+ const commonParam = getCookieParam();
46
+ Object.assign(params, form, commonParam, props.defaultParams || {});
47
+ const query = formatDateRange(params, props.items);
48
+
49
+ const { url } = props;
50
+ if (!url) return null;
51
+ const requestURL = isString(url) ? url : url.fetch || url.restful;
52
+ if (!requestURL) return null;
53
+ const method = url.fetch ? 'post' : 'get';
54
+ return new Promise((resolve, reject) => {
55
+ http[method](requestURL, query)
56
+ .then((response: IResponseData) => {
57
+ resolve(response.list);
58
+ })
59
+ .catch((e: any) => {
60
+ reject(e);
61
+ });
62
+ });
63
+ };
64
+
65
+ /**
66
+ * @description 查询服务
67
+ * @param props 查询接口的路径
68
+ * @param form 查询条件
69
+ * @param page 分页参数
70
+ * @param http http实例
71
+ * @param isDoc doc文档
72
+ * @returns Promise
73
+ */
74
+ export const query = (props, form, page, http, isDoc) => {
75
+ if (isDoc) return getDocData();
76
+ for (const key in form) {
77
+ if (form[key] && isString(form[key])) {
78
+ form[key] = form[key].trim();
79
+ }
80
+ }
81
+ const params = { pageNum: page.currentPage, pageSize: page.pageSize };
82
+ const commonParam = getCookieParam();
83
+ Object.assign(params, commonParam, props.defaultParams || {}, form);
84
+ const query = formatDateRange(params, props.items);
85
+ const { url } = props;
86
+ console.log(query);
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
+ const startFormatter = 'yyyy-MM-dd 00:00:00';
137
+ const endFormatter = 'yyyy-MM-dd 23:59:59';
138
+ const formatDateRange = (listQuery: any, items) => {
139
+ const dateRanges = items.filter(
140
+ f => f.itemRender?.name === '#SuDateRange' || f.itemRender?.props?.multiple || f.multiple
141
+ );
142
+ if (isEmpty(dateRanges)) return listQuery;
143
+ const query = clone(listQuery, true);
144
+ dateRanges.forEach((element: any) => {
145
+ if (element.multiple || element.itemRender?.props?.multiple) {
146
+ query[element.field] = query[element.field]?.join(',');
147
+ } else {
148
+ const val = query[element.field];
149
+ if (val && element.toField) {
150
+ query[element.fromField] = toDateString(val[0], startFormatter);
151
+ query[element.toField] = toDateString(val[1], endFormatter);
152
+ } else if (val) {
153
+ query[`${element.field}From`] = toDateString(val[0], startFormatter);
154
+ query[`${element.field}To`] = toDateString(val[1], endFormatter);
155
+ }
156
+ delete query[element.field];
157
+ }
158
+ });
159
+ return query;
160
+ };
161
+
162
+ const getCookieParam = () => {
163
+ return cookies.get(kCOOKIES) ? JSON.parse(cookies.get(kCOOKIES)) : {};
164
+ };
165
+
166
+ /** 工具栏默认按钮组 */
167
+ export const inlineButtons = [
168
+ {
169
+ code: 'insert_actived',
170
+ name: 'add',
171
+ status: 'u-cyan',
172
+ icon: 'vxe-icon-add',
173
+ auth: 'add'
174
+ },
175
+ {
176
+ code: 'delete',
177
+ status: 'danger',
178
+ icon: 'vxe-icon-delete',
179
+ auth: 'del'
180
+ },
181
+ {
182
+ code: 'save',
183
+ status: 'primary',
184
+ icon: 'vxe-icon-save',
185
+ auth: 'edit'
186
+ }
187
+ ];
188
+ // form 模式按钮
189
+ export const dialogButtons = [
190
+ {
191
+ code: 'add',
192
+ status: 'u-cyan',
193
+ icon: 'vxe-icon-add',
194
+ auth: 'add'
195
+ },
196
+ {
197
+ code: 'delete',
198
+ status: 'danger',
199
+ icon: 'vxe-icon-delete',
200
+ auth: 'del'
201
+ }
202
+ ];
203
+
204
+ export const defaultColums = [
205
+ { field: 'createdByName', width: 90, visible: false },
206
+ { field: 'creationDate', width: 140, visible: false },
207
+ { field: 'lastUpdatedByName', width: 90, visible: false },
208
+ { field: 'lastUpdateDate', width: 140, visible: false }
209
+ ];
210
+
211
+ /** 导出配置 */
212
+ export const getExportConfig = attrs => {
213
+ if (isObject(attrs.exportConfig)) return attrs.exportConfig;
214
+ return {
215
+ filename: attrs.fileName || '导出明细',
216
+ type: 'xlsx',
217
+ types: ['xlsx', 'csv'],
218
+ modes: ['current', 'selected', 'all'],
219
+ useStyle: true,
220
+ sheetMethod: ({ worksheet }) => (attrs.onSheetMethod ? attrs.onSheetMethod(worksheet) : onSheetMethod(worksheet)),
221
+ columnFilterMethod: ({ column }) =>
222
+ attrs.columnFilter
223
+ ? !!attrs.columnFilter(column)
224
+ : !['operate'].includes(column.field) && column.type !== 'checkbox'
225
+ };
226
+ };
227
+
228
+ export const getToolBarConfig = (data, props, attrs, hasAuthority) => {
229
+ const refreshOptions = {
230
+ icon: 'ri-refresh-line',
231
+ code: 'query',
232
+ iconLoading: 'vxe-icon-spinner roll vxe-loading--default-icon'
233
+ };
234
+ debugger;
235
+ // 不可编辑时
236
+ if (!props.editable) {
237
+ data.editConfig.editable = props.editable;
238
+ const hasExport = props.needExport && hasAuthority('export');
239
+ if (hasExport) {
240
+ data.exportConfig = getExportConfig(attrs);
241
+ }
242
+ data.toolbarConfig = {
243
+ buttons: [],
244
+ enabled: hasExport,
245
+ refreshOptions,
246
+ exportOptions: { icon: 'ri-download-2-line', code: 'export' },
247
+ export: hasExport,
248
+ custom: !!attrs.gridId,
249
+ refresh: true,
250
+ perfect: true
251
+ };
252
+ return data;
253
+ }
254
+
255
+ // 先设置传入的按钮
256
+ let buttons = clone(attrs.buttons || [], true);
257
+
258
+ // 获取默认的按钮
259
+ const toolButtons = attrs.mode !== 'form' ? clone(inlineButtons, true) : clone(dialogButtons, true);
260
+ // 判断传入的按钮是否有默认按钮的auth,有就不加入按钮组中,相当于重写了默认的按钮
261
+ // reverse的原因是: 保持现有按钮顺序, 新增,保存,删除
262
+ toolButtons.reverse().forEach(btn => {
263
+ !buttons.some(s => s.code === btn.code) && buttons.unshift(btn);
264
+ if (attrs.authPrefix && !['print', 'export'].includes(btn.auth)) {
265
+ btn.auth = attrs.authPrefix + btn.auth.slice(0, 1).toLocaleUpperCase() + btn.auth.slice(1).toLocaleLowerCase();
266
+ }
267
+ });
268
+
269
+ buttons = formatButton(buttons, props.auth).filter(button => {
270
+ const flag = button.auth ? hasAuthority(button.auth) : true;
271
+ if (button.dropdowns?.length) {
272
+ button.dropdowns = button.dropdowns.filter(btn => !btn.auth || (btn.auth && hasAuthority(btn.auth)));
273
+ }
274
+ return flag;
275
+ });
276
+ // inline 行内模式,单击行模式
277
+ const editConfig = { trigger: 'dblclick', mode: 'row', showStatus: true };
278
+ data.editConfig = attrs.mode !== 'form' ? editConfig : { enabled: false };
279
+ // 导出权限
280
+ const hasExport = props.needExport && hasAuthority('export');
281
+ let exportBtn = null;
282
+ if (hasExport) {
283
+ data.exportConfig = getExportConfig(attrs);
284
+ exportBtn = { icon: 'ri-download-2-line', code: 'export' };
285
+ }
286
+ data.toolbarConfig = {
287
+ buttons,
288
+ enabled: true,
289
+ refreshOptions,
290
+ custom: !!attrs.gridId,
291
+ exportOptions: exportBtn,
292
+ export: hasExport,
293
+ refresh: true,
294
+ perfect: true
295
+ };
296
+ return data;
297
+ };
298
+
299
+ /**
300
+ * @description: 表格脚合并方法
301
+ * @param {*} columns 列数据
302
+ * @param {*} data 数据源
303
+ * @param {*} sum 合并属性
304
+ * @return {*} 合并脚方法
305
+ */
306
+ export const footerSumMethod = ({ columns, data }, sum) => {
307
+ return [
308
+ columns.map((column, columnIdx) => {
309
+ if (columnIdx === (sum.index || 0)) {
310
+ return sum.label || '合计';
311
+ }
312
+ if (sum.fields?.includes(column.property)) {
313
+ const total = data.reduce((prev, cur) => {
314
+ return prev + Number(cur[column.property] || 0);
315
+ }, 0);
316
+ return total ? Number(total.toFixed(sum.decimal || 2)) : total;
317
+ }
318
+ return '';
319
+ })
320
+ ];
321
+ };
322
+
323
+ /**
324
+ * @description: checkbox是否可选
325
+ */
326
+ export const onCheckMethod = (row, props) => {
327
+ if (isFunction(props.checkMethod)) {
328
+ return props.checkMethod(row);
329
+ }
330
+ return true;
331
+ };
332
+
333
+ /*** excel样式重置 */
334
+ const onSheetMethod = ws => {
335
+ ws.eachRow((row, rowNumber) => {
336
+ row.font = { name: '微软雅黑', size: 9 };
337
+ row.border = {
338
+ top: { style: 'thin' },
339
+ left: { style: 'thin' },
340
+ bottom: { style: 'thin' },
341
+ right: { style: 'thin' }
342
+ };
343
+
344
+ if (rowNumber === 1) {
345
+ row.fill = {
346
+ type: 'pattern',
347
+ pattern: 'solid',
348
+ fgColor: { argb: '4F81BD' }
349
+ };
350
+ row.font = {
351
+ name: '微软雅黑',
352
+ size: 10,
353
+ bold: true,
354
+ color: { argb: 'FFFFFFFF' }
355
+ };
356
+ }
357
+ });
358
+ };
359
+
360
+ const getDocData = () => {
361
+ return new Promise(resolve => {
362
+ setTimeout(() => {
363
+ const list = [
364
+ { id: 1, name: 'Test1', sex: 'Man', age: 28, address: 'Shenzhen' },
365
+ { id: 2, name: 'Test2', sex: 'Women', age: 22, address: 'Guangzhou' },
366
+ { id: 3, name: 'Test3', sex: 'Man', age: 32, address: 'Shanghai' },
367
+ { id: 4, name: 'Test4', sex: 'Women', age: 23, address: 'test abc' },
368
+ { id: 5, name: 'Test5', sex: 'Women', age: 30, address: 'Shanghai' }
369
+ ];
370
+ resolve({ list, total: 5 });
371
+ }, 100);
372
+ });
373
+ };
374
+
375
+ export const getAttrs = attrs => {
376
+ const data = {};
377
+ Object.keys(attrs).forEach(key => {
378
+ const nKey = key.replace(/-(\w)/g, str => str.slice(1).toUpperCase());
379
+ data[nKey] = attrs[key];
380
+ });
381
+ return data;
382
+ };
383
+
384
+ export const formatItems = (items, status, span = 24) => {
385
+ if (!items.length) return items;
386
+ return items.map(item => {
387
+ if (item.children?.length) {
388
+ item.children = formatItems(item.children, status, span);
389
+ return item;
390
+ } else {
391
+ item.title = item.title || `message.${item.field}`;
392
+ item.span = item.span || span;
393
+ if (item.type === 'collapseNode') {
394
+ // 折叠项目,title和宽度不需要
395
+ item.title = '';
396
+ item.titleWidth = 0;
397
+ }
398
+ let disabled = false;
399
+ if (status === 'detail') {
400
+ disabled = true;
401
+ item.placeholder = null;
402
+ } else {
403
+ disabled = item.disabled === false ? item.disabled : item.disabled || item.itemRender?.props?.disabled;
404
+ }
405
+ let itemRender = {
406
+ name: 'VxeInput',
407
+ props: { disabled, placeholder: disabled ? '' : item.placeholder }
408
+ };
409
+ if (item.code && !item.itemRender) {
410
+ itemRender = renderHook.renderDict(item.code);
411
+ }
412
+ item.itemRender = item.itemRender || itemRender;
413
+ item.itemRender['props'] = Object.assign(item.itemRender.props || {}, {
414
+ disabled
415
+ });
416
+ return item;
417
+ }
418
+ });
419
+ };
420
+
421
+ /**
422
+ * @description: 标准化必填数据
423
+ * @param {*} records 数据列表
424
+ * @param {*} t i18n对象
425
+ * @return {*} rule数据
426
+ */
427
+ export const formatRules = (records, t) => {
428
+ const rule = {};
429
+ records.forEach(item => {
430
+ if (item.children?.length) {
431
+ const subRuls = formatRules(item.children, t);
432
+ merge(rule, subRuls);
433
+ } else {
434
+ if (item.required) {
435
+ const { field, title } = item;
436
+ const i18n = title?.startsWith('message.');
437
+ rule[field] = [
438
+ {
439
+ required: true,
440
+ message: `${t('message.required')}${title && i18n ? t(title) : title || t(`message.${field}`)}`
441
+ }
442
+ ];
443
+ }
444
+ }
445
+ });
446
+ return rule;
447
+ };
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { usePermissionStoreHook } from '../../store/modules/permission';
10
10
  import type { Directive } from 'vue';
11
- import router from '../../router';
11
+ import { router } from '../../router';
12
12
  import type { DirectiveBinding } from 'vue';
13
13
 
14
14
  export const auth: Directive = {
@@ -6,7 +6,7 @@
6
6
  * @Description: file content
7
7
  -->
8
8
  <template>
9
- <div class="system-navbar bg-[#fff] shadow-sm shadow-[rgba(0, 21, 41, 0.08)] dark:shadow-[#0d0d0d]">
9
+ <div class="system-navbar bg-white shadow-sm shadow-[rgba(0, 21, 41, 0.08)] dark:shadow-[#0d0d0d]">
10
10
  <Hamburger
11
11
  v-if="layout !== 'mix'"
12
12
  :is-active="appHook.sidebar.opened"