@utogether/udp-core 2.0.0-beta.1 → 2.0.0-beta.4
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.
- package/dist/{403-CTJDBjz7.js → 403-CekcmGOc.js} +3 -3
- package/dist/403-CxOqlq0f-C28ufSE6.js +65 -0
- package/dist/403-WCboRvzZ-ZAPgYStl-Ck7rlpC9.js +65 -0
- package/dist/404-2V0Qi-d7-DkNwQggp-3kilva5o.js +65 -0
- package/dist/{404-BFYkWIkQ.js → 404-DeSH9KnK.js} +1 -1
- package/dist/404-xdB6lFeQ-DRhUFuKU.js +65 -0
- package/dist/500-BYfzvixf-CGpEieyQ-DLrc9brB.js +67 -0
- package/dist/500-C94bRK2S-_XtNljMI.js +67 -0
- package/dist/{500-DGG3qadg.js → 500-DHOHlmtv.js} +2 -2
- package/dist/{AuthorityInfo-ozZIo1Te.js → AuthorityInfo-BC8U3Zk4.js} +1 -1
- package/dist/AuthorityInfo-DBovfUjB-DpQwT9Q5-ChKFxbGl.js +4 -0
- package/dist/AuthorityInfo-Dy3b_nFN-BBC0HKlV.js +4 -0
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-Bh7IbcdY-BgLN7Lgx.js +100 -0
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-D-l_Az3s-Cw7WmFxz-B8tPqh_7.js +100 -0
- package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-DujerENw.js → AuthorityInfo.vue_vue_type_style_index_0_lang-DVFi0qOJ.js} +2 -2
- package/dist/AuthorityPanel-CRlAwbaI-G7pZXKdE-DAeYw45g.js +4 -0
- package/dist/AuthorityPanel-CRlAwbaI-G7pZXKdE.js +4 -0
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S-CJvk3pW8-C6jMEDJq.js +114 -0
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-DxhZjp1S-CJvk3pW8.js +114 -0
- package/dist/Company-B4vsXy2I-CkNCOqjJ-PjoD0ztY.js +25 -0
- package/dist/{Company-6VJtwh23.js → Company-Byq4p14C.js} +3 -3
- package/dist/Company-gKkfnhLt-BReGxz7n.js +25 -0
- package/dist/CompanyPanel-BF5Pc35s-CtpymP6a.js +206 -0
- package/dist/{CompanyPanel-B2P488mq.js → CompanyPanel-CIHP7rVd.js} +7 -7
- package/dist/CompanyPanel-Czcx8Gyw-CvndXwB_-mYpxegRQ.js +206 -0
- package/dist/DataSet-DT-rGICv-DaUfgbxk-YztlXv7w.js +147 -0
- package/dist/DataSet-DT-rGICv-DaUfgbxk.js +147 -0
- package/dist/{Department-BnwoLEOC.js → Department-CxgSq34X.js} +3 -3
- package/dist/Department-D0I3QVZe-CfWPT-lY.js +25 -0
- package/dist/Department-D0dVUrGC-C6HJcYI1-DhAtBQym.js +25 -0
- package/dist/DepartmentPanel-2LHODgc7--VCCaEsu.js +254 -0
- package/dist/DepartmentPanel-e91Lxr1j-BS_A-ILd-V3QvVWmJ.js +254 -0
- package/dist/{DepartmentPanel-CRrrmxtv.js → DepartmentPanel-hYNqywSQ.js} +22 -22
- package/dist/DesignPanel-CtF3cAAQ-FM7zpexb.js +4 -0
- package/dist/DesignPanel-DdFl_ohi-uCwFxcl1-7p3ouXrw.js +4 -0
- package/dist/{DesignPanel-CvbccgX2.js → DesignPanel-GEhqXIAx.js} +1 -1
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BACPrfUI-cC7yL0uY-CoM_RAUN.js +1013 -0
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-BCYgwoVt-CcCVpy0f.js +1013 -0
- package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-Dz2tUszs.js → DesignPanel.vue_vue_type_style_index_0_lang-DxA6H5Ts.js} +3 -3
- package/dist/DictView-BzQLOf_P-DDicwdmM-B8CFC279.js +111 -0
- package/dist/DictView-H3V5hxg3-BQZWN2zT.js +111 -0
- package/dist/{DictView-Ce1LoVHh.js → DictView-tyGrHFO8.js} +1 -1
- package/dist/InvOrganization-BiGLnbqe-BK3vgYYR.js +74 -0
- package/dist/{InvOrganization-BwCFZO1X.js → InvOrganization-DjJ4XkxN.js} +2 -2
- package/dist/InvOrganization-atbhw0CI-BABbVt9V-BT8PkfWL.js +74 -0
- package/dist/{Org-0hzs6b0R.js → Org-3eHX7nBU.js} +2 -2
- package/dist/Org-BW1YHG-Q-Cow7JWlD-C7ygI7jx.js +39 -0
- package/dist/Org-DQTCQHNY-CEEpGGlZ.js +39 -0
- package/dist/{Preview--DnEAhwh.js → Preview-Cgc3O8vp.js} +1 -1
- package/dist/Preview-DJtVsoq1-CCGidQjJ-DQ_OC1-S.js +48 -0
- package/dist/Preview-DXaiis29-BYyNhC1p.js +48 -0
- package/dist/ReportDefine-BLh4CiER-D68a0DWB.js +10 -0
- package/dist/ReportDefine-CNx_ob99-6NQAHK-Q-BL5gB56o.js +10 -0
- package/dist/{ReportDefine-Cu983bTN.js → ReportDefine-FYxHLbPV.js} +1 -1
- package/dist/{ReportDesign-QsWXXgvo.js → ReportDesign-BTOVgMzz.js} +7 -7
- package/dist/ReportDesign-FbQ6yTJS-C1pPAUSp-DTsrU_wq.js +165 -0
- package/dist/ReportDesign-Ni1YxrLC-DfziOJc3.js +165 -0
- package/dist/ReportQuery-C5gz8Lgd-Eu2cQmda-c9iy6TZ_.js +75 -0
- package/dist/ReportQuery-C8G88_qF-BKknwX1u.js +75 -0
- package/dist/{ReportQuery-BjKIIhPu.js → ReportQuery-Dhy9sk04.js} +1 -1
- package/dist/{ReportQueryFrom-DIjBO6Fx.js → ReportQueryFrom-B1TE8lOG.js} +1 -1
- package/dist/ReportQueryFrom-C7scua5v-uHXWq8Gy-Cq4havLh.js +4 -0
- package/dist/ReportQueryFrom-CuZKPtB4-B_TaZr-N.js +4 -0
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-BAn_siFW-CdTqG6KF.js +178 -0
- package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-0T62cUMK.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-D93NL2N7.js} +7 -7
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DCbz67Wa-vK6r2uCl-kdXwDD3n.js +178 -0
- package/dist/ReportTemplate-BDANdIWv-D_IGjR1w-txJDRw_J.js +161 -0
- package/dist/{ReportTemplate-2uk9tJcy.js → ReportTemplate-C-EuU7mL.js} +8 -8
- package/dist/ReportTemplate-DFnDXWmx-QQkaZRvV.js +161 -0
- package/dist/Role-BQ7hsfPn-BLwTiMMj.js +25 -0
- package/dist/Role-ByB0WbxW-5E8Mb148-WoZV4JKV.js +25 -0
- package/dist/{Role-_QP8QEaI.js → Role-Dc1dZ0o9.js} +3 -3
- package/dist/{RoleAssign-C2gkcmEQ.js → RoleAssign-DDv65izq.js} +3 -3
- package/dist/RoleAssign-DW6iC_0v-Bis61auk-BB4DziuB.js +26 -0
- package/dist/RoleAssign-UPCg2d4G-g4V-duK9.js +26 -0
- package/dist/RolePanel-BM2MaQPU-CgcsbfaX-D28vR3Fh.js +4 -0
- package/dist/RolePanel-C-mQ5XRq-JQYWITkX.js +4 -0
- package/dist/{RolePanel-vnl_lXNY.js → RolePanel-CiDM8OSr.js} +1 -1
- package/dist/RolePanel-ClQy8DBL-DARL4O-o-DrElGZ66.js +4 -0
- package/dist/RolePanel-CoSXOCZN-BdCEhz3b.js +4 -0
- package/dist/{RolePanel-B8FPNGaA.js → RolePanel-Dw_pTEGV.js} +1 -1
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-Bc_Ao_PU-DMmxr2iI-Bsk0Mun8.js +132 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-Bg-t2UhF-CMTLt3Lp.js +154 -0
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-bxHXrBYl.js → RolePanel.vue_vue_type_script_setup_true_lang-CG_KY7NS.js} +7 -7
- package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-BuQbYEEI.js → RolePanel.vue_vue_type_script_setup_true_lang-Ctq1lItN.js} +8 -8
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-D-o7HYZ8-DPs8J-8D.js +132 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-fthF1zkp-JsbQJoDy-vZfwM6bG.js +154 -0
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-ByWIwajm-BsBf2Vs3-CTeY23xN.js +100 -0
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-CCsoxDfk-D-4pB58A.js +100 -0
- package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-C6yZXBqB.js → ScrollPanel.vue_vue_type_style_index_0_lang-CyU7XjI3.js} +1 -1
- package/dist/Staff-CuxzvhD9-D0KTcyRh-Cj8NbX79.js +25 -0
- package/dist/Staff-D-CmvG1R-uwSWH8-m.js +25 -0
- package/dist/{Staff-CHWrMIEb.js → Staff-DMh451jL.js} +3 -3
- package/dist/{StaffInfo-Cpq2eayz.js → StaffInfo-2PhYcVaz.js} +1 -1
- package/dist/StaffInfo-CY7gUICu-EZUhUwIp-C8POP58u.js +4 -0
- package/dist/StaffInfo-Idhvuc6e-COVQmEz0.js +4 -0
- package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-BVCjF2i1.js → StaffInfo.vue_vue_type_script_setup_true_lang-CrCFms3g.js} +1 -1
- package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-Dd8gtQz8-Dlkt-eCn-p0kltEdZ.js +108 -0
- package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-MUGKjnHU-Cj9lcXG6.js +108 -0
- package/dist/{StaffPanel-D2BMXt5p.js → StaffPanel-BrvkXT68.js} +1 -1
- package/dist/StaffPanel-CDDmAYE5-mLPGD2Nf.js +4 -0
- package/dist/StaffPanel-CwqG0_xr-CrvzLJoc-AX54GdZ3.js +4 -0
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-Bdilqbee-RiBDcMMj.js +143 -0
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-DCdBy8Hu-BXrueqi0-DFG90qAT.js +143 -0
- package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-B6jAGo-g.js → StaffPanel.vue_vue_type_script_setup_true_lang-DKr8VVOJ.js} +42 -42
- package/dist/SysUser-9Q2UJWhi-DprWXFlR-DUMl4Hfm.js +15 -0
- package/dist/{SysUser-om6H1BeC.js → SysUser-DLDd5do7.js} +2 -2
- package/dist/SysUser-a-j5bppr-CpP0s5DW.js +15 -0
- package/dist/SysUserPanel-6V232wwB-DI8apzmL.js +4 -0
- package/dist/{SysUserPanel-CH0HPP7h.js → SysUserPanel-DDQxi2Hk.js} +1 -1
- package/dist/SysUserPanel-bJy69O7x-BJtBgFEs-DEXctwBe.js +4 -0
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BOtHuMVy-CD9JQp9h.js +356 -0
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DUPFqgz3-BSqRCMen-BBtBr0VU.js +356 -0
- package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-Dpl13ee0.js → SysUserPanel.vue_vue_type_script_setup_true_lang-DvOggZs6.js} +2 -2
- package/dist/SystemMenu-BnVeOSOQ-6HW3jX57.js +156 -0
- package/dist/SystemMenu-DGOAolc1-CJSLHP8i-DIUNb03s.js +156 -0
- package/dist/{SystemMenu-BkG_DKxA.js → SystemMenu-nFNfz4Nj.js} +7 -7
- package/dist/{UserInfo-D9croxUe.js → UserInfo-B9PLKur5.js} +1 -1
- package/dist/UserInfo-CKoOHkAM-DDWp0I_U-DEerO-y3.js +4 -0
- package/dist/UserInfo-Cax9b2nw-DBResyaY.js +4 -0
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-BaT53SSu-DsNaAomO-7IKIrGoq.js +160 -0
- package/dist/{UserInfo.vue_vue_type_style_index_0_lang-DLIP8xpN.js → UserInfo.vue_vue_type_style_index_0_lang-BwZNwtQH.js} +2 -2
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-D-cw11i9-B2nI6TLi.js +160 -0
- package/dist/await-to-js.es5-Bv3Eu4mi-UCggJjes-CRQnmLCs.js +10 -0
- package/dist/await-to-js.es5-Bv3Eu4mi-UCggJjes.js +10 -0
- package/dist/await-to-js.es5-Bv3Eu4mi.js +10 -0
- package/dist/childView-0YZQ6GBn-CEqg7k5d-CDGM_XzZ.js +4 -0
- package/dist/{childView-BY_Ip-l1.js → childView-BEDVB_RG.js} +1 -1
- package/dist/{childView-CHp_TueS.js → childView-BRa268Qh.js} +1 -1
- package/dist/childView-DKG3eZo8-CCtKjCU7.js +4 -0
- package/dist/childView-DKkgi3yo-D47ft-vi-B5yI8Dk7.js +4 -0
- package/dist/childView-siumuBz0-CyYKsSPy.js +4 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-ABMrGInv-ClOdE_sa-BnvsyZ35.js +143 -0
- package/dist/{childView.vue_vue_type_style_index_0_lang-BNHbDRjt.js → childView.vue_vue_type_style_index_0_lang-BcyosNSH.js} +8 -8
- package/dist/childView.vue_vue_type_style_index_0_lang-CUfXDS1q-DNNy6Qe3.js +180 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-CW3EbAmW-D6Jvom5y.js +143 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-CaW106ve-CClTM8PK-ZSgCqafc.js +180 -0
- package/dist/{childView.vue_vue_type_style_index_0_lang-CbjGf7Z7.js → childView.vue_vue_type_style_index_0_lang-qsceJGeR.js} +8 -8
- package/dist/{code-rule-Ce6yWqCq.js → code-rule-CJ4FuOo1.js} +2 -2
- package/dist/code-rule-Dtoree6F-B4yeNvFw.js +148 -0
- package/dist/code-rule-wQyfgpNL-C4evD4Co-BOJCC1LY.js +148 -0
- package/dist/core.es.js +10 -10
- package/dist/cron-task-C-kryDtd-C0NuGZCe-DIJuoNx-.js +135 -0
- package/dist/{cron-task-DziaH0rI.js → cron-task-CXnv7hIa.js} +2 -2
- package/dist/cron-task-GSRgA7S5-D_xfN2g_.js +135 -0
- package/dist/flow-task-B07st2aD-CgQvagSQ-BaPlX6ds.js +10 -0
- package/dist/flow-task-B07st2aD-CgQvagSQ.js +10 -0
- package/dist/frameView-BOGA3ezf-QoSxzmSQ-BWs9F5mT.js +44 -0
- package/dist/frameView-Cy6wxW0K-BLdNZaGh.js +44 -0
- package/dist/{frameView-DNeCVQaY.js → frameView-g5e9PYdE.js} +1 -1
- package/dist/{index-BabfUVv_.js → index-BEAth5RR.js} +1057 -1033
- package/dist/layout-home-3Dy4onl4-COK554mq.js +228 -0
- package/dist/layout-home-CYHksXN_-Basy-3IH-Dnun4YUs.js +228 -0
- package/dist/layout-home-bl3JShSF.js +232 -0
- package/dist/layoutView-BaRvAbIa-xVgfqspc-zL46XaoI.js +3302 -0
- package/dist/layoutView-DMjNscJ--DvK2S5BQ.js +3302 -0
- package/dist/{layoutView-12Mlp9A2.js → layoutView-DmM9xk-X.js} +8 -8
- package/dist/log-in-Cx1dGik8-BVeEHeZ8-D7mV8pl4.js +117 -0
- package/dist/log-in-VAG6Cvcx-B6arurXx.js +117 -0
- package/dist/{log-in-1NGaA5OM.js → log-in-eGoxFTDE.js} +8 -8
- package/dist/log-out-COYdxrNC-ftopGZdE-Ch_UgXZv.js +130 -0
- package/dist/{log-out-B8_atGcQ.js → log-out-CthD_tSk.js} +4 -4
- package/dist/log-out-DZGaMCjC-OztBlMPh.js +130 -0
- package/dist/login-CqVMdNHs-CRJ-LWAK.js +241 -0
- package/dist/login-Dg9ofNS8-Bocp1XMA-DY4y3cAG.js +241 -0
- package/dist/{login-5dydO6GR.js → login-Dn7iO3SU.js} +16 -16
- package/dist/login-log-DJBGJVV0-AoOyj0jD-AoOyj0jD.js +70 -0
- package/dist/login-log-DJBGJVV0-AoOyj0jD.js +70 -0
- package/dist/{lov-view-DPvGUu3h.js → lov-view-Bt23RK6S.js} +7 -7
- package/dist/lov-view-C0T5prk8-B2DBmn55-BvzOsVW8.js +97 -0
- package/dist/lov-view-Cc68_28B-y4f2SzBr.js +97 -0
- package/dist/{menuInfo-DVADYfEK.js → menuInfo-BEmcSaIX.js} +1 -1
- package/dist/menuInfo-BIrIaJlH-Bxn4KTWH.js +4 -0
- package/dist/menuInfo-BZJ_q7bz-Drho-_QC-BK5n3Shr.js +4 -0
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-BA8xjUo3-BCZ1wipf-DEApwWGK.js +363 -0
- package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DgsifDrm.js → menuInfo.vue_vue_type_style_index_0_lang-CVuG-x2a.js} +2 -2
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-DlE4w35X-gWYo2VJe.js +363 -0
- package/dist/{pda-app-BZXs-2BQ.js → pda-app-BKfXoKAs.js} +9 -9
- package/dist/pda-app-DnjphrRS-4tIZDsnN.js +710 -0
- package/dist/pda-app-m9hsppHo-B4xyja1o-9mD3zI7J.js +710 -0
- package/dist/redirect-BqegffKC-CBCIuqmz-46JkXpSM.js +15 -0
- package/dist/redirect-BqegffKC-CBCIuqmz.js +15 -0
- package/dist/resource-C6KEIXu--B_ddyecm-CFF-A4cr.js +97 -0
- package/dist/{resource-BZA9NFKc.js → resource-CshrvEYp.js} +4 -4
- package/dist/resource-DISgPDM7-C4P8jqU0.js +97 -0
- package/dist/su-welcome-BjbuSrBZ-DrInu823.js +49339 -0
- package/dist/su-welcome-CYYy-dzr-D3RKPoB0-DhP783YJ.js +42089 -0
- package/dist/su-welcome-t7YusM3U.js +49427 -0
- package/dist/sys-config-DCjJGtht-DARDjlrt-Dx8559bf.js +370 -0
- package/dist/{sys-config-DQmNjWH4.js → sys-config-Jqj3l7NK.js} +13 -13
- package/dist/sys-config-Yc9vh1t1-B3bJPd9S.js +370 -0
- package/dist/udp-core.css +1 -1
- package/dist/utogether-MlnyYtNS-CGgjFNPS-CGgjFNPS.js +4 -0
- package/dist/utogether-MlnyYtNS-CGgjFNPS.js +4 -0
- package/package.json +5 -2
- package/src/App.vue +71 -71
- package/src/components/udp/content/index.vue +88 -88
- package/src/components/udp/form-upload/form-upload.vue +492 -492
- package/src/components/udp/grid/index.vue +524 -524
- package/src/components/udp/index.ts +6 -6
- package/src/components/udp/ut-stamp-badge/index.vue +271 -271
- package/src/components/udp/utils.ts +408 -408
- package/src/layout/components/lay-content/index.vue +136 -136
- package/src/layout/components/lay-search/components/SearchModal.vue +181 -189
- package/src/layout/components/lay-setting/index.vue +503 -503
- package/src/layout/components/lay-sidebar/sidebar-logo.vue +101 -101
- package/src/layout/components/lay-tag/index.vue +598 -598
- package/src/layout/hooks/useNav.ts +176 -176
- package/src/layout/hooks/useTag.ts +227 -227
- package/src/layout/layoutView.vue +216 -216
- package/src/layout/types.ts +93 -93
- package/src/main.ts +111 -112
- package/src/plugins/i18n/zh.ts +1 -0
- package/src/plugins/vxe-table/index.ts +116 -116
- package/src/plugins/vxe-table/render.tsx +968 -968
- package/src/router/index.ts +187 -187
- package/src/router/modules/home.ts +32 -32
- package/src/router/utils.ts +420 -420
- package/src/store/modules/epTheme.ts +48 -48
- package/src/style/vxetable.scss +364 -356
- package/src/utils/dataFormat/index.ts +222 -222
- package/src/utils/lifecycle.ts +39 -39
- package/src/views/organization/department/DepartmentPanel.vue +303 -303
- package/src/views/organization/staff/StaffInfo.vue +127 -127
- package/src/views/organization/staff/StaffPanel.vue +3 -3
- package/src/views/system/layout/layout-home.vue +46 -7
- package/src/views/system/menu/AuthorityPanel.vue +141 -141
- package/src/views/system/menu/SystemMenu.vue +194 -194
- package/src/views/system/menu/menuInfo.vue +1 -1
- package/src/views/system/sysUser/SysUserPanel.vue +363 -363
- package/src/views/udev/coderule/code-rule.vue +132 -132
- package/src/views/udev/dict/DictView.vue +118 -118
- package/src/views/udev/dict/childView.vue +184 -184
- package/src/views/udev/lov/childView.vue +174 -174
- package/src/views/uhome/components/common-menu.vue +118 -0
- package/src/views/uhome/components/dynamic-component.vue +66 -0
- package/src/views/uhome/components/home-todo.vue +171 -0
- package/src/views/uhome/components/menu-favorite.vue +315 -315
- package/src/views/uhome/dynamic-card.vue +18 -19
- package/src/views/uhome/su-welcome.vue +47 -117
- package/src/views/ulogin/login.vue +336 -336
- package/src/views/upms/interface/log-in.vue +100 -100
- package/src/views/upms/interface/log-out.vue +104 -104
- package/src/views/upms/user/login-log.vue +54 -54
- package/types/global.d.ts +232 -232
- package/dist/await-to-js.es5-BtRbN2QH.js +0 -10
- package/dist/layout-home-Cis1KlEr.js +0 -195
- package/dist/su-welcome-BXe6Cdp3.js +0 -580
package/src/router/utils.ts
CHANGED
|
@@ -1,420 +1,420 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: levi7754 levi7754@163.com
|
|
3
|
-
* @Date: 2024-08-01 21:42:39
|
|
4
|
-
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
-
* @LastEditTime: 2025-12-02 18:21:41
|
|
6
|
-
* @FilePath: \udp-front\packages\udp-core\src\router\utils.ts
|
|
7
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
*/
|
|
9
|
-
import type { RouteRecordRaw, RouteComponent } from 'vue-router';
|
|
10
|
-
import { isProxy, toRaw, defineAsyncComponent } from 'vue';
|
|
11
|
-
import { useTimeoutFn } from '@vueuse/core';
|
|
12
|
-
import { storageLocal, buildHierarchyTree, dbstorage } from '@utogether/utils';
|
|
13
|
-
import { clone } from 'xe-utils';
|
|
14
|
-
import { router, getViews } from './index';
|
|
15
|
-
import { getConfig } from '../config';
|
|
16
|
-
import { geti18n } from '../plugins/i18n';
|
|
17
|
-
import { routerArrays } from '../layout/types';
|
|
18
|
-
import { usePermissionStoreHook } from '../store/modules/permission';
|
|
19
|
-
import { useSystemStoreHook } from '../store/modules/system';
|
|
20
|
-
import { useMultiTagsStoreHook } from '../store/modules/multiTags';
|
|
21
|
-
import { getServiceApi } from '../api';
|
|
22
|
-
import createComponent from './createComponent';
|
|
23
|
-
|
|
24
|
-
const Layout = () => import('../layout/layoutView.vue');
|
|
25
|
-
const IFrame = () => import('../layout/frameView.vue');
|
|
26
|
-
|
|
27
|
-
// 动态路由
|
|
28
|
-
import { initDict, initSystemInfo, getAsyncRoutes } from '../api/user';
|
|
29
|
-
// https://cn.vitejs.dev/guide/features.html#glob-import
|
|
30
|
-
// const modulesRoutes = import.meta.glob('/src/views/**/*.{vue,tsx}');
|
|
31
|
-
|
|
32
|
-
// 菜单类型
|
|
33
|
-
enum MenuCategoty {
|
|
34
|
-
Menu = '5', // 菜单
|
|
35
|
-
Lowcode = '10' // 低代码
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** 按照路由中meta下的rank等级升序来排序路由 */
|
|
39
|
-
function ascending(arr: any[]) {
|
|
40
|
-
arr.forEach(v => {
|
|
41
|
-
if (v?.meta?.rank === null) v.meta.rank = undefined;
|
|
42
|
-
if (v?.meta?.rank === 0) {
|
|
43
|
-
if (v.name !== 'home' && v.path !== '/') {
|
|
44
|
-
console.warn('rank only the home page can be 0');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return arr.sort((a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
|
49
|
-
return a?.meta?.rank - b?.meta?.rank;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** 过滤meta中showLink为false的菜单 */
|
|
54
|
-
function filterTree(data: RouteComponent[]) {
|
|
55
|
-
const newTree = clone(data, true).filter((v: { meta: { showLink: boolean } }) => v && v.meta?.showLink !== false);
|
|
56
|
-
newTree.forEach((v: { children }) => v.children && (v.children = filterTree(v.children)));
|
|
57
|
-
return newTree;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** 通过指定 `key` 获取父级路径集合,默认 `key` 为 `path` */
|
|
61
|
-
function getParentPaths(value: string, routes: RouteRecordRaw[], key = 'path') {
|
|
62
|
-
// 深度遍历查找
|
|
63
|
-
function dfs(routes: RouteRecordRaw[], value: string, parents: string[]) {
|
|
64
|
-
for (let i = 0; i < routes.length; i++) {
|
|
65
|
-
const item = routes[i];
|
|
66
|
-
// 找到path则返回父级path
|
|
67
|
-
// if (item[key] === value) {
|
|
68
|
-
// return parents.length ? parents : routes[0];
|
|
69
|
-
// }
|
|
70
|
-
if (item[key] === value) return parents;
|
|
71
|
-
// children不存在或为空则不递归
|
|
72
|
-
if (!item.children || !item.children.length) continue;
|
|
73
|
-
// 往下查找时将当前path入栈
|
|
74
|
-
parents.push(item.path);
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
if (dfs(item.children, value, parents).length) return parents;
|
|
77
|
-
// 深度遍历查找未找到时当前path 出栈
|
|
78
|
-
parents.pop();
|
|
79
|
-
}
|
|
80
|
-
// 未找到时返回空数组
|
|
81
|
-
return [];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return dfs(routes, value, []);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** 查找对应 `path` 的路由信息 */
|
|
88
|
-
function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
|
|
89
|
-
let res = routes.find((item: { path: string }) => item.path == path);
|
|
90
|
-
if (res) {
|
|
91
|
-
return isProxy(res) ? toRaw(res) : res;
|
|
92
|
-
} else {
|
|
93
|
-
for (let i = 0; i < routes.length; i++) {
|
|
94
|
-
if (routes[i].children instanceof Array && routes[i].children.length > 0) {
|
|
95
|
-
res = findRouteByPath(path, routes[i].children);
|
|
96
|
-
if (res) {
|
|
97
|
-
return isProxy(res) ? toRaw(res) : res;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function addPathMatch() {
|
|
105
|
-
if (!router.hasRoute('pathMatch')) {
|
|
106
|
-
router.addRoute({
|
|
107
|
-
path: '/:pathMatch(.*)',
|
|
108
|
-
name: 'pathMatch',
|
|
109
|
-
redirect: '/error/404'
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @description: 添加审批动态路由
|
|
116
|
-
* @param {*} syncRoutes 异步获取的路由表数据
|
|
117
|
-
* @param {*} routes 格式化后的路由表数据
|
|
118
|
-
* @return {*} 格式化后的路由表数据
|
|
119
|
-
*/
|
|
120
|
-
// function addWorkflowRouter(syncRoutes, routes) {
|
|
121
|
-
// const flowIdx = syncRoutes.findIndex(f => f.menuCode === 'Workflow');
|
|
122
|
-
// const isExit = flowIdx !== -1 && syncRoutes[flowIdx].children?.some(s => s.name === 'workflowApprove');
|
|
123
|
-
// if (!isExit) {
|
|
124
|
-
// flowIdx !== -1 && routes[flowIdx].children?.push(workflowRouter);
|
|
125
|
-
// }
|
|
126
|
-
// return routes;
|
|
127
|
-
// }
|
|
128
|
-
// 菜单国家化
|
|
129
|
-
function setMenui18n() {
|
|
130
|
-
const i18n = geti18n();
|
|
131
|
-
i18n.global?.mergeLocaleMessage('zh', menuI18n.zh);
|
|
132
|
-
i18n.global?.mergeLocaleMessage('en', menuI18n.en);
|
|
133
|
-
storageLocal.setItem('menu_zh', menuI18n.zh);
|
|
134
|
-
storageLocal.setItem('menu_en', menuI18n.en);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function handleAsyncRoutes(routesList) {
|
|
138
|
-
if (routesList?.length) {
|
|
139
|
-
const idx = routesList.findIndex(f => f.menuCode === 'SysHome');
|
|
140
|
-
if (idx !== -1) {
|
|
141
|
-
// 仪表盘报表
|
|
142
|
-
const dashboardTabs = [];
|
|
143
|
-
const homeMenus = [];
|
|
144
|
-
routesList[idx].children.forEach(child => {
|
|
145
|
-
if (child.menuCategory !== '1') {
|
|
146
|
-
dashboardTabs.push(child);
|
|
147
|
-
} else {
|
|
148
|
-
homeMenus.push(child);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
routesList[idx].children = homeMenus;
|
|
152
|
-
useSystemStoreHook().setHomeMenus(dashboardTabs);
|
|
153
|
-
}
|
|
154
|
-
const routes = clone(addAsyncRoutes(routesList), true);
|
|
155
|
-
|
|
156
|
-
// routes = addWorkflowRouter(routesList, routes);
|
|
157
|
-
setMenui18n();
|
|
158
|
-
formatFlatteningRoutes(routes).map((v: RouteRecordRaw) => {
|
|
159
|
-
// 菜单国际化
|
|
160
|
-
// 防止重复添加路由
|
|
161
|
-
const { options } = router;
|
|
162
|
-
if (options.routes[0].children.findIndex(value => value.path === v.path) !== -1) {
|
|
163
|
-
return;
|
|
164
|
-
} else {
|
|
165
|
-
// 切记将路由push到routes后还需要使用addRoute,这样路由才能正常跳转
|
|
166
|
-
router.options.routes[0].children.push(v);
|
|
167
|
-
// 最终路由进行升序
|
|
168
|
-
ascending(router.options.routes[0].children);
|
|
169
|
-
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
usePermissionStoreHook().changeSetting(routesList);
|
|
174
|
-
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
|
175
|
-
useMultiTagsStoreHook().handleTags('equal', [
|
|
176
|
-
...routerArrays,
|
|
177
|
-
...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
|
|
178
|
-
]);
|
|
179
|
-
}
|
|
180
|
-
addPathMatch();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
|
|
184
|
-
async function initRouter(userName) {
|
|
185
|
-
let asyncRouteList = [];
|
|
186
|
-
const key = `U-${userName}-ROUTES`;
|
|
187
|
-
// 开启动态路由缓存本地
|
|
188
|
-
if (getConfig().CachingAsyncRoutes) {
|
|
189
|
-
await dbstorage.getItem(key).then(data => (asyncRouteList = data));
|
|
190
|
-
}
|
|
191
|
-
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
192
|
-
await initSystemInfo().then(async (res: IRecord) => {
|
|
193
|
-
useSystemStoreHook().setSystemInfo(res);
|
|
194
|
-
await getServiceApi()
|
|
195
|
-
.get('/uums/cusOrganization', { pageSize: 100, pageNum: 1, orgId: res.orgId })
|
|
196
|
-
.then((res: IResponseData) => useSystemStoreHook().setInvOrgList(res?.list || []));
|
|
197
|
-
});
|
|
198
|
-
if (asyncRouteList?.length) {
|
|
199
|
-
return new Promise(resolve => {
|
|
200
|
-
handleAsyncRoutes(asyncRouteList);
|
|
201
|
-
// 缓存最新的路由
|
|
202
|
-
getAsyncRoutes({ userName }).then((data: any) => {
|
|
203
|
-
dbstorage.setItem(key, data);
|
|
204
|
-
});
|
|
205
|
-
resolve(router);
|
|
206
|
-
});
|
|
207
|
-
} else {
|
|
208
|
-
return new Promise(resolve => {
|
|
209
|
-
getAsyncRoutes({ userName }).then((data: any) => {
|
|
210
|
-
handleAsyncRoutes(clone(data, true));
|
|
211
|
-
dbstorage.setItem(key, data);
|
|
212
|
-
resolve(router);
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* 将多级嵌套路由处理成一维数组
|
|
220
|
-
* @param routesList 传入路由
|
|
221
|
-
* @returns 返回处理后的一维路由
|
|
222
|
-
*/
|
|
223
|
-
function formatFlatteningRoutes(routesList: RouteRecordRaw[]) {
|
|
224
|
-
if (routesList.length === 0) return routesList;
|
|
225
|
-
let hierarchyList = buildHierarchyTree(routesList);
|
|
226
|
-
for (let i = 0; i < hierarchyList.length; i++) {
|
|
227
|
-
if (hierarchyList[i].children) {
|
|
228
|
-
hierarchyList = hierarchyList.slice(0, i + 1).concat(hierarchyList[i].children, hierarchyList.slice(i + 1));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return hierarchyList;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* 一维数组处理成多级嵌套数组(三级及以上的路由全部拍成二级,keep-alive 只支持到二级缓存)
|
|
236
|
-
* @param routesList 处理后的一维路由菜单数组
|
|
237
|
-
* @returns 返回将一维数组重新处理成规定路由的格式
|
|
238
|
-
*/
|
|
239
|
-
function formatTwoStageRoutes(routesList: RouteRecordRaw[]) {
|
|
240
|
-
if (routesList.length === 0) return routesList;
|
|
241
|
-
const newRoutesList: RouteRecordRaw[] = [];
|
|
242
|
-
routesList.forEach((v: RouteRecordRaw) => {
|
|
243
|
-
if (v.path === '/') {
|
|
244
|
-
newRoutesList.push({
|
|
245
|
-
component: v.component,
|
|
246
|
-
name: v.name,
|
|
247
|
-
path: v.path,
|
|
248
|
-
redirect: v.redirect,
|
|
249
|
-
meta: v.meta,
|
|
250
|
-
children: []
|
|
251
|
-
});
|
|
252
|
-
} else {
|
|
253
|
-
newRoutesList[0].children.push({ ...v });
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
return newRoutesList;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/** 处理缓存路由(添加、删除、刷新) */
|
|
260
|
-
function handleAliveRoute({ name }: ToRouteType, mode?: string) {
|
|
261
|
-
switch (mode) {
|
|
262
|
-
case 'add':
|
|
263
|
-
usePermissionStoreHook().cacheOperate({ mode: 'add', name });
|
|
264
|
-
break;
|
|
265
|
-
case 'delete':
|
|
266
|
-
usePermissionStoreHook().cacheOperate({ mode: 'delete', name });
|
|
267
|
-
break;
|
|
268
|
-
case 'refresh':
|
|
269
|
-
usePermissionStoreHook().cacheOperate({ mode: 'refresh', name });
|
|
270
|
-
break;
|
|
271
|
-
default:
|
|
272
|
-
usePermissionStoreHook().cacheOperate({ mode: 'delete', name });
|
|
273
|
-
useTimeoutFn(() => {
|
|
274
|
-
usePermissionStoreHook().cacheOperate({ mode: 'add', name });
|
|
275
|
-
}, 100);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/** 过滤后端传来的动态路由 重新生成规范路由 */
|
|
280
|
-
const menuI18n = {
|
|
281
|
-
zh: {},
|
|
282
|
-
en: {}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const processMenus = [];
|
|
286
|
-
|
|
287
|
-
const addAsyncRoutes = (arrRoutes: Array<any>) => {
|
|
288
|
-
const modulesRoutes = getViews();
|
|
289
|
-
|
|
290
|
-
if (!arrRoutes || !arrRoutes.length) return;
|
|
291
|
-
const modulesRoutesKeys = Object.keys(modulesRoutes);
|
|
292
|
-
for (let i = 0; i < arrRoutes.length; i++) {
|
|
293
|
-
const v = arrRoutes[i];
|
|
294
|
-
|
|
295
|
-
if (v?.children && v.children.length && !v.redirect) {
|
|
296
|
-
// 父级的redirect属性取值:如果子级存在且父级的redirect属性不存在,默认取第一个子级的path;如果子级存在且父级的redirect属性存在,取存在的redirect属性,会覆盖默认值
|
|
297
|
-
v.redirect = v.children[0].path;
|
|
298
|
-
}
|
|
299
|
-
const { icon, permissionCode, extraIcon, frameSrc } = v;
|
|
300
|
-
// 流程菜单保存
|
|
301
|
-
v.isApprovalPage === 'Y' && processMenus.push(v);
|
|
302
|
-
|
|
303
|
-
v.meta = {
|
|
304
|
-
keepAlive: true,
|
|
305
|
-
rank: v.sort,
|
|
306
|
-
title: `${v.i18nField}`,
|
|
307
|
-
// 审批流设计页面和审批页面的code写死,只需配置页面即可(保底方式)
|
|
308
|
-
// showLink: !['UDPFlowTask'].includes(v.menuCode) ? null : false
|
|
309
|
-
showLink: v.showLink !== 'N'
|
|
310
|
-
};
|
|
311
|
-
v.hiddenTag = null;
|
|
312
|
-
Object.assign(v.meta, { icon, permissionCode, extraIcon, frameSrc });
|
|
313
|
-
menuI18n.zh[v.i18nField] = v.menuName || v.menuNameEn;
|
|
314
|
-
menuI18n.en[v.i18nField] = v.menuNameEn || v.menuName;
|
|
315
|
-
v.name = v.menuCode || v.name;
|
|
316
|
-
v.path = v.menuPath || v.path;
|
|
317
|
-
if (!v.parentId) {
|
|
318
|
-
v.component = Layout;
|
|
319
|
-
} else if (v.meta?.frameSrc) {
|
|
320
|
-
v.component = IFrame;
|
|
321
|
-
} else if (v.menuCategory === MenuCategoty.Lowcode) {
|
|
322
|
-
// 低开路由处理
|
|
323
|
-
const index = modulesRoutesKeys.findIndex(ev => ev.includes('lowcode-contain'));
|
|
324
|
-
v.component = createComponent(
|
|
325
|
-
v.name,
|
|
326
|
-
defineAsyncComponent(() => import(/* @vite-ignore */ modulesRoutesKeys[index]))
|
|
327
|
-
);
|
|
328
|
-
// 将模块类型赋值到meta中
|
|
329
|
-
Object.assign(v.meta, { moduleType: v.moduleType });
|
|
330
|
-
} else if (v.menuCategory !== MenuCategoty.Menu) {
|
|
331
|
-
const index = modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
|
|
332
|
-
v.component = modulesRoutes[modulesRoutesKeys[index]];
|
|
333
|
-
}
|
|
334
|
-
if (v?.children && v.children.length) {
|
|
335
|
-
addAsyncRoutes(v.children);
|
|
336
|
-
} else {
|
|
337
|
-
delete v.children;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return arrRoutes;
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
// 是否有权限
|
|
344
|
-
function hasPermissions(value: Array<string>): boolean {
|
|
345
|
-
if (value && value instanceof Array && value.length > 0) {
|
|
346
|
-
const roles = usePermissionStoreHook().buttonAuth;
|
|
347
|
-
const permissionRoles = value;
|
|
348
|
-
|
|
349
|
-
const hasPermission = roles.some(role => {
|
|
350
|
-
return permissionRoles.includes(role);
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
if (!hasPermission) {
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
return true;
|
|
357
|
-
} else {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
// 删除当前路由
|
|
362
|
-
function delCurrentRoute(current: any, toNext = true) {
|
|
363
|
-
const startIndex: number = useMultiTagsStoreHook().multiTags.findIndex(tag => {
|
|
364
|
-
if (current.query) {
|
|
365
|
-
if (current.path === tag.path) {
|
|
366
|
-
return current.query === tag.query;
|
|
367
|
-
}
|
|
368
|
-
} else {
|
|
369
|
-
return current.path === tag.path;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
useMultiTagsStoreHook().handleTags('splice', '', { startIndex, length: 1 });
|
|
373
|
-
handleAliveRoute(current.matched, 'delete');
|
|
374
|
-
if (toNext) {
|
|
375
|
-
const newRoute = useMultiTagsStoreHook().handleTags('slice');
|
|
376
|
-
router.push({
|
|
377
|
-
path: newRoute[0].path,
|
|
378
|
-
query: newRoute[0].query
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function handleTopMenu(route) {
|
|
384
|
-
if (route?.children && route.children.length > 1) {
|
|
385
|
-
if (route.redirect) {
|
|
386
|
-
return route.children.filter(cur => cur.path === route.redirect)[0];
|
|
387
|
-
} else {
|
|
388
|
-
return route.children[0];
|
|
389
|
-
}
|
|
390
|
-
} else {
|
|
391
|
-
return route;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
/** 获取所有菜单中的第一个菜单(顶级菜单)*/
|
|
396
|
-
function getTopMenu(tag = false) {
|
|
397
|
-
const topMenu = handleTopMenu(usePermissionStoreHook().wholeMenus[0]?.children[0]);
|
|
398
|
-
tag && useMultiTagsStoreHook().handleTags('push', topMenu);
|
|
399
|
-
return topMenu;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function getProcessMenu() {
|
|
403
|
-
return processMenus;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
export {
|
|
407
|
-
ascending,
|
|
408
|
-
filterTree,
|
|
409
|
-
initRouter,
|
|
410
|
-
getTopMenu,
|
|
411
|
-
getProcessMenu,
|
|
412
|
-
hasPermissions,
|
|
413
|
-
addAsyncRoutes,
|
|
414
|
-
getParentPaths,
|
|
415
|
-
findRouteByPath,
|
|
416
|
-
handleAliveRoute,
|
|
417
|
-
formatTwoStageRoutes,
|
|
418
|
-
formatFlatteningRoutes,
|
|
419
|
-
delCurrentRoute
|
|
420
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* @Author: levi7754 levi7754@163.com
|
|
3
|
+
* @Date: 2024-08-01 21:42:39
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2025-12-02 18:21:41
|
|
6
|
+
* @FilePath: \udp-front\packages\udp-core\src\router\utils.ts
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
9
|
+
import type { RouteRecordRaw, RouteComponent } from 'vue-router';
|
|
10
|
+
import { isProxy, toRaw, defineAsyncComponent } from 'vue';
|
|
11
|
+
import { useTimeoutFn } from '@vueuse/core';
|
|
12
|
+
import { storageLocal, buildHierarchyTree, dbstorage } from '@utogether/utils';
|
|
13
|
+
import { clone } from 'xe-utils';
|
|
14
|
+
import { router, getViews } from './index';
|
|
15
|
+
import { getConfig } from '../config';
|
|
16
|
+
import { geti18n } from '../plugins/i18n';
|
|
17
|
+
import { routerArrays } from '../layout/types';
|
|
18
|
+
import { usePermissionStoreHook } from '../store/modules/permission';
|
|
19
|
+
import { useSystemStoreHook } from '../store/modules/system';
|
|
20
|
+
import { useMultiTagsStoreHook } from '../store/modules/multiTags';
|
|
21
|
+
import { getServiceApi } from '../api';
|
|
22
|
+
import createComponent from './createComponent';
|
|
23
|
+
|
|
24
|
+
const Layout = () => import('../layout/layoutView.vue');
|
|
25
|
+
const IFrame = () => import('../layout/frameView.vue');
|
|
26
|
+
|
|
27
|
+
// 动态路由
|
|
28
|
+
import { initDict, initSystemInfo, getAsyncRoutes } from '../api/user';
|
|
29
|
+
// https://cn.vitejs.dev/guide/features.html#glob-import
|
|
30
|
+
// const modulesRoutes = import.meta.glob('/src/views/**/*.{vue,tsx}');
|
|
31
|
+
|
|
32
|
+
// 菜单类型
|
|
33
|
+
enum MenuCategoty {
|
|
34
|
+
Menu = '5', // 菜单
|
|
35
|
+
Lowcode = '10' // 低代码
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 按照路由中meta下的rank等级升序来排序路由 */
|
|
39
|
+
function ascending(arr: any[]) {
|
|
40
|
+
arr.forEach(v => {
|
|
41
|
+
if (v?.meta?.rank === null) v.meta.rank = undefined;
|
|
42
|
+
if (v?.meta?.rank === 0) {
|
|
43
|
+
if (v.name !== 'home' && v.path !== '/') {
|
|
44
|
+
console.warn('rank only the home page can be 0');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return arr.sort((a: { meta: { rank: number } }, b: { meta: { rank: number } }) => {
|
|
49
|
+
return a?.meta?.rank - b?.meta?.rank;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 过滤meta中showLink为false的菜单 */
|
|
54
|
+
function filterTree(data: RouteComponent[]) {
|
|
55
|
+
const newTree = clone(data, true).filter((v: { meta: { showLink: boolean } }) => v && v.meta?.showLink !== false);
|
|
56
|
+
newTree.forEach((v: { children }) => v.children && (v.children = filterTree(v.children)));
|
|
57
|
+
return newTree;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 通过指定 `key` 获取父级路径集合,默认 `key` 为 `path` */
|
|
61
|
+
function getParentPaths(value: string, routes: RouteRecordRaw[], key = 'path') {
|
|
62
|
+
// 深度遍历查找
|
|
63
|
+
function dfs(routes: RouteRecordRaw[], value: string, parents: string[]) {
|
|
64
|
+
for (let i = 0; i < routes.length; i++) {
|
|
65
|
+
const item = routes[i];
|
|
66
|
+
// 找到path则返回父级path
|
|
67
|
+
// if (item[key] === value) {
|
|
68
|
+
// return parents.length ? parents : routes[0];
|
|
69
|
+
// }
|
|
70
|
+
if (item[key] === value) return parents;
|
|
71
|
+
// children不存在或为空则不递归
|
|
72
|
+
if (!item.children || !item.children.length) continue;
|
|
73
|
+
// 往下查找时将当前path入栈
|
|
74
|
+
parents.push(item.path);
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
if (dfs(item.children, value, parents).length) return parents;
|
|
77
|
+
// 深度遍历查找未找到时当前path 出栈
|
|
78
|
+
parents.pop();
|
|
79
|
+
}
|
|
80
|
+
// 未找到时返回空数组
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return dfs(routes, value, []);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** 查找对应 `path` 的路由信息 */
|
|
88
|
+
function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
|
|
89
|
+
let res = routes.find((item: { path: string }) => item.path == path);
|
|
90
|
+
if (res) {
|
|
91
|
+
return isProxy(res) ? toRaw(res) : res;
|
|
92
|
+
} else {
|
|
93
|
+
for (let i = 0; i < routes.length; i++) {
|
|
94
|
+
if (routes[i].children instanceof Array && routes[i].children.length > 0) {
|
|
95
|
+
res = findRouteByPath(path, routes[i].children);
|
|
96
|
+
if (res) {
|
|
97
|
+
return isProxy(res) ? toRaw(res) : res;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function addPathMatch() {
|
|
105
|
+
if (!router.hasRoute('pathMatch')) {
|
|
106
|
+
router.addRoute({
|
|
107
|
+
path: '/:pathMatch(.*)',
|
|
108
|
+
name: 'pathMatch',
|
|
109
|
+
redirect: '/error/404'
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @description: 添加审批动态路由
|
|
116
|
+
* @param {*} syncRoutes 异步获取的路由表数据
|
|
117
|
+
* @param {*} routes 格式化后的路由表数据
|
|
118
|
+
* @return {*} 格式化后的路由表数据
|
|
119
|
+
*/
|
|
120
|
+
// function addWorkflowRouter(syncRoutes, routes) {
|
|
121
|
+
// const flowIdx = syncRoutes.findIndex(f => f.menuCode === 'Workflow');
|
|
122
|
+
// const isExit = flowIdx !== -1 && syncRoutes[flowIdx].children?.some(s => s.name === 'workflowApprove');
|
|
123
|
+
// if (!isExit) {
|
|
124
|
+
// flowIdx !== -1 && routes[flowIdx].children?.push(workflowRouter);
|
|
125
|
+
// }
|
|
126
|
+
// return routes;
|
|
127
|
+
// }
|
|
128
|
+
// 菜单国家化
|
|
129
|
+
function setMenui18n() {
|
|
130
|
+
const i18n = geti18n();
|
|
131
|
+
i18n.global?.mergeLocaleMessage('zh', menuI18n.zh);
|
|
132
|
+
i18n.global?.mergeLocaleMessage('en', menuI18n.en);
|
|
133
|
+
storageLocal.setItem('menu_zh', menuI18n.zh);
|
|
134
|
+
storageLocal.setItem('menu_en', menuI18n.en);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function handleAsyncRoutes(routesList) {
|
|
138
|
+
if (routesList?.length) {
|
|
139
|
+
const idx = routesList.findIndex(f => f.menuCode === 'SysHome');
|
|
140
|
+
if (idx !== -1) {
|
|
141
|
+
// 仪表盘报表
|
|
142
|
+
const dashboardTabs = [];
|
|
143
|
+
const homeMenus = [];
|
|
144
|
+
routesList[idx].children.forEach(child => {
|
|
145
|
+
if (child.menuCategory !== '1') {
|
|
146
|
+
dashboardTabs.push(child);
|
|
147
|
+
} else {
|
|
148
|
+
homeMenus.push(child);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
routesList[idx].children = homeMenus;
|
|
152
|
+
useSystemStoreHook().setHomeMenus(dashboardTabs);
|
|
153
|
+
}
|
|
154
|
+
const routes = clone(addAsyncRoutes(routesList), true);
|
|
155
|
+
|
|
156
|
+
// routes = addWorkflowRouter(routesList, routes);
|
|
157
|
+
setMenui18n();
|
|
158
|
+
formatFlatteningRoutes(routes).map((v: RouteRecordRaw) => {
|
|
159
|
+
// 菜单国际化
|
|
160
|
+
// 防止重复添加路由
|
|
161
|
+
const { options } = router;
|
|
162
|
+
if (options.routes[0].children.findIndex(value => value.path === v.path) !== -1) {
|
|
163
|
+
return;
|
|
164
|
+
} else {
|
|
165
|
+
// 切记将路由push到routes后还需要使用addRoute,这样路由才能正常跳转
|
|
166
|
+
router.options.routes[0].children.push(v);
|
|
167
|
+
// 最终路由进行升序
|
|
168
|
+
ascending(router.options.routes[0].children);
|
|
169
|
+
if (!router.hasRoute(v?.name)) router.addRoute(v);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
usePermissionStoreHook().changeSetting(routesList);
|
|
174
|
+
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
|
175
|
+
useMultiTagsStoreHook().handleTags('equal', [
|
|
176
|
+
...routerArrays,
|
|
177
|
+
...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
addPathMatch();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
|
|
184
|
+
async function initRouter(userName) {
|
|
185
|
+
let asyncRouteList = [];
|
|
186
|
+
const key = `U-${userName}-ROUTES`;
|
|
187
|
+
// 开启动态路由缓存本地
|
|
188
|
+
if (getConfig().CachingAsyncRoutes) {
|
|
189
|
+
await dbstorage.getItem(key).then(data => (asyncRouteList = data));
|
|
190
|
+
}
|
|
191
|
+
initDict().then(res => useSystemStoreHook().setDict(res));
|
|
192
|
+
await initSystemInfo().then(async (res: IRecord) => {
|
|
193
|
+
useSystemStoreHook().setSystemInfo(res);
|
|
194
|
+
await getServiceApi()
|
|
195
|
+
.get('/uums/cusOrganization', { pageSize: 100, pageNum: 1, orgId: res.orgId })
|
|
196
|
+
.then((res: IResponseData) => useSystemStoreHook().setInvOrgList(res?.list || []));
|
|
197
|
+
});
|
|
198
|
+
if (asyncRouteList?.length) {
|
|
199
|
+
return new Promise(resolve => {
|
|
200
|
+
handleAsyncRoutes(asyncRouteList);
|
|
201
|
+
// 缓存最新的路由
|
|
202
|
+
getAsyncRoutes({ userName }).then((data: any) => {
|
|
203
|
+
dbstorage.setItem(key, data);
|
|
204
|
+
});
|
|
205
|
+
resolve(router);
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
return new Promise(resolve => {
|
|
209
|
+
getAsyncRoutes({ userName }).then((data: any) => {
|
|
210
|
+
handleAsyncRoutes(clone(data, true));
|
|
211
|
+
dbstorage.setItem(key, data);
|
|
212
|
+
resolve(router);
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* 将多级嵌套路由处理成一维数组
|
|
220
|
+
* @param routesList 传入路由
|
|
221
|
+
* @returns 返回处理后的一维路由
|
|
222
|
+
*/
|
|
223
|
+
function formatFlatteningRoutes(routesList: RouteRecordRaw[]) {
|
|
224
|
+
if (routesList.length === 0) return routesList;
|
|
225
|
+
let hierarchyList = buildHierarchyTree(routesList);
|
|
226
|
+
for (let i = 0; i < hierarchyList.length; i++) {
|
|
227
|
+
if (hierarchyList[i].children) {
|
|
228
|
+
hierarchyList = hierarchyList.slice(0, i + 1).concat(hierarchyList[i].children, hierarchyList.slice(i + 1));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return hierarchyList;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* 一维数组处理成多级嵌套数组(三级及以上的路由全部拍成二级,keep-alive 只支持到二级缓存)
|
|
236
|
+
* @param routesList 处理后的一维路由菜单数组
|
|
237
|
+
* @returns 返回将一维数组重新处理成规定路由的格式
|
|
238
|
+
*/
|
|
239
|
+
function formatTwoStageRoutes(routesList: RouteRecordRaw[]) {
|
|
240
|
+
if (routesList.length === 0) return routesList;
|
|
241
|
+
const newRoutesList: RouteRecordRaw[] = [];
|
|
242
|
+
routesList.forEach((v: RouteRecordRaw) => {
|
|
243
|
+
if (v.path === '/') {
|
|
244
|
+
newRoutesList.push({
|
|
245
|
+
component: v.component,
|
|
246
|
+
name: v.name,
|
|
247
|
+
path: v.path,
|
|
248
|
+
redirect: v.redirect,
|
|
249
|
+
meta: v.meta,
|
|
250
|
+
children: []
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
newRoutesList[0].children.push({ ...v });
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
return newRoutesList;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** 处理缓存路由(添加、删除、刷新) */
|
|
260
|
+
function handleAliveRoute({ name }: ToRouteType, mode?: string) {
|
|
261
|
+
switch (mode) {
|
|
262
|
+
case 'add':
|
|
263
|
+
usePermissionStoreHook().cacheOperate({ mode: 'add', name });
|
|
264
|
+
break;
|
|
265
|
+
case 'delete':
|
|
266
|
+
usePermissionStoreHook().cacheOperate({ mode: 'delete', name });
|
|
267
|
+
break;
|
|
268
|
+
case 'refresh':
|
|
269
|
+
usePermissionStoreHook().cacheOperate({ mode: 'refresh', name });
|
|
270
|
+
break;
|
|
271
|
+
default:
|
|
272
|
+
usePermissionStoreHook().cacheOperate({ mode: 'delete', name });
|
|
273
|
+
useTimeoutFn(() => {
|
|
274
|
+
usePermissionStoreHook().cacheOperate({ mode: 'add', name });
|
|
275
|
+
}, 100);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** 过滤后端传来的动态路由 重新生成规范路由 */
|
|
280
|
+
const menuI18n = {
|
|
281
|
+
zh: {},
|
|
282
|
+
en: {}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const processMenus = [];
|
|
286
|
+
|
|
287
|
+
const addAsyncRoutes = (arrRoutes: Array<any>) => {
|
|
288
|
+
const modulesRoutes = getViews();
|
|
289
|
+
|
|
290
|
+
if (!arrRoutes || !arrRoutes.length) return;
|
|
291
|
+
const modulesRoutesKeys = Object.keys(modulesRoutes);
|
|
292
|
+
for (let i = 0; i < arrRoutes.length; i++) {
|
|
293
|
+
const v = arrRoutes[i];
|
|
294
|
+
|
|
295
|
+
if (v?.children && v.children.length && !v.redirect) {
|
|
296
|
+
// 父级的redirect属性取值:如果子级存在且父级的redirect属性不存在,默认取第一个子级的path;如果子级存在且父级的redirect属性存在,取存在的redirect属性,会覆盖默认值
|
|
297
|
+
v.redirect = v.children[0].path;
|
|
298
|
+
}
|
|
299
|
+
const { icon, permissionCode, extraIcon, frameSrc } = v;
|
|
300
|
+
// 流程菜单保存
|
|
301
|
+
v.isApprovalPage === 'Y' && processMenus.push(v);
|
|
302
|
+
|
|
303
|
+
v.meta = {
|
|
304
|
+
keepAlive: true,
|
|
305
|
+
rank: v.sort,
|
|
306
|
+
title: `${v.i18nField}`,
|
|
307
|
+
// 审批流设计页面和审批页面的code写死,只需配置页面即可(保底方式)
|
|
308
|
+
// showLink: !['UDPFlowTask'].includes(v.menuCode) ? null : false
|
|
309
|
+
showLink: v.showLink !== 'N'
|
|
310
|
+
};
|
|
311
|
+
v.hiddenTag = null;
|
|
312
|
+
Object.assign(v.meta, { icon, permissionCode, extraIcon, frameSrc });
|
|
313
|
+
menuI18n.zh[v.i18nField] = v.menuName || v.menuNameEn;
|
|
314
|
+
menuI18n.en[v.i18nField] = v.menuNameEn || v.menuName;
|
|
315
|
+
v.name = v.menuCode || v.name;
|
|
316
|
+
v.path = v.menuPath || v.path;
|
|
317
|
+
if (!v.parentId) {
|
|
318
|
+
v.component = Layout;
|
|
319
|
+
} else if (v.meta?.frameSrc) {
|
|
320
|
+
v.component = IFrame;
|
|
321
|
+
} else if (v.menuCategory === MenuCategoty.Lowcode) {
|
|
322
|
+
// 低开路由处理
|
|
323
|
+
const index = modulesRoutesKeys.findIndex(ev => ev.includes('lowcode-contain'));
|
|
324
|
+
v.component = createComponent(
|
|
325
|
+
v.name,
|
|
326
|
+
defineAsyncComponent(() => import(/* @vite-ignore */ modulesRoutesKeys[index]))
|
|
327
|
+
);
|
|
328
|
+
// 将模块类型赋值到meta中
|
|
329
|
+
Object.assign(v.meta, { moduleType: v.moduleType });
|
|
330
|
+
} else if (v.menuCategory !== MenuCategoty.Menu) {
|
|
331
|
+
const index = modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
|
|
332
|
+
v.component = modulesRoutes[modulesRoutesKeys[index]];
|
|
333
|
+
}
|
|
334
|
+
if (v?.children && v.children.length) {
|
|
335
|
+
addAsyncRoutes(v.children);
|
|
336
|
+
} else {
|
|
337
|
+
delete v.children;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return arrRoutes;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
// 是否有权限
|
|
344
|
+
function hasPermissions(value: Array<string>): boolean {
|
|
345
|
+
if (value && value instanceof Array && value.length > 0) {
|
|
346
|
+
const roles = usePermissionStoreHook().buttonAuth;
|
|
347
|
+
const permissionRoles = value;
|
|
348
|
+
|
|
349
|
+
const hasPermission = roles.some(role => {
|
|
350
|
+
return permissionRoles.includes(role);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
if (!hasPermission) {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
return true;
|
|
357
|
+
} else {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
// 删除当前路由
|
|
362
|
+
function delCurrentRoute(current: any, toNext = true) {
|
|
363
|
+
const startIndex: number = useMultiTagsStoreHook().multiTags.findIndex(tag => {
|
|
364
|
+
if (current.query) {
|
|
365
|
+
if (current.path === tag.path) {
|
|
366
|
+
return current.query === tag.query;
|
|
367
|
+
}
|
|
368
|
+
} else {
|
|
369
|
+
return current.path === tag.path;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
useMultiTagsStoreHook().handleTags('splice', '', { startIndex, length: 1 });
|
|
373
|
+
handleAliveRoute(current.matched, 'delete');
|
|
374
|
+
if (toNext) {
|
|
375
|
+
const newRoute = useMultiTagsStoreHook().handleTags('slice');
|
|
376
|
+
router.push({
|
|
377
|
+
path: newRoute[0].path,
|
|
378
|
+
query: newRoute[0].query
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function handleTopMenu(route) {
|
|
384
|
+
if (route?.children && route.children.length > 1) {
|
|
385
|
+
if (route.redirect) {
|
|
386
|
+
return route.children.filter(cur => cur.path === route.redirect)[0];
|
|
387
|
+
} else {
|
|
388
|
+
return route.children[0];
|
|
389
|
+
}
|
|
390
|
+
} else {
|
|
391
|
+
return route;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** 获取所有菜单中的第一个菜单(顶级菜单)*/
|
|
396
|
+
function getTopMenu(tag = false) {
|
|
397
|
+
const topMenu = handleTopMenu(usePermissionStoreHook().wholeMenus[0]?.children[0]);
|
|
398
|
+
tag && useMultiTagsStoreHook().handleTags('push', topMenu);
|
|
399
|
+
return topMenu;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function getProcessMenu() {
|
|
403
|
+
return processMenus;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export {
|
|
407
|
+
ascending,
|
|
408
|
+
filterTree,
|
|
409
|
+
initRouter,
|
|
410
|
+
getTopMenu,
|
|
411
|
+
getProcessMenu,
|
|
412
|
+
hasPermissions,
|
|
413
|
+
addAsyncRoutes,
|
|
414
|
+
getParentPaths,
|
|
415
|
+
findRouteByPath,
|
|
416
|
+
handleAliveRoute,
|
|
417
|
+
formatTwoStageRoutes,
|
|
418
|
+
formatFlatteningRoutes,
|
|
419
|
+
delCurrentRoute
|
|
420
|
+
};
|