hrp-ui-base 1.0.1 → 1.0.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 (269) hide show
  1. package/dist/components.cjs +1 -1
  2. package/dist/components.es.js +3595 -1224
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.es.js +100 -67
  5. package/dist/style.css +1 -1
  6. package/package.json +16 -4
  7. package/packages/approval-process/.eslintrc +7 -0
  8. package/packages/approval-process/README.md +130 -0
  9. package/packages/approval-process/index.ts +65 -0
  10. package/packages/approval-process/package.json +17 -0
  11. package/packages/approval-process/packages/components/choose-member/BO/departBo.ts +8 -0
  12. package/packages/approval-process/packages/components/choose-member/BO/memberBo.ts +14 -0
  13. package/packages/approval-process/packages/components/choose-member/BO/role.svg +1 -0
  14. package/packages/approval-process/packages/components/choose-member/BO/roleBo.ts +16 -0
  15. package/packages/approval-process/packages/components/choose-member/index.vue +497 -0
  16. package/packages/approval-process/packages/components/choose-member/styles/common.scss +134 -0
  17. package/packages/approval-process/packages/components/comment/assets/avatar.svg +1 -0
  18. package/packages/approval-process/packages/components/comment/assets/download.svg +4 -0
  19. package/packages/approval-process/packages/components/comment/assets/mp3.svg +11 -0
  20. package/packages/approval-process/packages/components/comment/assets/mp4.svg +11 -0
  21. package/packages/approval-process/packages/components/comment/assets/other.svg +11 -0
  22. package/packages/approval-process/packages/components/comment/assets/pdf.svg +11 -0
  23. package/packages/approval-process/packages/components/comment/assets/ppt.svg +11 -0
  24. package/packages/approval-process/packages/components/comment/assets/preview.svg +4 -0
  25. package/packages/approval-process/packages/components/comment/assets/remove.png +0 -0
  26. package/packages/approval-process/packages/components/comment/assets/word.svg +11 -0
  27. package/packages/approval-process/packages/components/comment/assets/xls.svg +11 -0
  28. package/packages/approval-process/packages/components/comment/index.vue +843 -0
  29. package/packages/approval-process/packages/components/comment/modules/previewMp.vue +54 -0
  30. package/packages/approval-process/packages/components/comment/styles/comment-style.scss +304 -0
  31. package/packages/approval-process/packages/components/image-cropper/index.vue +202 -0
  32. package/packages/approval-process/packages/components/sign/index.vue +766 -0
  33. package/packages/approval-process/packages/components/sign/modules/full-screen-sign.vue +20 -0
  34. package/packages/approval-process/packages/components/urge-dialog/index.vue +121 -0
  35. package/packages/approval-process/packages/components/vue-esign/index.vue +289 -0
  36. package/packages/approval-process/packages/flow/approve-component/approve-success.vue +82 -0
  37. package/packages/approval-process/packages/flow/approve-component/route-params-error.vue +49 -0
  38. package/packages/approval-process/packages/flow/approve-component/submit-success.vue +59 -0
  39. package/packages/approval-process/packages/flow/examine-approve-itr.vue +978 -0
  40. package/packages/approval-process/packages/flow/examine-approve.vue +1065 -0
  41. package/packages/approval-process/packages/flow/form-component/associated-approval-form/README.md +38 -0
  42. package/packages/approval-process/packages/flow/form-component/associated-approval-form/assets/avatar.svg +1 -0
  43. package/packages/approval-process/packages/flow/form-component/associated-approval-form/index.vue +159 -0
  44. package/packages/approval-process/packages/flow/form-component/associated-approval-form/modules/associated-approval-form-mobile.vue +297 -0
  45. package/packages/approval-process/packages/flow/form-component/associated-approval-form/modules/associated-approval-form-pc.vue +314 -0
  46. package/packages/approval-process/packages/flow/form-component/associated-approval-form/style/curd-area-mobile.scss +110 -0
  47. package/packages/approval-process/packages/flow/form-component/associated-approval-form/style/curd-area.scss +96 -0
  48. package/packages/approval-process/packages/flow/form-component/associated-approval-form/style/out-put.scss +48 -0
  49. package/packages/approval-process/packages/flow/form-component/show-sign.vue +27 -0
  50. package/packages/approval-process/packages/flow/styles/common.scss +134 -0
  51. package/packages/approval-process/packages/flow/styles/examine-approve-pc.scss +465 -0
  52. package/packages/approval-process/packages/flow/styles/examine-approve-phone.scss +293 -0
  53. package/packages/approval-process/packages/flow/styles/submit-approve-pc.scss +379 -0
  54. package/packages/approval-process/packages/flow/styles/submit-approve-phone.scss +337 -0
  55. package/packages/approval-process/packages/flow/submit-approve-itr.vue +623 -0
  56. package/packages/approval-process/packages/flow/submit-approve.vue +628 -0
  57. package/packages/approval-process/packages/flow/systemCom/BO/departBo.ts +8 -0
  58. package/packages/approval-process/packages/flow/systemCom/BO/memberBo.ts +14 -0
  59. package/packages/approval-process/packages/flow/systemCom/BO/role.svg +1 -0
  60. package/packages/approval-process/packages/flow/systemCom/BO/roleBo.ts +16 -0
  61. package/packages/approval-process/packages/flow/systemCom/choose-depart.vue +399 -0
  62. package/packages/approval-process/packages/flow/systemCom/choose-member-phone.vue +515 -0
  63. package/packages/approval-process/packages/flow/systemCom/choose-member.vue +565 -0
  64. package/packages/approval-process/packages/flow/systemCom/choose-role.vue +301 -0
  65. package/packages/approval-process/packages/styles/common.scss +134 -0
  66. package/packages/approval-process/packages/styles/flex-common.scss +118 -0
  67. package/packages/approval-process/packages/styles/flexCommon.scss +73 -0
  68. package/packages/approval-process/packages/styles/main.css +216 -0
  69. package/packages/approval-process/packages/styles/router-page.scss +371 -0
  70. package/packages/approval-process/packages/styles/style-set.ts +207 -0
  71. package/packages/approval-process/packages/types.d.ts +4 -0
  72. package/packages/approval-process/packages/utils/base.ts +15 -0
  73. package/packages/approval-process/packages/utils/crypto.ts +67 -0
  74. package/packages/approval-process/packages/utils/ddUtils.ts +56 -0
  75. package/packages/approval-process/packages/utils/debounce.ts +36 -0
  76. package/packages/approval-process/packages/utils/des.js +1107 -0
  77. package/packages/approval-process/packages/utils/download.ts +38 -0
  78. package/packages/approval-process/packages/utils/editor.ts +37 -0
  79. package/packages/approval-process/packages/utils/getEnv.ts +36 -0
  80. package/packages/approval-process/packages/utils/os.ts +20 -0
  81. package/packages/approval-process/packages/utils/path-util.ts +31 -0
  82. package/packages/approval-process/packages/utils/routerUtil.ts +304 -0
  83. package/packages/approval-process/packages/utils/string-utils.ts +13 -0
  84. package/packages/approval-process/packages/utils/throttle.ts +44 -0
  85. package/packages/approval-process/packages/utils/validate.ts +92 -0
  86. package/packages/approval-process/packages/utils/ws.ts +218 -0
  87. package/packages/approval-process/tsconfig.json +72 -0
  88. package/packages/approval-process/vite.config.ts +56 -0
  89. package/src/api/bms/flow/FlowCommentController.ts +50 -0
  90. package/src/api/bms/flow/FlowInstanceController.ts +167 -0
  91. package/src/api/bms/flow/FlowProcessController.ts +55 -0
  92. package/src/api/bms/flow/FlowSheetController.ts +27 -0
  93. package/src/api/bms/flow/FlowSignController.ts +76 -0
  94. package/src/api/bms/flow/bo/AssociatedApprovalBO.ts +15 -0
  95. package/src/api/bms/flow/bo/AssociatedApprovalVO.ts +35 -0
  96. package/src/api/bms/flow/bo/AuditBaseInfo.ts +39 -0
  97. package/src/api/bms/flow/bo/ButtonVo.ts +7 -0
  98. package/src/api/bms/flow/bo/DingCallbackBo.ts +13 -0
  99. package/src/api/bms/flow/bo/FlowCommentBO.ts +12 -0
  100. package/src/api/bms/flow/bo/FlowCommentVO.ts +23 -0
  101. package/src/api/bms/flow/bo/FlowInstanceBO.ts +14 -0
  102. package/src/api/bms/flow/bo/FlowNodeVO.ts +24 -0
  103. package/src/api/bms/flow/bo/FlowNoticeBO.ts +17 -0
  104. package/src/api/bms/flow/bo/FlowProcessBO.ts +13 -0
  105. package/src/api/bms/flow/bo/FlowProcessVO.ts +9 -0
  106. package/src/api/bms/flow/bo/FlowReplyVO.ts +23 -0
  107. package/src/api/bms/flow/bo/FlowSheetVO.ts +16 -0
  108. package/src/api/bms/flow/bo/InstanceBackBO.ts +9 -0
  109. package/src/api/bms/flow/bo/InstanceNodeBO.ts +13 -0
  110. package/src/api/bms/flow/bo/InstanceNodeVO.ts +21 -0
  111. package/src/api/bms/flow/bo/NodeShowVo.ts +19 -0
  112. package/src/api/bms/flow/bo/ReviewBO.ts +11 -0
  113. package/src/api/bms/flow/bo/SheetSearchBO.ts +11 -0
  114. package/src/api/bms/flow/bo/SystemVO.ts +7 -0
  115. package/src/api/bms/flow/bo/TransmitBO.ts +9 -0
  116. package/src/api/bms/flow/bo/UrgeFlowBO.ts +7 -0
  117. package/src/api/bms/flow/bo/UserBaseInfoVo.ts +13 -0
  118. package/src/api/bms/flow/bo/UserInfoVo.ts +44 -0
  119. package/src/api/bms/flow/bo/UserResultVo.ts +17 -0
  120. package/src/api/bms/flow/bo/ValueMapBo.ts +7 -0
  121. package/src/api/bms/home/HomeController.ts +106 -0
  122. package/src/api/bms/home/bo/CollectedMenuBo.ts +9 -0
  123. package/src/api/bms/home/bo/DeptBaseVo.ts +9 -0
  124. package/src/api/bms/home/bo/DomainVO.ts +13 -0
  125. package/src/api/bms/home/bo/FunPermission.ts +17 -0
  126. package/src/api/bms/home/bo/GroupVO.ts +10 -0
  127. package/src/api/bms/home/bo/HomeMenu.ts +22 -0
  128. package/src/api/bms/home/bo/HomeMenuVo.ts +11 -0
  129. package/src/api/bms/home/bo/PersonalizationBo.ts +17 -0
  130. package/src/api/bms/home/bo/PersonalizationVo.ts +19 -0
  131. package/src/api/bms/home/bo/PhoneMenu.ts +14 -0
  132. package/src/api/bms/home/bo/SearchMenuVo.ts +10 -0
  133. package/src/api/bms/home/bo/UserBaseInfoVo.ts +11 -0
  134. package/src/api/hrms/dept/bo/DeptBaseVo.ts +6 -0
  135. package/src/api/hrms/dept/bo/DeptTreeVo.ts +23 -0
  136. package/src/api/hrms/dept/bo/DeptUserVo.ts +9 -0
  137. package/src/api/hrms/dept/bo/DeptUsersVo.ts +10 -0
  138. package/src/api/hrms/dept/bo/DeptVo.ts +19 -0
  139. package/src/api/hrms/dept/bo/UserBaseInfoVo.ts +8 -0
  140. package/src/api/hrms/dept/deptController.ts +100 -0
  141. package/src/api/hrms/role/bo/RoleBaseVo.ts +6 -0
  142. package/src/api/hrms/role/bo/RoleGroupVo.ts +11 -0
  143. package/src/api/hrms/role/bo/RoleVo.ts +22 -0
  144. package/src/api/hrms/role/roleController.ts +19 -0
  145. package/src/api/hrms/user/bo/UserBaseInfoVo.ts +11 -0
  146. package/src/api/hrms/user/bo/UserCardVO.ts +14 -0
  147. package/src/api/hrms/user/bo/UserDeptBO.ts +13 -0
  148. package/src/api/hrms/user/bo/UserRoleBO.ts +11 -0
  149. package/src/api/hrms/user/bo/UserVO.ts +23 -0
  150. package/src/api/hrms/user/userController.ts +86 -0
  151. package/src/api/notice/NoticeController.ts +73 -0
  152. package/src/api/notice/bo/NoticePageBO.ts +24 -0
  153. package/src/api/notice/bo/NoticeVO.ts +31 -0
  154. package/src/api/work-order-pc/flow/Bo/ValueMapBo.ts +7 -0
  155. package/src/api/work-order-pc/flow/ItrFlowProcessController.ts +42 -0
  156. package/src/api/work-order-pc/flow/Vo/FlowNodeVO.ts +24 -0
  157. package/src/api/work-order-pc/flow/Vo/UserInfoVo.ts +44 -0
  158. package/src/assets/layout/avatar-default.svg +6 -0
  159. package/src/assets/layout/collect-active.svg +7 -0
  160. package/src/assets/layout/collect-default.svg +7 -0
  161. package/src/assets/layout/download-active.svg +8 -0
  162. package/src/assets/layout/download-default.svg +8 -0
  163. package/src/assets/layout/export-dark.svg +7 -0
  164. package/src/assets/layout/export-default.svg +7 -0
  165. package/src/assets/layout/font-active.svg +6 -0
  166. package/src/assets/layout/font-default.svg +6 -0
  167. package/src/assets/layout/help-active.svg +10 -0
  168. package/src/assets/layout/help-default.svg +10 -0
  169. package/src/assets/layout/home-active.svg +6 -0
  170. package/src/assets/layout/home.svg +6 -0
  171. package/src/assets/layout/menu-expand.svg +6 -0
  172. package/src/assets/layout/menu-icon.png +0 -0
  173. package/src/assets/layout/menu-position-active.svg +6 -0
  174. package/src/assets/layout/menu-position-default.svg +6 -0
  175. package/src/assets/layout/message-active.svg +9 -0
  176. package/src/assets/layout/message-default.svg +9 -0
  177. package/src/assets/layout/moon.svg +8 -0
  178. package/src/assets/layout/router-all-dark.svg +11 -0
  179. package/src/assets/layout/router-all-default.svg +17 -0
  180. package/src/assets/layout/search-active.svg +20 -0
  181. package/src/assets/layout/search-default.svg +20 -0
  182. package/src/assets/layout/star-active.svg +1 -0
  183. package/src/assets/layout/star-default.svg +3 -0
  184. package/src/assets/layout/sun-active.svg +6 -0
  185. package/src/assets/layout/sun-default.svg +6 -0
  186. package/src/assets/layout/switch-moon.svg +3 -0
  187. package/src/assets/layout/switch-sun.svg +41 -0
  188. package/src/assets/layout/todo-active.svg +12 -0
  189. package/src/assets/layout/todo-default.svg +12 -0
  190. package/src/assets/layout/user-dark.svg +13 -0
  191. package/src/assets/layout/user-default.svg +13 -0
  192. package/src/assets/process/agree.png +0 -0
  193. package/src/assets/process/defaultAvatar.png +0 -0
  194. package/src/assets/process/drawer/departManagerJump.png +0 -0
  195. package/src/assets/process/drawer/manyLevel1close.svg +10 -0
  196. package/src/assets/process/drawer/manyLevel1open.svg +7 -0
  197. package/src/assets/process/drawer/manyLevel2close.svg +7 -0
  198. package/src/assets/process/drawer/manyLevel2open.svg +7 -0
  199. package/src/assets/process/inProcess.png +0 -0
  200. package/src/assets/process/manyPeople.png +0 -0
  201. package/src/assets/process/manyPeople2.png +0 -0
  202. package/src/assets/process/reject.png +0 -0
  203. package/src/assets/process/revoke.png +0 -0
  204. package/src/components/annex-img-upload/index.vue +4 -4
  205. package/src/components/annex-img-upload/modules/previewMp.vue +1 -1
  206. package/src/components/annex-upload/index.vue +4 -4
  207. package/src/components/annex-upload/modules/previewMp.vue +1 -1
  208. package/src/components/annex-upload-weijian/index.vue +4 -4
  209. package/src/components/annex-upload-weijian/modules/previewMp.vue +1 -1
  210. package/src/components/base-layout/index.vue +198 -0
  211. package/src/components/layout/SysHeader.vue +90 -0
  212. package/src/components/layout/SysHeaderLeft.vue +116 -0
  213. package/src/components/layout/SysHeaderRight.vue +112 -0
  214. package/src/components/layout/SysHeaderTabs.vue +289 -0
  215. package/src/components/layout/components/avatar-component.vue +77 -0
  216. package/src/components/layout/components/dark-component.vue +82 -0
  217. package/src/components/layout/components/download-component.vue +49 -0
  218. package/src/components/layout/components/font-size-component.vue +66 -0
  219. package/src/components/layout/components/menu-position-component.vue +97 -0
  220. package/src/components/layout/components/message-component.vue +64 -0
  221. package/src/components/layout/components/todo-component.vue +55 -0
  222. package/src/components/layout/index.ts +24 -0
  223. package/src/components/layout/message/message-dictionary.ts +27 -0
  224. package/src/components/layout/message/message-icon//345/205/250/351/203/250/351/200/232/347/237/245-/350/223/235.svg +8 -0
  225. package/src/components/layout/message/message-icon//345/205/250/351/203/250/351/200/232/347/237/245-/351/273/221.svg +8 -0
  226. package/src/components/layout/message/message-icon//345/205/250/351/203/250/351/200/232/347/237/245.svg +8 -0
  227. package/src/components/layout/message/message-icon//345/205/254/345/221/212/351/200/232/347/237/245-/350/223/235.svg +12 -0
  228. package/src/components/layout/message/message-icon//345/205/254/345/221/212/351/200/232/347/237/245-/351/273/221.svg +12 -0
  229. package/src/components/layout/message/message-icon//345/205/254/345/221/212/351/200/232/347/237/245.svg +12 -0
  230. package/src/components/layout/message/message-icon//345/256/241/346/211/271/351/200/232/347/237/245-/350/223/235.svg +8 -0
  231. package/src/components/layout/message/message-icon//345/256/241/346/211/271/351/200/232/347/237/245-/351/273/221.svg +8 -0
  232. package/src/components/layout/message/message-icon//345/256/241/346/211/271/351/200/232/347/237/245.svg +8 -0
  233. package/src/components/layout/message/message-icon//345/257/274/345/207/272/351/200/232/347/237/245-/350/223/235.svg +13 -0
  234. package/src/components/layout/message/message-icon//345/257/274/345/207/272/351/200/232/347/237/245-/351/273/221.svg +13 -0
  235. package/src/components/layout/message/message-icon//345/257/274/345/207/272/351/200/232/347/237/245.svg +13 -0
  236. package/src/components/layout/message/message-icon//346/234/252/350/257/273/351/200/232/347/237/245-/350/223/235.svg +11 -0
  237. package/src/components/layout/message/message-icon//346/234/252/350/257/273/351/200/232/347/237/245-/351/273/221.svg +11 -0
  238. package/src/components/layout/message/message-icon//346/234/252/350/257/273/351/200/232/347/237/245.svg +11 -0
  239. package/src/components/layout/message/message-icon//347/251/272/347/212/266/346/200/201.svg +17 -0
  240. package/src/components/layout/message/message-icon//347/263/273/347/273/237/351/200/232/347/237/245-/350/223/235.svg +13 -0
  241. package/src/components/layout/message/message-icon//347/263/273/347/273/237/351/200/232/347/237/245-/351/273/221.svg +13 -0
  242. package/src/components/layout/message/message-icon//347/263/273/347/273/237/351/200/232/347/237/245.svg +13 -0
  243. package/src/components/layout/message/message-notification-drawer.vue +529 -0
  244. package/src/components/layout/personalization-guide-dialog.vue +255 -0
  245. package/src/components/layout/sideMenu-global.scss +115 -0
  246. package/src/components/layout/sideMenu.scss +312 -0
  247. package/src/components/layout/sideMenu.vue +542 -0
  248. package/src/components/layout/sideMenuSonList.vue +185 -0
  249. package/src/components/layout/styles/icon.scss +72 -0
  250. package/src/components/layout/types.ts +98 -0
  251. package/src/components/list-search-content/components/search-date-range.vue +1 -1
  252. package/src/components/list-search-content/components/search-date-time-range.vue +1 -1
  253. package/src/components/list-search-content/components/search-date.vue +1 -1
  254. package/src/components/list-search-content/components/search-input-number.vue +1 -1
  255. package/src/components/list-search-content/components/search-input.vue +1 -1
  256. package/src/components/list-search-content/components/search-multiple_select.vue +1 -1
  257. package/src/components/list-search-content/components/search-select.vue +1 -1
  258. package/src/components/list-search-content/index.vue +6 -6
  259. package/src/components/list-search-content/modules/add-views-package-dialog.vue +3 -3
  260. package/src/components/list-search-content/modules/search-condition-area.vue +2 -2
  261. package/src/components/list-search-content/modules/views-package-manage-dialog.vue +5 -5
  262. package/src/components.ts +19 -4
  263. package/src/index.ts +1 -0
  264. package/src/utils/dd-utils.ts +1 -1
  265. package/src/utils/get-dict.ts +2 -2
  266. package/src/utils/permit-utils.ts +2 -2
  267. package/src/api/bms/dict/bo/TotalDictSearchBO.ts +0 -8
  268. package/src/api/bms/file/FileExportController.ts +0 -18
  269. package/src/api/bms/file/bo/FileExportVO.ts +0 -17
@@ -0,0 +1,38 @@
1
+ const download0 = (data: Blob, fileName: string, mineType: string) => {
2
+ // 创建 blob
3
+ const blob = new Blob([data], { type: mineType })
4
+ // 创建 href 超链接,点击进行下载
5
+ window.URL = window.URL || window.webkitURL
6
+ const href = URL.createObjectURL(blob)
7
+ const downA = document.createElement('a')
8
+ downA.href = href
9
+ downA.download = fileName
10
+ downA.click()
11
+ // 销毁超连接
12
+ window.URL.revokeObjectURL(href)
13
+ }
14
+
15
+ const download = {
16
+ // 下载 Excel 方法
17
+ excel: (data:any, fileName: string) => {
18
+ download0(data, fileName, 'application/vnd.ms-excel')
19
+ },
20
+ // 下载 Word 方法
21
+ word: (data: Blob, fileName: string) => {
22
+ download0(data, fileName, 'application/msword')
23
+ },
24
+ // 下载 Zip 方法
25
+ zip: (data: Blob, fileName: string) => {
26
+ download0(data, fileName, 'application/zip')
27
+ },
28
+ // 下载 Html 方法
29
+ html: (data: Blob, fileName: string) => {
30
+ download0(data, fileName, 'text/html')
31
+ },
32
+ // 下载 Markdown 方法
33
+ markdown: (data: Blob, fileName: string) => {
34
+ download0(data, fileName, 'text/markdown')
35
+ }
36
+ }
37
+
38
+ export default download
@@ -0,0 +1,37 @@
1
+ const token = localStorage.getItem("TOKEN");
2
+ export const getImgSrc = (richText: any) => {
3
+ richText = richText.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, (match: any, capture: any) => {
4
+ let index = capture.indexOf('=')
5
+ capture = capture.slice(0, index) + '=' + token
6
+
7
+ match = match.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi,
8
+ `<img src=\'${capture}\' alt=\'文件\' data-href=\'${capture}\' style=\"\" \/> `)
9
+
10
+ return match
11
+ });
12
+ return richText
13
+ }
14
+ export const handleHtml = (rich: any) => {
15
+ //使用正则表达式匹配所有图片
16
+ let reg = RegExp(/<[img]+\s+(.*?)(?<id>\w*?)[\s'"](.*?)>/g);
17
+ let match = rich.match(reg);
18
+
19
+ if (match) {
20
+ //循环图片数组
21
+ for (let i = 0; i < match.length; i++) {
22
+ const item = match[i];
23
+ //根据判断条件添加不同class
24
+ if (item.includes("src=")) {
25
+ let len = item.length;
26
+ let _str = item.slice(0, len - 2) + " class=\"l-img\"/>";//追加 class 之后的img
27
+ rich = rich.replace(item, _str);
28
+ } else {
29
+ let len = item.length;
30
+ let _str = item.slice(0, len - 2) + " class=\"l-file-img\"/>";//追加 class 之后的img
31
+ rich = rich.replace(item, _str);
32
+ }
33
+ }
34
+ }
35
+ console.log("处理之后", rich);
36
+ return rich;
37
+ }
@@ -0,0 +1,36 @@
1
+ // 判断当前环境是否为手机 true 当前为移动端 false 当前是pc端
2
+ export const IsPhone = () => {
3
+ const userAgent = navigator.userAgent.toLowerCase();
4
+ // 移动端标识(兼容鸿蒙系统)
5
+ const mobileKeywords = [
6
+ 'android',
7
+ 'iphone',
8
+ 'ipad',
9
+ 'ipod',
10
+ 'harmonyos', // 鸿蒙系统
11
+ 'openharmony', // 开源鸿蒙
12
+ 'huawei', // 华为设备
13
+ 'honor', // 荣耀设备
14
+ 'symbianos',
15
+ 'windows phone',
16
+ 'mobile',
17
+ 'webos',
18
+ 'blackberry',
19
+ 'opera mini',
20
+ 'opera mobi',
21
+ 'iemobile',
22
+ 'wpdesktop',
23
+ ];
24
+ // 检查是否包含移动端关键词
25
+ const isMobileKeyword = mobileKeywords.some(keyword => userAgent.includes(keyword));
26
+ // // 额外检查:通过触摸点数量判断(移动设备通常支持触摸)
27
+ // const hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
28
+ // // 检查屏幕宽度(移动设备通常较窄)
29
+ // const isNarrowScreen = window.innerWidth <= 768;
30
+
31
+ return isMobileKeyword
32
+ }
33
+ // 判断当前环境是否为pc端 true 当前为pc端 false 当前是移动端
34
+ export const IsPc = () => {
35
+ return !IsPhone()
36
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 判断是移动端还是PC还是平板
3
+ */
4
+ export const os = function() {
5
+ let ua = navigator.userAgent,
6
+ isWindowsPhone:boolean = /(?:Windows Phone)/.test(ua),
7
+ isSymbian:boolean = /(?:SymbianOS)/.test(ua) || isWindowsPhone,
8
+ isAndroid:boolean = /(?:Android)/.test(ua),
9
+ isFireFox:boolean = /(?:Firefox)/.test(ua),
10
+ isChrome:boolean = /(?:Chrome|CriOS)/.test(ua),
11
+ isTablet:boolean = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)),
12
+ isPhone:boolean = /(?:iPhone)/.test(ua) && !isTablet,
13
+ isPc:boolean = !isPhone && !isAndroid && !isSymbian;
14
+ return {
15
+ isTablet: isTablet,
16
+ isPhone: isPhone,
17
+ isAndroid: isAndroid,
18
+ isPc: isPc
19
+ };
20
+ }();
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 获取一级路径: 比如 /baidu/a/#dd 获取到 /baidu
3
+ * 主要用来切割路由让菜单自动选中
4
+ * @param path
5
+ */
6
+ export function getFirstLevelPath (path:string):string{
7
+ if(path.indexOf("/")===0){
8
+ path=path.substring(1,path.length);
9
+ }
10
+ if(path.indexOf("/")>-1){
11
+ path=path.substring(0,path.indexOf("/"))
12
+ }
13
+ if(path.indexOf("?")>-1){
14
+ path=path.substring(0,path.indexOf("?"))
15
+ }
16
+ if(path.indexOf("#")>-1){
17
+ path=path.substring(0,path.indexOf("#"))
18
+ }
19
+ path="/"+path;
20
+ return path
21
+ }
22
+
23
+ /**
24
+ * 获取URl中的参数
25
+ * @param paramName 参数的名字
26
+ */
27
+ export function getUrlParam(paramName: string): string | null {
28
+ const queryString = window.location.search;
29
+ const urlParams = new URLSearchParams(queryString);
30
+ return urlParams.get(paramName);
31
+ }
@@ -0,0 +1,304 @@
1
+ import store from "@/stores/routeStore";
2
+ import { funcRoleStore } from "@/stores/funcRole";
3
+ import router from "@/router";
4
+ import { ElMessage } from "element-plus";
5
+ let StoreList = funcRoleStore(store);
6
+
7
+ /**
8
+ * @description : 寻找对应模块下的 第一个菜单数据
9
+ *
10
+ */
11
+ export const getModuleFirstMenuPath = (
12
+ toPath: string,
13
+ dataList: routeItemBo[]
14
+ ) => {
15
+ // 根据header的header true/false 来判断是不是上边的模块
16
+ // 因为 上边的header组件是用menu组件,所以模块会被当成一个菜单进行渲染,所以会跳/system类似的页面,这时候要在beforeEach判断出来这些菜单,要进行自动跳转至第一个菜单
17
+
18
+ // console.log(toPath, JSON.stringify(dataList))
19
+ if (!toPath || !dataList || !Array.isArray(dataList) || dataList.length == 0)
20
+ return null;
21
+ let aimPath = "";
22
+ // 循环找第一项 菜单path
23
+ for (let i = 0; i < dataList.length; i++) {
24
+ // 模块名相同
25
+ if (toPath == dataList[i].path) {
26
+ let haveFindPath = false;
27
+ let forPath = "";
28
+ if (
29
+ dataList[i] &&
30
+ dataList[i].children &&
31
+ Array.isArray(dataList[i].children) &&
32
+ dataList[i].children.length > 0
33
+ ) {
34
+ for (let j = 0; j < dataList[i].children.length; j++) {
35
+ if (
36
+ dataList[i].children[j].type == "M" &&
37
+ dataList[i].children[j].path &&
38
+ !dataList[i].children[j].hidden
39
+ ) {
40
+ haveFindPath = true;
41
+ forPath = dataList[i].children[j].path;
42
+ break;
43
+ } else if (dataList[i].children[j].type == "C") {
44
+ if (
45
+ dataList[i].children[j].children &&
46
+ Array.isArray(dataList[i].children[j].children) &&
47
+ dataList[i].children[j].children.length > 0
48
+ ) {
49
+ for (
50
+ let m = 0;
51
+ m < dataList[i].children[j].children.length;
52
+ m++
53
+ ) {
54
+ if (
55
+ dataList[i].children[j].children[m] &&
56
+ dataList[i].children[j].children[m].type == "M" &&
57
+ dataList[i].children[j].children[m].path &&
58
+ !dataList[i].children[j].children[m].hidden
59
+ ) {
60
+ haveFindPath = true;
61
+ forPath = dataList[i].children[j].children[m].path;
62
+ break;
63
+ }
64
+ }
65
+ }
66
+ if (haveFindPath) {
67
+ break;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ if (haveFindPath && forPath) {
73
+ aimPath = forPath;
74
+ break;
75
+ }
76
+ }
77
+ }
78
+ if (aimPath) {
79
+ return aimPath;
80
+ } else {
81
+ return null;
82
+ }
83
+ };
84
+ /**
85
+ * @description : 递归依据菜单地址获取到模块的item(地址,以及index)
86
+ *
87
+ */
88
+ export const getModuleNameByPathName = (path: string) => {
89
+ let aimObj: {
90
+ name?: string;
91
+ path?: string;
92
+ index?: number;
93
+ level?: number;
94
+ type?: string;
95
+ } = { name: "首页", path: "/home", index: 0, level: 0, type: "C" };
96
+ if (!path) return aimObj;
97
+ let index = 0;
98
+ let haveFind = false;
99
+ // @ts-ignore
100
+ let dataList: routeItemBo[] = StoreList.listData;
101
+ for (let i = 0; i < dataList.length; i++) {
102
+ let findResult = false;
103
+ // 模块名相同
104
+ if (path == dataList[i].path) {
105
+ findResult = true;
106
+ aimObj = {
107
+ name: dataList[i].name,
108
+ path: dataList[i].path,
109
+ index: i,
110
+ level: 1,
111
+ type: "C",
112
+ };
113
+ break;
114
+ } else {
115
+ if (
116
+ dataList[i] &&
117
+ dataList[i].children &&
118
+ Array.isArray(dataList[i].children) &&
119
+ // @ts-ignore
120
+ dataList[i].children.length > 0
121
+ ) {
122
+ // 有值去循环内部的菜单跟目录
123
+ for (let j = 0; j < dataList[i].children.length; j++) {
124
+ if (
125
+ dataList[i].children[j].type == "M" &&
126
+ dataList[i].children[j].path &&
127
+ path == dataList[i].children[j].path
128
+ ) {
129
+ findResult = true;
130
+ aimObj = {
131
+ name: dataList[i].children[j].name,
132
+ path: dataList[i].children[j].path,
133
+ index: i,
134
+ level: 2,
135
+ type: "M",
136
+ };
137
+ break;
138
+ } else if (dataList[i].children[j].type == "C") {
139
+ if (
140
+ dataList[i].children[j].path &&
141
+ path == dataList[i].children[j].path
142
+ ) {
143
+ findResult = true;
144
+ aimObj = {
145
+ name: dataList[i].children[j].name,
146
+ path: dataList[i].children[j].path,
147
+ index: i,
148
+ level: 2,
149
+ type: "C",
150
+ };
151
+ break;
152
+ } else {
153
+ if (
154
+ dataList[i].children[j].children &&
155
+ Array.isArray(dataList[i].children[j].children) &&
156
+ dataList[i].children[j].children.length > 0
157
+ ) {
158
+ for (
159
+ let m = 0;
160
+ m < dataList[i].children[j].children.length;
161
+ m++
162
+ ) {
163
+ if (
164
+ dataList[i].children[j].children[m] &&
165
+ path == dataList[i].children[j].children[m].path
166
+ ) {
167
+ findResult = true;
168
+ aimObj = {
169
+ name: dataList[i].children[j].children[m].name,
170
+ path: dataList[i].children[j].children[m].path,
171
+ index: i,
172
+ level: 3,
173
+ type: dataList[i].children[j].children[m].type,
174
+ };
175
+ break;
176
+ }
177
+ }
178
+ }
179
+ }
180
+ if (findResult) {
181
+ break;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ if (findResult) {
187
+ break;
188
+ }
189
+ }
190
+ if (findResult) {
191
+ break;
192
+ }
193
+ }
194
+ return {
195
+ name: aimObj.name ? aimObj.name : "首页",
196
+ path: aimObj.path ? aimObj.path : "/home",
197
+ index: aimObj.index !== undefined && aimObj.index >= 0 ? aimObj.index : 0,
198
+ level: aimObj.level !== undefined && aimObj.level >= 0 ? aimObj.level : 1,
199
+ type: aimObj.type ? aimObj.type : "/home",
200
+ };
201
+ };
202
+ /**
203
+ * @description 判断一个路由是否存在于系统的路由集合中
204
+ */
205
+ export const getRouteExistIf = (aimPath: string) => {
206
+ let routeList = router.getRoutes();
207
+ let findIf: boolean = false;
208
+ for (let i = 0; i < routeList.length; i++) {
209
+ if (routeList[i].path === aimPath) {
210
+ findIf = true;
211
+ break;
212
+ }
213
+ }
214
+ return findIf;
215
+ };
216
+
217
+ /** 递归寻找给定数组中的第一个菜单item */
218
+ export const getFirstMenuInList: (
219
+ routeList: routeItemBo[],
220
+ isFirst?: boolean
221
+ ) => routeItemBo | null = (routeList: routeItemBo[], isFirst?: boolean) => {
222
+ if (routeList && Array.isArray(routeList) && routeList.length > 0) {
223
+ let aimItem: routeItemBo | null = null;
224
+ for (let i = 0; i < routeList.length; i++) {
225
+ if (
226
+ routeList[i].type == "C" &&
227
+ routeList[i].children &&
228
+ Array.isArray(routeList[i].children) &&
229
+ routeList[i].children.length > 0
230
+ ) {
231
+ let forAimItem: routeItemBo | null = getFirstMenuInList(
232
+ routeList[i].children
233
+ );
234
+ if (forAimItem) {
235
+ aimItem = forAimItem;
236
+ if (isFirst) {
237
+ aimItem.index = i;
238
+ }
239
+ break;
240
+ } else {
241
+ return null;
242
+ }
243
+ } else if (routeList[i].type == "M") {
244
+ aimItem = routeList[i];
245
+ break;
246
+ }
247
+ }
248
+ if (aimItem && aimItem.path) {
249
+ return aimItem;
250
+ } else {
251
+ return null;
252
+ }
253
+ } else {
254
+ return null;
255
+ }
256
+ };
257
+ interface routeItemBo {
258
+ type: string;
259
+ children: routeItemBo[];
260
+ path: string;
261
+ id: string;
262
+ name: string;
263
+ hidden: boolean;
264
+ index?: number;
265
+ meta: {
266
+ title: null | string;
267
+ icon: null | string;
268
+ noCache: boolean | null;
269
+ link: null | boolean;
270
+ header: boolean | null;
271
+ };
272
+ }
273
+
274
+ /** 组装出微前端的子应用的完整路径 */
275
+ export const makeAccessPath: (belong: string, path: string) => string | null = (
276
+ belong: string,
277
+ path: string
278
+ ) => {
279
+ let url = "";
280
+ let pathname = window.location.pathname;
281
+ let tenantId = "";
282
+ if (pathname.split("/") && pathname.split("/").length === 4) {
283
+ tenantId = pathname.split("/")[1];
284
+ } else {
285
+ /** 启用 pathname 格式为 /租户id/系统名 时启用 */
286
+ // ElMessage.error("当前路径非法,请联系管理员!");
287
+ // return null;
288
+ }
289
+ if (import.meta.env.VITE_NODE_ENV == "development") {
290
+ try {
291
+ let baseUrl = window.location.origin + window.location.pathname;
292
+ return `${baseUrl}/${tenantId ? tenantId + '/' :''}${belong}/#${path}`;
293
+ } catch (error) {
294
+ ElMessage.error("配置文件错误,请检查.env文件");
295
+ return null;
296
+ }
297
+ } else if (import.meta.env.VITE_NODE_ENV == "production") {
298
+ let baseUrl = window.location.origin + window.location.pathname ;
299
+ return `${baseUrl}/${tenantId ? tenantId + '/' :''}${belong}/#${path}`;
300
+ } else {
301
+ ElMessage.error("当前环境非法,请联系管理员!");
302
+ return null;
303
+ }
304
+ };
@@ -0,0 +1,13 @@
1
+ /** 高亮显示文本,返回标签 */
2
+ export const highlightText = (text: string, key: string) => {
3
+ // 用于正则表达式匹配的关键字,确保关键字中的特殊字符被正确处理
4
+ const escapedKey = key.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
5
+
6
+ // 使用正则表达式全局匹配关键字
7
+ const regex = new RegExp(escapedKey, 'gi');
8
+
9
+ // 使用replace方法替换匹配到的关键字,为其添加高亮样式
10
+ const highlightedText = text.replace(regex, (match) => `<span style="color:var(--theme-normal-normal)">${match}</span>`);
11
+
12
+ return highlightedText;
13
+ };
@@ -0,0 +1,44 @@
1
+ import { ElMessage } from "element-plus";
2
+ /**
3
+ * 节流(TS)
4
+ * @param fn 需要包装的函数
5
+ * @param delay 每次执行的等待时间-单位ms
6
+ * @param immediate 是否默认执行一次(第一次不延迟)
7
+ */
8
+
9
+
10
+ /**
11
+ * TS中的this单独在函数中使用却是大大受限制的
12
+ * 所以在TS中我们使用class来解决这一问题
13
+ */
14
+
15
+ // 定义类throttle
16
+ class throttle {
17
+ public use = (
18
+ fn: Function,
19
+ delay: number,
20
+ immediate: boolean = false
21
+ ): Function => {
22
+ // 第一次触发时间戳
23
+ let startTime = Date.now()
24
+ return (...args: any[]) => {
25
+ // 再次触发时间
26
+ let curTime = Date.now()
27
+ // 间隔时间 = 延迟的时间 - (再次触发时间戳 - 第一次触发时间戳)
28
+ let interval = delay - (curTime - startTime)
29
+ if (interval <= 0) {
30
+ // 重新计算开始时间
31
+ startTime = Date.now()
32
+ fn.apply(this, args) // 确保引用函数的指向正确,并且函数的参数也不变
33
+ } else {
34
+ ElMessage({
35
+ message: '请不要频繁点击哦..',
36
+ type: 'warning',
37
+ })
38
+ }
39
+ }
40
+ }
41
+ }
42
+
43
+ // 导出节流函数
44
+ export default throttle
@@ -0,0 +1,92 @@
1
+ /**
2
+ * 判断url是否是http或https
3
+ * @returns {Boolean}
4
+ * @param url
5
+ */
6
+ export const isHttp = (url: string): boolean => {
7
+ return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1;
8
+ };
9
+
10
+ /**
11
+ * 判断path是否为外链
12
+ * @param {string} path
13
+ * @returns {Boolean}
14
+ */
15
+ export const isExternal = (path: string) => {
16
+ return /^(https?:|mailto:|tel:)/.test(path);
17
+ };
18
+
19
+ /**
20
+ * @param {string} str
21
+ * @returns {Boolean}
22
+ */
23
+ export const validUsername = (str: string) => {
24
+ const valid_map = ['admin', 'editor'];
25
+ return valid_map.indexOf(str.trim()) >= 0;
26
+ };
27
+
28
+ /**
29
+ * @param {string} url
30
+ * @returns {Boolean}
31
+ */
32
+ export const validURL = (url: string) => {
33
+ const reg =
34
+ /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
35
+ return reg.test(url);
36
+ };
37
+
38
+ /**
39
+ * @param {string} str
40
+ * @returns {Boolean}
41
+ */
42
+ export const validLowerCase = (str: string) => {
43
+ const reg = /^[a-z]+$/;
44
+ return reg.test(str);
45
+ };
46
+
47
+ /**
48
+ * @param {string} str
49
+ * @returns {Boolean}
50
+ */
51
+ export const validUpperCase = (str: string) => {
52
+ const reg = /^[A-Z]+$/;
53
+ return reg.test(str);
54
+ };
55
+
56
+ /**
57
+ * @param {string} str
58
+ * @returns {Boolean}
59
+ */
60
+ export const validAlphabets = (str: string) => {
61
+ const reg = /^[A-Za-z]+$/;
62
+ return reg.test(str);
63
+ };
64
+
65
+ /**
66
+ * @param {string} email
67
+ * @returns {Boolean}
68
+ */
69
+ export const validEmail = (email: string) => {
70
+ const reg =
71
+ /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
72
+ return reg.test(email);
73
+ };
74
+
75
+ /**
76
+ * @param {string} str
77
+ * @returns {Boolean}
78
+ */
79
+ export const isString = (str: any) => {
80
+ return typeof str === 'string' || str instanceof String;
81
+ };
82
+
83
+ /**
84
+ * @param {Array} arg
85
+ * @returns {Boolean}
86
+ */
87
+ export const isArray = (arg: string | string[]) => {
88
+ if (typeof Array.isArray === 'undefined') {
89
+ return Object.prototype.toString.call(arg) === '[object Array]';
90
+ }
91
+ return Array.isArray(arg);
92
+ };