Merge pull request !16 from ktianc/master
This commit is contained in:
ktianc 2024-03-12 10:26:14 +00:00 committed by Gitee
commit b3b427edef
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 123 additions and 99 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "vue-element-plus-admin", "name": "vue-element-plus-admin",
"version": "2.5.6", "version": "2.7.0",
"description": "一套基于vue3、element-plus、typesScript、vite4的后台集成方案。", "description": "一套基于vue3、element-plus、typesScript、vite4的后台集成方案。",
"author": "Archer <502431556@qq.com>", "author": "Archer <502431556@qq.com>",
"private": false, "private": false,
@ -24,18 +24,18 @@
"dependencies": { "dependencies": {
"@iconify/iconify": "3.1.1", "@iconify/iconify": "3.1.1",
"@iconify/vue": "4.1.1", "@iconify/vue": "4.1.1",
"@vueuse/core": "10.7.1", "@vueuse/core": "10.9.0",
"@wangeditor/editor": "5.1.23", "@wangeditor/editor": "5.1.23",
"@wangeditor/editor-for-vue": "5.1.10", "@wangeditor/editor-for-vue": "5.1.10",
"@zxcvbn-ts/core": "3.0.4", "@zxcvbn-ts/core": "3.0.4",
"animate.css": "4.1.1", "animate.css": "4.1.1",
"axios": "1.6.5", "axios": "1.6.7",
"cropperjs": "1.6.1", "cropperjs": "1.6.1",
"dayjs": "1.11.10", "dayjs": "1.11.10",
"driver.js": "1.3.1", "driver.js": "1.3.1",
"echarts": "5.4.3", "echarts": "5.5.0",
"echarts-wordcloud": "2.1.0", "echarts-wordcloud": "2.1.0",
"element-plus": "2.4.4", "element-plus": "2.5.6",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"mitt": "3.0.1", "mitt": "3.0.1",
"nprogress": "0.2.0", "nprogress": "0.2.0",
@ -44,68 +44,68 @@
"qrcode": "1.5.3", "qrcode": "1.5.3",
"qs": "6.11.2", "qs": "6.11.2",
"url": "0.11.3", "url": "0.11.3",
"vue": "3.4.7", "vue": "3.4.20",
"vue-draggable-plus": "0.3.4", "vue-draggable-plus": "0.3.5",
"vue-i18n": "9.9.0", "vue-i18n": "9.9.1",
"vue-json-pretty": "2.3.0", "vue-json-pretty": "2.3.0",
"vue-router": "4.2.5", "vue-router": "4.3.0",
"vue-types": "5.1.1", "vue-types": "5.1.1",
"xgplayer": "3.0.11" "xgplayer": "3.0.13"
}, },
"devDependencies": { "devDependencies": {
"@amap/amap-jsapi-loader": "1.0.1", "@amap/amap-jsapi-loader": "1.0.1",
"@commitlint/cli": "18.4.4", "@commitlint/cli": "19.0.1",
"@commitlint/config-conventional": "18.4.4", "@commitlint/config-conventional": "19.0.0",
"@iconify/json": "2.2.166", "@iconify/json": "2.2.187",
"@intlify/unplugin-vue-i18n": "2.0.0", "@intlify/unplugin-vue-i18n": "2.0.0",
"@kjgl77/datav-vue3": "1.6.1", "@kjgl77/datav-vue3": "1.6.1",
"@types/fs-extra": "11.0.4", "@types/fs-extra": "11.0.4",
"@types/inquirer": "9.0.7", "@types/inquirer": "9.0.7",
"@types/lodash-es": "4.17.12", "@types/lodash-es": "4.17.12",
"@types/node": "20.10.8", "@types/node": "20.11.21",
"@types/nprogress": "0.2.3", "@types/nprogress": "0.2.3",
"@types/qrcode": "1.5.5", "@types/qrcode": "1.5.5",
"@types/qs": "6.9.11", "@types/qs": "6.9.12",
"@types/sortablejs": "1.15.7", "@types/sortablejs": "1.15.8",
"@typescript-eslint/eslint-plugin": "6.18.1", "@typescript-eslint/eslint-plugin": "7.1.0",
"@typescript-eslint/parser": "6.18.1", "@typescript-eslint/parser": "7.1.0",
"@unocss/transformer-variant-group": "0.58.3", "@unocss/transformer-variant-group": "0.58.5",
"@vitejs/plugin-legacy": "5.2.0", "@vitejs/plugin-legacy": "5.3.1",
"@vitejs/plugin-vue": "5.0.2", "@vitejs/plugin-vue": "5.0.4",
"@vitejs/plugin-vue-jsx": "3.1.0", "@vitejs/plugin-vue-jsx": "3.1.0",
"autoprefixer": "10.4.16", "autoprefixer": "10.4.17",
"chalk": "5.3.0", "chalk": "5.3.0",
"consola": "3.2.3", "consola": "3.2.3",
"cron-validate": "1.4.5", "cron-validate": "1.4.5",
"eslint": "8.56.0", "eslint": "8.57.0",
"eslint-config-prettier": "9.1.0", "eslint-config-prettier": "9.1.0",
"eslint-define-config": "2.1.0", "eslint-define-config": "2.1.0",
"eslint-plugin-prettier": "5.1.2", "eslint-plugin-prettier": "5.1.3",
"eslint-plugin-vue": "9.19.2", "eslint-plugin-vue": "9.22.0",
"esno": "4.0.0", "esno": "4.0.0",
"fs-extra": "11.2.0", "fs-extra": "11.2.0",
"inquirer": "9.2.12", "inquirer": "9.2.15",
"less": "4.2.0", "less": "4.2.0",
"lint-staged": "15.2.0", "lint-staged": "15.2.2",
"lodash": "4.17.21", "lodash": "4.17.21",
"moment": "2.30.1", "moment": "2.30.1",
"plop": "4.0.1", "plop": "4.0.1",
"postcss": "8.4.33", "postcss": "8.4.35",
"postcss-html": "1.5.0", "postcss-html": "1.6.0",
"postcss-less": "6.0.0", "postcss-less": "6.0.0",
"prettier": "3.1.1", "prettier": "3.2.5",
"rimraf": "5.0.5", "rimraf": "5.0.5",
"rollup": "4.9.4", "rollup": "4.12.0",
"rollup-plugin-visualizer": "5.12.0", "rollup-plugin-visualizer": "5.12.0",
"stylelint": "16.1.0", "stylelint": "16.2.1",
"stylelint-config-html": "1.1.0", "stylelint-config-html": "1.1.0",
"stylelint-config-recommended": "14.0.0", "stylelint-config-recommended": "14.0.0",
"stylelint-config-standard": "36.0.0", "stylelint-config-standard": "36.0.0",
"stylelint-order": "6.0.4", "stylelint-order": "6.0.4",
"terser": "5.26.0", "terser": "5.28.1",
"typescript": "5.3.3", "typescript": "5.3.3",
"unocss": "0.58.3", "unocss": "0.58.5",
"vite": "5.0.11", "vite": "5.1.4",
"vite-plugin-ejs": "1.7.0", "vite-plugin-ejs": "1.7.0",
"vite-plugin-eslint": "1.8.1", "vite-plugin-eslint": "1.8.1",
"vite-plugin-progress": "0.0.7", "vite-plugin-progress": "0.0.7",
@ -113,9 +113,10 @@
"vite-plugin-style-import": "2.0.0", "vite-plugin-style-import": "2.0.0",
"vite-plugin-svg-icons": "2.0.1", "vite-plugin-svg-icons": "2.0.1",
"vue-draggable-plus": "0.2.6", "vue-draggable-plus": "0.2.6",
"vite-plugin-url-copy": "1.1.3",
"vue-tsc": "1.8.27", "vue-tsc": "1.8.27",
"vue3-json-viewer": "2.2.2", "vue3-json-viewer": "2.2.2",
"zipson": "^0.2.12" "zipson": "0.2.12"
}, },
"packageManager": "pnpm@8.1.0", "packageManager": "pnpm@8.1.0",
"engines": { "engines": {

View File

@ -484,7 +484,15 @@ export default defineComponent({
margin-left: 0 !important; margin-left: 0 !important;
} }
.@{elNamespace}-form--inline .@{elNamespace}-input { .@{elNamespace}-form--inline {
width: 245px; :deep(.el-form-item__content) {
& > :first-child {
min-width: 229.5px;
}
}
.@{elNamespace}-input-number {
// 229.5pxel-input-number,
min-width: 229.5px;
}
} }
</style> </style>

View File

@ -93,7 +93,7 @@ export default defineComponent({
> >
{{ {{
default: () => { default: () => {
const { renderMenuItem } = useRenderMenuItem(unref(menuMode)) const { renderMenuItem } = useRenderMenuItem()
return renderMenuItem(unref(routers)) return renderMenuItem(unref(routers))
} }
}} }}

View File

@ -2,57 +2,49 @@ import { ElSubMenu, ElMenuItem } from 'element-plus'
import { hasOneShowingChild } from '../helper' import { hasOneShowingChild } from '../helper'
import { isUrl } from '@/utils/is' import { isUrl } from '@/utils/is'
import { useRenderMenuTitle } from './useRenderMenuTitle' import { useRenderMenuTitle } from './useRenderMenuTitle'
import { useDesign } from '@/hooks/web/useDesign'
import { pathResolve } from '@/utils/routerHelper' import { pathResolve } from '@/utils/routerHelper'
const { renderMenuTitle } = useRenderMenuTitle() const { renderMenuTitle } = useRenderMenuTitle()
export const useRenderMenuItem = ( export const useRenderMenuItem = () =>
// allRouters: AppRouteRecordRaw[] = [], // allRouters: AppRouteRecordRaw[] = [],
menuMode: 'vertical' | 'horizontal' {
) => { const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => {
const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => { return routers
return routers .filter((v) => !v.meta?.hidden)
.filter((v) => !v.meta?.hidden) .map((v) => {
.map((v) => { const meta = v.meta ?? {}
const meta = v.meta ?? {} const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
if ( if (
oneShowingChild && oneShowingChild &&
(!onlyOneChild?.children || onlyOneChild?.noShowingChildren) && (!onlyOneChild?.children || onlyOneChild?.noShowingChildren) &&
!meta?.alwaysShow !meta?.alwaysShow
) { ) {
return ( return (
<ElMenuItem index={onlyOneChild ? pathResolve(fullPath, onlyOneChild.path) : fullPath}> <ElMenuItem
{{ index={onlyOneChild ? pathResolve(fullPath, onlyOneChild.path) : fullPath}
default: () => renderMenuTitle(onlyOneChild ? onlyOneChild?.meta : meta) >
}} {{
</ElMenuItem> default: () => renderMenuTitle(onlyOneChild ? onlyOneChild?.meta : meta)
) }}
} else { </ElMenuItem>
const { getPrefixCls } = useDesign() )
} else {
return (
<ElSubMenu index={fullPath}>
{{
title: () => renderMenuTitle(meta),
default: () => renderMenuItem(v.children!, fullPath)
}}
</ElSubMenu>
)
}
})
}
const preFixCls = getPrefixCls('menu-popper') return {
return ( renderMenuItem
<ElSubMenu }
index={fullPath}
popperClass={
menuMode === 'vertical' ? `${preFixCls}--vertical` : `${preFixCls}--horizontal`
}
>
{{
title: () => renderMenuTitle(meta),
default: () => renderMenuItem(v.children!, fullPath)
}}
</ElSubMenu>
)
}
})
} }
return {
renderMenuItem
}
}

View File

@ -88,6 +88,9 @@ export default defineComponent({
} else { } else {
showTitle.value = !collapse showTitle.value = !collapse
} }
},
{
immediate: true
} }
) )
@ -202,11 +205,12 @@ export default defineComponent({
</div> </div>
<Menu <Menu
class={[ class={[
'!absolute top-0 z-1000', '!absolute top-0 z-3000',
{ {
'!left-[var(--tab-menu-min-width)]': unref(collapse), '!left-[var(--tab-menu-min-width)]': unref(collapse),
'!left-[var(--tab-menu-max-width)]': !unref(collapse), '!left-[var(--tab-menu-max-width)]': !unref(collapse),
'!w-[var(--left-menu-max-width)]': unref(showMenu) || unref(fixedMenu), '!w-[var(--left-menu-max-width)] border-r-1 border-r-solid border-[var(--el-border-color)]':
unref(showMenu) || unref(fixedMenu),
'!w-0': !unref(showMenu) && !unref(fixedMenu) '!w-0': !unref(showMenu) && !unref(fixedMenu)
} }
]} ]}

View File

@ -80,7 +80,7 @@ export default defineComponent({
border: propTypes.bool.def(true), border: propTypes.bool.def(true),
size: { size: {
type: String as PropType<ComponentSize>, type: String as PropType<ComponentSize>,
validator: (v: ComponentSize) => ['medium', 'small', 'mini'].includes(v) validator: (v: ComponentSize) => ['default', 'small', 'large'].includes(v)
}, },
fit: propTypes.bool.def(true), fit: propTypes.bool.def(true),
showHeader: propTypes.bool.def(true), showHeader: propTypes.bool.def(true),
@ -349,6 +349,7 @@ export default defineComponent({
const bindValue: Recordable = { ...attrs, ...unref(getProps) } const bindValue: Recordable = { ...attrs, ...unref(getProps) }
delete bindValue.columns delete bindValue.columns
delete bindValue.data delete bindValue.data
delete bindValue.align
return bindValue return bindValue
}) })

View File

@ -24,13 +24,8 @@ import { propTypes } from '@/utils/propTypes'
import { moveElementToIndex } from '@/utils/index' import { moveElementToIndex } from '@/utils/index'
import { BaseButton } from '@/components/Button' import { BaseButton } from '@/components/Button'
const appStore = useAppStore()
const sizeMap = computed(() => appStore.sizeMap)
const { setStorage, getStorage, removeStorage } = useStorage() const { setStorage, getStorage, removeStorage } = useStorage()
const { t } = useI18n()
export default defineComponent({ export default defineComponent({
name: 'TableActions', name: 'TableActions',
props: { props: {
@ -47,6 +42,10 @@ export default defineComponent({
}, },
emits: ['refresh', 'changSize'], emits: ['refresh', 'changSize'],
setup(props, { emit }) { setup(props, { emit }) {
const appStore = useAppStore()
const sizeMap = computed(() => appStore.sizeMap)
const { t } = useI18n()
const refresh = () => { const refresh = () => {
emit('refresh') emit('refresh')
} }

View File

@ -210,13 +210,14 @@ const isActive = (route: RouteLocationNormalizedLoaded): boolean => {
// //
const itemRefs = useTemplateRefsList<ComponentRef<typeof ContextMenu & ContextMenuExpose>>() const itemRefs = useTemplateRefsList<ComponentRef<typeof ContextMenu & ContextMenuExpose>>()
// //
const visibleChange = (visible: boolean, tagItem: RouteLocationNormalizedLoaded) => { const visibleChange = (visible: boolean, tagItem: RouteLocationNormalizedLoaded) => {
if (visible) { if (visible) {
for (const v of unref(itemRefs)) { for (const v of unref(itemRefs)) {
const elDropdownMenuRef = v.elDropdownMenuRef const elDropdownMenuRef = v.elDropdownMenuRef
if (tagItem.fullPath !== v.tagItem.fullPath) { if (tagItem.fullPath !== v.tagItem.fullPath) {
elDropdownMenuRef?.handleClose() elDropdownMenuRef?.handleClose()
setSelectTag(tagItem)
} }
} }
} }
@ -582,4 +583,3 @@ watch(
} }
} }
</style> </style>
@/hooks/web/useTagsView

View File

@ -1,16 +1,33 @@
import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss' import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss'
import transformerVariantGroup from '@unocss/transformer-variant-group' import transformerVariantGroup from '@unocss/transformer-variant-group'
import { loadEnv } from 'vite'
const root = process.cwd()
const createPresetIcons = () => { 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 // @ts-ignore
if (import.meta.env.VITE_USE_ONLINE_ICON === 'true') { if (env.VITE_USE_ONLINE_ICON === 'true') {
return []
} else {
return [ return [
presetIcons({ presetIcons({
prefix: '' 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 []
} }
} }

View File

@ -7,6 +7,7 @@ import progress from 'vite-plugin-progress'
import EslintPlugin from 'vite-plugin-eslint' import EslintPlugin from 'vite-plugin-eslint'
import { ViteEjsPlugin } from 'vite-plugin-ejs' import { ViteEjsPlugin } from 'vite-plugin-ejs'
import PurgeIcons from 'vite-plugin-purge-icons' import PurgeIcons from 'vite-plugin-purge-icons'
import ServerUrlCopy from 'vite-plugin-url-copy'
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import' import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
@ -38,6 +39,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
} }
}), }),
VueJsx(), VueJsx(),
ServerUrlCopy(),
progress(), progress(),
env.VITE_USE_ALL_ELEMENT_PLUS_STYLE === 'false' env.VITE_USE_ALL_ELEMENT_PLUS_STYLE === 'false'
? createStyleImportPlugin({ ? createStyleImportPlugin({

View File

@ -11,7 +11,7 @@ from fastapi.security import OAuth2PasswordBearer
""" """
系统版本 系统版本
""" """
VERSION = "3.8.2" VERSION = "3.9.0"
"""安全警告: 不要在生产中打开调试运行!""" """安全警告: 不要在生产中打开调试运行!"""
DEBUG = False DEBUG = False