From 216b32ccbeb911105db86924be91ad8641cc6c7b Mon Sep 17 00:00:00 2001 From: bqy_fe <1743369777@qq.com> Date: Tue, 4 Jan 2022 00:32:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 16 + package.json | 12 +- src/App.vue | 24 +- src/assets/icons/locale.svg | 14 + src/components/SuspenseWithError.vue | 23 - src/components/a-custom-modal/index.ts | 1 - src/components/basic/README.md | 6 + .../{BasicHelp.vue => basic-help/index.vue} | 0 src/components/{ => basic}/button/button.vue | 4 +- src/components/{ => basic}/button/index.ts | 0 .../{ => basic}/button/styles/index.less | 0 .../button/styles/setButtonColor.less | 4 +- .../{ => basic}/button/styles/success.less | 0 .../{ => basic}/button/styles/warning.less | 0 .../{ => basic}/check-box/index.vue | 0 .../{ => basic}/context-menu/index.vue | 0 .../{ => basic}/context-menu/props.ts | 0 .../{ => basic}/context-menu/types.ts | 0 .../{ => basic}/iconfont/icon-font.tsx | 0 src/components/{ => basic}/iconfont/index.ts | 0 .../{ => basic}/icons-select/icons.json | 0 .../{ => basic}/icons-select/index.vue | 2 +- .../{ => basic}/image-preview/index.tsx | 0 src/components/basic/locale-picker/index.ts | 1 + src/components/basic/locale-picker/index.vue | 60 ++ .../{ => basic}/lockscreen/huawei-charge.vue | 0 .../{ => basic}/lockscreen/index.ts | 0 .../{ => basic}/lockscreen/index.vue | 0 .../{ => basic}/lockscreen/lockscreen.vue | 0 .../{ => basic}/lockscreen/xiaomi-charge.vue | 0 src/components/{ => basic}/progress/index.vue | 0 .../{ => basic}/split-panel/index.ts | 0 .../{ => basic}/split-panel/index.vue | 0 src/components/{ => basic}/svg-icon/index.ts | 0 src/components/basic/svg-icon/svg-icon.vue | 51 ++ src/components/basic/title-i18n/index.ts | 1 + src/components/basic/title-i18n/index.vue | 27 + src/components/business/README.md | 3 + src/components/core/README.md | 7 + src/components/core/draggable-modal/index.ts | 1 + .../draggable-modal}/index.vue | 0 .../dynamic-table/components/index.ts | 0 .../components/query-form/index.vue | 4 +- .../dynamic-table/components/table-action.vue | 0 .../table-settings/column-setting.vue | 2 +- .../components/table-settings/index.vue | 0 .../table-settings/refresh-setting.vue | 0 .../table-settings/size-setting.vue | 0 .../components/tool-bar/index.vue | 2 +- .../dynamic-table/dynamic-table.vue | 0 .../{ => core}/dynamic-table/hooks/index.ts | 0 .../dynamic-table/hooks/useExpandLoading.ts | 0 .../dynamic-table/hooks/usePagination.ts | 0 .../dynamic-table/hooks/useTableContext.ts | 0 .../{ => core}/dynamic-table/index.ts | 0 .../{ => core}/dynamic-table/props.ts | 0 .../dynamic-table/types/tableAction.ts | 0 .../{ => core}/dynamic-table/typing.ts | 2 +- .../schema-form}/componentMap.ts | 0 .../schema-form}/helper.ts | 2 +- .../schema-form}/hooks/useLabelWidth.ts | 0 .../schema-form}/index.ts | 0 .../schema-form}/schema-form-item.vue | 2 +- .../schema-form}/schema-form.vue | 0 .../schema-form}/types/form.ts | 0 .../schema-form}/types/formItem.ts | 0 .../schema-form}/types/hooks.ts | 0 .../schema-form}/types/index.ts | 0 src/components/preview-modal.vue | 237 ------- src/components/svg-icon/svg-icon.vue | 51 -- src/enums/cacheEnum.ts | 3 + src/hooks/functions/useContextMenu.ts | 4 +- src/hooks/useI18n.ts | 27 + src/hooks/useModal/modal.tsx | 10 +- src/hooks/useModal/useFormModal.tsx | 4 +- .../header/components/fullscreen/index.vue | 24 + src/layout/header/components/index.ts | 5 +- src/layout/header/components/search/index.vue | 83 +-- src/layout/header/index.vue | 126 +--- src/layout/index.vue | 2 +- src/layout/menu/menu-item.vue | 10 +- src/layout/tabs/tabs-view.vue | 7 +- src/locales/config.ts | 21 + src/locales/helper.ts | 37 + src/locales/index.ts | 38 ++ src/locales/lang/en-US/common.ts | 20 + src/locales/lang/en-US/layout.ts | 115 ++++ src/locales/lang/en-US/routes/basic.ts | 4 + src/locales/lang/en-US/routes/dashboard.ts | 6 + src/locales/lang/en-US/routes/demo.ts | 16 + src/locales/lang/en_US.ts | 13 + src/locales/lang/zh-CN/common.ts | 20 + src/locales/lang/zh-CN/layout.ts | 115 ++++ src/locales/lang/zh-CN/routes/basic.ts | 4 + src/locales/lang/zh-CN/routes/dashboard.ts | 6 + src/locales/lang/zh-CN/routes/demo.ts | 16 + src/locales/lang/zh_CN.ts | 11 + src/locales/useLocale.ts | 68 ++ src/main.ts | 4 + src/plugins/antd.ts | 2 +- src/plugins/customComponents.ts | 4 +- src/router/generator-router.tsx | 6 +- src/router/outsideLayout.ts | 2 +- src/router/router-guards.ts | 1 - src/router/staticModules/dashboard.ts | 9 +- src/router/staticModules/demos.ts | 42 +- src/router/staticModules/error.ts | 4 +- src/store/modules/keepAlive.ts | 7 +- src/store/modules/locale.ts | 32 + src/store/modules/lockscreen.ts | 5 + src/store/modules/tabsView.ts | 6 + src/store/modules/user.ts | 6 + src/store/modules/ws.ts | 6 + .../{shared => }/dashboard/welcome/index.vue | 0 src/views/{shared => }/demos/button.vue | 8 +- src/views/{shared => }/demos/custom-modal.vue | 10 +- .../demos/form/basic-form/form-schema.ts | 2 +- .../demos/form/basic-form/index.vue | 2 +- .../demos/form/rule-form/form-schema.ts | 2 +- .../demos/form/rule-form/index.vue | 2 +- .../{shared => }/demos/icons/Iconfont.vue | 23 +- .../demos/tables/lol-table/columns.tsx | 4 +- .../demos/tables/lol-table/heroInfo.vue | 0 .../demos/tables/lol-table/index.vue | 2 +- .../demos/tables/wzry-table/columns.tsx | 4 +- .../demos/tables/wzry-table/index.vue | 2 +- src/views/{shared => }/error/404.vue | 0 src/views/{shared => }/login/index.vue | 4 +- src/views/shared/icons/icons.ts | 357 ---------- src/views/shared/icons/index.vue | 60 -- src/views/system/monitor/login-log/index.vue | 2 +- src/views/system/monitor/online/index.vue | 2 +- src/views/system/monitor/req-log/index.vue | 2 +- src/views/system/monitor/serve/index.vue | 6 +- src/views/system/permission/menu/columns.tsx | 2 +- .../system/permission/menu/formSchemas.ts | 4 +- src/views/system/permission/menu/index.vue | 2 +- src/views/system/permission/role/columns.tsx | 2 +- .../system/permission/role/formSchemas.ts | 2 +- src/views/system/permission/role/index.vue | 2 +- src/views/system/permission/user/columns.tsx | 2 +- .../system/permission/user/formSchemas.ts | 2 +- src/views/system/permission/user/index.vue | 8 +- src/views/system/schedule/log/index.vue | 2 +- src/views/system/schedule/task/columns.tsx | 2 +- src/views/system/schedule/task/formSchemas.ts | 2 +- src/views/system/schedule/task/index.vue | 2 +- tsconfig.json | 5 +- types/utils.d.ts | 1 + types/vue-router.d.ts | 8 +- vue.config.js | 9 +- yarn.lock | 635 +++++++++++++++++- 152 files changed, 1645 insertions(+), 1051 deletions(-) create mode 100644 .editorconfig create mode 100644 src/assets/icons/locale.svg delete mode 100644 src/components/SuspenseWithError.vue delete mode 100644 src/components/a-custom-modal/index.ts create mode 100644 src/components/basic/README.md rename src/components/basic/{BasicHelp.vue => basic-help/index.vue} (100%) rename src/components/{ => basic}/button/button.vue (94%) rename src/components/{ => basic}/button/index.ts (100%) rename src/components/{ => basic}/button/styles/index.less (100%) rename src/components/{ => basic}/button/styles/setButtonColor.less (89%) rename src/components/{ => basic}/button/styles/success.less (100%) rename src/components/{ => basic}/button/styles/warning.less (100%) rename src/components/{ => basic}/check-box/index.vue (100%) rename src/components/{ => basic}/context-menu/index.vue (100%) rename src/components/{ => basic}/context-menu/props.ts (100%) rename src/components/{ => basic}/context-menu/types.ts (100%) rename src/components/{ => basic}/iconfont/icon-font.tsx (100%) rename src/components/{ => basic}/iconfont/index.ts (100%) rename src/components/{ => basic}/icons-select/icons.json (100%) rename src/components/{ => basic}/icons-select/index.vue (96%) rename src/components/{ => basic}/image-preview/index.tsx (100%) create mode 100644 src/components/basic/locale-picker/index.ts create mode 100644 src/components/basic/locale-picker/index.vue rename src/components/{ => basic}/lockscreen/huawei-charge.vue (100%) rename src/components/{ => basic}/lockscreen/index.ts (100%) rename src/components/{ => basic}/lockscreen/index.vue (100%) rename src/components/{ => basic}/lockscreen/lockscreen.vue (100%) rename src/components/{ => basic}/lockscreen/xiaomi-charge.vue (100%) rename src/components/{ => basic}/progress/index.vue (100%) rename src/components/{ => basic}/split-panel/index.ts (100%) rename src/components/{ => basic}/split-panel/index.vue (100%) rename src/components/{ => basic}/svg-icon/index.ts (100%) create mode 100644 src/components/basic/svg-icon/svg-icon.vue create mode 100644 src/components/basic/title-i18n/index.ts create mode 100644 src/components/basic/title-i18n/index.vue create mode 100644 src/components/business/README.md create mode 100644 src/components/core/README.md create mode 100644 src/components/core/draggable-modal/index.ts rename src/components/{a-custom-modal => core/draggable-modal}/index.vue (100%) rename src/components/{ => core}/dynamic-table/components/index.ts (100%) rename src/components/{ => core}/dynamic-table/components/query-form/index.vue (96%) rename src/components/{ => core}/dynamic-table/components/table-action.vue (100%) rename src/components/{ => core}/dynamic-table/components/table-settings/column-setting.vue (98%) rename src/components/{ => core}/dynamic-table/components/table-settings/index.vue (100%) rename src/components/{ => core}/dynamic-table/components/table-settings/refresh-setting.vue (100%) rename src/components/{ => core}/dynamic-table/components/table-settings/size-setting.vue (100%) rename src/components/{ => core}/dynamic-table/components/tool-bar/index.vue (93%) rename src/components/{ => core}/dynamic-table/dynamic-table.vue (100%) rename src/components/{ => core}/dynamic-table/hooks/index.ts (100%) rename src/components/{ => core}/dynamic-table/hooks/useExpandLoading.ts (100%) rename src/components/{ => core}/dynamic-table/hooks/usePagination.ts (100%) rename src/components/{ => core}/dynamic-table/hooks/useTableContext.ts (100%) rename src/components/{ => core}/dynamic-table/index.ts (100%) rename src/components/{ => core}/dynamic-table/props.ts (100%) rename src/components/{ => core}/dynamic-table/types/tableAction.ts (100%) rename src/components/{ => core}/dynamic-table/typing.ts (94%) rename src/components/{JSON-schema-form => core/schema-form}/componentMap.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/helper.ts (97%) rename src/components/{JSON-schema-form => core/schema-form}/hooks/useLabelWidth.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/index.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/schema-form-item.vue (99%) rename src/components/{JSON-schema-form => core/schema-form}/schema-form.vue (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/form.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/formItem.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/hooks.ts (100%) rename src/components/{JSON-schema-form => core/schema-form}/types/index.ts (100%) delete mode 100644 src/components/preview-modal.vue delete mode 100644 src/components/svg-icon/svg-icon.vue create mode 100644 src/hooks/useI18n.ts create mode 100644 src/layout/header/components/fullscreen/index.vue create mode 100644 src/locales/config.ts create mode 100644 src/locales/helper.ts create mode 100644 src/locales/index.ts create mode 100644 src/locales/lang/en-US/common.ts create mode 100644 src/locales/lang/en-US/layout.ts create mode 100644 src/locales/lang/en-US/routes/basic.ts create mode 100644 src/locales/lang/en-US/routes/dashboard.ts create mode 100644 src/locales/lang/en-US/routes/demo.ts create mode 100644 src/locales/lang/en_US.ts create mode 100644 src/locales/lang/zh-CN/common.ts create mode 100644 src/locales/lang/zh-CN/layout.ts create mode 100644 src/locales/lang/zh-CN/routes/basic.ts create mode 100644 src/locales/lang/zh-CN/routes/dashboard.ts create mode 100644 src/locales/lang/zh-CN/routes/demo.ts create mode 100644 src/locales/lang/zh_CN.ts create mode 100644 src/locales/useLocale.ts create mode 100644 src/store/modules/locale.ts rename src/views/{shared => }/dashboard/welcome/index.vue (100%) rename src/views/{shared => }/demos/button.vue (83%) rename src/views/{shared => }/demos/custom-modal.vue (82%) rename src/views/{shared => }/demos/form/basic-form/form-schema.ts (98%) rename src/views/{shared => }/demos/form/basic-form/index.vue (94%) rename src/views/{shared => }/demos/form/rule-form/form-schema.ts (98%) rename src/views/{shared => }/demos/form/rule-form/index.vue (94%) rename src/views/{shared => }/demos/icons/Iconfont.vue (79%) rename src/views/{shared => }/demos/tables/lol-table/columns.tsx (88%) rename src/views/{shared => }/demos/tables/lol-table/heroInfo.vue (100%) rename src/views/{shared => }/demos/tables/lol-table/index.vue (92%) rename src/views/{shared => }/demos/tables/wzry-table/columns.tsx (88%) rename src/views/{shared => }/demos/tables/wzry-table/index.vue (96%) rename src/views/{shared => }/error/404.vue (100%) rename src/views/{shared => }/login/index.vue (97%) delete mode 100644 src/views/shared/icons/icons.ts delete mode 100644 src/views/shared/icons/index.vue create mode 100644 types/utils.d.ts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..7e3649acc --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/package.json b/package.json index cfebc7320..c4844896a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "prepare": "husky install", + "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", + "postversion": "git push && git push origin --tags", "test prod cors": "npx http-server dist --cors --gzip -P http://29135jo738.zicp.vip", "test prod gzip": "npx http-server dist --cors --gzip -c-1" }, @@ -34,13 +36,16 @@ "socket.io-client": "4.4.0", "sortablejs": "^1.14.0", "vue": "^3.2.26", - "vue-router": "^4.0.12" + "vue-i18n": "^9.2.0-beta.26", + "vue-router": "^4.0.12", + "xlsx": "^0.17.4" }, "devDependencies": { "@commitlint/cli": "^16.0.1", "@commitlint/config-conventional": "^16.0.0", + "@intlify/vue-i18n-loader": "^4.1.0", "@types/lodash": "^4.14.178", - "@types/node": "^17.0.6", + "@types/node": "^17.0.7", "@types/webpack-env": "^1.16.3", "@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/parser": "^5.8.1", @@ -56,6 +61,7 @@ "babel-plugin-lodash": "^3.3.4", "commitizen": "^4.2.4", "compression-webpack-plugin": "^9.2.0", + "conventional-changelog-cli": "^2.2.2", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", @@ -63,7 +69,7 @@ "husky": "^7.0.4", "less": "^4.1.2", "less-loader": "10.2.0", - "lint-staged": "^12.1.4", + "lint-staged": "^12.1.5", "lodash-webpack-plugin": "^0.11.6", "path-browserify": "^1.0.1", "postcss-html": "^1.3.0", diff --git a/src/App.vue b/src/App.vue index bf25504f0..bf5ae3f9e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,19 +1,29 @@ - + - - - + diff --git a/src/assets/icons/locale.svg b/src/assets/icons/locale.svg new file mode 100644 index 000000000..c7b268350 --- /dev/null +++ b/src/assets/icons/locale.svg @@ -0,0 +1,14 @@ + + + + diff --git a/src/components/SuspenseWithError.vue b/src/components/SuspenseWithError.vue deleted file mode 100644 index 6b69507d1..000000000 --- a/src/components/SuspenseWithError.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - {{ error }} - - - - - - - - - - - - diff --git a/src/components/a-custom-modal/index.ts b/src/components/a-custom-modal/index.ts deleted file mode 100644 index 03ad8dfff..000000000 --- a/src/components/a-custom-modal/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as CustomAModal } from './index.vue'; diff --git a/src/components/basic/README.md b/src/components/basic/README.md new file mode 100644 index 000000000..cb18e0484 --- /dev/null +++ b/src/components/basic/README.md @@ -0,0 +1,6 @@ +### 基础组件(目录说明) + +| 组件名称 | 描述 | 是否全局组件 | 使用建议 | +| --- | --- | --- | --- | +| button | `按钮组件`基于 a-button 二次封装,主要扩展了按钮的颜色,基本使用方式与 antdv 的 a-button 保持一致 | 是 | -- | +| check-box | `复选框`基于 a-checkbox 二次封装,基本使用方式与 antdv 的 a-checkbox 保持一致 | 否 | -- | diff --git a/src/components/basic/BasicHelp.vue b/src/components/basic/basic-help/index.vue similarity index 100% rename from src/components/basic/BasicHelp.vue rename to src/components/basic/basic-help/index.vue diff --git a/src/components/button/button.vue b/src/components/basic/button/button.vue similarity index 94% rename from src/components/button/button.vue rename to src/components/basic/button/button.vue index 851d5716e..35f697077 100644 --- a/src/components/button/button.vue +++ b/src/components/basic/button/button.vue @@ -35,9 +35,9 @@ diff --git a/src/components/button/index.ts b/src/components/basic/button/index.ts similarity index 100% rename from src/components/button/index.ts rename to src/components/basic/button/index.ts diff --git a/src/components/button/styles/index.less b/src/components/basic/button/styles/index.less similarity index 100% rename from src/components/button/styles/index.less rename to src/components/basic/button/styles/index.less diff --git a/src/components/button/styles/setButtonColor.less b/src/components/basic/button/styles/setButtonColor.less similarity index 89% rename from src/components/button/styles/setButtonColor.less rename to src/components/basic/button/styles/setButtonColor.less index b563f6f3a..3e11949fa 100644 --- a/src/components/button/styles/setButtonColor.less +++ b/src/components/basic/button/styles/setButtonColor.less @@ -1,5 +1,5 @@ -@import '~ant-design-vue/lib/style/themes/default'; -@import '~ant-design-vue/es/button/style/mixin'; +@import '../../../../../node_modules/ant-design-vue/lib/style/themes/default'; +@import '../../../../../node_modules/ant-design-vue/es/button/style/mixin'; .button-variant(@color; @background) { .button-color(@color; @background; @background); diff --git a/src/components/button/styles/success.less b/src/components/basic/button/styles/success.less similarity index 100% rename from src/components/button/styles/success.less rename to src/components/basic/button/styles/success.less diff --git a/src/components/button/styles/warning.less b/src/components/basic/button/styles/warning.less similarity index 100% rename from src/components/button/styles/warning.less rename to src/components/basic/button/styles/warning.less diff --git a/src/components/check-box/index.vue b/src/components/basic/check-box/index.vue similarity index 100% rename from src/components/check-box/index.vue rename to src/components/basic/check-box/index.vue diff --git a/src/components/context-menu/index.vue b/src/components/basic/context-menu/index.vue similarity index 100% rename from src/components/context-menu/index.vue rename to src/components/basic/context-menu/index.vue diff --git a/src/components/context-menu/props.ts b/src/components/basic/context-menu/props.ts similarity index 100% rename from src/components/context-menu/props.ts rename to src/components/basic/context-menu/props.ts diff --git a/src/components/context-menu/types.ts b/src/components/basic/context-menu/types.ts similarity index 100% rename from src/components/context-menu/types.ts rename to src/components/basic/context-menu/types.ts diff --git a/src/components/iconfont/icon-font.tsx b/src/components/basic/iconfont/icon-font.tsx similarity index 100% rename from src/components/iconfont/icon-font.tsx rename to src/components/basic/iconfont/icon-font.tsx diff --git a/src/components/iconfont/index.ts b/src/components/basic/iconfont/index.ts similarity index 100% rename from src/components/iconfont/index.ts rename to src/components/basic/iconfont/index.ts diff --git a/src/components/icons-select/icons.json b/src/components/basic/icons-select/icons.json similarity index 100% rename from src/components/icons-select/icons.json rename to src/components/basic/icons-select/icons.json diff --git a/src/components/icons-select/index.vue b/src/components/basic/icons-select/index.vue similarity index 96% rename from src/components/icons-select/index.vue rename to src/components/basic/icons-select/index.vue index e9d485e17..4c26969b8 100644 --- a/src/components/icons-select/index.vue +++ b/src/components/basic/icons-select/index.vue @@ -24,7 +24,7 @@ diff --git a/src/components/lockscreen/huawei-charge.vue b/src/components/basic/lockscreen/huawei-charge.vue similarity index 100% rename from src/components/lockscreen/huawei-charge.vue rename to src/components/basic/lockscreen/huawei-charge.vue diff --git a/src/components/lockscreen/index.ts b/src/components/basic/lockscreen/index.ts similarity index 100% rename from src/components/lockscreen/index.ts rename to src/components/basic/lockscreen/index.ts diff --git a/src/components/lockscreen/index.vue b/src/components/basic/lockscreen/index.vue similarity index 100% rename from src/components/lockscreen/index.vue rename to src/components/basic/lockscreen/index.vue diff --git a/src/components/lockscreen/lockscreen.vue b/src/components/basic/lockscreen/lockscreen.vue similarity index 100% rename from src/components/lockscreen/lockscreen.vue rename to src/components/basic/lockscreen/lockscreen.vue diff --git a/src/components/lockscreen/xiaomi-charge.vue b/src/components/basic/lockscreen/xiaomi-charge.vue similarity index 100% rename from src/components/lockscreen/xiaomi-charge.vue rename to src/components/basic/lockscreen/xiaomi-charge.vue diff --git a/src/components/progress/index.vue b/src/components/basic/progress/index.vue similarity index 100% rename from src/components/progress/index.vue rename to src/components/basic/progress/index.vue diff --git a/src/components/split-panel/index.ts b/src/components/basic/split-panel/index.ts similarity index 100% rename from src/components/split-panel/index.ts rename to src/components/basic/split-panel/index.ts diff --git a/src/components/split-panel/index.vue b/src/components/basic/split-panel/index.vue similarity index 100% rename from src/components/split-panel/index.vue rename to src/components/basic/split-panel/index.vue diff --git a/src/components/svg-icon/index.ts b/src/components/basic/svg-icon/index.ts similarity index 100% rename from src/components/svg-icon/index.ts rename to src/components/basic/svg-icon/index.ts diff --git a/src/components/basic/svg-icon/svg-icon.vue b/src/components/basic/svg-icon/svg-icon.vue new file mode 100644 index 000000000..4df60b8ad --- /dev/null +++ b/src/components/basic/svg-icon/svg-icon.vue @@ -0,0 +1,51 @@ + + + + + + + + + diff --git a/src/components/basic/title-i18n/index.ts b/src/components/basic/title-i18n/index.ts new file mode 100644 index 000000000..3382ba125 --- /dev/null +++ b/src/components/basic/title-i18n/index.ts @@ -0,0 +1 @@ +export { default as TitleI18n } from './index.vue'; diff --git a/src/components/basic/title-i18n/index.vue b/src/components/basic/title-i18n/index.vue new file mode 100644 index 000000000..2cf6504c6 --- /dev/null +++ b/src/components/basic/title-i18n/index.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/src/components/business/README.md b/src/components/business/README.md new file mode 100644 index 000000000..403b3c2ee --- /dev/null +++ b/src/components/business/README.md @@ -0,0 +1,3 @@ +### 业务组件(目录说明) + +#### 与业务强耦合的组件可以放这里 diff --git a/src/components/core/README.md b/src/components/core/README.md new file mode 100644 index 000000000..e7ad511cd --- /dev/null +++ b/src/components/core/README.md @@ -0,0 +1,7 @@ +### 核心组件(目录说明) + +| 组件名称 | 描述 | 是否全局组件 | 使用建议 | +| --- | --- | --- | --- | +| draggable-modal | `可拖拽弹窗`基于 a-modal 二次封装的可拖拽模态框,基本使用方式与 antdv 的 a-modal 保持一致 | 否 | 有弹窗拖拽需求的可以使用此组件 | +| dynamic-table | `动态表格`基于 a-table 二次封装的表格,基本使用方式与 antdv 的 a-table 保持一致 | 否 | 根据自己需求调整,建议全局使用统一的表格封装组件 | +| schema-form | `动态表单`基于 a-form 二次封装。通过 JSON schema 的方式配置使用 | 否 | 定制性不高的表单都可以考虑使用 | diff --git a/src/components/core/draggable-modal/index.ts b/src/components/core/draggable-modal/index.ts new file mode 100644 index 000000000..96898a972 --- /dev/null +++ b/src/components/core/draggable-modal/index.ts @@ -0,0 +1 @@ +export { default as DraggableModal } from './index.vue'; diff --git a/src/components/a-custom-modal/index.vue b/src/components/core/draggable-modal/index.vue similarity index 100% rename from src/components/a-custom-modal/index.vue rename to src/components/core/draggable-modal/index.vue diff --git a/src/components/dynamic-table/components/index.ts b/src/components/core/dynamic-table/components/index.ts similarity index 100% rename from src/components/dynamic-table/components/index.ts rename to src/components/core/dynamic-table/components/index.ts diff --git a/src/components/dynamic-table/components/query-form/index.vue b/src/components/core/dynamic-table/components/query-form/index.vue similarity index 96% rename from src/components/dynamic-table/components/query-form/index.vue rename to src/components/core/dynamic-table/components/query-form/index.vue index 0fd1c9520..8b7f78ce2 100644 --- a/src/components/dynamic-table/components/query-form/index.vue +++ b/src/components/core/dynamic-table/components/query-form/index.vue @@ -23,8 +23,8 @@ import { defineComponent, reactive, toRefs, computed, ref } from 'vue'; import { DownOutlined } from '@ant-design/icons-vue'; import type { TableColumn } from '../../typing'; - import SchemaForm from '@/components/JSON-schema-form/schema-form.vue'; - import type { FormItemSchema, FormProps } from '@/components/JSON-schema-form/types/form'; + import SchemaForm from '@/components/core/schema-form/schema-form.vue'; + import type { FormItemSchema, FormProps } from '@/components/core/schema-form/types/form'; export default defineComponent({ name: 'QueryForm', diff --git a/src/components/dynamic-table/components/table-action.vue b/src/components/core/dynamic-table/components/table-action.vue similarity index 100% rename from src/components/dynamic-table/components/table-action.vue rename to src/components/core/dynamic-table/components/table-action.vue diff --git a/src/components/dynamic-table/components/table-settings/column-setting.vue b/src/components/core/dynamic-table/components/table-settings/column-setting.vue similarity index 98% rename from src/components/dynamic-table/components/table-settings/column-setting.vue rename to src/components/core/dynamic-table/components/table-settings/column-setting.vue index 256c74ab8..e988ed383 100644 --- a/src/components/dynamic-table/components/table-settings/column-setting.vue +++ b/src/components/core/dynamic-table/components/table-settings/column-setting.vue @@ -74,7 +74,7 @@ } from '@ant-design/icons-vue'; import { useTableContext } from '../../hooks/useTableContext'; import { cloneDeep } from 'lodash'; - import Checkbox from '@/components/check-box/index.vue'; + import Checkbox from '@/components/basic/check-box/index.vue'; import type { TableColumn } from '../../typing'; import { useSortable } from '@/hooks/useSortable'; import { isNullAndUnDef } from '@/utils/is'; diff --git a/src/components/dynamic-table/components/table-settings/index.vue b/src/components/core/dynamic-table/components/table-settings/index.vue similarity index 100% rename from src/components/dynamic-table/components/table-settings/index.vue rename to src/components/core/dynamic-table/components/table-settings/index.vue diff --git a/src/components/dynamic-table/components/table-settings/refresh-setting.vue b/src/components/core/dynamic-table/components/table-settings/refresh-setting.vue similarity index 100% rename from src/components/dynamic-table/components/table-settings/refresh-setting.vue rename to src/components/core/dynamic-table/components/table-settings/refresh-setting.vue diff --git a/src/components/dynamic-table/components/table-settings/size-setting.vue b/src/components/core/dynamic-table/components/table-settings/size-setting.vue similarity index 100% rename from src/components/dynamic-table/components/table-settings/size-setting.vue rename to src/components/core/dynamic-table/components/table-settings/size-setting.vue diff --git a/src/components/dynamic-table/components/tool-bar/index.vue b/src/components/core/dynamic-table/components/tool-bar/index.vue similarity index 93% rename from src/components/dynamic-table/components/tool-bar/index.vue rename to src/components/core/dynamic-table/components/tool-bar/index.vue index a5665f7e3..da49a38ec 100644 --- a/src/components/dynamic-table/components/tool-bar/index.vue +++ b/src/components/core/dynamic-table/components/tool-bar/index.vue @@ -17,7 +17,7 @@ - - diff --git a/src/components/svg-icon/svg-icon.vue b/src/components/svg-icon/svg-icon.vue deleted file mode 100644 index fa5741c12..000000000 --- a/src/components/svg-icon/svg-icon.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - diff --git a/src/enums/cacheEnum.ts b/src/enums/cacheEnum.ts index e91012748..adc7fc5ec 100644 --- a/src/enums/cacheEnum.ts +++ b/src/enums/cacheEnum.ts @@ -1,6 +1,9 @@ // 用户token export const ACCESS_TOKEN_KEY = 'ACCESS_TOKEN'; +// 国际化 +export const LOCALE_KEY = 'LOCALE__'; + // 用户信息 export const USER_INFO_KEY = 'USER__INFO__'; diff --git a/src/hooks/functions/useContextMenu.ts b/src/hooks/functions/useContextMenu.ts index ad65535d9..ec0d11000 100644 --- a/src/hooks/functions/useContextMenu.ts +++ b/src/hooks/functions/useContextMenu.ts @@ -1,8 +1,8 @@ import { createApp, h, App } from 'vue'; -import { Props } from '@/components/context-menu/types'; +import { Props } from '@/components/basic/context-menu/types'; -import ContentMenu from '@/components/context-menu/index.vue'; +import ContentMenu from '@/components/basic/context-menu/index.vue'; let ContentMenuInstance: App | null = null; let wrapperEl: HTMLElement | null = null; diff --git a/src/hooks/useI18n.ts b/src/hooks/useI18n.ts new file mode 100644 index 000000000..f726121f0 --- /dev/null +++ b/src/hooks/useI18n.ts @@ -0,0 +1,27 @@ +import { i18n } from '@/locales'; +import { Title18n } from 'types/vue-router'; + +/** + * 国际化转换工具函数,主要用于处理动态路由的title + * @param {string | Title18n} message message + * @param isI18n 默认为true,获取对应的翻译文本,否则返回本身 + * @returns message + */ +export function transformI18n(message: string | Title18n = '', isI18n = true) { + if (!message) { + return ''; + } + + // 处理动态路由的title, 格式 {zh_CN:"",en_US:""} + if (typeof message === 'object') { + return message[i18n.global?.locale]; + } + + if (isI18n && typeof message === 'string') { + return i18n.global.t(message); + } + return message; +} + +// 主要用于配合vscode i18nn ally插件的提示。此功能仅用于路由和菜单。请在其他地方使用 vue-i18n 的 useI18n +export const t = (key: string) => key; diff --git a/src/hooks/useModal/modal.tsx b/src/hooks/useModal/modal.tsx index dd9cf9e97..fab265e15 100644 --- a/src/hooks/useModal/modal.tsx +++ b/src/hooks/useModal/modal.tsx @@ -1,16 +1,16 @@ -import CustomAModal from '@/components/a-custom-modal/index.vue'; +import { DraggableModal } from '@/components/core/draggable-modal'; import { defineComponent, reactive, watchEffect, watch, ref } from 'vue'; import type { HookModalProps } from './types'; import { isFunction } from '@/utils/is'; -import zhCN from 'ant-design-vue/es/locale/zh_CN'; import { ConfigProvider } from 'ant-design-vue'; import { omit } from 'lodash'; +import { useLocale } from '@/locales/useLocale'; export const MyModal = defineComponent({ - components: { modal: CustomAModal }, + components: { modal: DraggableModal }, setup(props: HookModalProps) { const confirmLoading = ref(false); - + const { getAntdLocale } = useLocale(); const state = reactive({ visible: props.visible, }); @@ -43,7 +43,7 @@ export const MyModal = defineComponent({ return () => { return ( - + + + + + + + + + diff --git a/src/layout/header/components/index.ts b/src/layout/header/components/index.ts index e9cc94f79..2ad0d7e0f 100644 --- a/src/layout/header/components/index.ts +++ b/src/layout/header/components/index.ts @@ -1,3 +1,2 @@ -import SearchModal from './search/index.vue'; - -export { SearchModal }; +export { default as Search } from './search/index.vue'; +export { default as FullScreen } from './fullscreen/index.vue'; diff --git a/src/layout/header/components/search/index.vue b/src/layout/header/components/search/index.vue index abae075fe..3beb5dc20 100644 --- a/src/layout/header/components/search/index.vue +++ b/src/layout/header/components/search/index.vue @@ -1,55 +1,51 @@ - - + + - - + + + + + + + + + + + - - - - - - - - - + + diff --git a/src/layout/index.vue b/src/layout/index.vue index b0a7606d3..e10c4370c 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -54,7 +54,7 @@ setup() { const collapsed = ref(false); // 自定义侧边栏菜单收缩和展开时的宽度 - const asiderWidth = computed(() => (collapsed.value ? 80 : 208)); + const asiderWidth = computed(() => (collapsed.value ? 80 : 220)); return { collapsed, diff --git a/src/layout/menu/menu-item.vue b/src/layout/menu/menu-item.vue index 769ccfef8..c1e45c0f4 100644 --- a/src/layout/menu/menu-item.vue +++ b/src/layout/menu/menu-item.vue @@ -9,7 +9,7 @@ - {{ getTitle(props.menuInfo.meta?.title) }} + @@ -21,7 +21,7 @@ - {{ getTitle(props.menuInfo?.meta?.title) }} + @@ -37,16 +37,14 @@ import { PropType } from 'vue'; import { Menu } from 'ant-design-vue'; import type { RouteRecordRaw } from 'vue-router'; - import { IconFont } from '@/components/iconfont'; + import { IconFont } from '@/components/basic/iconfont'; + import { TitleI18n } from '@/components/basic/title-i18n'; const props = defineProps({ menuInfo: { type: Object as PropType, }, }); - const getTitle = (title) => { - return typeof title === 'string' ? title : title?.['zh_CN']; - }; diff --git a/src/layout/tabs/tabs-view.vue b/src/layout/tabs/tabs-view.vue index 4b73571de..74504dfe1 100644 --- a/src/layout/tabs/tabs-view.vue +++ b/src/layout/tabs/tabs-view.vue @@ -12,7 +12,7 @@ - {{ getTitle(pageItem.meta?.title) }} + @@ -109,6 +109,7 @@ } from '@ant-design/icons-vue'; import { Dropdown, Tabs, message, Menu } from 'ant-design-vue'; import { REDIRECT_NAME } from '@/router/constant'; + import { TitleI18n } from '@/components/basic/title-i18n'; type RouteItem = Omit; @@ -240,10 +241,6 @@ tabsViewStore.closeAllTabs(); router.replace('/'); }; - - const getTitle = (title) => { - return typeof title === 'string' ? title : title?.['zh_CN']; - }; diff --git a/src/views/shared/demos/tables/lol-table/columns.tsx b/src/views/demos/tables/lol-table/columns.tsx similarity index 88% rename from src/views/shared/demos/tables/lol-table/columns.tsx rename to src/views/demos/tables/lol-table/columns.tsx index bd923ec42..7ef588725 100644 --- a/src/views/shared/demos/tables/lol-table/columns.tsx +++ b/src/views/demos/tables/lol-table/columns.tsx @@ -1,7 +1,7 @@ -import type { TableColumn } from '@/components/dynamic-table'; +import type { TableColumn } from '@/components/core/dynamic-table'; import { Tag } from 'ant-design-vue'; import router from '@/router'; -import ImagePreview from '@/components/image-preview/index'; +import ImagePreview from '@/components/basic/image-preview/index'; export const columns: TableColumn[] = [ { diff --git a/src/views/shared/demos/tables/lol-table/heroInfo.vue b/src/views/demos/tables/lol-table/heroInfo.vue similarity index 100% rename from src/views/shared/demos/tables/lol-table/heroInfo.vue rename to src/views/demos/tables/lol-table/heroInfo.vue diff --git a/src/views/shared/demos/tables/lol-table/index.vue b/src/views/demos/tables/lol-table/index.vue similarity index 92% rename from src/views/shared/demos/tables/lol-table/index.vue rename to src/views/demos/tables/lol-table/index.vue index 2e94a29a2..84ed6bfba 100644 --- a/src/views/shared/demos/tables/lol-table/index.vue +++ b/src/views/demos/tables/lol-table/index.vue @@ -23,7 +23,7 @@ - - diff --git a/src/views/system/monitor/login-log/index.vue b/src/views/system/monitor/login-log/index.vue index 7b7771f0e..6b4602b76 100644 --- a/src/views/system/monitor/login-log/index.vue +++ b/src/views/system/monitor/login-log/index.vue @@ -7,7 +7,7 @@ diff --git a/src/views/system/permission/menu/columns.tsx b/src/views/system/permission/menu/columns.tsx index f3fbda5ae..5f7f500dc 100644 --- a/src/views/system/permission/menu/columns.tsx +++ b/src/views/system/permission/menu/columns.tsx @@ -1,4 +1,4 @@ -import type { TableColumn } from '@/components/dynamic-table'; +import type { TableColumn } from '@/components/core/dynamic-table'; // import { Avatar, Space, Tag } from 'ant-design-vue'; export type TableListItem = API.MenuListResultItem; diff --git a/src/views/system/permission/menu/formSchemas.ts b/src/views/system/permission/menu/formSchemas.ts index a1b25ded1..53d2bcf42 100644 --- a/src/views/system/permission/menu/formSchemas.ts +++ b/src/views/system/permission/menu/formSchemas.ts @@ -1,6 +1,6 @@ import { shallowRef } from 'vue'; -import type { FormItemSchema } from '@/components/JSON-schema-form/types/form'; -import IconsSelect from '@/components/icons-select/index.vue'; +import type { FormItemSchema } from '@/components/core/schema-form/types/form'; +import IconsSelect from '@/components/basic/icons-select/index.vue'; import MultipleCascader from './components/multiple-cascader/index.vue'; import { constantRouterComponents } from '@/router/asyncModules'; diff --git a/src/views/system/permission/menu/index.vue b/src/views/system/permission/menu/index.vue index 25ae5aef6..b68318de6 100644 --- a/src/views/system/permission/menu/index.vue +++ b/src/views/system/permission/menu/index.vue @@ -31,7 +31,7 @@ import { ref } from 'vue'; import type { TreeSelectProps } from 'ant-design-vue'; import { getMenuList, updateMenu, createMenu, deleteMenu } from '@/api/system/menu'; - import { DynamicTable } from '@/components/dynamic-table'; + import { DynamicTable } from '@/components/core/dynamic-table'; import { useFormModal } from '@/hooks/useModal/useFormModal'; import { baseColumns, type TableListItem, type TableColumnItem } from './columns'; import { menuSchemas } from './formSchemas'; diff --git a/src/views/system/permission/role/columns.tsx b/src/views/system/permission/role/columns.tsx index 5005a6f4c..966ae16c6 100644 --- a/src/views/system/permission/role/columns.tsx +++ b/src/views/system/permission/role/columns.tsx @@ -1,4 +1,4 @@ -import type { TableColumn } from '@/components/dynamic-table'; +import type { TableColumn } from '@/components/core/dynamic-table'; // import { Avatar, Space, Tag } from 'ant-design-vue'; export type TableListItem = API.RoleListResultItem; diff --git a/src/views/system/permission/role/formSchemas.ts b/src/views/system/permission/role/formSchemas.ts index 8e9f77a7b..99886398b 100644 --- a/src/views/system/permission/role/formSchemas.ts +++ b/src/views/system/permission/role/formSchemas.ts @@ -1,4 +1,4 @@ -import type { FormItemSchema } from '@/components/JSON-schema-form/types/form'; +import type { FormItemSchema } from '@/components/core/schema-form/types/form'; export const roleSchemas: FormItemSchema[] = [ { diff --git a/src/views/system/permission/role/index.vue b/src/views/system/permission/role/index.vue index 6d1e5166a..319812752 100644 --- a/src/views/system/permission/role/index.vue +++ b/src/views/system/permission/role/index.vue @@ -36,7 +36,7 @@ } from '@/api/system/role'; import { getDeptList } from '@/api/system/dept'; import { getMenuList } from '@/api/system/menu'; - import { DynamicTable } from '@/components/dynamic-table'; + import { DynamicTable } from '@/components/core/dynamic-table'; import { useFormModal } from '@/hooks/useModal/useFormModal'; import { baseColumns, type TableListItem, type TableColumnItem } from './columns'; import { roleSchemas } from './formSchemas'; diff --git a/src/views/system/permission/user/columns.tsx b/src/views/system/permission/user/columns.tsx index 0b33cc10a..0873e81e3 100644 --- a/src/views/system/permission/user/columns.tsx +++ b/src/views/system/permission/user/columns.tsx @@ -1,4 +1,4 @@ -import type { TableColumn } from '@/components/dynamic-table'; +import type { TableColumn } from '@/components/core/dynamic-table'; import { Avatar, Space, Tag } from 'ant-design-vue'; export type TableListItem = API.UserListPageResultItem; diff --git a/src/views/system/permission/user/formSchemas.ts b/src/views/system/permission/user/formSchemas.ts index a7cc2d6b1..5cdf573ec 100644 --- a/src/views/system/permission/user/formSchemas.ts +++ b/src/views/system/permission/user/formSchemas.ts @@ -1,4 +1,4 @@ -import type { FormItemSchema } from '@/components/JSON-schema-form/types/form'; +import type { FormItemSchema } from '@/components/core/schema-form/types/form'; import { getRoleList } from '@/api/system/role'; export const deptSchemas: FormItemSchema[] = [ diff --git a/src/views/system/permission/user/index.vue b/src/views/system/permission/user/index.vue index 694368641..169fc7b20 100644 --- a/src/views/system/permission/user/index.vue +++ b/src/views/system/permission/user/index.vue @@ -99,8 +99,12 @@ ExclamationCircleOutlined, SwapOutlined, } from '@ant-design/icons-vue'; - import { SplitPanel } from '@/components/split-panel'; - import { DynamicTable, LoadDataParams, DynamicTableInstance } from '@/components/dynamic-table'; + import { SplitPanel } from '@/components/basic/split-panel'; + import { + DynamicTable, + type LoadDataParams, + type DynamicTableInstance, + } from '@/components/core/dynamic-table'; import { deleteUsers, getUserListPage, diff --git a/src/views/system/schedule/log/index.vue b/src/views/system/schedule/log/index.vue index abb8b4d9c..0fb8f9c08 100644 --- a/src/views/system/schedule/log/index.vue +++ b/src/views/system/schedule/log/index.vue @@ -12,7 +12,7 @@