Merge branch 'main' into gitee

This commit is contained in:
xiaoxian521 2024-04-15 17:56:10 +08:00
commit ebf6bb23eb
5 changed files with 54 additions and 23 deletions

View File

@ -1,7 +1,15 @@
import Sortable from "sortablejs"; import Sortable from "sortablejs";
import { transformI18n } from "@/plugins/i18n"; import { transformI18n } from "@/plugins/i18n";
import { useEpThemeStoreHook } from "@/store/modules/epTheme"; import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { defineComponent, ref, computed, type PropType, nextTick } from "vue"; import {
type PropType,
ref,
unref,
computed,
nextTick,
defineComponent,
getCurrentInstance
} from "vue";
import { import {
delay, delay,
cloneDeep, cloneDeep,
@ -34,6 +42,10 @@ const props = {
isExpandAll: { isExpandAll: {
type: Boolean, type: Boolean,
default: true default: true
},
tableKey: {
type: [String, Number] as PropType<string | number>,
default: "0"
} }
}; };
@ -46,6 +58,7 @@ export default defineComponent({
const loading = ref(false); const loading = ref(false);
const checkAll = ref(true); const checkAll = ref(true);
const isIndeterminate = ref(false); const isIndeterminate = ref(false);
const instance = getCurrentInstance()!;
const isExpandAll = ref(props.isExpandAll); const isExpandAll = ref(props.isExpandAll);
const filterColumns = cloneDeep(props?.columns).filter(column => const filterColumns = cloneDeep(props?.columns).filter(column =>
isBoolean(column?.hide) isBoolean(column?.hide)
@ -170,9 +183,9 @@ export default defineComponent({
const rowDrop = (event: { preventDefault: () => void }) => { const rowDrop = (event: { preventDefault: () => void }) => {
event.preventDefault(); event.preventDefault();
nextTick(() => { nextTick(() => {
const wrapper: HTMLElement = document.querySelector( const wrapper: HTMLElement = (
".el-checkbox-group>div" instance?.proxy?.$refs[`GroupRef${unref(props.tableKey)}`] as any
); ).$el.firstElementChild;
Sortable.create(wrapper, { Sortable.create(wrapper, {
animation: 300, animation: 300,
handle: ".drag-btn", handle: ".drag-btn",
@ -299,6 +312,7 @@ export default defineComponent({
<div class="pt-[6px] pl-[11px]"> <div class="pt-[6px] pl-[11px]">
<el-scrollbar max-height="36vh"> <el-scrollbar max-height="36vh">
<el-checkbox-group <el-checkbox-group
ref={`GroupRef${unref(props.tableKey)}`}
modelValue={checkedColumns.value} modelValue={checkedColumns.value}
onChange={value => handleCheckedColumnsChange(value)} onChange={value => handleCheckedColumnsChange(value)}
> >

View File

@ -145,7 +145,7 @@ function resolvePath(routePath) {
props.item?.pathList?.length === 2) props.item?.pathList?.length === 2)
" "
truncated truncated
class="!px-4 !text-inherit" class="!w-full !px-4 !text-inherit"
> >
{{ transformI18n(onlyOneChild.meta.title) }} {{ transformI18n(onlyOneChild.meta.title) }}
</el-text> </el-text>
@ -157,7 +157,7 @@ function resolvePath(routePath) {
offset: [0, -10], offset: [0, -10],
theme: tooltipEffect theme: tooltipEffect
}" }"
class="!text-inherit" class="!w-full !text-inherit"
> >
{{ transformI18n(onlyOneChild.meta.title) }} {{ transformI18n(onlyOneChild.meta.title) }}
</ReText> </ReText>
@ -185,7 +185,9 @@ function resolvePath(routePath) {
</div> </div>
<ReText <ReText
v-if=" v-if="
!( layout === 'mix' && toRaw(props.item.meta.icon)
? !isCollapse || props.item?.pathList?.length !== 2
: !(
layout === 'vertical' && layout === 'vertical' &&
isCollapse && isCollapse &&
toRaw(props.item.meta.icon) && toRaw(props.item.meta.icon) &&
@ -197,6 +199,7 @@ function resolvePath(routePath) {
theme: tooltipEffect theme: tooltipEffect
}" }"
:class="{ :class="{
'!w-full': true,
'!text-inherit': true, '!text-inherit': true,
'!px-4': '!px-4':
layout !== 'horizontal' && layout !== 'horizontal' &&

View File

@ -367,9 +367,23 @@ function hasAuth(value: string | Array<string>): boolean {
return isAuths ? true : false; return isAuths ? true : false;
} }
function handleTopMenu(route) {
if (route?.children && route.children.length > 1) {
if (route.redirect) {
return route.children.filter(cur => cur.path === route.redirect)[0];
} else {
return route.children[0];
}
} else {
return route;
}
}
/** 获取所有菜单中的第一个菜单(顶级菜单)*/ /** 获取所有菜单中的第一个菜单(顶级菜单)*/
function getTopMenu(tag = false): menuType { function getTopMenu(tag = false): menuType {
const topMenu = usePermissionStoreHook().wholeMenus[0]?.children[0]; const topMenu = handleTopMenu(
usePermissionStoreHook().wholeMenus[0]?.children[0]
);
tag && useMultiTagsStoreHook().handleTags("push", topMenu); tag && useMultiTagsStoreHook().handleTags("push", topMenu);
return topMenu; return topMenu;
} }

View File

@ -74,7 +74,7 @@ class PureHttp {
} }
/** 请求白名单放置一些不需要token的接口通过设置请求白名单防止token过期后再请求造成的死循环问题 */ /** 请求白名单放置一些不需要token的接口通过设置请求白名单防止token过期后再请求造成的死循环问题 */
const whiteList = ["/refresh-token", "/login"]; const whiteList = ["/refresh-token", "/login"];
return whiteList.find(url => url === config.url) return whiteList.some(url => config.url.endsWith(url))
? config ? config
: new Promise(resolve => { : new Promise(resolve => {
const data = getToken(); const data = getToken();

View File

@ -70,10 +70,10 @@ getMine().then(res => {
<el-container class="h-full"> <el-container class="h-full">
<el-aside <el-aside
v-if="isOpen" v-if="isOpen"
class="settings-sidebar px-2 dark:!bg-[var(--el-bg-color)]" class="pure-account-settings overflow-hidden px-2 dark:!bg-[var(--el-bg-color)] border-r-[1px] border-[var(--pure-border-color)]"
:width="deviceDetection() ? '180px' : '240px'" :width="deviceDetection() ? '180px' : '240px'"
> >
<el-menu :default-active="witchPane" class="settings-menu"> <el-menu :default-active="witchPane" class="pure-account-settings-menu">
<el-menu-item <el-menu-item
class="hover:!transition-all hover:!duration-200 hover:!text-base !h-[50px]" class="hover:!transition-all hover:!duration-200 hover:!text-base !h-[50px]"
@click="router.go(-1)" @click="router.go(-1)"
@ -129,20 +129,18 @@ getMine().then(res => {
</el-container> </el-container>
</template> </template>
<style lang="scss" scoped> <style lang="scss">
.settings-sidebar { .pure-account-settings {
overflow: hidden;
background: $menuBg; background: $menuBg;
border-right: 1px solid var(--pure-border-color);
} }
.settings-menu { .pure-account-settings-menu {
background-color: transparent; background-color: transparent;
border: none; border: none;
::v-deep(.el-menu-item) { .el-menu-item {
height: 48px !important; height: 48px !important;
color: $menuText !important; color: $menuText;
background-color: transparent !important; background-color: transparent !important;
transition: color 0.2s; transition: color 0.2s;
@ -169,7 +167,9 @@ getMine().then(res => {
} }
} }
} }
</style>
<style lang="scss" scoped>
body[layout] { body[layout] {
.el-menu--vertical .is-active { .el-menu--vertical .is-active {
color: #fff !important; color: #fff !important;