@liujitcn/kratos-admin-core 0.0.1
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/README.md +168 -0
- package/build/getEnv.ts +46 -0
- package/build/plugins.ts +206 -0
- package/build/proxy.ts +29 -0
- package/dist/package/declarations/build/getEnv.d.ts +13 -0
- package/dist/package/declarations/build/plugins.d.ts +20 -0
- package/dist/package/declarations/build/proxy.d.ts +10 -0
- package/dist/package/declarations/index.d.ts +7 -0
- package/dist/package/declarations/src/App.vue.d.ts +3 -0
- package/dist/package/declarations/src/api/base/config.d.ts +7 -0
- package/dist/package/declarations/src/api/base/file.d.ts +11 -0
- package/dist/package/declarations/src/api/base/login.d.ts +18 -0
- package/dist/package/declarations/src/api/base/oauth.d.ts +12 -0
- package/dist/package/declarations/src/api/system/auth.d.ts +13 -0
- package/dist/package/declarations/src/api/system/base_dict.d.ts +8 -0
- package/dist/package/declarations/src/api/system/base_tenant.d.ts +9 -0
- package/dist/package/declarations/src/auth.d.ts +1 -0
- package/dist/package/declarations/src/bootstrap.d.ts +23 -0
- package/dist/package/declarations/src/components/Card/DataPanelCard.vue.d.ts +23 -0
- package/dist/package/declarations/src/components/CronExpression/index.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/Dialog/FormDialog.vue.d.ts +74 -0
- package/dist/package/declarations/src/components/Dialog/ProDialog.vue.d.ts +58 -0
- package/dist/package/declarations/src/components/Dict/DictLabel.vue.d.ts +11 -0
- package/dist/package/declarations/src/components/Dict/index.vue.d.ts +30 -0
- package/dist/package/declarations/src/components/ECharts/config/index.d.ts +7 -0
- package/dist/package/declarations/src/components/ECharts/index.vue.d.ts +22 -0
- package/dist/package/declarations/src/components/ErrorMessage/index.vue.d.ts +12 -0
- package/dist/package/declarations/src/components/Grid/components/GridItem.vue.d.ts +34 -0
- package/dist/package/declarations/src/components/Grid/index.vue.d.ts +28 -0
- package/dist/package/declarations/src/components/Grid/interface/index.d.ts +7 -0
- package/dist/package/declarations/src/components/ImportExcel/index.vue.d.ts +26 -0
- package/dist/package/declarations/src/components/Loading/fullScreen.d.ts +5 -0
- package/dist/package/declarations/src/components/Loading/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/components/PasswordStrength/index.vue.d.ts +13 -0
- package/dist/package/declarations/src/components/ProForm/components/DynamicList.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/ProForm/components/KvList.vue.d.ts +26 -0
- package/dist/package/declarations/src/components/ProForm/components/ProFormItem.vue.d.ts +28 -0
- package/dist/package/declarations/src/components/ProForm/index.vue.d.ts +36 -0
- package/dist/package/declarations/src/components/ProForm/interface/index.d.ts +47 -0
- package/dist/package/declarations/src/components/ProTable/components/ColSetting.vue.d.ts +9 -0
- package/dist/package/declarations/src/components/ProTable/components/Pagination.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/ProTable/components/TableColumn.vue.d.ts +9 -0
- package/dist/package/declarations/src/components/ProTable/interface/index.d.ts +187 -0
- package/dist/package/declarations/src/components/ProTable.d.ts +5 -0
- package/dist/package/declarations/src/components/SearchForm/components/SearchFormItem.vue.d.ts +21 -0
- package/dist/package/declarations/src/components/SearchForm/index.vue.d.ts +22 -0
- package/dist/package/declarations/src/components/SelectFilter/index.vue.d.ts +44 -0
- package/dist/package/declarations/src/components/SelectIcon/index.vue.d.ts +19 -0
- package/dist/package/declarations/src/components/SvgIcon/index.vue.d.ts +15 -0
- package/dist/package/declarations/src/components/SwitchDark/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/components/TreeFilter/index.vue.d.ts +5866 -0
- package/dist/package/declarations/src/components/Upload/File.vue.d.ts +24 -0
- package/dist/package/declarations/src/components/Upload/Files.vue.d.ts +26 -0
- package/dist/package/declarations/src/components/Upload/Img.vue.d.ts +43 -0
- package/dist/package/declarations/src/components/Upload/Imgs.vue.d.ts +46 -0
- package/dist/package/declarations/src/components/WangEditor/index.vue.d.ts +29 -0
- package/dist/package/declarations/src/config/index.d.ts +6 -0
- package/dist/package/declarations/src/config/nprogress.d.ts +3 -0
- package/dist/package/declarations/src/directives/index.d.ts +5 -0
- package/dist/package/declarations/src/directives/modules/auth.d.ts +3 -0
- package/dist/package/declarations/src/directives/modules/copy.d.ts +8 -0
- package/dist/package/declarations/src/directives/modules/debounce.d.ts +8 -0
- package/dist/package/declarations/src/directives/modules/draggable.d.ts +3 -0
- package/dist/package/declarations/src/directives/modules/longpress.d.ts +7 -0
- package/dist/package/declarations/src/directives/modules/throttle.d.ts +3 -0
- package/dist/package/declarations/src/directives/modules/waterMarker.d.ts +5 -0
- package/dist/package/declarations/src/enums/httpEnum.d.ts +29 -0
- package/dist/package/declarations/src/format.d.ts +1 -0
- package/dist/package/declarations/src/hooks/interface/index.d.ts +36 -0
- package/dist/package/declarations/src/hooks/useAuthButtons.d.ts +8 -0
- package/dist/package/declarations/src/hooks/useDownload.d.ts +9 -0
- package/dist/package/declarations/src/hooks/useHandleData.d.ts +10 -0
- package/dist/package/declarations/src/hooks/useOnline.d.ts +6 -0
- package/dist/package/declarations/src/hooks/useSelection.d.ts +10 -0
- package/dist/package/declarations/src/hooks/useTable.d.ts +46 -0
- package/dist/package/declarations/src/hooks/useTheme.d.ts +12 -0
- package/dist/package/declarations/src/hooks/useTime.d.ts +13 -0
- package/dist/package/declarations/src/index.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutClassic/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutColumns/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutTransverse/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/LayoutVertical/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Footer/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/ToolBarLeft.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/ToolBarRight.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/AssemblySize.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/Avatar.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/Breadcrumb.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/CollapseIcon.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/Fullscreen.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/InfoDialog.vue.d.ts +5 -0
- package/dist/package/declarations/src/layouts/components/Header/components/PasswordDialog.vue.d.ts +5 -0
- package/dist/package/declarations/src/layouts/components/Header/components/SearchMenu.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Header/components/ThemeSetting.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Main/components/Maximize.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Main/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Menu/SubMenu.vue.d.ts +7 -0
- package/dist/package/declarations/src/layouts/components/Tabs/components/MoreButton.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/Tabs/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/components/ThemeDrawer/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/layouts/indexAsync.vue.d.ts +3 -0
- package/dist/package/declarations/src/modules/index.d.ts +117 -0
- package/dist/package/declarations/src/modules/kratosAdmin.d.ts +4 -0
- package/dist/package/declarations/src/navigation.d.ts +2 -0
- package/dist/package/declarations/src/request.d.ts +2 -0
- package/dist/package/declarations/src/routers/index.d.ts +21 -0
- package/dist/package/declarations/src/routers/modules/dynamicRouter.d.ts +4 -0
- package/dist/package/declarations/src/routers/modules/staticRouter.d.ts +25 -0
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +23 -0
- package/dist/package/declarations/src/rpc/base/v1/file.d.ts +52 -0
- package/dist/package/declarations/src/rpc/base/v1/login.d.ts +107 -0
- package/dist/package/declarations/src/rpc/base/v1/oauth.d.ts +167 -0
- package/dist/package/declarations/src/rpc/common/v1/common.d.ts +57 -0
- package/dist/package/declarations/src/rpc/common/v1/enum.d.ts +58 -0
- package/dist/package/declarations/src/rpc/common/v1/types.d.ts +60 -0
- package/dist/package/declarations/src/rpc/google/protobuf/empty.d.ts +11 -0
- package/dist/package/declarations/src/rpc/google/protobuf/wrappers.d.ts +108 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +156 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +215 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_tenant.d.ts +112 -0
- package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +67 -0
- package/dist/package/declarations/src/security.d.ts +3 -0
- package/dist/package/declarations/src/stores/helper/persist.d.ts +9 -0
- package/dist/package/declarations/src/stores/index.d.ts +2 -0
- package/dist/package/declarations/src/stores/interface/index.d.ts +90 -0
- package/dist/package/declarations/src/stores/modules/auth.d.ts +168 -0
- package/dist/package/declarations/src/stores/modules/config.d.ts +26 -0
- package/dist/package/declarations/src/stores/modules/dict.d.ts +32 -0
- package/dist/package/declarations/src/stores/modules/global.d.ts +4 -0
- package/dist/package/declarations/src/stores/modules/keepAlive.d.ts +6 -0
- package/dist/package/declarations/src/stores/modules/tabs.d.ts +13 -0
- package/dist/package/declarations/src/stores/modules/user.d.ts +29 -0
- package/dist/package/declarations/src/stores/runtime.d.ts +4 -0
- package/dist/package/declarations/src/styles/theme/aside.d.ts +4 -0
- package/dist/package/declarations/src/styles/theme/header.d.ts +4 -0
- package/dist/package/declarations/src/styles/theme/menu.d.ts +4 -0
- package/dist/package/declarations/src/table.d.ts +1 -0
- package/dist/package/declarations/src/tenant.d.ts +1 -0
- package/dist/package/declarations/src/utils/color.d.ts +28 -0
- package/dist/package/declarations/src/utils/dict.d.ts +15 -0
- package/dist/package/declarations/src/utils/eleValidate.d.ts +4 -0
- package/dist/package/declarations/src/utils/errorHandler.d.ts +5 -0
- package/dist/package/declarations/src/utils/index.d.ts +192 -0
- package/dist/package/declarations/src/utils/is/index.d.ts +72 -0
- package/dist/package/declarations/src/utils/mittBus.d.ts +2 -0
- package/dist/package/declarations/src/utils/oauthProvider.d.ts +19 -0
- package/dist/package/declarations/src/utils/passwordCrypto.d.ts +6 -0
- package/dist/package/declarations/src/utils/passwordStrength.d.ts +36 -0
- package/dist/package/declarations/src/utils/proTable.d.ts +44 -0
- package/dist/package/declarations/src/utils/request.d.ts +11 -0
- package/dist/package/declarations/src/utils/router.d.ts +14 -0
- package/dist/package/declarations/src/utils/svg.d.ts +4 -0
- package/dist/package/declarations/src/utils/tenant.d.ts +6 -0
- package/dist/package/declarations/src/utils/utils.d.ts +12 -0
- package/dist/package/declarations/src/views/error/403.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/error/404.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/error/500.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/error/pending.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/login/components/LoginForm.vue.d.ts +4 -0
- package/dist/package/declarations/src/views/login/index.vue.d.ts +3 -0
- package/dist/package/declarations/vite.config.d.ts +13 -0
- package/dist/package/src/App.vue +25 -0
- package/dist/package/src/api/base/config.ts +19 -0
- package/dist/package/src/api/base/file.ts +75 -0
- package/dist/package/src/api/base/login.ts +81 -0
- package/dist/package/src/api/base/oauth.ts +50 -0
- package/dist/package/src/api/system/auth.ts +45 -0
- package/dist/package/src/api/system/base_dict.ts +19 -0
- package/dist/package/src/api/system/base_tenant.ts +20 -0
- package/dist/package/src/assets/fonts/DIN.otf +0 -0
- package/dist/package/src/assets/fonts/MetroDF.ttf +0 -0
- package/dist/package/src/assets/fonts/YouSheBiaoTiHei.ttf +0 -0
- package/dist/package/src/assets/fonts/font.scss +14 -0
- package/dist/package/src/assets/iconfont/iconfont.scss +47 -0
- package/dist/package/src/assets/iconfont/iconfont.ttf +0 -0
- package/dist/package/src/assets/images/403.png +0 -0
- package/dist/package/src/assets/images/404.png +0 -0
- package/dist/package/src/assets/images/500.png +0 -0
- package/dist/package/src/assets/images/avatar.png +0 -0
- package/dist/package/src/assets/images/login_bg.svg +33 -0
- package/dist/package/src/assets/images/login_left.png +0 -0
- package/dist/package/src/assets/images/logo.svg +1 -0
- package/dist/package/src/assets/images/notData.png +0 -0
- package/dist/package/src/assets/images/oauth/dingtalk.png +0 -0
- package/dist/package/src/assets/images/oauth/feishu.png +0 -0
- package/dist/package/src/assets/images/oauth/gitee.png +0 -0
- package/dist/package/src/assets/images/oauth/github.png +0 -0
- package/dist/package/src/assets/images/oauth/google.png +0 -0
- package/dist/package/src/assets/images/oauth/wechat.png +0 -0
- package/dist/package/src/assets/images/oauth/wechatwork.png +0 -0
- package/dist/package/src/auth.ts +1 -0
- package/dist/package/src/bootstrap.ts +69 -0
- package/dist/package/src/components/Card/DataPanelCard.vue +67 -0
- package/dist/package/src/components/CronExpression/index.vue +713 -0
- package/dist/package/src/components/Dialog/FormDialog.vue +160 -0
- package/dist/package/src/components/Dialog/ProDialog.vue +96 -0
- package/dist/package/src/components/Dict/DictLabel.vue +62 -0
- package/dist/package/src/components/Dict/index.vue +157 -0
- package/dist/package/src/components/ECharts/config/index.ts +45 -0
- package/dist/package/src/components/ECharts/index.vue +108 -0
- package/dist/package/src/components/ErrorMessage/index.vue +63 -0
- package/dist/package/src/components/Grid/components/GridItem.vue +69 -0
- package/dist/package/src/components/Grid/index.vue +169 -0
- package/dist/package/src/components/Grid/interface/index.ts +8 -0
- package/dist/package/src/components/ImportExcel/index.scss +3 -0
- package/dist/package/src/components/ImportExcel/index.vue +150 -0
- package/dist/package/src/components/Loading/fullScreen.ts +45 -0
- package/dist/package/src/components/Loading/index.scss +67 -0
- package/dist/package/src/components/Loading/index.vue +13 -0
- package/dist/package/src/components/PasswordStrength/index.vue +127 -0
- package/dist/package/src/components/ProForm/components/DynamicList.vue +59 -0
- package/dist/package/src/components/ProForm/components/KvList.vue +73 -0
- package/dist/package/src/components/ProForm/components/ProFormItem.vue +191 -0
- package/dist/package/src/components/ProForm/index.vue +120 -0
- package/dist/package/src/components/ProForm/interface/index.ts +74 -0
- package/dist/package/src/components/ProTable/components/ColSetting.vue +45 -0
- package/dist/package/src/components/ProTable/components/Pagination.vue +58 -0
- package/dist/package/src/components/ProTable/components/TableColumn.vue +234 -0
- package/dist/package/src/components/ProTable/index.vue +567 -0
- package/dist/package/src/components/ProTable/interface/index.ts +223 -0
- package/dist/package/src/components/ProTable.ts +8 -0
- package/dist/package/src/components/SearchForm/components/SearchFormItem.vue +168 -0
- package/dist/package/src/components/SearchForm/index.vue +105 -0
- package/dist/package/src/components/SelectFilter/index.scss +63 -0
- package/dist/package/src/components/SelectFilter/index.vue +113 -0
- package/dist/package/src/components/SelectIcon/index.scss +39 -0
- package/dist/package/src/components/SelectIcon/index.vue +105 -0
- package/dist/package/src/components/SvgIcon/index.vue +35 -0
- package/dist/package/src/components/SwitchDark/index.vue +12 -0
- package/dist/package/src/components/TreeFilter/index.scss +44 -0
- package/dist/package/src/components/TreeFilter/index.vue +207 -0
- package/dist/package/src/components/Upload/File.vue +201 -0
- package/dist/package/src/components/Upload/Files.vue +234 -0
- package/dist/package/src/components/Upload/Img.vue +306 -0
- package/dist/package/src/components/Upload/Imgs.vue +320 -0
- package/dist/package/src/components/WangEditor/index.scss +28 -0
- package/dist/package/src/components/WangEditor/index.vue +154 -0
- package/dist/package/src/config/index.ts +19 -0
- package/dist/package/src/config/nprogress.ts +12 -0
- package/dist/package/src/directives/index.ts +28 -0
- package/dist/package/src/directives/modules/auth.ts +25 -0
- package/dist/package/src/directives/modules/copy.ts +39 -0
- package/dist/package/src/directives/modules/debounce.ts +32 -0
- package/dist/package/src/directives/modules/draggable.ts +50 -0
- package/dist/package/src/directives/modules/longpress.ts +49 -0
- package/dist/package/src/directives/modules/throttle.ts +42 -0
- package/dist/package/src/directives/modules/waterMarker.ts +36 -0
- package/dist/package/src/enums/httpEnum.ts +35 -0
- package/dist/package/src/format.ts +1 -0
- package/dist/package/src/hooks/interface/index.ts +38 -0
- package/dist/package/src/hooks/useAuthButtons.ts +25 -0
- package/dist/package/src/hooks/useDownload.ts +44 -0
- package/dist/package/src/hooks/useHandleData.ts +38 -0
- package/dist/package/src/hooks/useOnline.ts +27 -0
- package/dist/package/src/hooks/useSelection.ts +34 -0
- package/dist/package/src/hooks/useTable.ts +151 -0
- package/dist/package/src/hooks/useTheme.ts +111 -0
- package/dist/package/src/hooks/useTime.ts +38 -0
- package/dist/package/src/index.ts +9 -0
- package/dist/package/src/layouts/LayoutClassic/index.scss +60 -0
- package/dist/package/src/layouts/LayoutClassic/index.vue +64 -0
- package/dist/package/src/layouts/LayoutColumns/index.scss +95 -0
- package/dist/package/src/layouts/LayoutColumns/index.vue +113 -0
- package/dist/package/src/layouts/LayoutTransverse/index.scss +60 -0
- package/dist/package/src/layouts/LayoutTransverse/index.vue +70 -0
- package/dist/package/src/layouts/LayoutVertical/index.scss +70 -0
- package/dist/package/src/layouts/LayoutVertical/index.vue +119 -0
- package/dist/package/src/layouts/components/Footer/index.scss +11 -0
- package/dist/package/src/layouts/components/Footer/index.vue +21 -0
- package/dist/package/src/layouts/components/Header/ToolBarLeft.vue +23 -0
- package/dist/package/src/layouts/components/Header/ToolBarRight.vue +44 -0
- package/dist/package/src/layouts/components/Header/components/AssemblySize.vue +39 -0
- package/dist/package/src/layouts/components/Header/components/Avatar.vue +226 -0
- package/dist/package/src/layouts/components/Header/components/Breadcrumb.vue +117 -0
- package/dist/package/src/layouts/components/Header/components/CollapseIcon.vue +21 -0
- package/dist/package/src/layouts/components/Header/components/Fullscreen.vue +28 -0
- package/dist/package/src/layouts/components/Header/components/InfoDialog.vue +22 -0
- package/dist/package/src/layouts/components/Header/components/PasswordDialog.vue +22 -0
- package/dist/package/src/layouts/components/Header/components/SearchMenu.vue +207 -0
- package/dist/package/src/layouts/components/Header/components/ThemeSetting.vue +14 -0
- package/dist/package/src/layouts/components/Main/components/Maximize.vue +39 -0
- package/dist/package/src/layouts/components/Main/index.scss +14 -0
- package/dist/package/src/layouts/components/Main/index.vue +90 -0
- package/dist/package/src/layouts/components/Menu/SubMenu.vue +132 -0
- package/dist/package/src/layouts/components/Tabs/components/MoreButton.vue +83 -0
- package/dist/package/src/layouts/components/Tabs/index.scss +69 -0
- package/dist/package/src/layouts/components/Tabs/index.vue +111 -0
- package/dist/package/src/layouts/components/ThemeDrawer/index.scss +137 -0
- package/dist/package/src/layouts/components/ThemeDrawer/index.vue +191 -0
- package/dist/package/src/layouts/index.vue +50 -0
- package/dist/package/src/layouts/indexAsync.vue +54 -0
- package/dist/package/src/modules/index.ts +233 -0
- package/dist/package/src/modules/kratosAdmin.ts +17 -0
- package/dist/package/src/navigation.ts +2 -0
- package/dist/package/src/request.ts +2 -0
- package/dist/package/src/routers/index.ts +143 -0
- package/dist/package/src/routers/modules/dynamicRouter.ts +160 -0
- package/dist/package/src/routers/modules/staticRouter.ts +73 -0
- package/dist/package/src/rpc/base/v1/config.ts +34 -0
- package/dist/package/src/rpc/base/v1/file.ts +66 -0
- package/dist/package/src/rpc/base/v1/login.ts +128 -0
- package/dist/package/src/rpc/base/v1/oauth.ts +199 -0
- package/dist/package/src/rpc/common/v1/common.ts +71 -0
- package/dist/package/src/rpc/common/v1/enum.ts +71 -0
- package/dist/package/src/rpc/common/v1/types.ts +77 -0
- package/dist/package/src/rpc/google/protobuf/empty.ts +19 -0
- package/dist/package/src/rpc/google/protobuf/wrappers.ts +124 -0
- package/dist/package/src/rpc/system/admin/v1/auth.ts +208 -0
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +249 -0
- package/dist/package/src/rpc/system/admin/v1/base_tenant.ts +134 -0
- package/dist/package/src/rpc/system/common/v1/enum.ts +80 -0
- package/dist/package/src/security.ts +3 -0
- package/dist/package/src/stores/helper/persist.ts +19 -0
- package/dist/package/src/stores/index.ts +8 -0
- package/dist/package/src/stores/interface/index.ts +102 -0
- package/dist/package/src/stores/modules/auth.ts +73 -0
- package/dist/package/src/stores/modules/config.ts +119 -0
- package/dist/package/src/stores/modules/dict.ts +65 -0
- package/dist/package/src/stores/modules/global.ts +54 -0
- package/dist/package/src/stores/modules/keepAlive.ts +22 -0
- package/dist/package/src/stores/modules/tabs.ts +77 -0
- package/dist/package/src/stores/modules/user.ts +109 -0
- package/dist/package/src/stores/runtime.ts +4 -0
- package/dist/package/src/styles/common.scss +144 -0
- package/dist/package/src/styles/element-dark.scss +46 -0
- package/dist/package/src/styles/element.scss +333 -0
- package/dist/package/src/styles/reset.scss +143 -0
- package/dist/package/src/styles/theme/aside.ts +16 -0
- package/dist/package/src/styles/theme/header.ts +25 -0
- package/dist/package/src/styles/theme/menu.ts +31 -0
- package/dist/package/src/styles/var.scss +2 -0
- package/dist/package/src/table.ts +1 -0
- package/dist/package/src/tenant.ts +1 -0
- package/dist/package/src/typings/global.d.ts +74 -0
- package/dist/package/src/typings/utils.d.ts +17 -0
- package/dist/package/src/typings/window.d.ts +8 -0
- package/dist/package/src/utils/color.ts +59 -0
- package/dist/package/src/utils/dict.ts +17 -0
- package/dist/package/src/utils/eleValidate.ts +14 -0
- package/dist/package/src/utils/errorHandler.ts +27 -0
- package/dist/package/src/utils/index.ts +403 -0
- package/dist/package/src/utils/is/index.ts +125 -0
- package/dist/package/src/utils/mittBus.ts +5 -0
- package/dist/package/src/utils/oauthProvider.ts +79 -0
- package/dist/package/src/utils/passwordCrypto.ts +71 -0
- package/dist/package/src/utils/passwordStrength.ts +86 -0
- package/dist/package/src/utils/proTable.ts +124 -0
- package/dist/package/src/utils/request.ts +296 -0
- package/dist/package/src/utils/router.ts +43 -0
- package/dist/package/src/utils/svg.ts +13 -0
- package/dist/package/src/utils/tenant.ts +10 -0
- package/dist/package/src/utils/utils.ts +40 -0
- package/dist/package/src/views/error/403.vue +8 -0
- package/dist/package/src/views/error/404.vue +8 -0
- package/dist/package/src/views/error/500.vue +8 -0
- package/dist/package/src/views/error/pending.vue +16 -0
- package/dist/package/src/views/login/components/LoginForm.vue +797 -0
- package/dist/package/src/views/login/index.scss +103 -0
- package/dist/package/src/views/login/index.vue +108 -0
- package/dist/package/src/vite-env.d.ts +3 -0
- package/dist/package/types/generated/auto-imports.d.ts +124 -0
- package/dist/package/types/generated/components.d.ts +151 -0
- package/package.json +199 -0
- package/tsconfig.json +21 -0
- package/types/generated/auto-imports.d.ts +124 -0
- package/types/generated/components.d.ts +151 -0
- package/vite.config.ts +239 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: system/common/v1/enum.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
/** 系统配置类型 */
|
|
10
|
+
export enum BaseConfigType {
|
|
11
|
+
UNKNOWN_BCT = 0,
|
|
12
|
+
/** TEXT - 文本 */
|
|
13
|
+
TEXT = 1,
|
|
14
|
+
/** IMAGE - 图片 */
|
|
15
|
+
IMAGE = 2,
|
|
16
|
+
/** RICH_TEXT - 富文本 */
|
|
17
|
+
RICH_TEXT = 3,
|
|
18
|
+
/** DICT - 字典 */
|
|
19
|
+
DICT = 4,
|
|
20
|
+
/** BOOLEAN - 布尔 */
|
|
21
|
+
BOOLEAN = 5,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 定时任务日志状态 */
|
|
25
|
+
export enum BaseJobLogStatus {
|
|
26
|
+
UNKNOWN_BJLS = 0,
|
|
27
|
+
/** SUCCESS - 成功 */
|
|
28
|
+
SUCCESS = 1,
|
|
29
|
+
/** FAIL - 失败 */
|
|
30
|
+
FAIL = 2,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 菜单类型 */
|
|
34
|
+
export enum BaseMenuType {
|
|
35
|
+
UNKNOWN_MT = 0,
|
|
36
|
+
/** FOLDER - 目录 */
|
|
37
|
+
FOLDER = 1,
|
|
38
|
+
/** MENU - 菜单 */
|
|
39
|
+
MENU = 2,
|
|
40
|
+
/** BUTTON - 按钮 */
|
|
41
|
+
BUTTON = 3,
|
|
42
|
+
/** EXT_LINK - 外部链接 */
|
|
43
|
+
EXT_LINK = 4,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** 角色数据范围 */
|
|
47
|
+
export enum BaseRoleDataScope {
|
|
48
|
+
UNKNOWN_RDS = 0,
|
|
49
|
+
/** ALL - 全部数据 */
|
|
50
|
+
ALL = 1,
|
|
51
|
+
/** DEPT_AND_CHILDREN - 部门及子部门数据 */
|
|
52
|
+
DEPT_AND_CHILDREN = 2,
|
|
53
|
+
/** SELF_DEPT - 本部门数据 */
|
|
54
|
+
SELF_DEPT = 3,
|
|
55
|
+
/** SELF_USER - 本人数据 */
|
|
56
|
+
SELF_USER = 4,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** 用户性别 */
|
|
60
|
+
export enum BaseUserGender {
|
|
61
|
+
UNKNOWN_BUG = 0,
|
|
62
|
+
/** SECRET - 保密 */
|
|
63
|
+
SECRET = 1,
|
|
64
|
+
/** BOY - 男 */
|
|
65
|
+
BOY = 2,
|
|
66
|
+
/** GIRL - 禁用 */
|
|
67
|
+
GIRL = 3,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 代码生成表状态 */
|
|
71
|
+
export enum CodeGenTableStatus {
|
|
72
|
+
/** UNKNOWN_CGTS - 未指定 */
|
|
73
|
+
UNKNOWN_CGTS = 0,
|
|
74
|
+
/** DRAFT_CGTS - 草稿 */
|
|
75
|
+
DRAFT_CGTS = 1,
|
|
76
|
+
/** GENERATED_CGTS - 已生成 */
|
|
77
|
+
GENERATED_CGTS = 2,
|
|
78
|
+
/** DISABLED_CGTS - 停用 */
|
|
79
|
+
DISABLED_CGTS = 3,
|
|
80
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PersistenceOptions } from "pinia-plugin-persistedstate";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description pinia 持久化参数配置
|
|
5
|
+
* @param {String} key 存储到持久化的 name
|
|
6
|
+
* @param {Array} paths 需要持久化的 state name
|
|
7
|
+
* @return persist
|
|
8
|
+
* */
|
|
9
|
+
const piniaPersistConfig = (key: string, paths?: string[]) => {
|
|
10
|
+
const persist: PersistenceOptions = {
|
|
11
|
+
key,
|
|
12
|
+
storage: localStorage,
|
|
13
|
+
// storage: sessionStorage,
|
|
14
|
+
pick: paths
|
|
15
|
+
};
|
|
16
|
+
return persist;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default piniaPersistConfig;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { RouteItem, UserInfoForm } from "../../rpc/system/admin/v1/auth";
|
|
2
|
+
import type { OptionBaseDictResponse_BaseDictItem } from "../../rpc/system/admin/v1/base_dict";
|
|
3
|
+
|
|
4
|
+
/** 后台整体布局模式。 */
|
|
5
|
+
export type LayoutType = "vertical" | "classic" | "transverse" | "columns";
|
|
6
|
+
|
|
7
|
+
/** Element Plus 组件默认尺寸。 */
|
|
8
|
+
export type AssemblySizeType = "large" | "default" | "small";
|
|
9
|
+
|
|
10
|
+
/** 站点展示配置 */
|
|
11
|
+
export interface SiteDisplayConfig {
|
|
12
|
+
/** 项目名称 */
|
|
13
|
+
sysName: string;
|
|
14
|
+
/** ICP 备案号 */
|
|
15
|
+
icp: string;
|
|
16
|
+
/** 版权文案 */
|
|
17
|
+
copyright: string;
|
|
18
|
+
/** 页面水印文案 */
|
|
19
|
+
watermark: string;
|
|
20
|
+
/** 管理端 Logo 地址 */
|
|
21
|
+
adminLogo: string;
|
|
22
|
+
/** 登录页左侧背景图地址 */
|
|
23
|
+
background: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 登录验证码配置 */
|
|
27
|
+
export interface LoginCaptchaConfig {
|
|
28
|
+
/** 验证码类型 */
|
|
29
|
+
type: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 全局 UI 偏好和布局状态。 */
|
|
33
|
+
export interface GlobalState {
|
|
34
|
+
layout: LayoutType;
|
|
35
|
+
assemblySize: AssemblySizeType;
|
|
36
|
+
maximize: boolean;
|
|
37
|
+
primary: string;
|
|
38
|
+
isDark: boolean;
|
|
39
|
+
isGrey: boolean;
|
|
40
|
+
isWeak: boolean;
|
|
41
|
+
asideInverted: boolean;
|
|
42
|
+
headerInverted: boolean;
|
|
43
|
+
isCollapse: boolean;
|
|
44
|
+
accordion: boolean;
|
|
45
|
+
watermark: boolean;
|
|
46
|
+
breadcrumb: boolean;
|
|
47
|
+
breadcrumbIcon: boolean;
|
|
48
|
+
tabs: boolean;
|
|
49
|
+
tabsIcon: boolean;
|
|
50
|
+
footer: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 当前登录用户认证状态。 */
|
|
54
|
+
export interface UserState {
|
|
55
|
+
token: string;
|
|
56
|
+
refreshToken: string;
|
|
57
|
+
tokenType: string;
|
|
58
|
+
tokenExpiresAt: number;
|
|
59
|
+
userInfo: UserInfoForm;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 标签页菜单项状态。 */
|
|
63
|
+
export interface TabsMenuProps {
|
|
64
|
+
icon: string;
|
|
65
|
+
title: string;
|
|
66
|
+
path: string;
|
|
67
|
+
name: string;
|
|
68
|
+
close: boolean;
|
|
69
|
+
isKeepAlive: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** 多标签页状态。 */
|
|
73
|
+
export interface TabsState {
|
|
74
|
+
tabsMenuList: TabsMenuProps[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** 动态路由和按钮权限状态。 */
|
|
78
|
+
export interface AuthState {
|
|
79
|
+
routeName: string;
|
|
80
|
+
authButtonList: {
|
|
81
|
+
[key: string]: string[];
|
|
82
|
+
};
|
|
83
|
+
authMenuList: RouteItem[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** 需要缓存的页面组件名称状态。 */
|
|
87
|
+
export interface KeepAliveState {
|
|
88
|
+
keepAliveName: string[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** 全局字典缓存状态。 */
|
|
92
|
+
export interface DictState {
|
|
93
|
+
dictionary: Record<string, OptionBaseDictResponse_BaseDictItem[]>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 站点配置状态 */
|
|
97
|
+
export interface SiteConfigState {
|
|
98
|
+
/** 当前站点展示配置 */
|
|
99
|
+
display: SiteDisplayConfig;
|
|
100
|
+
/** 当前登录验证码配置 */
|
|
101
|
+
captcha: LoginCaptchaConfig;
|
|
102
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { defAuthService } from "../../api/system/auth";
|
|
3
|
+
import { AuthState } from "../../stores/interface";
|
|
4
|
+
import { getFlatMenuList, getShowMenuList, getAllBreadcrumbList, isExternalPath } from "../../utils";
|
|
5
|
+
import type { RouteItem } from "../../rpc/system/admin/v1/auth";
|
|
6
|
+
|
|
7
|
+
const GLOBAL_AUTH_BUTTON_KEY = "__global__";
|
|
8
|
+
|
|
9
|
+
/** 规范化路由路径,统一转换为绝对路径。 */
|
|
10
|
+
function normalizeRoutePath(path?: string, parentPath = "") {
|
|
11
|
+
if (!path) return "";
|
|
12
|
+
if (path === "/") return "/";
|
|
13
|
+
if (isExternalPath(path)) return path;
|
|
14
|
+
if (path.startsWith("/")) return path;
|
|
15
|
+
|
|
16
|
+
const normalizedParentPath = parentPath && parentPath !== "/" ? parentPath.replace(/\/+$/, "") : "";
|
|
17
|
+
const normalizedCurrentPath = path.replace(/^\/+/, "");
|
|
18
|
+
const pathSegments = [normalizedParentPath.replace(/^\/+/, ""), normalizedCurrentPath].filter(Boolean);
|
|
19
|
+
return `/${pathSegments.join("/")}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 递归规范化菜单树,避免菜单点击时发生相对路径拼接。 */
|
|
23
|
+
function normalizeRouteTree(menuList: RouteItem[], parentPath = ""): RouteItem[] {
|
|
24
|
+
return menuList.map(item => {
|
|
25
|
+
const currentPath = normalizeRoutePath(item.path, parentPath);
|
|
26
|
+
return {
|
|
27
|
+
...item,
|
|
28
|
+
path: currentPath,
|
|
29
|
+
children: normalizeRouteTree(item.children ?? [], currentPath)
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const useAuthStore = defineStore("admin-auth", {
|
|
35
|
+
state: (): AuthState => ({
|
|
36
|
+
// 按钮权限列表
|
|
37
|
+
authButtonList: {},
|
|
38
|
+
// 菜单权限列表
|
|
39
|
+
authMenuList: [],
|
|
40
|
+
// 当前页面的 router name,用来做按钮权限筛选
|
|
41
|
+
routeName: ""
|
|
42
|
+
}),
|
|
43
|
+
getters: {
|
|
44
|
+
// 按钮权限列表
|
|
45
|
+
authButtonListGet: state => state.authButtonList,
|
|
46
|
+
// 菜单权限列表 ==> 这里的菜单没有经过任何处理
|
|
47
|
+
authMenuListGet: state => state.authMenuList,
|
|
48
|
+
// 菜单权限列表 ==> 左侧菜单栏渲染,需要剔除 hide == true
|
|
49
|
+
showMenuListGet: state => getShowMenuList(state.authMenuList),
|
|
50
|
+
// 菜单权限列表 ==> 扁平化之后的一维数组菜单,主要用来添加动态路由
|
|
51
|
+
flatMenuListGet: state => getFlatMenuList(state.authMenuList),
|
|
52
|
+
// 递归处理后的所有面包屑导航列表
|
|
53
|
+
breadcrumbListGet: state => getAllBreadcrumbList(state.authMenuList)
|
|
54
|
+
},
|
|
55
|
+
actions: {
|
|
56
|
+
/** 获取按钮权限列表 */
|
|
57
|
+
async getAuthButtonList() {
|
|
58
|
+
const data = await defAuthService.ListUserButton({});
|
|
59
|
+
this.authButtonList = {
|
|
60
|
+
[GLOBAL_AUTH_BUTTON_KEY]: data.value ?? []
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
/** 获取菜单权限列表 */
|
|
64
|
+
async getAuthMenuList() {
|
|
65
|
+
const data = await defAuthService.TreeUserMenu({});
|
|
66
|
+
this.authMenuList = normalizeRouteTree(data.routes ?? []);
|
|
67
|
+
},
|
|
68
|
+
/** 设置当前路由名称 */
|
|
69
|
+
async setRouteName(name: string) {
|
|
70
|
+
this.routeName = name;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { defConfigService } from "../../api/base/config";
|
|
3
|
+
import { BaseConfigSite } from "../../rpc/common/v1/enum";
|
|
4
|
+
import type { LoginCaptchaConfig, SiteConfigState, SiteDisplayConfig } from "../../stores/interface";
|
|
5
|
+
import defaultLogoUrl from "../../assets/images/logo.svg";
|
|
6
|
+
import defaultBackgroundUrl from "../../assets/images/login_left.png";
|
|
7
|
+
|
|
8
|
+
const CAPTCHA_TYPE_KEY = "captchaType";
|
|
9
|
+
|
|
10
|
+
const DEFAULT_SITE_DISPLAY_CONFIG: SiteDisplayConfig = {
|
|
11
|
+
sysName: "Admin",
|
|
12
|
+
icp: "",
|
|
13
|
+
copyright: "2026 © Admin",
|
|
14
|
+
watermark: "Admin",
|
|
15
|
+
adminLogo: defaultLogoUrl,
|
|
16
|
+
background: defaultBackgroundUrl
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const DEFAULT_LOGIN_CAPTCHA_CONFIG: LoginCaptchaConfig = {
|
|
20
|
+
type: "digit"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 合并站点展示配置,忽略空字符串配置,避免后端返回空值覆盖默认值。
|
|
25
|
+
*/
|
|
26
|
+
function mergeSiteDisplayConfig(
|
|
27
|
+
currentDisplayConfig: SiteDisplayConfig,
|
|
28
|
+
nextDisplayConfig: Partial<SiteDisplayConfig>
|
|
29
|
+
): SiteDisplayConfig {
|
|
30
|
+
const mergedDisplayConfig = { ...currentDisplayConfig };
|
|
31
|
+
|
|
32
|
+
Object.entries(nextDisplayConfig).forEach(([key, value]) => {
|
|
33
|
+
if (typeof value !== "string") return;
|
|
34
|
+
if (!value.trim()) return;
|
|
35
|
+
mergedDisplayConfig[key as keyof SiteDisplayConfig] = value;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return mergedDisplayConfig;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 将服务端配置项转换为站点展示配置字段。
|
|
43
|
+
*/
|
|
44
|
+
function normalizeSiteDisplayConfig(configMap: Record<string, string>) {
|
|
45
|
+
return {
|
|
46
|
+
sysName: configMap.sysName,
|
|
47
|
+
icp: configMap.icp,
|
|
48
|
+
copyright: configMap.copyright,
|
|
49
|
+
watermark: configMap.watermark,
|
|
50
|
+
adminLogo: configMap.adminLogo,
|
|
51
|
+
background: configMap.background
|
|
52
|
+
} satisfies Partial<SiteDisplayConfig>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 将服务端配置项转换为登录验证码配置字段。
|
|
57
|
+
*/
|
|
58
|
+
function normalizeLoginCaptchaConfig(configMap: Record<string, string>) {
|
|
59
|
+
return {
|
|
60
|
+
type: configMap[CAPTCHA_TYPE_KEY]
|
|
61
|
+
} satisfies Partial<LoginCaptchaConfig>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 将公共配置列表转换为便于读取的键值映射。
|
|
66
|
+
*/
|
|
67
|
+
function buildConfigMap(configs: Array<{ key?: string; value?: string }>) {
|
|
68
|
+
const configMap: Record<string, string> = {};
|
|
69
|
+
configs.forEach(configItem => {
|
|
70
|
+
if (!configItem.key) return;
|
|
71
|
+
configMap[configItem.key] = configItem.value ?? "";
|
|
72
|
+
});
|
|
73
|
+
return configMap;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const useConfigStore = defineStore("admin-config", {
|
|
77
|
+
state: (): SiteConfigState => ({
|
|
78
|
+
display: { ...DEFAULT_SITE_DISPLAY_CONFIG },
|
|
79
|
+
captcha: { ...DEFAULT_LOGIN_CAPTCHA_CONFIG }
|
|
80
|
+
}),
|
|
81
|
+
getters: {},
|
|
82
|
+
actions: {
|
|
83
|
+
/**
|
|
84
|
+
* 设置站点展示配置。
|
|
85
|
+
*/
|
|
86
|
+
setDisplayConfig(nextDisplayConfig: Partial<SiteDisplayConfig>) {
|
|
87
|
+
this.display = mergeSiteDisplayConfig(this.display, nextDisplayConfig);
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* 设置登录验证码配置。
|
|
91
|
+
*/
|
|
92
|
+
setLoginCaptchaConfig(nextCaptchaConfig: Partial<LoginCaptchaConfig>) {
|
|
93
|
+
this.captcha = {
|
|
94
|
+
...this.captcha,
|
|
95
|
+
...Object.fromEntries(Object.entries(nextCaptchaConfig).filter(([, value]) => typeof value === "string" && value))
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* 重置为默认站点展示配置。
|
|
100
|
+
*/
|
|
101
|
+
resetDisplayConfig() {
|
|
102
|
+
this.display = { ...DEFAULT_SITE_DISPLAY_CONFIG };
|
|
103
|
+
this.captcha = { ...DEFAULT_LOGIN_CAPTCHA_CONFIG };
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* 加载管理端站点配置,并以服务端返回值覆盖本地默认值。
|
|
107
|
+
*/
|
|
108
|
+
async loadDisplayConfig() {
|
|
109
|
+
const configResponse = await defConfigService.GetConfig({
|
|
110
|
+
site: BaseConfigSite.ADMIN
|
|
111
|
+
});
|
|
112
|
+
const configMap = buildConfigMap(configResponse.configs ?? []);
|
|
113
|
+
|
|
114
|
+
this.setDisplayConfig(normalizeSiteDisplayConfig(configMap));
|
|
115
|
+
this.setLoginCaptchaConfig(normalizeLoginCaptchaConfig(configMap));
|
|
116
|
+
return this.display;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import pinia from "../../stores";
|
|
3
|
+
import { defBaseDictService } from "../../api/system/base_dict";
|
|
4
|
+
import type { DictState } from "../../stores/interface";
|
|
5
|
+
import piniaPersistConfig from "../../stores/helper/persist";
|
|
6
|
+
import type { OptionBaseDictResponse_BaseDict, OptionBaseDictResponse_BaseDictItem } from "../../rpc/system/admin/v1/base_dict";
|
|
7
|
+
|
|
8
|
+
export const useDictStore = defineStore("admin-dict", {
|
|
9
|
+
state: (): DictState => ({
|
|
10
|
+
dictionary: {}
|
|
11
|
+
}),
|
|
12
|
+
getters: {},
|
|
13
|
+
actions: {
|
|
14
|
+
/** 设置单个字典缓存 */
|
|
15
|
+
setDictionary(dict: OptionBaseDictResponse_BaseDict) {
|
|
16
|
+
if (!dict.code) return;
|
|
17
|
+
this.dictionary[dict.code] = dict.items ?? [];
|
|
18
|
+
},
|
|
19
|
+
/** 从服务端加载全部字典缓存 */
|
|
20
|
+
async loadDictionaries(forceRefresh = false) {
|
|
21
|
+
if (!forceRefresh && Object.keys(this.dictionary).length) return this.dictionary;
|
|
22
|
+
|
|
23
|
+
const dictRes = await defBaseDictService.OptionBaseDict({});
|
|
24
|
+
const nextDictionary: Record<string, OptionBaseDictResponse_BaseDictItem[]> = {};
|
|
25
|
+
|
|
26
|
+
const baseDicts = dictRes.base_dicts ?? [];
|
|
27
|
+
baseDicts.forEach(dict => {
|
|
28
|
+
if (!dict.code) return;
|
|
29
|
+
nextDictionary[dict.code] = dict.items ?? [];
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
this.dictionary = nextDictionary;
|
|
33
|
+
return this.dictionary;
|
|
34
|
+
},
|
|
35
|
+
/** 获取指定字典缓存 */
|
|
36
|
+
getDictionary(dictCode: string): OptionBaseDictResponse_BaseDictItem[] {
|
|
37
|
+
return this.dictionary[dictCode] ?? [];
|
|
38
|
+
},
|
|
39
|
+
/** 确保指定字典编码已加载,避免持久化旧缓存缺少新增字典时下拉为空 */
|
|
40
|
+
async ensureDictionary(dictCode: string) {
|
|
41
|
+
const cachedDict = this.getDictionary(dictCode);
|
|
42
|
+
if (cachedDict.length) return cachedDict;
|
|
43
|
+
|
|
44
|
+
await this.loadDictionaries(true);
|
|
45
|
+
return this.getDictionary(dictCode);
|
|
46
|
+
},
|
|
47
|
+
/** 清空字典缓存 */
|
|
48
|
+
clearDictionaryCache() {
|
|
49
|
+
this.dictionary = {};
|
|
50
|
+
},
|
|
51
|
+
/** 强制刷新字典缓存 */
|
|
52
|
+
async updateDictionaryCache() {
|
|
53
|
+
this.clearDictionaryCache();
|
|
54
|
+
await this.loadDictionaries(true);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
persist: piniaPersistConfig("admin-dict")
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 在非 setup 场景使用 Dict Store。
|
|
62
|
+
*/
|
|
63
|
+
export function useDictStoreHook() {
|
|
64
|
+
return useDictStore(pinia);
|
|
65
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { GlobalState } from "../../stores/interface";
|
|
3
|
+
import { DEFAULT_PRIMARY } from "../../config";
|
|
4
|
+
import piniaPersistConfig from "../../stores/helper/persist";
|
|
5
|
+
|
|
6
|
+
export const useGlobalStore = defineStore("admin-global", {
|
|
7
|
+
// 修改默认值之后,需清除 localStorage 数据
|
|
8
|
+
state: (): GlobalState => ({
|
|
9
|
+
// 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns)
|
|
10
|
+
layout: "vertical",
|
|
11
|
+
// element 组件大小
|
|
12
|
+
assemblySize: "default",
|
|
13
|
+
// 当前页面是否全屏
|
|
14
|
+
maximize: false,
|
|
15
|
+
// 主题颜色
|
|
16
|
+
primary: DEFAULT_PRIMARY,
|
|
17
|
+
// 深色模式
|
|
18
|
+
isDark: false,
|
|
19
|
+
// 灰色模式
|
|
20
|
+
isGrey: false,
|
|
21
|
+
// 色弱模式
|
|
22
|
+
isWeak: false,
|
|
23
|
+
// 侧边栏反转
|
|
24
|
+
asideInverted: false,
|
|
25
|
+
// 头部反转
|
|
26
|
+
headerInverted: false,
|
|
27
|
+
// 折叠菜单
|
|
28
|
+
isCollapse: false,
|
|
29
|
+
// 菜单手风琴
|
|
30
|
+
accordion: true,
|
|
31
|
+
// 页面水印
|
|
32
|
+
watermark: false,
|
|
33
|
+
// 面包屑导航
|
|
34
|
+
breadcrumb: true,
|
|
35
|
+
// 面包屑导航图标
|
|
36
|
+
breadcrumbIcon: true,
|
|
37
|
+
// 标签页
|
|
38
|
+
tabs: true,
|
|
39
|
+
// 标签页图标
|
|
40
|
+
tabsIcon: true,
|
|
41
|
+
// 页脚
|
|
42
|
+
footer: true
|
|
43
|
+
}),
|
|
44
|
+
getters: {},
|
|
45
|
+
actions: {
|
|
46
|
+
// Set GlobalState
|
|
47
|
+
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
|
48
|
+
this.$patch(state => {
|
|
49
|
+
state[args[0]] = args[1];
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
persist: piniaPersistConfig("admin-global")
|
|
54
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { KeepAliveState } from "../../stores/interface";
|
|
3
|
+
|
|
4
|
+
export const useKeepAliveStore = defineStore("admin-keepAlive", {
|
|
5
|
+
state: (): KeepAliveState => ({
|
|
6
|
+
keepAliveName: []
|
|
7
|
+
}),
|
|
8
|
+
actions: {
|
|
9
|
+
// Add KeepAliveName
|
|
10
|
+
async addKeepAliveName(name: string) {
|
|
11
|
+
!this.keepAliveName.includes(name) && this.keepAliveName.push(name);
|
|
12
|
+
},
|
|
13
|
+
// Remove KeepAliveName
|
|
14
|
+
async removeKeepAliveName(name: string) {
|
|
15
|
+
this.keepAliveName = this.keepAliveName.filter(item => item !== name);
|
|
16
|
+
},
|
|
17
|
+
// Set KeepAliveName
|
|
18
|
+
async setKeepAliveName(keepAliveName: string[] = []) {
|
|
19
|
+
this.keepAliveName = keepAliveName;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import router from "../../routers";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
import { getUrlWithParams } from "../../utils";
|
|
4
|
+
import { useKeepAliveStore } from "./keepAlive";
|
|
5
|
+
import { TabsState, TabsMenuProps } from "../../stores/interface";
|
|
6
|
+
import piniaPersistConfig from "../../stores/helper/persist";
|
|
7
|
+
|
|
8
|
+
export const useTabsStore = defineStore("admin-tabs", {
|
|
9
|
+
state: (): TabsState => ({
|
|
10
|
+
tabsMenuList: []
|
|
11
|
+
}),
|
|
12
|
+
actions: {
|
|
13
|
+
/** 添加页签并同步 KeepAlive。 */
|
|
14
|
+
async addTabs(tabItem: TabsMenuProps) {
|
|
15
|
+
const keepAliveStore = useKeepAliveStore();
|
|
16
|
+
if (this.tabsMenuList.every(item => item.path !== tabItem.path)) {
|
|
17
|
+
this.tabsMenuList.push(tabItem);
|
|
18
|
+
}
|
|
19
|
+
// add keepalive
|
|
20
|
+
if (!keepAliveStore.keepAliveName.includes(tabItem.name) && tabItem.isKeepAlive) {
|
|
21
|
+
keepAliveStore.addKeepAliveName(tabItem.path);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
/** 删除页签并同步 KeepAlive。 */
|
|
25
|
+
async removeTabs(tabPath: string, isCurrent: boolean = true) {
|
|
26
|
+
const keepAliveStore = useKeepAliveStore();
|
|
27
|
+
if (isCurrent) {
|
|
28
|
+
this.tabsMenuList.forEach((item, index) => {
|
|
29
|
+
if (item.path !== tabPath) return;
|
|
30
|
+
const nextTab = this.tabsMenuList[index + 1] || this.tabsMenuList[index - 1];
|
|
31
|
+
if (!nextTab) return;
|
|
32
|
+
router.push(nextTab.path);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// remove keepalive
|
|
36
|
+
const tabItem = this.tabsMenuList.find(item => item.path === tabPath);
|
|
37
|
+
tabItem?.isKeepAlive && keepAliveStore.removeKeepAliveName(tabItem.path);
|
|
38
|
+
// set tabs
|
|
39
|
+
this.tabsMenuList = this.tabsMenuList.filter(item => item.path !== tabPath);
|
|
40
|
+
},
|
|
41
|
+
/** 关闭指定页签一侧的其他页签。 */
|
|
42
|
+
async closeTabsOnSide(path: string, type: "left" | "right") {
|
|
43
|
+
const keepAliveStore = useKeepAliveStore();
|
|
44
|
+
const currentIndex = this.tabsMenuList.findIndex(item => item.path === path);
|
|
45
|
+
if (currentIndex !== -1) {
|
|
46
|
+
const range = type === "left" ? [0, currentIndex] : [currentIndex + 1, this.tabsMenuList.length];
|
|
47
|
+
this.tabsMenuList = this.tabsMenuList.filter((item, index) => {
|
|
48
|
+
return index < range[0] || index >= range[1] || !item.close;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// set keepalive
|
|
52
|
+
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
|
|
53
|
+
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.path));
|
|
54
|
+
},
|
|
55
|
+
/** 关闭除指定页签和固定页签外的其他页签。 */
|
|
56
|
+
async closeMultipleTab(tabsMenuValue?: string) {
|
|
57
|
+
const keepAliveStore = useKeepAliveStore();
|
|
58
|
+
this.tabsMenuList = this.tabsMenuList.filter(item => {
|
|
59
|
+
return item.path === tabsMenuValue || !item.close;
|
|
60
|
+
});
|
|
61
|
+
// set keepalive
|
|
62
|
+
const KeepAliveList = this.tabsMenuList.filter(item => item.isKeepAlive);
|
|
63
|
+
keepAliveStore.setKeepAliveName(KeepAliveList.map(item => item.path));
|
|
64
|
+
},
|
|
65
|
+
// Set Tabs
|
|
66
|
+
async setTabs(tabsMenuList: TabsMenuProps[]) {
|
|
67
|
+
this.tabsMenuList = tabsMenuList;
|
|
68
|
+
},
|
|
69
|
+
// Set Tabs Title
|
|
70
|
+
async setTabsTitle(title: string) {
|
|
71
|
+
this.tabsMenuList.forEach(item => {
|
|
72
|
+
if (item.path == getUrlWithParams()) item.title = title;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
persist: piniaPersistConfig("admin-tabs")
|
|
77
|
+
});
|