@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,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
需求:实现一个拖拽指令,可在父元素区域任意拖拽元素。
|
|
3
|
+
|
|
4
|
+
思路:
|
|
5
|
+
1、设置需要拖拽的元素为absolute,其父元素为relative。
|
|
6
|
+
2、鼠标按下(onmousedown)时记录目标元素当前的 left 和 top 值。
|
|
7
|
+
3、鼠标移动(onmousemove)时计算每次移动的横向距离和纵向距离的变化值,并改变元素的 left 和 top 值
|
|
8
|
+
4、鼠标松开(onmouseup)时完成一次拖拽
|
|
9
|
+
|
|
10
|
+
使用:在 Dom 上加上 v-draggable 即可
|
|
11
|
+
<div class="dialog-model" v-draggable></div>
|
|
12
|
+
*/
|
|
13
|
+
import type { Directive } from "vue";
|
|
14
|
+
/** 拖拽指令需要访问父节点尺寸的元素类型。 */
|
|
15
|
+
interface ElType extends HTMLElement {
|
|
16
|
+
parentNode: any;
|
|
17
|
+
}
|
|
18
|
+
const draggable: Directive = {
|
|
19
|
+
mounted: function (el: ElType) {
|
|
20
|
+
el.style.cursor = "move";
|
|
21
|
+
el.style.position = "absolute";
|
|
22
|
+
el.onmousedown = function (e) {
|
|
23
|
+
let disX = e.pageX - el.offsetLeft;
|
|
24
|
+
let disY = e.pageY - el.offsetTop;
|
|
25
|
+
document.onmousemove = function (e) {
|
|
26
|
+
let x = e.pageX - disX;
|
|
27
|
+
let y = e.pageY - disY;
|
|
28
|
+
let maxX = el.parentNode.offsetWidth - el.offsetWidth;
|
|
29
|
+
let maxY = el.parentNode.offsetHeight - el.offsetHeight;
|
|
30
|
+
if (x < 0) {
|
|
31
|
+
x = 0;
|
|
32
|
+
} else if (x > maxX) {
|
|
33
|
+
x = maxX;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (y < 0) {
|
|
37
|
+
y = 0;
|
|
38
|
+
} else if (y > maxY) {
|
|
39
|
+
y = maxY;
|
|
40
|
+
}
|
|
41
|
+
el.style.left = x + "px";
|
|
42
|
+
el.style.top = y + "px";
|
|
43
|
+
};
|
|
44
|
+
document.onmouseup = function () {
|
|
45
|
+
document.onmousemove = document.onmouseup = null;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export default draggable;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v-longpress
|
|
3
|
+
* 长按指令,长按时触发事件
|
|
4
|
+
*/
|
|
5
|
+
import type { Directive, DirectiveBinding } from "vue";
|
|
6
|
+
|
|
7
|
+
const directive: Directive = {
|
|
8
|
+
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
|
9
|
+
if (typeof binding.value !== "function") {
|
|
10
|
+
throw "callback must be a function";
|
|
11
|
+
}
|
|
12
|
+
// 定义变量
|
|
13
|
+
let pressTimer: any = null;
|
|
14
|
+
// 创建计时器( 2秒后执行函数 )
|
|
15
|
+
const start = (e: any) => {
|
|
16
|
+
if (e.button) {
|
|
17
|
+
if (e.type === "click" && e.button !== 0) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (pressTimer === null) {
|
|
22
|
+
pressTimer = setTimeout(() => {
|
|
23
|
+
handler(e);
|
|
24
|
+
}, 1000);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
// 取消计时器
|
|
28
|
+
const cancel = () => {
|
|
29
|
+
if (pressTimer !== null) {
|
|
30
|
+
clearTimeout(pressTimer);
|
|
31
|
+
pressTimer = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
// 运行函数
|
|
35
|
+
const handler = (e: MouseEvent | TouchEvent) => {
|
|
36
|
+
binding.value(e);
|
|
37
|
+
};
|
|
38
|
+
// 添加事件监听器
|
|
39
|
+
el.addEventListener("mousedown", start);
|
|
40
|
+
el.addEventListener("touchstart", start);
|
|
41
|
+
// 取消计时器
|
|
42
|
+
el.addEventListener("click", cancel);
|
|
43
|
+
el.addEventListener("mouseout", cancel);
|
|
44
|
+
el.addEventListener("touchend", cancel);
|
|
45
|
+
el.addEventListener("touchcancel", cancel);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default directive;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
需求:防止按钮在短时间内被多次点击,使用节流函数限制规定时间内只能点击一次。
|
|
3
|
+
|
|
4
|
+
思路:
|
|
5
|
+
1、第一次点击,立即调用方法并禁用按钮,等延迟结束再次激活按钮
|
|
6
|
+
2、将需要触发的方法绑定在指令上
|
|
7
|
+
|
|
8
|
+
使用:给 Dom 加上 v-throttle 及回调函数即可
|
|
9
|
+
<button v-throttle="debounceClick">节流提交</button>
|
|
10
|
+
*/
|
|
11
|
+
import type { Directive, DirectiveBinding } from "vue";
|
|
12
|
+
/** 节流指令挂载点击处理函数和禁用状态的元素类型。 */
|
|
13
|
+
interface ElType extends HTMLElement {
|
|
14
|
+
__handleClick__: () => any;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
const throttle: Directive = {
|
|
18
|
+
mounted(el: ElType, binding: DirectiveBinding) {
|
|
19
|
+
if (typeof binding.value !== "function") {
|
|
20
|
+
throw "callback must be a function";
|
|
21
|
+
}
|
|
22
|
+
let timer: NodeJS.Timeout | null = null;
|
|
23
|
+
el.__handleClick__ = function () {
|
|
24
|
+
if (timer) {
|
|
25
|
+
clearTimeout(timer);
|
|
26
|
+
}
|
|
27
|
+
if (!el.disabled) {
|
|
28
|
+
el.disabled = true;
|
|
29
|
+
binding.value();
|
|
30
|
+
timer = setTimeout(() => {
|
|
31
|
+
el.disabled = false;
|
|
32
|
+
}, 1000);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
el.addEventListener("click", el.__handleClick__);
|
|
36
|
+
},
|
|
37
|
+
beforeUnmount(el: ElType) {
|
|
38
|
+
el.removeEventListener("click", el.__handleClick__);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default throttle;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
需求:给整个页面添加背景水印。
|
|
3
|
+
|
|
4
|
+
思路:
|
|
5
|
+
1、使用 canvas 特性生成 base64 格式的图片文件,设置其字体大小,颜色等。
|
|
6
|
+
2、将其设置为背景图片,从而实现页面或组件水印效果
|
|
7
|
+
|
|
8
|
+
使用:设置水印文案,颜色,字体大小即可
|
|
9
|
+
<div v-waterMarker="{text:'版权所有',textColor:'rgba(180, 180, 180, 0.4)'}"></div>
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { Directive, DirectiveBinding } from "vue";
|
|
13
|
+
const addWaterMarker: Directive = (str: string, parentNode: any, font: any, textColor: string) => {
|
|
14
|
+
// 水印文字,父元素,字体,文字颜色
|
|
15
|
+
let can: HTMLCanvasElement = document.createElement("canvas");
|
|
16
|
+
parentNode.appendChild(can);
|
|
17
|
+
can.width = 205;
|
|
18
|
+
can.height = 140;
|
|
19
|
+
can.style.display = "none";
|
|
20
|
+
let cans = can.getContext("2d") as CanvasRenderingContext2D;
|
|
21
|
+
cans.rotate((-20 * Math.PI) / 180);
|
|
22
|
+
cans.font = font || "16px Microsoft JhengHei";
|
|
23
|
+
cans.fillStyle = textColor || "rgba(180, 180, 180, 0.3)";
|
|
24
|
+
cans.textAlign = "left";
|
|
25
|
+
cans.textBaseline = "Middle" as CanvasTextBaseline;
|
|
26
|
+
cans.fillText(str, can.width / 10, can.height / 2);
|
|
27
|
+
parentNode.style.backgroundImage = "url(" + can.toDataURL("image/png") + ")";
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const waterMarker = {
|
|
31
|
+
mounted(el: DirectiveBinding, binding: DirectiveBinding) {
|
|
32
|
+
addWaterMarker(binding.value.text, el, binding.value.font, binding.value.textColor);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default waterMarker;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description:请求配置
|
|
3
|
+
*/
|
|
4
|
+
export enum ResultEnum {
|
|
5
|
+
SUCCESS = 200,
|
|
6
|
+
ERROR = 500,
|
|
7
|
+
OVERDUE = 401,
|
|
8
|
+
TIMEOUT = 30000,
|
|
9
|
+
TYPE = "success"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description:请求方法
|
|
14
|
+
*/
|
|
15
|
+
export enum RequestEnum {
|
|
16
|
+
GET = "GET",
|
|
17
|
+
POST = "POST",
|
|
18
|
+
PATCH = "PATCH",
|
|
19
|
+
PUT = "PUT",
|
|
20
|
+
DELETE = "DELETE"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description:常用的 contentTyp 类型
|
|
25
|
+
*/
|
|
26
|
+
export enum ContentTypeEnum {
|
|
27
|
+
// json
|
|
28
|
+
JSON = "application/json;charset=UTF-8",
|
|
29
|
+
// text
|
|
30
|
+
TEXT = "text/plain;charset=UTF-8",
|
|
31
|
+
// form-data 一般配合qs
|
|
32
|
+
FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
|
|
33
|
+
// form-data 上传
|
|
34
|
+
FORM_DATA = "multipart/form-data;charset=UTF-8"
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { formatJson, formatSrc } from "./utils/utils";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export namespace Table {
|
|
2
|
+
/** 表格分页状态。 */
|
|
3
|
+
export interface Pageable {
|
|
4
|
+
page_num: number;
|
|
5
|
+
page_size: number;
|
|
6
|
+
total: number;
|
|
7
|
+
}
|
|
8
|
+
/** useTable 维护的表格请求、分页和查询状态。 */
|
|
9
|
+
export interface StateProps {
|
|
10
|
+
loading: boolean;
|
|
11
|
+
tableData: any[];
|
|
12
|
+
pageable: Pageable;
|
|
13
|
+
searchParam: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
searchInitParam: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
totalParam: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
icon?: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export namespace HandleData {
|
|
29
|
+
/** Element Plus 消息提示类型。 */
|
|
30
|
+
export type MessageType = "" | "success" | "warning" | "info" | "error";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export namespace Theme {
|
|
34
|
+
/** 后台菜单和头部主题类型。 */
|
|
35
|
+
export type ThemeType = "light" | "inverted" | "dark";
|
|
36
|
+
/** 灰色模式与色弱模式类型。 */
|
|
37
|
+
export type GreyOrWeakType = "grey" | "weak";
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useRoute } from "vue-router";
|
|
3
|
+
import { useAuthStore } from "../stores/modules/auth";
|
|
4
|
+
|
|
5
|
+
const GLOBAL_AUTH_BUTTON_KEY = "__global__";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description 页面按钮权限
|
|
9
|
+
* */
|
|
10
|
+
export const useAuthButtons = () => {
|
|
11
|
+
const route = useRoute();
|
|
12
|
+
const authStore = useAuthStore();
|
|
13
|
+
const authButtons =
|
|
14
|
+
authStore.authButtonListGet[route.name as string] || authStore.authButtonListGet[GLOBAL_AUTH_BUTTON_KEY] || [];
|
|
15
|
+
|
|
16
|
+
const BUTTONS = computed(() => {
|
|
17
|
+
let currentPageAuthButton: { [key: string]: boolean } = {};
|
|
18
|
+
authButtons.forEach(item => (currentPageAuthButton[item] = true));
|
|
19
|
+
return currentPageAuthButton;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
BUTTONS
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ElNotification } from "element-plus";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description 接收数据流生成 blob,创建链接,下载文件
|
|
5
|
+
* @param {Function} api 导出表格的api方法 (必传)
|
|
6
|
+
* @param {String} tempName 导出的文件名 (必传)
|
|
7
|
+
* @param {Object} params 导出的参数 (默认{})
|
|
8
|
+
* @param {Boolean} isNotify 是否有导出消息提示 (默认为 true)
|
|
9
|
+
* @param {String} fileType 导出的文件格式 (默认为.xlsx)
|
|
10
|
+
* */
|
|
11
|
+
export const useDownload = async (
|
|
12
|
+
api: (param: any) => Promise<any>,
|
|
13
|
+
tempName: string,
|
|
14
|
+
params: any = {},
|
|
15
|
+
isNotify: boolean = true,
|
|
16
|
+
fileType: string = ".xlsx"
|
|
17
|
+
) => {
|
|
18
|
+
if (isNotify) {
|
|
19
|
+
ElNotification({
|
|
20
|
+
title: "温馨提示",
|
|
21
|
+
message: "如果数据庞大会导致下载缓慢哦,请您耐心等待!",
|
|
22
|
+
type: "info",
|
|
23
|
+
duration: 3000
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const res = await api(params);
|
|
28
|
+
const blob = new Blob([res]);
|
|
29
|
+
// 兼容 edge 不支持 createObjectURL 方法
|
|
30
|
+
if ("msSaveOrOpenBlob" in navigator) return window.navigator.msSaveOrOpenBlob(blob, tempName + fileType);
|
|
31
|
+
const blobUrl = window.URL.createObjectURL(blob);
|
|
32
|
+
const exportFile = document.createElement("a");
|
|
33
|
+
exportFile.style.display = "none";
|
|
34
|
+
exportFile.download = `${tempName}${fileType}`;
|
|
35
|
+
exportFile.href = blobUrl;
|
|
36
|
+
document.body.appendChild(exportFile);
|
|
37
|
+
exportFile.click();
|
|
38
|
+
// 去除下载对 url 的影响
|
|
39
|
+
document.body.removeChild(exportFile);
|
|
40
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.log(error);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ElMessageBox, ElMessage } from "element-plus";
|
|
2
|
+
import { HandleData } from "./interface";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description 操作单条数据信息 (二次确认【删除、禁用、启用、重置密码】)
|
|
6
|
+
* @param {Function} api 操作数据接口的api方法 (必传)
|
|
7
|
+
* @param {Object} params 携带的操作数据参数 {id,params} (必传)
|
|
8
|
+
* @param {String} message 提示信息 (必传)
|
|
9
|
+
* @param {String} confirmType icon类型 (不必传,默认为 warning)
|
|
10
|
+
* @returns {Promise}
|
|
11
|
+
*/
|
|
12
|
+
export const useHandleData = (
|
|
13
|
+
api: (params: any) => Promise<any>,
|
|
14
|
+
params: any = {},
|
|
15
|
+
message: string,
|
|
16
|
+
confirmType: HandleData.MessageType = "warning"
|
|
17
|
+
) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
ElMessageBox.confirm(`是否${message}?`, "温馨提示", {
|
|
20
|
+
confirmButtonText: "确定",
|
|
21
|
+
cancelButtonText: "取消",
|
|
22
|
+
type: confirmType,
|
|
23
|
+
draggable: true
|
|
24
|
+
})
|
|
25
|
+
.then(async () => {
|
|
26
|
+
const res = await api(params);
|
|
27
|
+
if (!res) return reject(false);
|
|
28
|
+
ElMessage({
|
|
29
|
+
type: "success",
|
|
30
|
+
message: `${message}成功!`
|
|
31
|
+
});
|
|
32
|
+
resolve(true);
|
|
33
|
+
})
|
|
34
|
+
.catch(() => {
|
|
35
|
+
// cancel operation
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ref, onMounted, onUnmounted } from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description 网络是否可用
|
|
5
|
+
* */
|
|
6
|
+
export const useOnline = () => {
|
|
7
|
+
const online = ref(true);
|
|
8
|
+
const showStatus = (val: any) => {
|
|
9
|
+
online.value = typeof val == "boolean" ? val : val.target.online;
|
|
10
|
+
};
|
|
11
|
+
// 在页面加载后,设置正确的网络状态
|
|
12
|
+
navigator.onLine ? showStatus(true) : showStatus(false);
|
|
13
|
+
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
// 开始监听网络状态的变化
|
|
16
|
+
window.addEventListener("online", showStatus);
|
|
17
|
+
window.addEventListener("offline", showStatus);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
onUnmounted(() => {
|
|
21
|
+
// 移除监听网络状态的变化
|
|
22
|
+
window.removeEventListener("online", showStatus);
|
|
23
|
+
window.removeEventListener("offline", showStatus);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return { online };
|
|
27
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description 表格多选数据操作
|
|
5
|
+
* @param {String} rowKey 当表格可以多选时,所指定的 id
|
|
6
|
+
* */
|
|
7
|
+
export const useSelection = (rowKey: string = "id") => {
|
|
8
|
+
const isSelected = ref<boolean>(false);
|
|
9
|
+
const selectedList = ref<any[]>([]);
|
|
10
|
+
|
|
11
|
+
// 当前选中的所有 ids 数组
|
|
12
|
+
const selectedListIds = computed((): Array<string | number> => {
|
|
13
|
+
const ids: Array<string | number> = [];
|
|
14
|
+
selectedList.value.forEach(item => ids.push(item[rowKey]));
|
|
15
|
+
return ids;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description 多选操作
|
|
20
|
+
* @param {Array} rowArr 当前选择的所有数据
|
|
21
|
+
* @return void
|
|
22
|
+
*/
|
|
23
|
+
const selectionChange = (rowArr: any[]) => {
|
|
24
|
+
rowArr.length ? (isSelected.value = true) : (isSelected.value = false);
|
|
25
|
+
selectedList.value = rowArr;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
isSelected,
|
|
30
|
+
selectedList,
|
|
31
|
+
selectedListIds,
|
|
32
|
+
selectionChange
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Table } from "./interface";
|
|
2
|
+
import { reactive, computed, toRefs } from "vue";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description table 页面操作方法封装
|
|
6
|
+
* @param {Function} api 获取表格数据 api 方法 (必传)
|
|
7
|
+
* @param {Object} initParam 获取数据初始化参数 (非必传,默认为{})
|
|
8
|
+
* @param {Boolean} isPageable 是否有分页 (非必传,默认为true)
|
|
9
|
+
* @param {Function} dataCallBack 对后台返回的数据进行处理的方法 (非必传)
|
|
10
|
+
* */
|
|
11
|
+
export const useTable = (
|
|
12
|
+
api?: (params: any) => Promise<any>,
|
|
13
|
+
initParam: object = {},
|
|
14
|
+
isPageable: boolean = true,
|
|
15
|
+
dataCallBack?: (data: any) => any,
|
|
16
|
+
requestError?: (error: any) => void
|
|
17
|
+
) => {
|
|
18
|
+
const state = reactive<Table.StateProps>({
|
|
19
|
+
// 表格加载状态
|
|
20
|
+
loading: false,
|
|
21
|
+
// 表格数据
|
|
22
|
+
tableData: [],
|
|
23
|
+
// 分页数据
|
|
24
|
+
pageable: {
|
|
25
|
+
// 当前页数
|
|
26
|
+
page_num: 1,
|
|
27
|
+
// 每页显示条数
|
|
28
|
+
page_size: 10,
|
|
29
|
+
// 总条数
|
|
30
|
+
total: 0
|
|
31
|
+
},
|
|
32
|
+
// 查询参数(只包括查询)
|
|
33
|
+
searchParam: {},
|
|
34
|
+
// 初始化默认的查询参数
|
|
35
|
+
searchInitParam: {},
|
|
36
|
+
// 总参数(包含分页和查询参数)
|
|
37
|
+
totalParam: {}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description 分页查询参数(只包括分页和表格字段排序,其他排序方式可自行配置)
|
|
42
|
+
* */
|
|
43
|
+
const pageParam = computed({
|
|
44
|
+
get: () => {
|
|
45
|
+
return {
|
|
46
|
+
page_num: state.pageable.page_num,
|
|
47
|
+
page_size: state.pageable.page_size
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
set: (newVal: any) => {
|
|
51
|
+
console.log("我是分页更新之后的值", newVal);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @description 获取表格数据
|
|
57
|
+
* @return void
|
|
58
|
+
* */
|
|
59
|
+
const getTableList = async () => {
|
|
60
|
+
if (!api) return;
|
|
61
|
+
state.loading = true;
|
|
62
|
+
try {
|
|
63
|
+
// 先把初始化参数和分页参数放到总参数里面
|
|
64
|
+
Object.assign(state.totalParam, initParam, isPageable ? pageParam.value : {});
|
|
65
|
+
let { data } = await api({ ...state.searchInitParam, ...state.totalParam });
|
|
66
|
+
dataCallBack && (data = dataCallBack(data));
|
|
67
|
+
state.tableData = isPageable ? data.list : data;
|
|
68
|
+
// 解构后台返回的分页数据 (如果有分页更新分页信息)
|
|
69
|
+
if (isPageable) {
|
|
70
|
+
// Element Plus 要求分页总数为非负数字,兼容接口未返回总数的情况。
|
|
71
|
+
const total = Number(data.total ?? 0);
|
|
72
|
+
state.pageable.total = Number.isFinite(total) && total >= 0 ? total : 0;
|
|
73
|
+
}
|
|
74
|
+
} catch (error) {
|
|
75
|
+
requestError && requestError(error);
|
|
76
|
+
} finally {
|
|
77
|
+
state.loading = false;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @description 更新查询参数
|
|
83
|
+
* @return void
|
|
84
|
+
* */
|
|
85
|
+
const updatedTotalParam = () => {
|
|
86
|
+
state.totalParam = {};
|
|
87
|
+
// 处理查询参数,可以给查询参数加自定义前缀操作
|
|
88
|
+
let nowSearchParam: Table.StateProps["searchParam"] = {};
|
|
89
|
+
// 防止手动清空输入框携带参数(这里可以自定义查询参数前缀)
|
|
90
|
+
for (let key in state.searchParam) {
|
|
91
|
+
// 某些情况下参数为 false/0 也应该携带参数
|
|
92
|
+
if (state.searchParam[key] || state.searchParam[key] === false || state.searchParam[key] === 0) {
|
|
93
|
+
nowSearchParam[key] = state.searchParam[key];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
Object.assign(state.totalParam, nowSearchParam);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description 表格数据查询
|
|
101
|
+
* @return void
|
|
102
|
+
* */
|
|
103
|
+
const search = () => {
|
|
104
|
+
state.pageable.page_num = 1;
|
|
105
|
+
updatedTotalParam();
|
|
106
|
+
getTableList();
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @description 表格数据重置
|
|
111
|
+
* @return void
|
|
112
|
+
* */
|
|
113
|
+
const reset = () => {
|
|
114
|
+
state.pageable.page_num = 1;
|
|
115
|
+
// 重置搜索表单的时,如果有默认搜索参数,则重置默认的搜索参数
|
|
116
|
+
state.searchParam = { ...state.searchInitParam };
|
|
117
|
+
updatedTotalParam();
|
|
118
|
+
getTableList();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @description 每页条数改变
|
|
123
|
+
* @param {Number} val 当前条数
|
|
124
|
+
* @return void
|
|
125
|
+
* */
|
|
126
|
+
const handleSizeChange = (val: number) => {
|
|
127
|
+
state.pageable.page_num = 1;
|
|
128
|
+
state.pageable.page_size = val;
|
|
129
|
+
getTableList();
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @description 当前页改变
|
|
134
|
+
* @param {Number} val 当前页
|
|
135
|
+
* @return void
|
|
136
|
+
* */
|
|
137
|
+
const handleCurrentChange = (val: number) => {
|
|
138
|
+
state.pageable.page_num = val;
|
|
139
|
+
getTableList();
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
...toRefs(state),
|
|
144
|
+
getTableList,
|
|
145
|
+
search,
|
|
146
|
+
reset,
|
|
147
|
+
handleSizeChange,
|
|
148
|
+
handleCurrentChange,
|
|
149
|
+
updatedTotalParam
|
|
150
|
+
};
|
|
151
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { storeToRefs } from "pinia";
|
|
2
|
+
import { Theme } from "./interface";
|
|
3
|
+
import { ElMessage } from "element-plus";
|
|
4
|
+
import { DEFAULT_PRIMARY } from "../config";
|
|
5
|
+
import { useGlobalStore } from "../stores/modules/global";
|
|
6
|
+
import { getLightColor, getDarkColor } from "../utils/color";
|
|
7
|
+
import { menuTheme } from "../styles/theme/menu";
|
|
8
|
+
import { asideTheme } from "../styles/theme/aside";
|
|
9
|
+
import { headerTheme } from "../styles/theme/header";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @description 全局主题 hooks
|
|
13
|
+
* */
|
|
14
|
+
export const useTheme = () => {
|
|
15
|
+
const globalStore = useGlobalStore();
|
|
16
|
+
const { primary, isDark, isGrey, isWeak, layout, asideInverted, headerInverted } = storeToRefs(globalStore);
|
|
17
|
+
|
|
18
|
+
// 切换暗黑模式 ==> 同时修改主题颜色、侧边栏、头部颜色
|
|
19
|
+
const switchDark = () => {
|
|
20
|
+
const html = document.documentElement as HTMLElement;
|
|
21
|
+
if (isDark.value) html.setAttribute("class", "dark");
|
|
22
|
+
else html.setAttribute("class", "");
|
|
23
|
+
changePrimary(primary.value);
|
|
24
|
+
setAsideTheme();
|
|
25
|
+
setHeaderTheme();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 修改主题颜色
|
|
29
|
+
const changePrimary = (val: string | null) => {
|
|
30
|
+
if (!val) {
|
|
31
|
+
val = DEFAULT_PRIMARY;
|
|
32
|
+
ElMessage({ type: "success", message: `主题颜色已重置为 ${DEFAULT_PRIMARY}` });
|
|
33
|
+
}
|
|
34
|
+
// 计算主题颜色变化
|
|
35
|
+
document.documentElement.style.setProperty("--el-color-primary", val);
|
|
36
|
+
document.documentElement.style.setProperty(
|
|
37
|
+
"--el-color-primary-dark-2",
|
|
38
|
+
isDark.value ? `${getLightColor(val, 0.2)}` : `${getDarkColor(val, 0.3)}`
|
|
39
|
+
);
|
|
40
|
+
for (let i = 1; i <= 9; i++) {
|
|
41
|
+
const primaryColor = isDark.value ? `${getDarkColor(val, i / 10)}` : `${getLightColor(val, i / 10)}`;
|
|
42
|
+
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, primaryColor);
|
|
43
|
+
}
|
|
44
|
+
globalStore.setGlobalState("primary", val);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// 灰色和弱色切换
|
|
48
|
+
const changeGreyOrWeak = (type: Theme.GreyOrWeakType, value: boolean) => {
|
|
49
|
+
const body = document.body as HTMLElement;
|
|
50
|
+
if (!value) return body.removeAttribute("style");
|
|
51
|
+
const styles: Record<Theme.GreyOrWeakType, string> = {
|
|
52
|
+
grey: "filter: grayscale(1)",
|
|
53
|
+
weak: "filter: invert(80%)"
|
|
54
|
+
};
|
|
55
|
+
body.setAttribute("style", styles[type]);
|
|
56
|
+
const propName = type === "grey" ? "isWeak" : "isGrey";
|
|
57
|
+
globalStore.setGlobalState(propName, false);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// 设置菜单样式
|
|
61
|
+
const setMenuTheme = () => {
|
|
62
|
+
let type: Theme.ThemeType = "light";
|
|
63
|
+
if (layout.value === "transverse" && headerInverted.value) type = "inverted";
|
|
64
|
+
if (layout.value !== "transverse" && asideInverted.value) type = "inverted";
|
|
65
|
+
if (isDark.value) type = "dark";
|
|
66
|
+
const theme = menuTheme[type!];
|
|
67
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
68
|
+
document.documentElement.style.setProperty(key, value);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// 设置侧边栏样式
|
|
73
|
+
const setAsideTheme = () => {
|
|
74
|
+
let type: Theme.ThemeType = "light";
|
|
75
|
+
if (asideInverted.value) type = "inverted";
|
|
76
|
+
if (isDark.value) type = "dark";
|
|
77
|
+
const theme = asideTheme[type!];
|
|
78
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
79
|
+
document.documentElement.style.setProperty(key, value);
|
|
80
|
+
}
|
|
81
|
+
setMenuTheme();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// 设置头部样式
|
|
85
|
+
const setHeaderTheme = () => {
|
|
86
|
+
let type: Theme.ThemeType = "light";
|
|
87
|
+
if (headerInverted.value) type = "inverted";
|
|
88
|
+
if (isDark.value) type = "dark";
|
|
89
|
+
const theme = headerTheme[type!];
|
|
90
|
+
for (const [key, value] of Object.entries(theme)) {
|
|
91
|
+
document.documentElement.style.setProperty(key, value);
|
|
92
|
+
}
|
|
93
|
+
setMenuTheme();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// init theme
|
|
97
|
+
const initTheme = () => {
|
|
98
|
+
switchDark();
|
|
99
|
+
if (isGrey.value) changeGreyOrWeak("grey", true);
|
|
100
|
+
if (isWeak.value) changeGreyOrWeak("weak", true);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
initTheme,
|
|
105
|
+
switchDark,
|
|
106
|
+
changePrimary,
|
|
107
|
+
changeGreyOrWeak,
|
|
108
|
+
setAsideTheme,
|
|
109
|
+
setHeaderTheme
|
|
110
|
+
};
|
|
111
|
+
};
|