create-young-proj 0.13.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +31 -22
- package/dist/index.mjs +34 -34
- package/package.json +12 -11
- package/template-nuxt-admin/README.md +23 -16
- package/template-nuxt-website/README.md +117 -0
- package/template-uni-app/README.md +5 -0
- package/template-admin-server/.editorconfig +0 -11
- package/template-admin-server/.nvmrc +0 -1
- package/template-admin-server/.vscode/extensions.json +0 -6
- package/template-admin-server/.vscode/settings.json +0 -4
- package/template-admin-server/_gitignore +0 -15
- package/template-admin-server/boot.mjs +0 -11
- package/template-admin-server/package.json +0 -60
- package/template-admin-server/rome.json +0 -22
- package/template-admin-server/src/config/config.default.ts +0 -56
- package/template-admin-server/src/configuration.ts +0 -47
- package/template-admin-server/src/controller/admin.controller.ts +0 -397
- package/template-admin-server/src/controller/api.controller.ts +0 -98
- package/template-admin-server/src/controller/base.controller.ts +0 -70
- package/template-admin-server/src/controller/dto/api.ts +0 -47
- package/template-admin-server/src/controller/dto/index.ts +0 -36
- package/template-admin-server/src/controller/dto/menu.ts +0 -41
- package/template-admin-server/src/controller/dto/role.ts +0 -41
- package/template-admin-server/src/controller/dto/user.ts +0 -52
- package/template-admin-server/src/controller/menu.controller.ts +0 -138
- package/template-admin-server/src/controller/role.controller.ts +0 -116
- package/template-admin-server/src/controller/user.controller.ts +0 -108
- package/template-admin-server/src/entities/Api.ts +0 -29
- package/template-admin-server/src/entities/BaseCreate.ts +0 -30
- package/template-admin-server/src/entities/Menu.ts +0 -39
- package/template-admin-server/src/entities/Role.ts +0 -36
- package/template-admin-server/src/entities/User.ts +0 -35
- package/template-admin-server/src/entities/index.ts +0 -10
- package/template-admin-server/src/filter/default.filter.ts +0 -22
- package/template-admin-server/src/filter/notfound.filter.ts +0 -23
- package/template-admin-server/src/middleware/helper.middleware.ts +0 -28
- package/template-admin-server/src/middleware/index.ts +0 -9
- package/template-admin-server/src/middleware/jwt.middleware.ts +0 -32
- package/template-admin-server/src/middleware/report.middleware.ts +0 -26
- package/template-admin-server/src/service/api.service.ts +0 -174
- package/template-admin-server/src/service/basic.ts +0 -118
- package/template-admin-server/src/service/index.ts +0 -10
- package/template-admin-server/src/service/menu.service.ts +0 -139
- package/template-admin-server/src/service/role.service.ts +0 -286
- package/template-admin-server/src/service/user.service.ts +0 -124
- package/template-admin-server/src/strategy/jwt.strategy.ts +0 -26
- package/template-admin-server/src/types/index.ts +0 -42
- package/template-admin-server/src/types/types.d.ts +0 -31
- package/template-admin-server/tsconfig.json +0 -24
- package/template-nuxt-admin/.eslintrc +0 -14
- package/template-nuxt-admin/.vscode/extensions.json +0 -12
- package/template-nuxt-admin/.vscode/settings.json +0 -25
- package/template-nuxt-admin/Dockerfile +0 -41
- package/template-nuxt-admin/_gitignore +0 -23
- package/template-nuxt-admin/_npmrc +0 -2
- package/template-nuxt-admin/app.vue +0 -41
- package/template-nuxt-admin/boot.mjs +0 -16
- package/template-nuxt-admin/components/ScreenFull.vue +0 -19
- package/template-nuxt-admin/components/TopSearch.vue +0 -77
- package/template-nuxt-admin/components/TopUser.vue +0 -72
- package/template-nuxt-admin/components/YoungChangePassword.vue +0 -97
- package/template-nuxt-admin/components/YoungCodeInput.vue +0 -66
- package/template-nuxt-admin/components/YoungLink.vue +0 -24
- package/template-nuxt-admin/components/YoungLoading.vue +0 -39
- package/template-nuxt-admin/components/layout/Footer.vue +0 -29
- package/template-nuxt-admin/components/layout/Logo.vue +0 -54
- package/template-nuxt-admin/components/layout/Main.vue +0 -26
- package/template-nuxt-admin/components/layout/NavBar.vue +0 -89
- package/template-nuxt-admin/components/layout/SideBar.vue +0 -96
- package/template-nuxt-admin/components/layout/SubMenu.vue +0 -52
- package/template-nuxt-admin/components/layout/TabsBar.vue +0 -184
- package/template-nuxt-admin/composables/api.ts +0 -105
- package/template-nuxt-admin/composables/apis/delete.ts +0 -37
- package/template-nuxt-admin/composables/apis/get.ts +0 -83
- package/template-nuxt-admin/composables/apis/index.ts +0 -10
- package/template-nuxt-admin/composables/apis/patch.ts +0 -74
- package/template-nuxt-admin/composables/apis/post.ts +0 -85
- package/template-nuxt-admin/composables/config.ts +0 -13
- package/template-nuxt-admin/composables/icon.ts +0 -27
- package/template-nuxt-admin/composables/nav.ts +0 -75
- package/template-nuxt-admin/composables/tags.ts +0 -136
- package/template-nuxt-admin/composables/user.ts +0 -46
- package/template-nuxt-admin/config/.devrc +0 -1
- package/template-nuxt-admin/config/.onlinerc +0 -1
- package/template-nuxt-admin/config/.testrc +0 -1
- package/template-nuxt-admin/env.d.ts +0 -47
- package/template-nuxt-admin/error.vue +0 -61
- package/template-nuxt-admin/layouts/blank.vue +0 -9
- package/template-nuxt-admin/layouts/default.vue +0 -125
- package/template-nuxt-admin/middleware/auth.global.ts +0 -69
- package/template-nuxt-admin/nuxt.config.ts +0 -106
- package/template-nuxt-admin/package.json +0 -64
- package/template-nuxt-admin/pages/home/[id].vue +0 -28
- package/template-nuxt-admin/pages/index.vue +0 -15
- package/template-nuxt-admin/pages/login.vue +0 -199
- package/template-nuxt-admin/pages/system/api.vue +0 -179
- package/template-nuxt-admin/pages/system/hooks/useRole.ts +0 -335
- package/template-nuxt-admin/pages/system/menuList.vue +0 -353
- package/template-nuxt-admin/pages/system/role.vue +0 -145
- package/template-nuxt-admin/pages/system/user.vue +0 -225
- package/template-nuxt-admin/plugins/directive.ts +0 -26
- package/template-nuxt-admin/public/bg.webp +0 -0
- package/template-nuxt-admin/public/default_avatar.svg +0 -1
- package/template-nuxt-admin/public/favicon.svg +0 -2
- package/template-nuxt-admin/public/image_placeholder.svg +0 -15
- package/template-nuxt-admin/public/logo.svg +0 -2
- package/template-nuxt-admin/public/tabbar_bg.png +0 -0
- package/template-nuxt-admin/server/api/[...all].ts +0 -10
- package/template-nuxt-admin/server/plugins/env.ts +0 -87
- package/template-nuxt-admin/server/routes/get/env.ts +0 -13
- package/template-nuxt-admin/server/tsconfig.json +0 -3
- package/template-nuxt-admin/server/utils/index.ts +0 -36
- package/template-nuxt-admin/styles/element.scss +0 -30
- package/template-nuxt-admin/styles/index.scss +0 -59
- package/template-nuxt-admin/styles/variable.scss +0 -103
- package/template-nuxt-admin/tsconfig.json +0 -7
- package/template-nuxt-admin/typings/global.d.ts +0 -16
- package/template-nuxt-admin/typings/system.d.ts +0 -66
- package/template-nuxt-admin/typings/user.d.ts +0 -19
- package/template-nuxt-admin/uno.config.ts +0 -40
- package/template-nuxt-admin/utils/tool.ts +0 -199
- package/template-nuxt-admin/yarn.lock +0 -8487
- package/template-uni-app/.eslintignore +0 -1
- package/template-uni-app/.eslintrc +0 -16
- package/template-uni-app/.vscode/.server-controller-port.log +0 -5
- package/template-uni-app/.vscode/css.code-snippets +0 -398
- package/template-uni-app/.vscode/extensions.json +0 -12
- package/template-uni-app/.vscode/js.code-snippets +0 -1669
- package/template-uni-app/.vscode/settings.json +0 -25
- package/template-uni-app/.vscode/vue-html.code-snippets +0 -682
- package/template-uni-app/_env +0 -3
- package/template-uni-app/_env.development +0 -11
- package/template-uni-app/_env.production +0 -8
- package/template-uni-app/_env.test +0 -11
- package/template-uni-app/_gitignore +0 -3
- package/template-uni-app/_npmrc +0 -2
- package/template-uni-app/auto-imports.d.ts +0 -413
- package/template-uni-app/components.d.ts +0 -17
- package/template-uni-app/custom-plugins/index.ts +0 -7
- package/template-uni-app/custom-plugins/multiconf.ts +0 -74
- package/template-uni-app/dist/dev/mp-weixin/apis/index.js +0 -43
- package/template-uni-app/dist/dev/mp-weixin/apis/requests/get.js +0 -10
- package/template-uni-app/dist/dev/mp-weixin/apis/requests/index.js +0 -1
- package/template-uni-app/dist/dev/mp-weixin/apis/requests/post.js +0 -15
- package/template-uni-app/dist/dev/mp-weixin/app.js +0 -92
- package/template-uni-app/dist/dev/mp-weixin/app.json +0 -51
- package/template-uni-app/dist/dev/mp-weixin/app.wxss +0 -2378
- package/template-uni-app/dist/dev/mp-weixin/common/assets.js +0 -13
- package/template-uni-app/dist/dev/mp-weixin/common/vendor.js +0 -9166
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.js +0 -22
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading/young-loading.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.js +0 -22
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-loading-mini/young-loading-mini.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.js +0 -81
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-navbar/young-navbar.wxss +0 -108
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.js +0 -55
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/components/young-tabbar/young-tabbar.wxss +0 -88
- package/template-uni-app/dist/dev/mp-weixin/config/enum.js +0 -21
- package/template-uni-app/dist/dev/mp-weixin/config/index.js +0 -1
- package/template-uni-app/dist/dev/mp-weixin/config/map.js +0 -1
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.js +0 -29
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.json +0 -6
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/layouts/default.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.js +0 -56
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.json +0 -9
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/layouts/tabbar.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js +0 -98
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.json +0 -4
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.wxss +0 -125
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.js +0 -37
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.json +0 -5
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/pages/demo/index.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/pages/index.js +0 -50
- package/template-uni-app/dist/dev/mp-weixin/pages/index.json +0 -5
- package/template-uni-app/dist/dev/mp-weixin/pages/index.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/pages/index.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/pages/my.js +0 -22
- package/template-uni-app/dist/dev/mp-weixin/pages/my.json +0 -3
- package/template-uni-app/dist/dev/mp-weixin/pages/my.wxml +0 -1
- package/template-uni-app/dist/dev/mp-weixin/pages/my.wxss +0 -0
- package/template-uni-app/dist/dev/mp-weixin/project.config.json +0 -55
- package/template-uni-app/dist/dev/mp-weixin/project.private.config.json +0 -6
- package/template-uni-app/dist/dev/mp-weixin/static/back.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/h.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/home.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/home_active.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/more.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/my.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/my_active.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/static/network.png +0 -0
- package/template-uni-app/dist/dev/mp-weixin/store/index.js +0 -8
- package/template-uni-app/dist/dev/mp-weixin/store/local/index.js +0 -13
- package/template-uni-app/dist/dev/mp-weixin/store/system.js +0 -14
- package/template-uni-app/dist/dev/mp-weixin/utils/modal.js +0 -78
- package/template-uni-app/dist/dev/mp-weixin/utils/route.js +0 -83
- package/template-uni-app/dist/dev/mp-weixin/utils/system.js +0 -27
- package/template-uni-app/index.html +0 -23
- package/template-uni-app/manifest.config.ts +0 -88
- package/template-uni-app/package.json +0 -108
- package/template-uni-app/pages.config.ts +0 -58
- package/template-uni-app/pnpm-lock.yaml +0 -9967
- package/template-uni-app/src/App.vue +0 -79
- package/template-uni-app/src/apis/index.ts +0 -54
- package/template-uni-app/src/apis/requests/get.ts +0 -52
- package/template-uni-app/src/apis/requests/index.ts +0 -8
- package/template-uni-app/src/apis/requests/post.ts +0 -23
- package/template-uni-app/src/components/young-loading/young-loading.vue +0 -36
- package/template-uni-app/src/components/young-loading-mini/young-loading-mini.vue +0 -35
- package/template-uni-app/src/components/young-navbar/young-navbar.vue +0 -252
- package/template-uni-app/src/components/young-tabbar/young-tabbar.vue +0 -145
- package/template-uni-app/src/config/enum.ts +0 -47
- package/template-uni-app/src/config/index.ts +0 -8
- package/template-uni-app/src/config/map.ts +0 -15
- package/template-uni-app/src/env.d.ts +0 -36
- package/template-uni-app/src/layouts/default.vue +0 -22
- package/template-uni-app/src/layouts/tabbar.vue +0 -38
- package/template-uni-app/src/main.ts +0 -20
- package/template-uni-app/src/manifest.json +0 -75
- package/template-uni-app/src/pages/demo/index.vue +0 -30
- package/template-uni-app/src/pages/index.vue +0 -65
- package/template-uni-app/src/pages/my.vue +0 -30
- package/template-uni-app/src/pages.json +0 -74
- package/template-uni-app/src/static/back.png +0 -0
- package/template-uni-app/src/static/h.png +0 -0
- package/template-uni-app/src/static/home.png +0 -0
- package/template-uni-app/src/static/home_active.png +0 -0
- package/template-uni-app/src/static/more.png +0 -0
- package/template-uni-app/src/static/my.png +0 -0
- package/template-uni-app/src/static/my_active.png +0 -0
- package/template-uni-app/src/static/network.png +0 -0
- package/template-uni-app/src/store/index.ts +0 -16
- package/template-uni-app/src/store/local/index.ts +0 -42
- package/template-uni-app/src/store/system.ts +0 -21
- package/template-uni-app/src/typings/global.d.ts +0 -7
- package/template-uni-app/src/uni.scss +0 -76
- package/template-uni-app/src/utils/auth.ts +0 -204
- package/template-uni-app/src/utils/index.ts +0 -11
- package/template-uni-app/src/utils/map.ts +0 -98
- package/template-uni-app/src/utils/modal.ts +0 -120
- package/template-uni-app/src/utils/route.ts +0 -151
- package/template-uni-app/src/utils/system.ts +0 -67
- package/template-uni-app/tsconfig.json +0 -16
- package/template-uni-app/unocss.config.ts +0 -30
- package/template-uni-app/vite.config.ts +0 -63
- package/template-uni-app/volar.config.js +0 -6
- package/template-vue-mobile/.vscode/base.code-snippets +0 -24
- package/template-vue-mobile/.vscode/extensions.json +0 -10
- package/template-vue-mobile/.vscode/settings.json +0 -7
- package/template-vue-mobile/Dockerfile +0 -42
- package/template-vue-mobile/_env +0 -6
- package/template-vue-mobile/_gitignore +0 -30
- package/template-vue-mobile/boot.mjs +0 -16
- package/template-vue-mobile/build/custom-plugin.ts +0 -30
- package/template-vue-mobile/build/index.ts +0 -7
- package/template-vue-mobile/build/plugins.ts +0 -68
- package/template-vue-mobile/config/.devrc +0 -2
- package/template-vue-mobile/config/.onlinerc +0 -1
- package/template-vue-mobile/config/.testrc +0 -1
- package/template-vue-mobile/index.html +0 -25
- package/template-vue-mobile/nitro.config.ts +0 -19
- package/template-vue-mobile/package.json +0 -48
- package/template-vue-mobile/plugins/env.ts +0 -26
- package/template-vue-mobile/public/vite.svg +0 -1
- package/template-vue-mobile/rome.json +0 -24
- package/template-vue-mobile/routes/[...all].ts +0 -11
- package/template-vue-mobile/routes/get/env.ts +0 -25
- package/template-vue-mobile/src/App.vue +0 -29
- package/template-vue-mobile/src/auto-components.d.ts +0 -24
- package/template-vue-mobile/src/auto-imports.d.ts +0 -289
- package/template-vue-mobile/src/components/Init.vue +0 -36
- package/template-vue-mobile/src/global.d.ts +0 -7
- package/template-vue-mobile/src/hooks/useVerifyCode.ts +0 -46
- package/template-vue-mobile/src/layouts/blank.vue +0 -9
- package/template-vue-mobile/src/layouts/default.vue +0 -27
- package/template-vue-mobile/src/layouts/sub.vue +0 -20
- package/template-vue-mobile/src/main.ts +0 -35
- package/template-vue-mobile/src/modules/1-router.ts +0 -40
- package/template-vue-mobile/src/modules/2-pinia.ts +0 -10
- package/template-vue-mobile/src/modules/3-net.ts +0 -46
- package/template-vue-mobile/src/modules/4-auth.ts +0 -64
- package/template-vue-mobile/src/views/[...all_404].vue +0 -557
- package/template-vue-mobile/src/views/base/login.vue +0 -110
- package/template-vue-mobile/src/views/base/resetPasswd.vue +0 -88
- package/template-vue-mobile/src/views/index.vue +0 -18
- package/template-vue-mobile/src/views/my.vue +0 -15
- package/template-vue-mobile/src/views/sub.vue +0 -18
- package/template-vue-mobile/src/vite-env.d.ts +0 -43
- package/template-vue-mobile/tsconfig.json +0 -21
- package/template-vue-mobile/tsconfig.node.json +0 -9
- package/template-vue-mobile/unocss.config.ts +0 -47
- package/template-vue-mobile/vite.config.ts +0 -32
- package/template-vue-mobile/yarn.lock +0 -4395
- package/template-vue-thin/.vscode/extensions.json +0 -10
- package/template-vue-thin/.vscode/settings.json +0 -4
- package/template-vue-thin/_env +0 -1
- package/template-vue-thin/_gitignore +0 -29
- package/template-vue-thin/index.html +0 -21
- package/template-vue-thin/package.json +0 -40
- package/template-vue-thin/public/vite.svg +0 -1
- package/template-vue-thin/src/App.vue +0 -9
- package/template-vue-thin/src/layouts/blank.vue +0 -9
- package/template-vue-thin/src/layouts/default.vue +0 -12
- package/template-vue-thin/src/layouts/list.vue +0 -12
- package/template-vue-thin/src/main.ts +0 -58
- package/template-vue-thin/src/views/[...all_404].vue +0 -488
- package/template-vue-thin/src/views/index.vue +0 -19
- package/template-vue-thin/src/views/list.vue +0 -17
- package/template-vue-thin/src/vite-env.d.ts +0 -22
- package/template-vue-thin/tsconfig.json +0 -21
- package/template-vue-thin/tsconfig.node.json +0 -9
- package/template-vue-thin/unocss.config.ts +0 -47
- package/template-vue-thin/vite.config.ts +0 -64
@@ -1,335 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-26 15:51:14
|
4
|
-
* @LastEditTime: 2023-07-28 11:22:35
|
5
|
-
* @Description:
|
6
|
-
*/
|
7
|
-
import type {
|
8
|
-
SelectOptionItem,
|
9
|
-
TableDataItem,
|
10
|
-
TableHeadItem,
|
11
|
-
YoungSearchScheme,
|
12
|
-
} from '@bluesyoung/ui-vue3-element-plus'
|
13
|
-
import { YoungSelect, useFormMode, useQuery } from '@bluesyoung/ui-vue3-element-plus'
|
14
|
-
import { deepClone } from '@bluesyoung/utils'
|
15
|
-
|
16
|
-
export function useRoleBase() {
|
17
|
-
const FORM_TEMP: RoleItem = {
|
18
|
-
id: 0,
|
19
|
-
name: '',
|
20
|
-
keyword: '',
|
21
|
-
desc: '',
|
22
|
-
status: 1,
|
23
|
-
sort: 0,
|
24
|
-
}
|
25
|
-
|
26
|
-
const { isAdd, isEdit, edit, del, sure, clear, form, formRef, validForm } = useFormMode(
|
27
|
-
FORM_TEMP,
|
28
|
-
{
|
29
|
-
addCbk: async () => {
|
30
|
-
const res = (await validForm()) as boolean
|
31
|
-
if (res) {
|
32
|
-
const v = deepClone(form.value)
|
33
|
-
await apis.post.addRoleItem(v)
|
34
|
-
ElMessage.success('新增成功!')
|
35
|
-
}
|
36
|
-
return res
|
37
|
-
},
|
38
|
-
modCbk: async () => {
|
39
|
-
const res = (await validForm()) as boolean
|
40
|
-
if (res) {
|
41
|
-
const v = deepClone(form.value)
|
42
|
-
await apis.patch.changeRoleItem(v)
|
43
|
-
ElMessage.success('修改成功!')
|
44
|
-
}
|
45
|
-
return res
|
46
|
-
},
|
47
|
-
delCbk: async (row) => {
|
48
|
-
await apis.delete.deleteRole(row.id.toString())
|
49
|
-
ElMessage.success('删除成功!')
|
50
|
-
query.value.pageNum = 1
|
51
|
-
},
|
52
|
-
cgEffect: () => getList(),
|
53
|
-
},
|
54
|
-
)
|
55
|
-
|
56
|
-
const options: SelectOptionItem[] = [
|
57
|
-
{ label: '禁用', value: 0 },
|
58
|
-
{ label: '启用', value: 1 },
|
59
|
-
]
|
60
|
-
|
61
|
-
const tableHead: TableHeadItem<RoleItem>[] = [
|
62
|
-
{ label: '角色ID', prop: 'id' },
|
63
|
-
{ label: '角色关键字', prop: 'keyword' },
|
64
|
-
{ label: '角色名称', prop: 'name' },
|
65
|
-
{ label: '角色描述', prop: 'desc' },
|
66
|
-
{ label: '创建信息', prop: 'creator' },
|
67
|
-
{
|
68
|
-
label: '启用状态',
|
69
|
-
prop: 'status',
|
70
|
-
render: row =>
|
71
|
-
h(YoungSelect, {
|
72
|
-
'modelValue': row.status,
|
73
|
-
options,
|
74
|
-
'onUpdate:modelValue': async (status) => {
|
75
|
-
// 状态未修改
|
76
|
-
if (status === row.status)
|
77
|
-
return
|
78
|
-
|
79
|
-
row.status = status as 0 | 1
|
80
|
-
await apis.patch.changeRoleItem(row)
|
81
|
-
ElMessage.success('修改成功!')
|
82
|
-
},
|
83
|
-
}),
|
84
|
-
},
|
85
|
-
]
|
86
|
-
const tableData = ref<TableDataItem<RoleItem>[]>([])
|
87
|
-
const getList = async () => {
|
88
|
-
const { list, pageNum, pageSize, total } = await apis.get.getRoleList(query.value)
|
89
|
-
tableData.value = deepClone(list || [])
|
90
|
-
query.value.pageNum = +pageNum || 1
|
91
|
-
query.value.pageSize = +pageSize || 50
|
92
|
-
query.value.total = +total || 0
|
93
|
-
}
|
94
|
-
|
95
|
-
interface Query extends BaseQuery {
|
96
|
-
name: string
|
97
|
-
keyword: string
|
98
|
-
status: 0 | 1
|
99
|
-
}
|
100
|
-
|
101
|
-
const { query, reset } = useQuery<Query>(
|
102
|
-
{
|
103
|
-
pageNum: 1,
|
104
|
-
pageSize: 10,
|
105
|
-
total: 0,
|
106
|
-
name: '',
|
107
|
-
keyword: '',
|
108
|
-
status: 1,
|
109
|
-
},
|
110
|
-
getList,
|
111
|
-
)
|
112
|
-
|
113
|
-
const queryScheme: YoungSearchScheme<Query> = {
|
114
|
-
name: {
|
115
|
-
type: 'input',
|
116
|
-
tip: '角色名称',
|
117
|
-
attrs: {
|
118
|
-
placeholder: '请输入角色名称(中文)',
|
119
|
-
},
|
120
|
-
},
|
121
|
-
keyword: {
|
122
|
-
type: 'input',
|
123
|
-
tip: '角色关键字',
|
124
|
-
attrs: {
|
125
|
-
placeholder: '请输入角色关键字(英文)',
|
126
|
-
},
|
127
|
-
},
|
128
|
-
status: {
|
129
|
-
type: 'select',
|
130
|
-
tip: '状态',
|
131
|
-
attrs: {
|
132
|
-
placeholder: '角色状态',
|
133
|
-
},
|
134
|
-
options,
|
135
|
-
},
|
136
|
-
}
|
137
|
-
|
138
|
-
return {
|
139
|
-
query,
|
140
|
-
queryScheme,
|
141
|
-
getList,
|
142
|
-
reset,
|
143
|
-
tableHead,
|
144
|
-
tableData,
|
145
|
-
baseFormRef: formRef,
|
146
|
-
base: reactive({
|
147
|
-
form,
|
148
|
-
isAdd,
|
149
|
-
isEdit,
|
150
|
-
edit,
|
151
|
-
del,
|
152
|
-
sure,
|
153
|
-
clear,
|
154
|
-
}),
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
export function useRoleMenu() {
|
159
|
-
const showPriority = ref(false)
|
160
|
-
const currRole = ref(0)
|
161
|
-
const access = ref<number[]>([])
|
162
|
-
const origin = ref<number[]>([])
|
163
|
-
|
164
|
-
const tableHead = ref<TableHeadItem<NavArrItem>[]>([
|
165
|
-
{ label: '菜单名称', prop: 'title' },
|
166
|
-
{ label: '菜单id', prop: 'id' },
|
167
|
-
{ label: '父节点', prop: 'parentId' },
|
168
|
-
{ label: '页面路径', prop: 'component' },
|
169
|
-
])
|
170
|
-
const tableData = ref<TableDataItem<NavArrItem>[]>([])
|
171
|
-
|
172
|
-
const checkMap = ref<Record<number, boolean>>({})
|
173
|
-
|
174
|
-
/**
|
175
|
-
* 生成节点映射
|
176
|
-
*/
|
177
|
-
const nodeMap = new Map<number, NavArrItem>()
|
178
|
-
const generateNodeMap = (list: NavArrItem[]) => {
|
179
|
-
for (const node of list) {
|
180
|
-
nodeMap.set(node.id, node)
|
181
|
-
if (node.children && node.children?.length > 0)
|
182
|
-
generateNodeMap(node.children)
|
183
|
-
}
|
184
|
-
}
|
185
|
-
|
186
|
-
/**
|
187
|
-
* 多级联动选择
|
188
|
-
*/
|
189
|
-
const selectChange = (item: NavArrItem) => {
|
190
|
-
if (item.children && item.children?.length !== 0) {
|
191
|
-
item.children.forEach((v) => {
|
192
|
-
checkMap.value[v.id] = checkMap.value[item.id]
|
193
|
-
selectChange(v)
|
194
|
-
})
|
195
|
-
}
|
196
|
-
if (checkMap.value[item.id]) {
|
197
|
-
while (item.parentId) {
|
198
|
-
const tp = nodeMap.get(item.parentId)
|
199
|
-
if (tp) {
|
200
|
-
item = tp
|
201
|
-
checkMap.value[item.id] = true
|
202
|
-
}
|
203
|
-
else {
|
204
|
-
break
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
}
|
209
|
-
|
210
|
-
const edit = async (row: TableDataItem<RoleItem>) => {
|
211
|
-
currRole.value = row.id
|
212
|
-
checkMap.value = {}
|
213
|
-
nodeMap.clear()
|
214
|
-
|
215
|
-
const { list, accessIds } = await apis.get.getRoleMenuTree(row.id)
|
216
|
-
generateNodeMap(list);
|
217
|
-
(Array.from(accessIds) as number[]).forEach((v) => {
|
218
|
-
checkMap.value[v] = true
|
219
|
-
})
|
220
|
-
|
221
|
-
tableData.value = deepClone(list)
|
222
|
-
access.value = accessIds
|
223
|
-
origin.value = accessIds
|
224
|
-
showPriority.value = true
|
225
|
-
}
|
226
|
-
const clear = () => {
|
227
|
-
showPriority.value = false
|
228
|
-
currRole.value = 0
|
229
|
-
tableData.value.length = 0
|
230
|
-
}
|
231
|
-
|
232
|
-
const sure = async () => {
|
233
|
-
const before = origin.value.slice()
|
234
|
-
const now = Object.entries(checkMap.value)
|
235
|
-
.filter(([k, v]) => v)
|
236
|
-
.map(([k, v]) => +k)
|
237
|
-
|
238
|
-
const add = now.filter(v => !before.includes(v))
|
239
|
-
const del = before.filter(v => !now.includes(v))
|
240
|
-
await apis.patch.changeRoleMenu(currRole.value, add, del)
|
241
|
-
ElMessage.success('修改成功!')
|
242
|
-
clear()
|
243
|
-
}
|
244
|
-
|
245
|
-
return {
|
246
|
-
showPriority,
|
247
|
-
menu: reactive({
|
248
|
-
checkMap,
|
249
|
-
tableHead,
|
250
|
-
tableData,
|
251
|
-
edit,
|
252
|
-
clear,
|
253
|
-
sure,
|
254
|
-
selectChange,
|
255
|
-
}),
|
256
|
-
}
|
257
|
-
}
|
258
|
-
|
259
|
-
export function useRoleApi() {
|
260
|
-
const showApi = ref(false)
|
261
|
-
const currRole = ref(0)
|
262
|
-
const access = ref<number[]>([])
|
263
|
-
const origin = ref<number[]>([])
|
264
|
-
|
265
|
-
const tableHead = ref<TableHeadItem<ApiItem>[]>([
|
266
|
-
{ prop: 'desc', label: '接口描述' },
|
267
|
-
{ prop: 'id', label: '接口ID' },
|
268
|
-
{ prop: 'method', label: '接口方法' },
|
269
|
-
{ prop: 'path', label: '请求地址' },
|
270
|
-
])
|
271
|
-
const tableData = ref<TableDataItem<ApiItem>[]>([])
|
272
|
-
|
273
|
-
const checkMap = ref<Record<number, boolean>>({})
|
274
|
-
|
275
|
-
const edit = async (row: TableDataItem<RoleItem>) => {
|
276
|
-
currRole.value = row.id
|
277
|
-
checkMap.value = {}
|
278
|
-
|
279
|
-
const { list, accessIds } = await apis.get.getRoleApis(row.id);
|
280
|
-
(Array.from(accessIds) as number[]).forEach((v) => {
|
281
|
-
checkMap.value[v] = true
|
282
|
-
})
|
283
|
-
|
284
|
-
tableData.value = deepClone(
|
285
|
-
Array.from(list)
|
286
|
-
.map((item: any) => item.children)
|
287
|
-
.flat(),
|
288
|
-
)
|
289
|
-
|
290
|
-
access.value = accessIds
|
291
|
-
origin.value = accessIds
|
292
|
-
showApi.value = true
|
293
|
-
|
294
|
-
isAll.value = tableData.value.length === access.value.length
|
295
|
-
}
|
296
|
-
const clear = () => {
|
297
|
-
showApi.value = false
|
298
|
-
currRole.value = 0
|
299
|
-
tableData.value.length = 0
|
300
|
-
}
|
301
|
-
|
302
|
-
const sure = async () => {
|
303
|
-
const before = origin.value.slice()
|
304
|
-
const now = Object.entries(checkMap.value)
|
305
|
-
.filter(([k, v]) => v)
|
306
|
-
.map(([k, v]) => +k)
|
307
|
-
|
308
|
-
const add = now.filter(v => !before.includes(v))
|
309
|
-
const del = before.filter(v => !now.includes(v))
|
310
|
-
await apis.patch.changeRoleApi(currRole.value, add, del)
|
311
|
-
ElMessage.success('修改成功!')
|
312
|
-
clear()
|
313
|
-
}
|
314
|
-
|
315
|
-
const isAll = ref(false)
|
316
|
-
const changeAll = () => {
|
317
|
-
tableData.value.forEach((i) => {
|
318
|
-
checkMap.value[i.id] = isAll.value
|
319
|
-
})
|
320
|
-
}
|
321
|
-
|
322
|
-
return {
|
323
|
-
showApi,
|
324
|
-
api: reactive({
|
325
|
-
checkMap,
|
326
|
-
tableHead,
|
327
|
-
tableData,
|
328
|
-
edit,
|
329
|
-
clear,
|
330
|
-
sure,
|
331
|
-
isAll,
|
332
|
-
changeAll,
|
333
|
-
}),
|
334
|
-
}
|
335
|
-
}
|
@@ -1,353 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
* @Author: zhangyang
|
3
|
-
* @Date: 2023-07-25 16:45:17
|
4
|
-
* @LastEditTime: 2023-08-25 16:55:00
|
5
|
-
* @Description:
|
6
|
-
-->
|
7
|
-
<script lang="ts" setup>
|
8
|
-
import { YoungDialog, YoungSelect, YoungTablePro, useFormMode } from '@bluesyoung/ui-vue3-element-plus'
|
9
|
-
import type { TableHeadItem } from '@bluesyoung/ui-vue3-element-plus'
|
10
|
-
import { deepClone, isArray } from '@bluesyoung/utils'
|
11
|
-
import { ElButton } from 'element-plus'
|
12
|
-
|
13
|
-
definePageMeta({
|
14
|
-
title: '菜单管理',
|
15
|
-
})
|
16
|
-
|
17
|
-
const FORM_TEMP: NavArrItem = {
|
18
|
-
breadcrumb: 0,
|
19
|
-
component: '',
|
20
|
-
createdAt: '',
|
21
|
-
creator: '',
|
22
|
-
icon: '',
|
23
|
-
id: 0,
|
24
|
-
name: '',
|
25
|
-
not_dev: 0,
|
26
|
-
parentId: 0,
|
27
|
-
path: '',
|
28
|
-
permission: '',
|
29
|
-
redirect: '',
|
30
|
-
sort: 0,
|
31
|
-
status: 1,
|
32
|
-
title: '',
|
33
|
-
updatedAt: '',
|
34
|
-
visible: 1,
|
35
|
-
}
|
36
|
-
// key 的类型必须为 string 才会生效!!!
|
37
|
-
const expandKeys = ref<Set<string>>(new Set())
|
38
|
-
|
39
|
-
let tempArr: string[] = []
|
40
|
-
function getFatherAndSon(arr: NavArrItem[], num?: number): string[] {
|
41
|
-
if (num === 1)
|
42
|
-
tempArr = []
|
43
|
-
|
44
|
-
for (const item of arr) {
|
45
|
-
tempArr.push(`${item.id}`)
|
46
|
-
if (item.children && isArray(item.children) && item.children.length > 0)
|
47
|
-
getFatherAndSon(deepClone(item.children))
|
48
|
-
}
|
49
|
-
return tempArr
|
50
|
-
}
|
51
|
-
function expandChange(...args: any) {
|
52
|
-
const [row, isOpen] = args as [NavArrItem, boolean]
|
53
|
-
const autoid = row.id
|
54
|
-
if (isOpen) {
|
55
|
-
expandKeys.value.add(`${autoid}`)
|
56
|
-
}
|
57
|
-
else {
|
58
|
-
const allSub = getFatherAndSon([row], 1)
|
59
|
-
allSub.forEach(v => expandKeys.value.delete(v))
|
60
|
-
}
|
61
|
-
}
|
62
|
-
const tableData = ref<NavArrItem[]>([])
|
63
|
-
|
64
|
-
const topMenuOption = ref<Partial<NavArrItem>[]>([])
|
65
|
-
|
66
|
-
/**
|
67
|
-
* 生成节点映射
|
68
|
-
*/
|
69
|
-
const nodeMap = new Map<string, NavArrItem>()
|
70
|
-
function generateNodeMap(list: NavArrItem[]) {
|
71
|
-
for (const node of list) {
|
72
|
-
nodeMap.set(node.id.toString(), node)
|
73
|
-
if (node.children && node.children?.length > 0)
|
74
|
-
generateNodeMap(node.children)
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
/**
|
79
|
-
* 获取节点列表
|
80
|
-
*/
|
81
|
-
async function getList() {
|
82
|
-
const list = Object.values(await apis.get.getMenuList())
|
83
|
-
generateNodeMap(list)
|
84
|
-
|
85
|
-
tableData.value = list
|
86
|
-
|
87
|
-
topMenuOption.value = [
|
88
|
-
{ title: '顶级目录', children: list, id: 0 },
|
89
|
-
]
|
90
|
-
}
|
91
|
-
|
92
|
-
const {
|
93
|
-
isAdd,
|
94
|
-
isEdit,
|
95
|
-
form,
|
96
|
-
edit,
|
97
|
-
del,
|
98
|
-
sure,
|
99
|
-
clear,
|
100
|
-
formRef,
|
101
|
-
validForm,
|
102
|
-
} = useFormMode<NavArrItem>(FORM_TEMP, {
|
103
|
-
addCbk: async () => {
|
104
|
-
const res = await validForm() as boolean
|
105
|
-
if (res) {
|
106
|
-
const v = deepClone(form.value)
|
107
|
-
await apis.post.addMenuItem(v)
|
108
|
-
ElMessage.success('菜单添加成功!')
|
109
|
-
}
|
110
|
-
return res
|
111
|
-
},
|
112
|
-
modCbk: async () => {
|
113
|
-
const res = await validForm() as boolean
|
114
|
-
if (res) {
|
115
|
-
const v = deepClone(form.value)
|
116
|
-
await apis.patch.changeMenuItem(v)
|
117
|
-
ElMessage.success('菜单修改成功!')
|
118
|
-
}
|
119
|
-
return res
|
120
|
-
},
|
121
|
-
delCbk: async (nav: NavArrItem) => {
|
122
|
-
apis.delete.deleteMenu(nav.id.toString())
|
123
|
-
expandKeys.value.delete(nav.id.toString())
|
124
|
-
ElMessage.success('节点删除成功!')
|
125
|
-
// 框架有 bug,视图更新不及时
|
126
|
-
location.reload()
|
127
|
-
},
|
128
|
-
cgEffect: async () => {
|
129
|
-
await getList()
|
130
|
-
},
|
131
|
-
})
|
132
|
-
|
133
|
-
/**
|
134
|
-
* 添加节点
|
135
|
-
*/
|
136
|
-
function add() {
|
137
|
-
form.value.parentId = 0
|
138
|
-
isAdd.value = true
|
139
|
-
}
|
140
|
-
|
141
|
-
const tableHead: TableHeadItem<NavArrItem>[] = [
|
142
|
-
{
|
143
|
-
prop: 'title',
|
144
|
-
label: '标题',
|
145
|
-
render: row => h('div', { class: 'inline-flex items-center justify-center' }, [
|
146
|
-
h('div', { class: row.icon }),
|
147
|
-
h('div', row.title),
|
148
|
-
]),
|
149
|
-
},
|
150
|
-
{
|
151
|
-
prop: 'sort',
|
152
|
-
label: '同级排序',
|
153
|
-
aligin: 'center',
|
154
|
-
render: (row, i) => h('div', {
|
155
|
-
class: 'flex text-2xl justify-center',
|
156
|
-
}, [
|
157
|
-
h('div', {
|
158
|
-
class: 'i-ic-round-keyboard-arrow-up cursor-pointer',
|
159
|
-
title: '向上',
|
160
|
-
onClick: async () => {
|
161
|
-
const arr = nodeMap.get(row.parentId.toString())?.children || []
|
162
|
-
const index = arr.findIndex(m => m.id === row.id)
|
163
|
-
if (index <= 0) {
|
164
|
-
return ElMessage.warning('已经到最前面啦!')
|
165
|
-
}
|
166
|
-
else {
|
167
|
-
const pre = arr[index - 1]
|
168
|
-
|
169
|
-
const num = row.sort
|
170
|
-
const preNum = pre.sort
|
171
|
-
|
172
|
-
if (num !== preNum) {
|
173
|
-
row.sort = preNum
|
174
|
-
pre.sort = num
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
row.sort = num - 1
|
178
|
-
}
|
179
|
-
await Promise.all([
|
180
|
-
apis.patch.changeMenuItem(row),
|
181
|
-
apis.patch.changeMenuItem(pre),
|
182
|
-
])
|
183
|
-
ElMessage.success('顺序修改成功!')
|
184
|
-
getList()
|
185
|
-
}
|
186
|
-
},
|
187
|
-
}),
|
188
|
-
h('div', {
|
189
|
-
class: 'i-ic-round-keyboard-arrow-down cursor-pointer',
|
190
|
-
title: '向下',
|
191
|
-
onClick: async () => {
|
192
|
-
const arr = nodeMap.get(row.parentId.toString())?.children || []
|
193
|
-
const index = arr.findIndex(m => m.id === row.id)
|
194
|
-
if (index === arr.length - 1) {
|
195
|
-
return ElMessage.warning('已经到最后面啦!')
|
196
|
-
}
|
197
|
-
else {
|
198
|
-
const next = arr[index + 1]
|
199
|
-
|
200
|
-
const num = row.sort
|
201
|
-
const nextNum = next.sort
|
202
|
-
|
203
|
-
if (num !== nextNum) {
|
204
|
-
row.sort = nextNum
|
205
|
-
next.sort = num
|
206
|
-
}
|
207
|
-
else {
|
208
|
-
row.sort = num + 1
|
209
|
-
}
|
210
|
-
await Promise.all([
|
211
|
-
apis.patch.changeMenuItem(row),
|
212
|
-
apis.patch.changeMenuItem(next),
|
213
|
-
])
|
214
|
-
ElMessage.success('顺序修改成功!')
|
215
|
-
getList()
|
216
|
-
}
|
217
|
-
},
|
218
|
-
}),
|
219
|
-
]),
|
220
|
-
},
|
221
|
-
{ prop: 'component', label: '页面路径' },
|
222
|
-
{
|
223
|
-
prop: 'visible',
|
224
|
-
label: '隐藏/显示',
|
225
|
-
render: row => h(YoungSelect, {
|
226
|
-
'modelValue': row.visible,
|
227
|
-
'options': [{ label: '显示', value: 1 }, { label: '隐藏', value: 0 }],
|
228
|
-
'onUpdate:modelValue': async (e: number) => {
|
229
|
-
// 状态未修改
|
230
|
-
if (e === row.visible)
|
231
|
-
return
|
232
|
-
|
233
|
-
row.visible = e
|
234
|
-
await apis.patch.changeMenuItem({ ...row, visible: e })
|
235
|
-
ElMessage.success('菜单修改成功!')
|
236
|
-
},
|
237
|
-
}),
|
238
|
-
},
|
239
|
-
{ prop: 'creator', label: '创建时间' },
|
240
|
-
{
|
241
|
-
prop: 'id',
|
242
|
-
label: '操作',
|
243
|
-
fixed: 'right',
|
244
|
-
width: '180',
|
245
|
-
render: row => h('div', [
|
246
|
-
h(ElButton, {
|
247
|
-
text: true,
|
248
|
-
class: '!p-0',
|
249
|
-
type: 'primary',
|
250
|
-
onClick: () => edit(row),
|
251
|
-
}, {
|
252
|
-
default: () => h('div', '编辑'),
|
253
|
-
}),
|
254
|
-
h(ElButton, {
|
255
|
-
type: 'primary',
|
256
|
-
class: '!p-0',
|
257
|
-
text: true,
|
258
|
-
onClick: () => {
|
259
|
-
form.value.parentId = row.id
|
260
|
-
isAdd.value = true
|
261
|
-
},
|
262
|
-
}, {
|
263
|
-
default: () => h('div', '添加子节点'),
|
264
|
-
}),
|
265
|
-
h(ElButton, {
|
266
|
-
text: true,
|
267
|
-
class: '!p-0',
|
268
|
-
type: 'danger',
|
269
|
-
onClick: () => del(row),
|
270
|
-
}, {
|
271
|
-
default: () => h('div', '删除'),
|
272
|
-
}),
|
273
|
-
]),
|
274
|
-
},
|
275
|
-
]
|
276
|
-
|
277
|
-
useTabReOpen(getList)
|
278
|
-
</script>
|
279
|
-
|
280
|
-
<template>
|
281
|
-
<ElCard>
|
282
|
-
<div>
|
283
|
-
<ElButton type="primary" plain @click="add">
|
284
|
-
新建菜单
|
285
|
-
</ElButton>
|
286
|
-
</div>
|
287
|
-
<!-- 节点列表 -->
|
288
|
-
<YoungTablePro
|
289
|
-
:table-data="tableData" :table-head="tableHead" :tree-props="{ children: 'children' }" row-key="id"
|
290
|
-
:expand-row-keys="[...expandKeys]" @expand-change="expandChange"
|
291
|
-
/>
|
292
|
-
<!-- 添加 / 编辑 -->
|
293
|
-
<YoungDialog width="370px" :is-add="isAdd" :diff-form="form" :is-edit="isEdit" @sure="sure" @clear="clear">
|
294
|
-
<template #body>
|
295
|
-
<ElForm ref="formRef" :model="form" label-width="80px" :label-position="WindowSize['lt-lg'] ? 'top' : 'left'">
|
296
|
-
<ElFormItem label="上级目录">
|
297
|
-
<ElCascader
|
298
|
-
:model-value="form.parentId" :props="{
|
299
|
-
label: 'title',
|
300
|
-
value: 'id',
|
301
|
-
checkStrictly: true,
|
302
|
-
multiple: false,
|
303
|
-
}" :options="topMenuOption" :show-all-levels="false"
|
304
|
-
@update:model-value="(e: any) => form.parentId = e[e.length - 1]"
|
305
|
-
/>
|
306
|
-
</ElFormItem>
|
307
|
-
<ElFormItem label="英文名称" prop="name" :rules="{ required: true, message: '请输入英文名', trigger: 'blur' }">
|
308
|
-
<ElInput v-model.trim="form.name" placeholder="请输入英文名" />
|
309
|
-
</ElFormItem>
|
310
|
-
<ElFormItem label="标题" prop="title" :rules="{ required: true, message: '请输入页面标题', trigger: 'blur' }">
|
311
|
-
<ElInput v-model.trim="form.title" placeholder="请输入页面标题" />
|
312
|
-
</ElFormItem>
|
313
|
-
<ElFormItem label="图标">
|
314
|
-
<ElSelect v-model="form.icon" class="select_icon" placeholder="请选择图标">
|
315
|
-
<template #prefix>
|
316
|
-
<div :class="form.icon" />
|
317
|
-
</template>
|
318
|
-
<ElOption v-for="(item, index) in MenuIconList" :key="`${index}sfjhaeoir`" :value="item.label">
|
319
|
-
<div :class="item.label" />
|
320
|
-
</ElOption>
|
321
|
-
</ElSelect>
|
322
|
-
</ElFormItem>
|
323
|
-
<ElFormItem label="排序">
|
324
|
-
<ElInputNumber v-model.number="form.sort" />
|
325
|
-
</ElFormItem>
|
326
|
-
<ElFormItem label="是否显示">
|
327
|
-
<ElRadioGroup v-model="form.visible">
|
328
|
-
<ElRadio :label="1">
|
329
|
-
显示
|
330
|
-
</ElRadio>
|
331
|
-
<ElRadio :label="0">
|
332
|
-
隐藏
|
333
|
-
</ElRadio>
|
334
|
-
</ElRadioGroup>
|
335
|
-
</ElFormItem>
|
336
|
-
<ElFormItem
|
337
|
-
label="路径" prop="component" :rules="form.parentId === 0 ? {}
|
338
|
-
: { message: '请输入合法的路径, eg: /path/page', trigger: 'blur', validator: (_: any, v: string) => v.trim() === '' || /\/(.*)\/(.*)/.test(v) }
|
339
|
-
"
|
340
|
-
>
|
341
|
-
<ElInput v-model.trim="form.component" />
|
342
|
-
</ElFormItem>
|
343
|
-
</ElForm>
|
344
|
-
</template>
|
345
|
-
</YoungDialog>
|
346
|
-
</ElCard>
|
347
|
-
</template>
|
348
|
-
|
349
|
-
<style lang="scss" scoped>
|
350
|
-
:deep(.select_icon .el-input__inner) {
|
351
|
-
opacity: 0 !important;
|
352
|
-
}
|
353
|
-
</style>
|