From 61f39a7c647a6341d5d23ea70ab805dfd35a267a Mon Sep 17 00:00:00 2001 From: ktianc <2445667550@qq.com> Date: Tue, 12 Mar 2024 18:23:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?vue-element-plus-admin=20=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=87=B3=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=203.7.0=EF=BC=883.7.0=E4=B8=AD=E6=96=B0=E5=A2=9E=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=9C=AA=E6=9B=B4=E6=96=B0=E5=8F=AA=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BA=86=E9=97=AE=E9=A2=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kinit-admin/package.json | 73 ++++++++-------- kinit-admin/src/components/Form/src/Form.vue | 12 ++- kinit-admin/src/components/Menu/src/Menu.vue | 2 +- .../Menu/src/components/useRenderMenuItem.tsx | 84 +++++++++---------- .../src/components/TabMenu/src/TabMenu.vue | 8 +- .../src/components/Table/src/Table.vue | 3 +- .../Table/src/components/TableActions.vue | 9 +- .../src/components/TagsView/src/TagsView.vue | 4 +- kinit-admin/uno.config.ts | 23 ++++- kinit-admin/vite.config.ts | 2 + 10 files changed, 122 insertions(+), 98 deletions(-) diff --git a/kinit-admin/package.json b/kinit-admin/package.json index 187c257..c1128a1 100644 --- a/kinit-admin/package.json +++ b/kinit-admin/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-plus-admin", - "version": "2.5.6", + "version": "2.7.0", "description": "一套基于vue3、element-plus、typesScript、vite4的后台集成方案。", "author": "Archer <502431556@qq.com>", "private": false, @@ -24,18 +24,18 @@ "dependencies": { "@iconify/iconify": "3.1.1", "@iconify/vue": "4.1.1", - "@vueuse/core": "10.7.1", + "@vueuse/core": "10.9.0", "@wangeditor/editor": "5.1.23", "@wangeditor/editor-for-vue": "5.1.10", "@zxcvbn-ts/core": "3.0.4", "animate.css": "4.1.1", - "axios": "1.6.5", + "axios": "1.6.7", "cropperjs": "1.6.1", "dayjs": "1.11.10", "driver.js": "1.3.1", - "echarts": "5.4.3", + "echarts": "5.5.0", "echarts-wordcloud": "2.1.0", - "element-plus": "2.4.4", + "element-plus": "2.5.6", "lodash-es": "4.17.21", "mitt": "3.0.1", "nprogress": "0.2.0", @@ -44,68 +44,68 @@ "qrcode": "1.5.3", "qs": "6.11.2", "url": "0.11.3", - "vue": "3.4.7", - "vue-draggable-plus": "0.3.4", - "vue-i18n": "9.9.0", + "vue": "3.4.20", + "vue-draggable-plus": "0.3.5", + "vue-i18n": "9.9.1", "vue-json-pretty": "2.3.0", - "vue-router": "4.2.5", + "vue-router": "4.3.0", "vue-types": "5.1.1", - "xgplayer": "3.0.11" + "xgplayer": "3.0.13" }, "devDependencies": { "@amap/amap-jsapi-loader": "1.0.1", - "@commitlint/cli": "18.4.4", - "@commitlint/config-conventional": "18.4.4", - "@iconify/json": "2.2.166", + "@commitlint/cli": "19.0.1", + "@commitlint/config-conventional": "19.0.0", + "@iconify/json": "2.2.187", "@intlify/unplugin-vue-i18n": "2.0.0", "@kjgl77/datav-vue3": "1.6.1", "@types/fs-extra": "11.0.4", "@types/inquirer": "9.0.7", "@types/lodash-es": "4.17.12", - "@types/node": "20.10.8", + "@types/node": "20.11.21", "@types/nprogress": "0.2.3", "@types/qrcode": "1.5.5", - "@types/qs": "6.9.11", - "@types/sortablejs": "1.15.7", - "@typescript-eslint/eslint-plugin": "6.18.1", - "@typescript-eslint/parser": "6.18.1", - "@unocss/transformer-variant-group": "0.58.3", - "@vitejs/plugin-legacy": "5.2.0", - "@vitejs/plugin-vue": "5.0.2", + "@types/qs": "6.9.12", + "@types/sortablejs": "1.15.8", + "@typescript-eslint/eslint-plugin": "7.1.0", + "@typescript-eslint/parser": "7.1.0", + "@unocss/transformer-variant-group": "0.58.5", + "@vitejs/plugin-legacy": "5.3.1", + "@vitejs/plugin-vue": "5.0.4", "@vitejs/plugin-vue-jsx": "3.1.0", - "autoprefixer": "10.4.16", + "autoprefixer": "10.4.17", "chalk": "5.3.0", "consola": "3.2.3", "cron-validate": "1.4.5", - "eslint": "8.56.0", + "eslint": "8.57.0", "eslint-config-prettier": "9.1.0", "eslint-define-config": "2.1.0", - "eslint-plugin-prettier": "5.1.2", - "eslint-plugin-vue": "9.19.2", + "eslint-plugin-prettier": "5.1.3", + "eslint-plugin-vue": "9.22.0", "esno": "4.0.0", "fs-extra": "11.2.0", - "inquirer": "9.2.12", + "inquirer": "9.2.15", "less": "4.2.0", - "lint-staged": "15.2.0", + "lint-staged": "15.2.2", "lodash": "4.17.21", "moment": "2.30.1", "plop": "4.0.1", - "postcss": "8.4.33", - "postcss-html": "1.5.0", + "postcss": "8.4.35", + "postcss-html": "1.6.0", "postcss-less": "6.0.0", - "prettier": "3.1.1", + "prettier": "3.2.5", "rimraf": "5.0.5", - "rollup": "4.9.4", + "rollup": "4.12.0", "rollup-plugin-visualizer": "5.12.0", - "stylelint": "16.1.0", + "stylelint": "16.2.1", "stylelint-config-html": "1.1.0", "stylelint-config-recommended": "14.0.0", "stylelint-config-standard": "36.0.0", "stylelint-order": "6.0.4", - "terser": "5.26.0", + "terser": "5.28.1", "typescript": "5.3.3", - "unocss": "0.58.3", - "vite": "5.0.11", + "unocss": "0.58.5", + "vite": "5.1.4", "vite-plugin-ejs": "1.7.0", "vite-plugin-eslint": "1.8.1", "vite-plugin-progress": "0.0.7", @@ -113,9 +113,10 @@ "vite-plugin-style-import": "2.0.0", "vite-plugin-svg-icons": "2.0.1", "vue-draggable-plus": "0.2.6", + "vite-plugin-url-copy": "1.1.3", "vue-tsc": "1.8.27", "vue3-json-viewer": "2.2.2", - "zipson": "^0.2.12" + "zipson": "0.2.12" }, "packageManager": "pnpm@8.1.0", "engines": { diff --git a/kinit-admin/src/components/Form/src/Form.vue b/kinit-admin/src/components/Form/src/Form.vue index 6d288dc..961df6e 100644 --- a/kinit-admin/src/components/Form/src/Form.vue +++ b/kinit-admin/src/components/Form/src/Form.vue @@ -484,7 +484,15 @@ export default defineComponent({ margin-left: 0 !important; } -.@{elNamespace}-form--inline .@{elNamespace}-input { - width: 245px; +.@{elNamespace}-form--inline { + :deep(.el-form-item__content) { + & > :first-child { + min-width: 229.5px; + } + } + .@{elNamespace}-input-number { + // 229.5px是兼容el-input-number的最小宽度, + min-width: 229.5px; + } } diff --git a/kinit-admin/src/components/Menu/src/Menu.vue b/kinit-admin/src/components/Menu/src/Menu.vue index efd0dd9..1ff914b 100644 --- a/kinit-admin/src/components/Menu/src/Menu.vue +++ b/kinit-admin/src/components/Menu/src/Menu.vue @@ -93,7 +93,7 @@ export default defineComponent({ > {{ default: () => { - const { renderMenuItem } = useRenderMenuItem(unref(menuMode)) + const { renderMenuItem } = useRenderMenuItem() return renderMenuItem(unref(routers)) } }} diff --git a/kinit-admin/src/components/Menu/src/components/useRenderMenuItem.tsx b/kinit-admin/src/components/Menu/src/components/useRenderMenuItem.tsx index 3a33922..301313f 100644 --- a/kinit-admin/src/components/Menu/src/components/useRenderMenuItem.tsx +++ b/kinit-admin/src/components/Menu/src/components/useRenderMenuItem.tsx @@ -2,57 +2,49 @@ import { ElSubMenu, ElMenuItem } from 'element-plus' import { hasOneShowingChild } from '../helper' import { isUrl } from '@/utils/is' import { useRenderMenuTitle } from './useRenderMenuTitle' -import { useDesign } from '@/hooks/web/useDesign' import { pathResolve } from '@/utils/routerHelper' const { renderMenuTitle } = useRenderMenuTitle() -export const useRenderMenuItem = ( +export const useRenderMenuItem = () => // allRouters: AppRouteRecordRaw[] = [], - menuMode: 'vertical' | 'horizontal' -) => { - const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => { - return routers - .filter((v) => !v.meta?.hidden) - .map((v) => { - const meta = v.meta ?? {} - const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) - const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath(allRouters, v.path).join('/') + { + const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => { + return routers + .filter((v) => !v.meta?.hidden) + .map((v) => { + const meta = v.meta ?? {} + const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) + const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath(allRouters, v.path).join('/') - if ( - oneShowingChild && - (!onlyOneChild?.children || onlyOneChild?.noShowingChildren) && - !meta?.alwaysShow - ) { - return ( - - {{ - default: () => renderMenuTitle(onlyOneChild ? onlyOneChild?.meta : meta) - }} - - ) - } else { - const { getPrefixCls } = useDesign() + if ( + oneShowingChild && + (!onlyOneChild?.children || onlyOneChild?.noShowingChildren) && + !meta?.alwaysShow + ) { + return ( + + {{ + default: () => renderMenuTitle(onlyOneChild ? onlyOneChild?.meta : meta) + }} + + ) + } else { + return ( + + {{ + title: () => renderMenuTitle(meta), + default: () => renderMenuItem(v.children!, fullPath) + }} + + ) + } + }) + } - const preFixCls = getPrefixCls('menu-popper') - return ( - - {{ - title: () => renderMenuTitle(meta), - default: () => renderMenuItem(v.children!, fullPath) - }} - - ) - } - }) + return { + renderMenuItem + } } - - return { - renderMenuItem - } -} diff --git a/kinit-admin/src/components/TabMenu/src/TabMenu.vue b/kinit-admin/src/components/TabMenu/src/TabMenu.vue index 1413f1e..9942611 100644 --- a/kinit-admin/src/components/TabMenu/src/TabMenu.vue +++ b/kinit-admin/src/components/TabMenu/src/TabMenu.vue @@ -88,6 +88,9 @@ export default defineComponent({ } else { showTitle.value = !collapse } + }, + { + immediate: true } ) @@ -202,11 +205,12 @@ export default defineComponent({ , - validator: (v: ComponentSize) => ['medium', 'small', 'mini'].includes(v) + validator: (v: ComponentSize) => ['default', 'small', 'large'].includes(v) }, fit: propTypes.bool.def(true), showHeader: propTypes.bool.def(true), @@ -349,6 +349,7 @@ export default defineComponent({ const bindValue: Recordable = { ...attrs, ...unref(getProps) } delete bindValue.columns delete bindValue.data + delete bindValue.align return bindValue }) diff --git a/kinit-admin/src/components/Table/src/components/TableActions.vue b/kinit-admin/src/components/Table/src/components/TableActions.vue index 1f16d06..b47b8cf 100644 --- a/kinit-admin/src/components/Table/src/components/TableActions.vue +++ b/kinit-admin/src/components/Table/src/components/TableActions.vue @@ -24,13 +24,8 @@ import { propTypes } from '@/utils/propTypes' import { moveElementToIndex } from '@/utils/index' import { BaseButton } from '@/components/Button' -const appStore = useAppStore() -const sizeMap = computed(() => appStore.sizeMap) - const { setStorage, getStorage, removeStorage } = useStorage() -const { t } = useI18n() - export default defineComponent({ name: 'TableActions', props: { @@ -47,6 +42,10 @@ export default defineComponent({ }, emits: ['refresh', 'changSize'], setup(props, { emit }) { + const appStore = useAppStore() + const sizeMap = computed(() => appStore.sizeMap) + const { t } = useI18n() + const refresh = () => { emit('refresh') } diff --git a/kinit-admin/src/components/TagsView/src/TagsView.vue b/kinit-admin/src/components/TagsView/src/TagsView.vue index 86baaa3..b4876c5 100644 --- a/kinit-admin/src/components/TagsView/src/TagsView.vue +++ b/kinit-admin/src/components/TagsView/src/TagsView.vue @@ -210,13 +210,14 @@ const isActive = (route: RouteLocationNormalizedLoaded): boolean => { // 所有右键菜单组件的元素 const itemRefs = useTemplateRefsList>() -// 右键菜单装填改变的时候 +// 右键菜单状态改变的时候 const visibleChange = (visible: boolean, tagItem: RouteLocationNormalizedLoaded) => { if (visible) { for (const v of unref(itemRefs)) { const elDropdownMenuRef = v.elDropdownMenuRef if (tagItem.fullPath !== v.tagItem.fullPath) { elDropdownMenuRef?.handleClose() + setSelectTag(tagItem) } } } @@ -582,4 +583,3 @@ watch( } } -@/hooks/web/useTagsView diff --git a/kinit-admin/uno.config.ts b/kinit-admin/uno.config.ts index c1432e1..c39c5de 100644 --- a/kinit-admin/uno.config.ts +++ b/kinit-admin/uno.config.ts @@ -1,16 +1,33 @@ import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss' import transformerVariantGroup from '@unocss/transformer-variant-group' +import { loadEnv } from 'vite' + +const root = process.cwd() const createPresetIcons = () => { + const isBuild = !!process.argv[4] + let env = {} as any + if (!isBuild) { + env = loadEnv(process.argv[3], root) + } else { + env = loadEnv(process.argv[4], root) + } + // @ts-ignore - if (import.meta.env.VITE_USE_ONLINE_ICON === 'true') { + if (env.VITE_USE_ONLINE_ICON === 'true') { + return [] + } else { return [ presetIcons({ prefix: '' + // 由于默认加载的是所有的图标,启动会非常慢,可以在这里去加载需要的图标,确保启动速度 + // collections: { + // carbon: () => import('@iconify-json/carbon/icons.json').then(i => i.default), + // mdi: () => import('@iconify-json/mdi/icons.json').then(i => i.default), + // logos: () => import('@iconify-json/logos/icons.json').then(i => i.default), + // } }) ] - } else { - return [] } } diff --git a/kinit-admin/vite.config.ts b/kinit-admin/vite.config.ts index 028d231..b9283dc 100644 --- a/kinit-admin/vite.config.ts +++ b/kinit-admin/vite.config.ts @@ -7,6 +7,7 @@ import progress from 'vite-plugin-progress' import EslintPlugin from 'vite-plugin-eslint' import { ViteEjsPlugin } from 'vite-plugin-ejs' import PurgeIcons from 'vite-plugin-purge-icons' +import ServerUrlCopy from 'vite-plugin-url-copy' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import' @@ -38,6 +39,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { } }), VueJsx(), + ServerUrlCopy(), progress(), env.VITE_USE_ALL_ELEMENT_PLUS_STYLE === 'false' ? createStyleImportPlugin({ From adc7b21fc287c8d74ddd804c9be0d6c177793b9d Mon Sep 17 00:00:00 2001 From: ktianc <2445667550@qq.com> Date: Tue, 12 Mar 2024 18:24:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=87=B3=203.9.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kinit-api/application/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinit-api/application/settings.py b/kinit-api/application/settings.py index 6642c12..7c23647 100644 --- a/kinit-api/application/settings.py +++ b/kinit-api/application/settings.py @@ -11,7 +11,7 @@ from fastapi.security import OAuth2PasswordBearer """ 系统版本 """ -VERSION = "3.8.2" +VERSION = "3.9.0" """安全警告: 不要在生产中打开调试运行!""" DEBUG = False