mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 08:57:19 +08:00
Merge branch 'main' into gitee
This commit is contained in:
commit
ebf6bb23eb
@ -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)}
|
||||||
>
|
>
|
||||||
|
@ -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,18 +185,21 @@ function resolvePath(routePath) {
|
|||||||
</div>
|
</div>
|
||||||
<ReText
|
<ReText
|
||||||
v-if="
|
v-if="
|
||||||
!(
|
layout === 'mix' && toRaw(props.item.meta.icon)
|
||||||
layout === 'vertical' &&
|
? !isCollapse || props.item?.pathList?.length !== 2
|
||||||
isCollapse &&
|
: !(
|
||||||
toRaw(props.item.meta.icon) &&
|
layout === 'vertical' &&
|
||||||
props.item.parentId === null
|
isCollapse &&
|
||||||
)
|
toRaw(props.item.meta.icon) &&
|
||||||
|
props.item.parentId === null
|
||||||
|
)
|
||||||
"
|
"
|
||||||
:tippyProps="{
|
:tippyProps="{
|
||||||
offset: [0, -10],
|
offset: [0, -10],
|
||||||
theme: tooltipEffect
|
theme: tooltipEffect
|
||||||
}"
|
}"
|
||||||
:class="{
|
:class="{
|
||||||
|
'!w-full': true,
|
||||||
'!text-inherit': true,
|
'!text-inherit': true,
|
||||||
'!px-4':
|
'!px-4':
|
||||||
layout !== 'horizontal' &&
|
layout !== 'horizontal' &&
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user