Commit 161205d32ab3153d376cbdfa7820b904ca243e1a

Authored by 芋道源码
Committed by Gitee
2 parents 0f988268 073b3048

!375 重构代码生成 路由 优化性能

Merge pull request !375 from xingyu/dev
yudao-ui-admin-vue3/package.json
1 1 {
2 2 "name": "yudao-ui-admin-vue3",
3   - "version": "1.6.6-snapshot.1911",
  3 + "version": "1.6.6-snapshot.1912",
4 4 "description": "基于vue3、vite4、element-plus、typesScript",
5 5 "author": "xingyu",
6 6 "private": false,
... ... @@ -55,9 +55,9 @@
55 55 "xe-utils": "^3.5.7"
56 56 },
57 57 "devDependencies": {
58   - "@commitlint/cli": "^17.4.1",
59   - "@commitlint/config-conventional": "^17.4.0",
60   - "@iconify/json": "^2.2.5",
  58 + "@commitlint/cli": "^17.4.2",
  59 + "@commitlint/config-conventional": "^17.4.2",
  60 + "@iconify/json": "^2.2.6",
61 61 "@intlify/unplugin-vue-i18n": "^0.8.1",
62 62 "@purge-icons/generated": "^0.9.0",
63 63 "@types/intro.js": "^5.1.0",
... ... @@ -77,14 +77,14 @@
77 77 "eslint-config-prettier": "^8.6.0",
78 78 "eslint-define-config": "^1.14.0",
79 79 "eslint-plugin-prettier": "^4.2.1",
80   - "eslint-plugin-vue": "^9.8.0",
  80 + "eslint-plugin-vue": "^9.9.0",
81 81 "lint-staged": "^13.1.0",
82 82 "postcss": "^8.4.21",
83 83 "postcss-html": "^1.5.0",
84 84 "postcss-scss": "^4.0.6",
85 85 "prettier": "^2.8.2",
86   - "rimraf": "^3.0.2",
87   - "rollup": "^3.9.1",
  86 + "rimraf": "^4.0.4",
  87 + "rollup": "^3.10.0",
88 88 "sass": "^1.57.1",
89 89 "stylelint": "^14.16.1",
90 90 "stylelint-config-html": "^1.1.0",
... ...
yudao-ui-admin-vue3/pnpm-lock.yaml
1 1 lockfileVersion: 5.4
2 2  
3 3 specifiers:
4   - '@commitlint/cli': ^17.4.1
5   - '@commitlint/config-conventional': ^17.4.0
  4 + '@commitlint/cli': ^17.4.2
  5 + '@commitlint/config-conventional': ^17.4.2
6 6 '@iconify/iconify': ^3.0.1
7   - '@iconify/json': ^2.2.5
  7 + '@iconify/json': ^2.2.6
8 8 '@intlify/unplugin-vue-i18n': ^0.8.1
9 9 '@purge-icons/generated': ^0.9.0
10 10 '@types/intro.js': ^5.1.0
... ... @@ -36,7 +36,7 @@ specifiers:
36 36 eslint-config-prettier: ^8.6.0
37 37 eslint-define-config: ^1.14.0
38 38 eslint-plugin-prettier: ^4.2.1
39   - eslint-plugin-vue: ^9.8.0
  39 + eslint-plugin-vue: ^9.9.0
40 40 intro.js: ^6.0.0
41 41 jsencrypt: ^3.3.1
42 42 lint-staged: ^13.1.0
... ... @@ -50,8 +50,8 @@ specifiers:
50 50 prettier: ^2.8.2
51 51 qrcode: ^1.5.1
52 52 qs: ^6.11.0
53   - rimraf: ^3.0.2
54   - rollup: ^3.9.1
  53 + rimraf: ^4.0.4
  54 + rollup: ^3.10.0
55 55 sass: ^1.57.1
56 56 stylelint: ^14.16.1
57 57 stylelint-config-html: ^1.1.0
... ... @@ -114,9 +114,9 @@ dependencies:
114 114 xe-utils: 3.5.7
115 115  
116 116 devDependencies:
117   - '@commitlint/cli': 17.4.1
118   - '@commitlint/config-conventional': 17.4.0
119   - '@iconify/json': 2.2.5
  117 + '@commitlint/cli': 17.4.2
  118 + '@commitlint/config-conventional': 17.4.2
  119 + '@iconify/json': 2.2.6
120 120 '@intlify/unplugin-vue-i18n': 0.8.1_vue-i18n@9.2.2
121 121 '@purge-icons/generated': 0.9.0
122 122 '@types/intro.js': 5.1.0
... ... @@ -136,14 +136,14 @@ devDependencies:
136 136 eslint-config-prettier: 8.6.0_eslint@8.31.0
137 137 eslint-define-config: 1.14.0
138 138 eslint-plugin-prettier: 4.2.1_iu5s7nk6dw7o3tajefwfiqfmge
139   - eslint-plugin-vue: 9.8.0_eslint@8.31.0
  139 + eslint-plugin-vue: 9.9.0_eslint@8.31.0
140 140 lint-staged: 13.1.0
141 141 postcss: 8.4.21
142 142 postcss-html: 1.5.0
143 143 postcss-scss: 4.0.6_postcss@8.4.21
144 144 prettier: 2.8.2
145   - rimraf: 3.0.2
146   - rollup: 3.9.1
  145 + rimraf: 4.0.4
  146 + rollup: 3.10.0
147 147 sass: 1.57.1
148 148 stylelint: 14.16.1
149 149 stylelint-config-html: 1.1.0_kbto3rg3njmczth2rrsgfnlsqa
... ... @@ -506,15 +506,15 @@ packages:
506 506 '@babel/helper-validator-identifier': 7.19.1
507 507 to-fast-properties: 2.0.0
508 508  
509   - /@commitlint/cli/17.4.1:
510   - resolution: {integrity: sha512-W8OJwz+izY+fVwyUt1HveCDmABMZNRVZHSVPw/Bh9Y62tp11SmmQaycgbsYLMiMy7JGn4mAJqEGlSHS9Uti9ZQ==}
  509 + /@commitlint/cli/17.4.2:
  510 + resolution: {integrity: sha512-0rPGJ2O1owhpxMIXL9YJ2CgPkdrFLKZElIZHXDN8L8+qWK1DGH7Q7IelBT1pchXTYTuDlqkOTdh//aTvT3bSUA==}
511 511 engines: {node: '>=v14'}
512 512 hasBin: true
513 513 dependencies:
514 514 '@commitlint/format': 17.4.0
515   - '@commitlint/lint': 17.4.0
516   - '@commitlint/load': 17.4.1
517   - '@commitlint/read': 17.4.0
  515 + '@commitlint/lint': 17.4.2
  516 + '@commitlint/load': 17.4.2
  517 + '@commitlint/read': 17.4.2
518 518 '@commitlint/types': 17.4.0
519 519 execa: 5.1.1
520 520 lodash.isfunction: 3.0.9
... ... @@ -526,8 +526,8 @@ packages:
526 526 - '@swc/wasm'
527 527 dev: true
528 528  
529   - /@commitlint/config-conventional/17.4.0:
530   - resolution: {integrity: sha512-G4XBf45J4ZMspO4NwBFzY3g/1Kb+B42BcIxeikF8wucQxcyxcmhRdjeQpRpS1XEcBq5pdtEEQFipuB9IuiNFhw==}
  529 + /@commitlint/config-conventional/17.4.2:
  530 + resolution: {integrity: sha512-JVo1moSj5eDMoql159q8zKCU8lkOhQ+b23Vl3LVVrS6PXDLQIELnJ34ChQmFVbBdSSRNAbbXnRDhosFU+wnuHw==}
531 531 engines: {node: '>=v14'}
532 532 dependencies:
533 533 conventional-changelog-conventionalcommits: 5.0.0
... ... @@ -566,26 +566,26 @@ packages:
566 566 chalk: 4.1.2
567 567 dev: true
568 568  
569   - /@commitlint/is-ignored/17.4.0:
570   - resolution: {integrity: sha512-mkRuBlPUaBimvSvJyIHEHEW1/jP1SqEI7NOoaO9/eyJkMbsaiv5b1QgDYL4ZXlHdS64RMV7Y21MVVzuIceImDA==}
  569 + /@commitlint/is-ignored/17.4.2:
  570 + resolution: {integrity: sha512-1b2Y2qJ6n7bHG9K6h8S4lBGUl6kc7mMhJN9gy1SQfUZqe92ToDjUTtgNWb6LbzR1X8Cq4SEus4VU8Z/riEa94Q==}
571 571 engines: {node: '>=v14'}
572 572 dependencies:
573 573 '@commitlint/types': 17.4.0
574 574 semver: 7.3.8
575 575 dev: true
576 576  
577   - /@commitlint/lint/17.4.0:
578   - resolution: {integrity: sha512-HG2YT4TUbQKs9v8QvpQjJ6OK+fhflsDB8M+D5tLrY79hbQOWA9mDKdRkABsW/AAhpNI9+zeGUWF3jj245jSHKw==}
  577 + /@commitlint/lint/17.4.2:
  578 + resolution: {integrity: sha512-HcymabrdBhsDMNzIv146+ZPNBPBK5gMNsVH+el2lCagnYgCi/4ixrHooeVyS64Fgce2K26+MC7OQ4vVH8wQWVw==}
579 579 engines: {node: '>=v14'}
580 580 dependencies:
581   - '@commitlint/is-ignored': 17.4.0
582   - '@commitlint/parse': 17.4.0
583   - '@commitlint/rules': 17.4.0
  581 + '@commitlint/is-ignored': 17.4.2
  582 + '@commitlint/parse': 17.4.2
  583 + '@commitlint/rules': 17.4.2
584 584 '@commitlint/types': 17.4.0
585 585 dev: true
586 586  
587   - /@commitlint/load/17.4.1:
588   - resolution: {integrity: sha512-6A7/LhIaQpL4ieciIDcVvK2d5z/UI1GBrtDaHm6sQSCL0265clB2/F7XKQNTJHXv9yG4LByT2r+QCpM4GugIfw==}
  587 + /@commitlint/load/17.4.2:
  588 + resolution: {integrity: sha512-Si++F85rJ9t4hw6JcOw1i2h0fdpdFQt0YKwjuK4bk9KhFjyFkRxvR3SB2dPaMs+EwWlDrDBGL+ygip1QD6gmPw==}
589 589 engines: {node: '>=v14'}
590 590 dependencies:
591 591 '@commitlint/config-validator': 17.4.0
... ... @@ -607,13 +607,13 @@ packages:
607 607 - '@swc/wasm'
608 608 dev: true
609 609  
610   - /@commitlint/message/17.4.0:
611   - resolution: {integrity: sha512-USGJDU9PPxcgQjKXCzvPUal65KAhxWq3hp+MrU1pNCN2itWM654CLIoY2LMIQ7rScTli9B5dTLH3vXhzbItmzA==}
  610 + /@commitlint/message/17.4.2:
  611 + resolution: {integrity: sha512-3XMNbzB+3bhKA1hSAWPCQA3lNxR4zaeQAQcHj0Hx5sVdO6ryXtgUBGGv+1ZCLMgAPRixuc6en+iNAzZ4NzAa8Q==}
612 612 engines: {node: '>=v14'}
613 613 dev: true
614 614  
615   - /@commitlint/parse/17.4.0:
616   - resolution: {integrity: sha512-x8opKc5p+Hgs+CrMbq3VAnW2L2foPAX6arW8u9c8nTzksldGgFsENT+XVyPmpSMLlVBswZ1tndcz1xyKiY9TJA==}
  615 + /@commitlint/parse/17.4.2:
  616 + resolution: {integrity: sha512-DK4EwqhxfXpyCA+UH8TBRIAXAfmmX4q9QRBz/2h9F9sI91yt6mltTrL6TKURMcjUVmgaB80wgS9QybNIyVBIJA==}
617 617 engines: {node: '>=v14'}
618 618 dependencies:
619 619 '@commitlint/types': 17.4.0
... ... @@ -621,8 +621,8 @@ packages:
621 621 conventional-commits-parser: 3.2.4
622 622 dev: true
623 623  
624   - /@commitlint/read/17.4.0:
625   - resolution: {integrity: sha512-pGDeZpbkyvhxK8ZoCDUacPPRpauKPWF3n2XpDBEnuGreqUF2clq2PVJpwMMaNN5cHW8iFKCbcoOjXhD01sln0A==}
  624 + /@commitlint/read/17.4.2:
  625 + resolution: {integrity: sha512-hasYOdbhEg+W4hi0InmXHxtD/1favB4WdwyFxs1eOy/DvMw6+2IZBmATgGOlqhahsypk4kChhxjAFJAZ2F+JBg==}
626 626 engines: {node: '>=v14'}
627 627 dependencies:
628 628 '@commitlint/top-level': 17.4.0
... ... @@ -644,12 +644,12 @@ packages:
644 644 resolve-global: 1.0.0
645 645 dev: true
646 646  
647   - /@commitlint/rules/17.4.0:
648   - resolution: {integrity: sha512-lz3i1jet2NNjTWpAMwjjQjMZCPWBIHK1Kkja9o09UmUtMjRdALTb8uMLe8gCyeq3DiiZ5lLYOhbsoPK56xGQKA==}
  647 + /@commitlint/rules/17.4.2:
  648 + resolution: {integrity: sha512-OGrPsMb9Fx3/bZ64/EzJehY9YDSGWzp81Pj+zJiY+r/NSgJI3nUYdlS37jykNIugzazdEXfMtQ10kmA+Kx2pZQ==}
649 649 engines: {node: '>=v14'}
650 650 dependencies:
651 651 '@commitlint/ensure': 17.4.0
652   - '@commitlint/message': 17.4.0
  652 + '@commitlint/message': 17.4.2
653 653 '@commitlint/to-lines': 17.4.0
654 654 '@commitlint/types': 17.4.0
655 655 execa: 5.1.1
... ... @@ -963,8 +963,8 @@ packages:
963 963 dependencies:
964 964 '@iconify/types': 2.0.0
965 965  
966   - /@iconify/json/2.2.5:
967   - resolution: {integrity: sha512-AIbJTRF9HJz7FJ8t7058huwDXHaFEY4a4f6uuPtctEQ8/I3ybrX66iZMgoLD1kLaamU4tzZPlZ6tSpA3pM8LZg==}
  966 + /@iconify/json/2.2.6:
  967 + resolution: {integrity: sha512-fRP5PwXvX0PAGne1/xHvd6zVYiHq9dQzdvhhxamwJuNjoIVRWNNP5y465NkxybzEX94kn2JnoULkA9kbZkXoqA==}
968 968 dependencies:
969 969 '@iconify/types': 2.0.0
970 970 pathe: 1.0.0
... ... @@ -3029,8 +3029,8 @@ packages:
3029 3029 prettier-linter-helpers: 1.0.0
3030 3030 dev: true
3031 3031  
3032   - /eslint-plugin-vue/9.8.0_eslint@8.31.0:
3033   - resolution: {integrity: sha512-E/AXwcTzunyzM83C2QqDHxepMzvI2y6x+mmeYHbVDQlKFqmKYvRrhaVixEeeG27uI44p9oKDFiyCRw4XxgtfHA==}
  3032 + /eslint-plugin-vue/9.9.0_eslint@8.31.0:
  3033 + resolution: {integrity: sha512-YbubS7eK0J7DCf0U2LxvVP7LMfs6rC6UltihIgval3azO3gyDwEGVgsCMe1TmDiEkl6GdMKfRpaME6QxIYtzDQ==}
3034 3034 engines: {node: ^14.17.0 || >=16.0.0}
3035 3035 peerDependencies:
3036 3036 eslint: ^6.2.0 || ^7.0.0 || ^8.0.0
... ... @@ -3039,7 +3039,7 @@ packages:
3039 3039 eslint-utils: 3.0.0_eslint@8.31.0
3040 3040 natural-compare: 1.4.0
3041 3041 nth-check: 2.1.1
3042   - postcss-selector-parser: 6.0.10
  3042 + postcss-selector-parser: 6.0.11
3043 3043 semver: 7.3.8
3044 3044 vue-eslint-parser: 9.1.0_eslint@8.31.0
3045 3045 xml-name-validator: 4.0.0
... ... @@ -4880,14 +4880,6 @@ packages:
4880 4880 postcss: 8.4.21
4881 4881 dev: true
4882 4882  
4883   - /postcss-selector-parser/6.0.10:
4884   - resolution: {integrity: sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==}
4885   - engines: {node: '>=4'}
4886   - dependencies:
4887   - cssesc: 3.0.0
4888   - util-deprecate: 1.0.2
4889   - dev: true
4890   -
4891 4883 /postcss-selector-parser/6.0.11:
4892 4884 resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==}
4893 4885 engines: {node: '>=4'}
... ... @@ -5200,6 +5192,12 @@ packages:
5200 5192 glob: 7.2.3
5201 5193 dev: true
5202 5194  
  5195 + /rimraf/4.0.4:
  5196 + resolution: {integrity: sha512-R0hoVr9xTwemarQjoWlNt/nb5dEGVTBhVdkRmEX2zEkT8T6onH0XKiGjuaC7rNNj/gYzY2p4NVRJ3sjO1ascHQ==}
  5197 + engines: {node: '>=14'}
  5198 + hasBin: true
  5199 + dev: true
  5200 +
5203 5201 /rollup-plugin-purge-icons/0.9.1:
5204 5202 resolution: {integrity: sha512-hRDKBsPUz47UMdBufki2feTmBF2ClEJlYqL7N6vpVAHSLd7V2BJUaNKOF7YYbLMofVVF+9hm44YSkYO6k9hUgg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/rollup-plugin-purge-icons/-/rollup-plugin-purge-icons-0.9.1.tgz}
5205 5203 engines: {node: '>= 12'}
... ... @@ -5219,8 +5217,8 @@ packages:
5219 5217 fsevents: 2.3.2
5220 5218 dev: true
5221 5219  
5222   - /rollup/3.9.1:
5223   - resolution: {integrity: sha512-GswCYHXftN8ZKGVgQhTFUJB/NBXxrRGgO2NCy6E8s1rwEJ4Q9/VttNqcYfEvx4dTo4j58YqdC3OVztPzlKSX8w==}
  5220 + /rollup/3.10.0:
  5221 + resolution: {integrity: sha512-JmRYz44NjC1MjVF2VKxc0M1a97vn+cDxeqWmnwyAF4FvpjK8YFdHpaqvQB+3IxCvX05vJxKZkoMDU8TShhmJVA==}
5224 5222 engines: {node: '>=14.18.0', npm: '>=8.0.0'}
5225 5223 hasBin: true
5226 5224 optionalDependencies:
... ... @@ -6207,7 +6205,7 @@ packages:
6207 6205 esbuild: 0.16.5
6208 6206 postcss: 8.4.21
6209 6207 resolve: 1.22.1
6210   - rollup: 3.9.1
  6208 + rollup: 3.10.0
6211 6209 sass: 1.57.1
6212 6210 terser: 5.16.1
6213 6211 optionalDependencies:
... ...
yudao-ui-admin-vue3/src/components/XTable/src/style/dark.scss
... ... @@ -78,4 +78,4 @@ $vxe-modal-border-color: #3b3b3b;
78 78 /*pulldown*/
79 79 $vxe-pulldown-panel-background-color: #262626 !default;
80 80  
81   -@import 'vxe-table/styles/index';
  81 +@import 'vxe-table/styles/index.scss';
... ...
yudao-ui-admin-vue3/src/components/XTable/src/style/index.scss
1   -@import 'vxe-table/styles/variable.scss';
2   -@import 'vxe-table/styles/modules.scss';
  1 +// @import 'vxe-table/styles/variable.scss';
  2 +// @import 'vxe-table/styles/modules.scss';
3 3 // @import './theme/light.scss';
4 4 i {
5 5 border-color: initial;
... ...
yudao-ui-admin-vue3/src/components/XTable/src/style/light.scss
... ... @@ -13,4 +13,4 @@ $vxe-danger-color: #f56c6c !default;
13 13 $vxe-disabled-color: #bfbfbf !default;
14 14 $vxe-primary-disabled-color: #c0c4cc !default;
15 15  
16   -@import 'vxe-table/styles/index';
  16 +@import 'vxe-table/styles/index.scss';
... ...
yudao-ui-admin-vue3/src/main.ts
... ... @@ -35,6 +35,8 @@ import { createApp } from 'vue'
35 35  
36 36 import App from './App.vue'
37 37  
  38 +import './permission'
  39 +
38 40 // 创建实例
39 41 const setupAll = async () => {
40 42 const app = createApp(App)
... ...
yudao-ui-admin-vue3/src/permission.ts 0 → 100644
  1 +import router from './router'
  2 +import type { RouteRecordRaw } from 'vue-router'
  3 +import { isRelogin } from '@/config/axios/service'
  4 +import { getAccessToken } from '@/utils/auth'
  5 +import { useTitle } from '@/hooks/web/useTitle'
  6 +import { useNProgress } from '@/hooks/web/useNProgress'
  7 +import { usePageLoading } from '@/hooks/web/usePageLoading'
  8 +import { useDictStoreWithOut } from '@/store/modules/dict'
  9 +import { useUserStoreWithOut } from '@/store/modules/user'
  10 +import { usePermissionStoreWithOut } from '@/store/modules/permission'
  11 +
  12 +const { start, done } = useNProgress()
  13 +
  14 +const { loadStart, loadDone } = usePageLoading()
  15 +// 路由不重定向白名单
  16 +const whiteList = [
  17 + '/login',
  18 + '/social-login',
  19 + '/auth-redirect',
  20 + '/bind',
  21 + '/register',
  22 + '/oauthLogin/gitee'
  23 +]
  24 +
  25 +// 路由加载前
  26 +router.beforeEach(async (to, from, next) => {
  27 + start()
  28 + loadStart()
  29 + if (getAccessToken()) {
  30 + if (to.path === '/login') {
  31 + next({ path: '/' })
  32 + } else {
  33 + // 获取所有字典
  34 + const dictStore = useDictStoreWithOut()
  35 + const userStore = useUserStoreWithOut()
  36 + const permissionStore = usePermissionStoreWithOut()
  37 + if (!dictStore.getIsSetDict) {
  38 + dictStore.setDictMap()
  39 + }
  40 + if (!userStore.getIsSetUser) {
  41 + isRelogin.show = true
  42 + await userStore.setUserInfoAction()
  43 + isRelogin.show = false
  44 + // 后端过滤菜单
  45 + await permissionStore.generateRoutes()
  46 + permissionStore.getAddRouters.forEach((route) => {
  47 + router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表
  48 + })
  49 + const redirectPath = from.query.redirect || to.path
  50 + const redirect = decodeURIComponent(redirectPath as string)
  51 + const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }
  52 + next(nextData)
  53 + } else {
  54 + next()
  55 + }
  56 + }
  57 + } else {
  58 + if (whiteList.indexOf(to.path) !== -1) {
  59 + next()
  60 + } else {
  61 + next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
  62 + }
  63 + }
  64 +})
  65 +
  66 +router.afterEach((to) => {
  67 + useTitle(to?.meta?.title as string)
  68 + done() // 结束Progress
  69 + loadDone()
  70 +})
... ...
yudao-ui-admin-vue3/src/plugins/vxeTable/index.scss deleted
1   -@import 'vxe-table/styles/variable.scss';
2   -@import 'vxe-table/styles/modules.scss';
3   -// @import './theme/light.scss';
4   -i {
5   - border-color: initial;
6   -}
yudao-ui-admin-vue3/src/plugins/vxeTable/theme/dark.scss deleted
1   -// 修改样式变量
2   -//@import 'vxe-table/styles/variable.scss';
3   -
4   -/*font*/
5   -$vxe-font-color: #e5e7eb;
6   -// $vxe-font-size: 14px !default;
7   -// $vxe-font-size-medium: 16px !default;
8   -// $vxe-font-size-small: 14px !default;
9   -// $vxe-font-size-mini: 12px !default;
10   -
11   -/*color*/
12   -$vxe-primary-color: #409eff !default;
13   -$vxe-success-color: #67c23a !default;
14   -$vxe-info-color: #909399 !default;
15   -$vxe-warning-color: #e6a23c !default;
16   -$vxe-danger-color: #f56c6c !default;
17   -$vxe-disabled-color: #bfbfbf !default;
18   -$vxe-primary-disabled-color: #c0c4cc !default;
19   -
20   -/*loading*/
21   -$vxe-loading-color: $vxe-primary-color !default;
22   -$vxe-loading-background-color: #1d1e1f !default;
23   -$vxe-loading-z-index: 999 !default;
24   -
25   -/*icon*/
26   -$vxe-icon-font-family: Verdana, Arial, Tahoma !default;
27   -$vxe-icon-background-color: #e5e7eb !default;
28   -
29   -/*toolbar*/
30   -$vxe-toolbar-background-color: #1d1e1f !default;
31   -$vxe-toolbar-button-border: #dcdfe6 !default;
32   -$vxe-toolbar-custom-active-background-color: #d9dadb !default;
33   -$vxe-toolbar-panel-background-color: #e5e7eb !default;
34   -
35   -$vxe-table-font-color: #e5e7eb;
36   -$vxe-table-header-background-color: #1d1e1f;
37   -$vxe-table-body-background-color: #141414;
38   -$vxe-table-row-striped-background-color: #1d1d1d;
39   -$vxe-table-row-hover-background-color: #1d1e1f;
40   -$vxe-table-row-hover-striped-background-color: #1e1e1e;
41   -$vxe-table-footer-background-color: #1d1e1f;
42   -$vxe-table-row-current-background-color: #302d2d;
43   -$vxe-table-column-current-background-color: #302d2d;
44   -$vxe-table-column-hover-background-color: #302d2d;
45   -$vxe-table-row-hover-current-background-color: #302d2d;
46   -$vxe-table-row-checkbox-checked-background-color: #3e3c37 !default;
47   -$vxe-table-row-hover-checkbox-checked-background-color: #615a4a !default;
48   -$vxe-table-menu-background-color: #1d1e1f;
49   -$vxe-table-border-width: 1px !default;
50   -$vxe-table-border-color: #4c4d4f !default;
51   -$vxe-table-fixed-left-scrolling-box-shadow: 8px 0px 10px -5px rgba(0, 0, 0, 0.12) !default;
52   -$vxe-table-fixed-right-scrolling-box-shadow: -8px 0px 10px -5px rgba(0, 0, 0, 0.12) !default;
53   -
54   -$vxe-form-background-color: #141414;
55   -
56   -/*pager*/
57   -$vxe-pager-background-color: #1d1e1f !default;
58   -$vxe-pager-perfect-background-color: #262727 !default;
59   -$vxe-pager-perfect-button-background-color: #a7a3a3 !default;
60   -
61   -$vxe-input-background-color: #141414;
62   -$vxe-input-border-color: #4c4d4f !default;
63   -
64   -$vxe-select-option-hover-background-color: #262626 !default;
65   -$vxe-select-panel-background-color: #141414 !default;
66   -$vxe-select-empty-color: #262626 !default;
67   -$vxe-optgroup-title-color: #909399 !default;
68   -
69   -/*button*/
70   -$vxe-button-default-background-color: #262626;
71   -$vxe-button-dropdown-panel-background-color: #141414;
72   -
73   -/*modal*/
74   -$vxe-modal-header-background-color: #141414;
75   -$vxe-modal-body-background-color: #141414;
76   -$vxe-modal-border-color: #3b3b3b;
77   -
78   -/*pulldown*/
79   -$vxe-pulldown-panel-background-color: #262626 !default;
80   -
81   -@import 'vxe-table/styles/index';
yudao-ui-admin-vue3/src/plugins/vxeTable/theme/light.scss deleted
1   -// 修改样式变量
2   -// /*font*/
3   -// $vxe-font-size: 12px !default;
4   -// $vxe-font-size-medium: 16px !default;
5   -// $vxe-font-size-small: 14px !default;
6   -// $vxe-font-size-mini: 12px !default;
7   -/*color*/
8   -$vxe-primary-color: #409eff !default;
9   -$vxe-success-color: #67c23a !default;
10   -$vxe-info-color: #909399 !default;
11   -$vxe-warning-color: #e6a23c !default;
12   -$vxe-danger-color: #f56c6c !default;
13   -$vxe-disabled-color: #bfbfbf !default;
14   -$vxe-primary-disabled-color: #c0c4cc !default;
15   -
16   -@import 'vxe-table/styles/index.scss';
yudao-ui-admin-vue3/src/router/index.ts
... ... @@ -2,19 +2,6 @@ import type { App } from 'vue'
2 2 import type { RouteRecordRaw } from 'vue-router'
3 3 import { createRouter, createWebHashHistory } from 'vue-router'
4 4 import remainingRouter from './modules/remaining'
5   -import { isRelogin } from '@/config/axios/service'
6   -import { getAccessToken } from '@/utils/auth'
7   -import { useTitle } from '@/hooks/web/useTitle'
8   -import { useNProgress } from '@/hooks/web/useNProgress'
9   -import { usePageLoading } from '@/hooks/web/usePageLoading'
10   -import { useDictStoreWithOut } from '@/store/modules/dict'
11   -import { useUserStoreWithOut } from '@/store/modules/user'
12   -import { usePermissionStoreWithOut } from '@/store/modules/permission'
13   -import { getInfoApi } from '@/api/login'
14   -
15   -const { start, done } = useNProgress()
16   -
17   -const { loadStart, loadDone } = usePageLoading()
18 5  
19 6 // 创建路由实例
20 7 const router = createRouter({
... ... @@ -24,64 +11,6 @@ const router = createRouter({
24 11 scrollBehavior: () => ({ left: 0, top: 0 })
25 12 })
26 13  
27   -// 路由不重定向白名单
28   -const whiteList = [
29   - '/login',
30   - '/social-login',
31   - '/auth-redirect',
32   - '/bind',
33   - '/register',
34   - '/oauthLogin/gitee'
35   -]
36   -
37   -// 路由加载前
38   -router.beforeEach(async (to, from, next) => {
39   - start()
40   - loadStart()
41   - if (getAccessToken()) {
42   - if (to.path === '/login') {
43   - next({ path: '/' })
44   - } else {
45   - // 获取所有字典
46   - const dictStore = useDictStoreWithOut()
47   - const userStore = useUserStoreWithOut()
48   - const permissionStore = usePermissionStoreWithOut()
49   - if (!dictStore.getIsSetDict) {
50   - dictStore.setDictMap()
51   - }
52   - if (!userStore.getIsSetUser) {
53   - isRelogin.show = true
54   - const res = await getInfoApi()
55   - await userStore.setUserInfoAction(res)
56   - isRelogin.show = false
57   - // 后端过滤菜单
58   - await permissionStore.generateRoutes()
59   - permissionStore.getAddRouters.forEach((route) => {
60   - router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表
61   - })
62   - const redirectPath = from.query.redirect || to.path
63   - const redirect = decodeURIComponent(redirectPath as string)
64   - const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }
65   - next(nextData)
66   - } else {
67   - next()
68   - }
69   - }
70   - } else {
71   - if (whiteList.indexOf(to.path) !== -1) {
72   - next()
73   - } else {
74   - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
75   - }
76   - }
77   -})
78   -
79   -router.afterEach((to) => {
80   - useTitle(to?.meta?.title as string)
81   - done() // 结束Progress
82   - loadDone()
83   -})
84   -
85 14 export const resetRouter = (): void => {
86 15 const resetWhiteNameList = ['Redirect', 'Login', 'NoFind', 'Root']
87 16 router.getRoutes().forEach((route) => {
... ...
yudao-ui-admin-vue3/src/store/modules/user.ts
... ... @@ -2,6 +2,7 @@ import { store } from '../index'
2 2 import { defineStore } from 'pinia'
3 3 import { getAccessToken, removeToken } from '@/utils/auth'
4 4 import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
  5 +import { getInfoApi } from '@/api/login'
5 6  
6 7 const { wsCache } = useCache()
7 8  
... ... @@ -43,11 +44,15 @@ export const useUserStore = defineStore('admin-user', {
43 44 }
44 45 },
45 46 actions: {
46   - async setUserInfoAction(userInfo: UserInfoVO) {
  47 + async setUserInfoAction() {
47 48 if (!getAccessToken()) {
48 49 this.resetState()
49 50 return null
50 51 }
  52 + let userInfo = wsCache.get(CACHE_KEY.USER)
  53 + if (!userInfo) {
  54 + userInfo = await getInfoApi()
  55 + }
51 56 this.permissions = userInfo.permissions
52 57 this.roles = userInfo.roles
53 58 this.user = userInfo.user
... ...
yudao-ui-admin-vue3/src/styles/variables.scss
... ... @@ -2,3 +2,5 @@
2 2 $namespace: v;
3 3 // el命名空间
4 4 $elNamespace: el;
  5 +// vxe命名空间
  6 +$vxeNamespace: vxe;
... ...
yudao-ui-admin-vue3/src/utils/propTypes.ts
... ... @@ -17,13 +17,12 @@ const propTypes = createTypes({
17 17  
18 18 // 需要自定义扩展的类型
19 19 // see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
20   -propTypes.extend([
21   - {
22   - name: 'style',
23   - getter: true,
24   - type: [String, Object],
25   - default: undefined
26   - }
27   -])
28   -
  20 +// propTypes.extend([
  21 +// {
  22 +// name: 'style',
  23 +// getter: true,
  24 +// type: [String, Object],
  25 +// default: undefined
  26 +// }
  27 +// ])
29 28 export { propTypes }
... ...
yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue
... ... @@ -8,9 +8,6 @@
8 8 <el-tab-pane label="字段信息" name="cloum">
9 9 <CloumInfoForm ref="cloumInfoRef" :info="cloumCurrentRow" />
10 10 </el-tab-pane>
11   - <el-tab-pane label="生成信息" name="genInfo">
12   - <GenInfoForm ref="genInfoRef" :genInfo="tableCurrentRow" />
13   - </el-tab-pane>
14 11 </el-tabs>
15 12 <template #right>
16 13 <XButton
... ... @@ -30,7 +27,7 @@ import { ElTabs, ElTabPane } from &#39;element-plus&#39;
30 27 import { useI18n } from '@/hooks/web/useI18n'
31 28 import { useMessage } from '@/hooks/web/useMessage'
32 29 import { ContentDetailWrap } from '@/components/ContentDetailWrap'
33   -import { BasicInfoForm, CloumInfoForm, GenInfoForm } from './components'
  30 +import { BasicInfoForm, CloumInfoForm } from './components'
34 31 import { getCodegenTableApi, updateCodegenTableApi } from '@/api/infra/codegen'
35 32 import { CodegenTableVO, CodegenColumnVO, CodegenUpdateReqVO } from '@/api/infra/codegen/types'
36 33  
... ... @@ -40,33 +37,29 @@ const { push } = useRouter()
40 37 const { query } = useRoute()
41 38 const loading = ref(false)
42 39 const title = ref('代码生成')
43   -const activeName = ref('cloum')
  40 +const activeName = ref('basicInfo')
44 41 const cloumInfoRef = ref(null)
45 42 const tableCurrentRow = ref<CodegenTableVO>()
46 43 const cloumCurrentRow = ref<CodegenColumnVO[]>([])
47 44 const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>()
48   -const genInfoRef = ref<ComponentRef<typeof GenInfoForm>>()
49 45  
50 46 const getList = async () => {
51 47 const id = query.id as unknown as number
52 48 if (id) {
53 49 // 获取表详细信息
54 50 const res = await getCodegenTableApi(id)
55   - tableCurrentRow.value = res.table
56 51 title.value = '修改[ ' + res.table.tableName + ' ]生成配置'
  52 + tableCurrentRow.value = res.table
57 53 cloumCurrentRow.value = res.columns
58 54 }
59 55 }
60 56 const submitForm = async () => {
61 57 const basicInfo = unref(basicInfoRef)
62   - const genInfo = unref(genInfoRef)
63 58 const basicForm = await basicInfo?.elFormRef?.validate()?.catch(() => {})
64   - const genForm = await genInfo?.elFormRef?.validate()?.catch(() => {})
65   - if (basicForm && genForm) {
  59 + if (basicForm) {
66 60 const basicInfoData = (await basicInfo?.getFormData()) as CodegenTableVO
67   - const genInfoData = (await genInfo?.getFormData()) as CodegenTableVO
68 61 const genTable: CodegenUpdateReqVO = {
69   - table: Object.assign({}, basicInfoData, genInfoData),
  62 + table: basicInfoData,
70 63 columns: cloumCurrentRow.value
71 64 }
72 65 await updateCodegenTableApi(genTable)
... ...
yudao-ui-admin-vue3/src/views/infra/codegen/components/BasicInfoForm.vue
... ... @@ -2,26 +2,60 @@
2 2 <Form :rules="rules" @register="register" />
3 3 </template>
4 4 <script setup lang="ts">
5   -import { PropType, reactive, watch } from 'vue'
  5 +import { onMounted, PropType, reactive, ref, watch } from 'vue'
6 6 import { required } from '@/utils/formRules'
7 7 import { useForm } from '@/hooks/web/useForm'
8 8 import { Form } from '@/components/Form'
9 9 import { FormSchema } from '@/types/form'
10 10 import { CodegenTableVO } from '@/api/infra/codegen/types'
  11 +import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  12 +import { listSimpleMenusApi } from '@/api/system/menu'
  13 +import { handleTree, defaultProps } from '@/utils/tree'
  14 +
11 15 const props = defineProps({
12 16 basicInfo: {
13 17 type: Object as PropType<Nullable<CodegenTableVO>>,
14 18 default: () => null
15 19 }
16 20 })
  21 +
  22 +const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
  23 +const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
  24 +const menuOptions = ref<any>([]) // 树形结构
  25 +const getTree = async () => {
  26 + const res = await listSimpleMenusApi()
  27 + menuOptions.value = handleTree(res)
  28 +}
  29 +
17 30 const rules = reactive({
18 31 tableName: [required],
19 32 tableComment: [required],
20 33 className: [required],
21   - author: [required]
  34 + author: [required],
  35 + templateType: [required],
  36 + scene: [required],
  37 + moduleName: [required],
  38 + businessName: [required],
  39 + businessPackage: [required],
  40 + classComment: [required]
22 41 })
23 42 const schema = reactive<FormSchema[]>([
24 43 {
  44 + label: '上级菜单',
  45 + field: 'parentMenuId',
  46 + component: 'TreeSelect',
  47 + componentProps: {
  48 + data: menuOptions,
  49 + props: defaultProps,
  50 + checkStrictly: true,
  51 + nodeKey: 'id'
  52 + },
  53 + labelMessage: '分配到指定菜单下,例如 系统管理',
  54 + colProps: {
  55 + span: 24
  56 + }
  57 + },
  58 + {
25 59 label: '表名称',
26 60 field: 'tableName',
27 61 component: 'Input',
... ... @@ -46,6 +80,64 @@ const schema = reactive&lt;FormSchema[]&gt;([
46 80 }
47 81 },
48 82 {
  83 + label: '类名称',
  84 + field: 'className',
  85 + component: 'Input',
  86 + labelMessage: '类名称(首字母大写),例如SysUser、SysMenu、SysDictData 等等',
  87 + colProps: {
  88 + span: 12
  89 + }
  90 + },
  91 + {
  92 + label: '生成模板',
  93 + field: 'templateType',
  94 + component: 'Select',
  95 + componentProps: {
  96 + options: templateTypeOptions
  97 + },
  98 + colProps: {
  99 + span: 12
  100 + }
  101 + },
  102 + {
  103 + label: '生成场景',
  104 + field: 'scene',
  105 + component: 'Select',
  106 + componentProps: {
  107 + options: sceneOptions
  108 + },
  109 + colProps: {
  110 + span: 12
  111 + }
  112 + },
  113 + {
  114 + label: '模块名',
  115 + field: 'moduleName',
  116 + component: 'Input',
  117 + labelMessage: '模块名,即一级目录,例如 system、infra、tool 等等',
  118 + colProps: {
  119 + span: 12
  120 + }
  121 + },
  122 + {
  123 + label: '业务名',
  124 + field: 'businessName',
  125 + component: 'Input',
  126 + labelMessage: '业务名,即二级目录,例如 user、permission、dict 等等',
  127 + colProps: {
  128 + span: 12
  129 + }
  130 + },
  131 + {
  132 + label: '类描述',
  133 + field: 'classComment',
  134 + component: 'Input',
  135 + labelMessage: '用作类描述,例如 用户',
  136 + colProps: {
  137 + span: 12
  138 + }
  139 + },
  140 + {
49 141 label: '作者',
50 142 field: 'author',
51 143 component: 'Input',
... ... @@ -62,7 +154,7 @@ const schema = reactive&lt;FormSchema[]&gt;([
62 154 rows: 4
63 155 },
64 156 colProps: {
65   - span: 12
  157 + span: 24
66 158 }
67 159 }
68 160 ])
... ... @@ -81,6 +173,10 @@ watch(
81 173 immediate: true
82 174 }
83 175 )
  176 +// ========== 初始化 ==========
  177 +onMounted(async () => {
  178 + await getTree()
  179 +})
84 180  
85 181 defineExpose({
86 182 elFormRef,
... ...
yudao-ui-admin-vue3/src/views/infra/codegen/components/CloumInfoForm.vue
1 1 <template>
2 2 <vxe-table
3 3 ref="dragTable"
  4 + border
4 5 :data="info"
5 6 max-height="600"
6 7 stripe
7 8 class="xtable-scrollbar"
8 9 :column-config="{ resizable: true }"
9 10 >
10   - <vxe-column title="字段列名" field="columnName" fixed="left" width="80" />
11   - <vxe-column title="字段描述" field="columnComment">
12   - <template #default="{ row }">
13   - <el-input v-model="row.columnComment" />
14   - </template>
15   - </vxe-column>
16   - <vxe-column title="物理类型" field="dataType" width="10%" />
17   - <vxe-column title="Java类型" width="10%" field="javaType">
18   - <template #default="{ row }">
19   - <el-select v-model="row.javaType">
20   - <el-option label="Long" value="Long" />
21   - <el-option label="String" value="String" />
22   - <el-option label="Integer" value="Integer" />
23   - <el-option label="Double" value="Double" />
24   - <el-option label="BigDecimal" value="BigDecimal" />
25   - <el-option label="LocalDateTime" value="LocalDateTime" />
26   - <el-option label="Boolean" value="Boolean" />
27   - </el-select>
28   - </template>
29   - </vxe-column>
30   - <vxe-column title="java属性" width="10%" field="javaField">
31   - <template #default="{ row }">
32   - <el-input v-model="row.javaField" />
33   - </template>
34   - </vxe-column>
35   - <vxe-column title="插入" width="4%" field="createOperation">
36   - <template #default="{ row }">
37   - <vxe-checkbox true-label="true" false-label="false" v-model="row.createOperation" />
38   - </template>
39   - </vxe-column>
40   - <vxe-column title="编辑" width="4%" field="updateOperation">
41   - <template #default="{ row }">
42   - <vxe-checkbox true-label="true" false-label="false" v-model="row.updateOperation" />
43   - </template>
44   - </vxe-column>
45   - <vxe-column title="列表" width="4%" field="listOperationResult">
46   - <template #default="{ row }">
47   - <vxe-checkbox true-label="true" false-label="false" v-model="row.listOperationResult" />
48   - </template>
49   - </vxe-column>
50   - <vxe-column title="查询" width="4%" field="listOperation">
51   - <template #default="{ row }">
52   - <vxe-checkbox true-label="true" false-label="false" v-model="row.listOperation" />
53   - </template>
54   - </vxe-column>
55   - <vxe-column title="查询方式" width="8%" field="listOperationCondition">
56   - <template #default="{ row }">
57   - <el-select v-model="row.listOperationCondition">
58   - <el-option label="=" value="=" />
59   - <el-option label="!=" value="!=" />
60   - <el-option label=">" value=">" />
61   - <el-option label=">=" value=">=" />
62   - <el-option label="<" value="<>" />
63   - <el-option label="<=" value="<=" />
64   - <el-option label="LIKE" value="LIKE" />
65   - <el-option label="BETWEEN" value="BETWEEN" />
66   - </el-select>
67   - </template>
68   - </vxe-column>
69   - <vxe-column title="允许空" width="4%" field="nullable">
70   - <template #default="{ row }">
71   - <vxe-checkbox true-label="true" false-label="false" v-model="row.nullable" />
72   - </template>
73   - </vxe-column>
  11 + <vxe-column title="字段列名" field="columnName" fixed="left" width="10%" />
  12 + <vxe-colgroup title="基础属性">
  13 + <vxe-column title="字段描述" field="columnComment" width="10%">
  14 + <template #default="{ row }">
  15 + <vxe-input v-model="row.columnComment" placeholder="请输入字段描述" />
  16 + </template>
  17 + </vxe-column>
  18 + <vxe-column title="物理类型" field="dataType" width="10%" />
  19 + <vxe-column title="Java类型" width="10%" field="javaType">
  20 + <template #default="{ row }">
  21 + <vxe-select v-model="row.javaType" placeholder="请选择Java类型">
  22 + <vxe-option label="Long" value="Long" />
  23 + <vxe-option label="String" value="String" />
  24 + <vxe-option label="Integer" value="Integer" />
  25 + <vxe-option label="Double" value="Double" />
  26 + <vxe-option label="BigDecimal" value="BigDecimal" />
  27 + <vxe-option label="LocalDateTime" value="LocalDateTime" />
  28 + <vxe-option label="Boolean" value="Boolean" />
  29 + </vxe-select>
  30 + </template>
  31 + </vxe-column>
  32 + <vxe-column title="java属性" width="8%" field="javaField">
  33 + <template #default="{ row }">
  34 + <vxe-input v-model="row.javaField" placeholder="请输入java属性" />
  35 + </template>
  36 + </vxe-column>
  37 + </vxe-colgroup>
  38 + <vxe-colgroup title="增删改查">
  39 + <vxe-column title="插入" width="40px" field="createOperation">
  40 + <template #default="{ row }">
  41 + <vxe-checkbox true-label="true" false-label="false" v-model="row.createOperation" />
  42 + </template>
  43 + </vxe-column>
  44 + <vxe-column title="编辑" width="40px" field="updateOperation">
  45 + <template #default="{ row }">
  46 + <vxe-checkbox true-label="true" false-label="false" v-model="row.updateOperation" />
  47 + </template>
  48 + </vxe-column>
  49 + <vxe-column title="列表" width="40px" field="listOperationResult">
  50 + <template #default="{ row }">
  51 + <vxe-checkbox true-label="true" false-label="false" v-model="row.listOperationResult" />
  52 + </template>
  53 + </vxe-column>
  54 + <vxe-column title="查询" width="40px" field="listOperation">
  55 + <template #default="{ row }">
  56 + <vxe-checkbox true-label="true" false-label="false" v-model="row.listOperation" />
  57 + </template>
  58 + </vxe-column>
  59 + <vxe-column title="允许空" width="40px" field="nullable">
  60 + <template #default="{ row }">
  61 + <vxe-checkbox true-label="true" false-label="false" v-model="row.nullable" />
  62 + </template>
  63 + </vxe-column>
  64 + <vxe-column title="查询方式" width="60px" field="listOperationCondition">
  65 + <template #default="{ row }">
  66 + <vxe-select v-model="row.listOperationCondition" placeholder="请选择查询方式">
  67 + <vxe-option label="=" value="=" />
  68 + <vxe-option label="!=" value="!=" />
  69 + <vxe-option label=">" value=">" />
  70 + <vxe-option label=">=" value=">=" />
  71 + <vxe-option label="<" value="<>" />
  72 + <vxe-option label="<=" value="<=" />
  73 + <vxe-option label="LIKE" value="LIKE" />
  74 + <vxe-option label="BETWEEN" value="BETWEEN" />
  75 + </vxe-select>
  76 + </template>
  77 + </vxe-column>
  78 + </vxe-colgroup>
74 79 <vxe-column title="显示类型" width="10%" field="htmlType">
75 80 <template #default="{ row }">
76   - <el-select v-model="row.htmlType">
77   - <el-option label="文本框" value="input" />
78   - <el-option label="文本域" value="textarea" />
79   - <el-option label="下拉框" value="select" />
80   - <el-option label="单选框" value="radio" />
81   - <el-option label="复选框" value="checkbox" />
82   - <el-option label="日期控件" value="datetime" />
83   - <el-option label="图片上传" value="imageUpload" />
84   - <el-option label="文件上传" value="fileUpload" />
85   - <el-option label="富文本控件" value="editor" />
86   - </el-select>
  81 + <vxe-select v-model="row.htmlType" placeholder="请选择显示类型">
  82 + <vxe-option label="文本框" value="input" />
  83 + <vxe-option label="文本域" value="textarea" />
  84 + <vxe-option label="下拉框" value="select" />
  85 + <vxe-option label="单选框" value="radio" />
  86 + <vxe-option label="复选框" value="checkbox" />
  87 + <vxe-option label="日期控件" value="datetime" />
  88 + <vxe-option label="图片上传" value="imageUpload" />
  89 + <vxe-option label="文件上传" value="fileUpload" />
  90 + <vxe-option label="富文本控件" value="editor" />
  91 + </vxe-select>
87 92 </template>
88 93 </vxe-column>
89 94 <vxe-column title="字典类型" width="10%" field="dictType">
90 95 <template #default="{ row }">
91   - <el-select v-model="row.dictType" clearable filterable placeholder="请选择">
92   - <el-option
  96 + <vxe-select v-model="row.dictType" clearable filterable placeholder="请选择字典类型">
  97 + <vxe-option
93 98 v-for="dict in dictOptions"
94 99 :key="dict.id"
95 100 :label="dict.name"
96 101 :value="dict.type"
97 102 />
98   - </el-select>
  103 + </vxe-select>
99 104 </template>
100 105 </vxe-column>
101 106 <vxe-column title="示例" field="example">
102 107 <template #default="{ row }">
103   - <el-input v-model="row.example" />
  108 + <vxe-input v-model="row.example" placeholder="请输入示例" />
104 109 </template>
105 110 </vxe-column>
106 111 </vxe-table>
107 112 </template>
108 113 <script setup lang="ts">
109 114 import { onMounted, PropType, ref } from 'vue'
110   -import { ElInput, ElSelect, ElOption } from 'element-plus'
111 115 import { DictTypeVO } from '@/api/system/dict/types'
112 116 import { CodegenColumnVO } from '@/api/infra/codegen/types'
113 117 import { listSimpleDictTypeApi } from '@/api/system/dict/dict.type'
... ...
yudao-ui-admin-vue3/src/views/infra/codegen/components/GenInfoForm.vue deleted
1   -<template>
2   - <Form :rules="rules" @register="register" />
3   -</template>
4   -<script setup lang="ts">
5   -import { onMounted, PropType, reactive, ref, watch } from 'vue'
6   -import { Form } from '@/components/Form'
7   -import { useForm } from '@/hooks/web/useForm'
8   -import { required } from '@/utils/formRules'
9   -import { handleTree, defaultProps } from '@/utils/tree'
10   -import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
11   -import { listSimpleMenusApi } from '@/api/system/menu'
12   -import { CodegenTableVO } from '@/api/infra/codegen/types'
13   -import { FormSchema } from '@/types/form'
14   -const props = defineProps({
15   - genInfo: {
16   - type: Object as PropType<Nullable<CodegenTableVO>>,
17   - default: () => null
18   - }
19   -})
20   -const rules = reactive({
21   - templateType: [required],
22   - scene: [required],
23   - moduleName: [required],
24   - businessName: [required],
25   - businessPackage: [required],
26   - className: [required],
27   - classComment: [required]
28   -})
29   -const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
30   -const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
31   -const menuOptions = ref<any>([]) // 树形结构
32   -const getTree = async () => {
33   - const res = await listSimpleMenusApi()
34   - menuOptions.value = handleTree(res)
35   -}
36   -const schema = reactive<FormSchema[]>([
37   - {
38   - label: '生成模板',
39   - field: 'templateType',
40   - component: 'Select',
41   - componentProps: {
42   - options: templateTypeOptions
43   - },
44   - colProps: {
45   - span: 12
46   - }
47   - },
48   - {
49   - label: '生成场景',
50   - field: 'scene',
51   - component: 'Select',
52   - componentProps: {
53   - options: sceneOptions
54   - },
55   - colProps: {
56   - span: 12
57   - }
58   - },
59   - {
60   - label: '模块名',
61   - field: 'moduleName',
62   - component: 'Input',
63   - labelMessage: '模块名,即一级目录,例如 system、infra、tool 等等',
64   - colProps: {
65   - span: 12
66   - }
67   - },
68   - {
69   - label: '业务名',
70   - field: 'businessName',
71   - component: 'Input',
72   - labelMessage: '业务名,即二级目录,例如 user、permission、dict 等等',
73   - colProps: {
74   - span: 12
75   - }
76   - },
77   - {
78   - label: '类名称',
79   - field: 'className',
80   - component: 'Input',
81   - labelMessage: '类名称(首字母大写),例如SysUser、SysMenu、SysDictData 等等',
82   - colProps: {
83   - span: 12
84   - }
85   - },
86   - {
87   - label: '类描述',
88   - field: 'classComment',
89   - component: 'Input',
90   - labelMessage: '用作类描述,例如 用户',
91   - colProps: {
92   - span: 12
93   - }
94   - },
95   - {
96   - label: '上级菜单',
97   - field: 'parentMenuId',
98   - component: 'TreeSelect',
99   - componentProps: {
100   - data: menuOptions,
101   - props: defaultProps,
102   - checkStrictly: true,
103   - nodeKey: 'id'
104   - },
105   - labelMessage: '分配到指定菜单下,例如 系统管理',
106   - colProps: {
107   - span: 12
108   - }
109   - }
110   -])
111   -const { register, methods, elFormRef } = useForm({
112   - schema
113   -})
114   -
115   -// ========== 初始化 ==========
116   -onMounted(async () => {
117   - await getTree()
118   -})
119   -watch(
120   - () => props.genInfo,
121   - (genInfo) => {
122   - if (!genInfo) return
123   - const { setValues } = methods
124   - setValues(genInfo)
125   - },
126   - {
127   - deep: true,
128   - immediate: true
129   - }
130   -)
131   -defineExpose({
132   - elFormRef,
133   - getFormData: methods.getFormData
134   -})
135   -</script>
yudao-ui-admin-vue3/src/views/infra/codegen/components/index.ts
1 1 import BasicInfoForm from './BasicInfoForm.vue'
2 2 import CloumInfoForm from './CloumInfoForm.vue'
3   -import GenInfoForm from './GenInfoForm.vue'
4 3 import ImportTable from './ImportTable.vue'
5 4 import Preview from './Preview.vue'
6   -export { BasicInfoForm, CloumInfoForm, GenInfoForm, ImportTable, Preview }
  5 +export { BasicInfoForm, CloumInfoForm, ImportTable, Preview }
... ...
yudao-ui-admin-vue3/src/views/system/dept/index.vue
... ... @@ -167,6 +167,7 @@ const submitForm = async () =&gt; {
167 167 dialogVisible.value = false
168 168 } finally {
169 169 actionLoading.value = false
  170 + await getTree()
170 171 await reload()
171 172 }
172 173 }
... ...