解决导航栏显示上次打开所有导航栏记录bug

This commit is contained in:
zhujiyan
2024-08-05 11:20:35 +08:00
parent 12ecbbeb34
commit 5a6951a866
53 changed files with 3740 additions and 63 deletions

View File

@@ -21,9 +21,9 @@ import { isEmpty } from 'lodash-es'
import { setNavTabsWidth } from '@/utils/layout'
import { adminBaseRoutePath } from '@/router/static'
import { getRouteMenu, dictDataCache } from '@/api/auth'
import { getAreaList } from '@/api/common'
import { getAreaList, areaSelect } from '@/api/common'
import { BasicDictData } from '@/stores/interface'
import { getUserById } from '@/api/user-boot/user'
import { getAllUserSimpleList, getUserById } from '@/api/user-boot/user'
defineOptions({
components: { Default, Classic, Streamline, Double }
@@ -51,10 +51,12 @@ onBeforeMount(() => {
})
const init = async () => {
await Promise.all([getAreaList(), dictDataCache(),getUserById()]).then(res => {
await Promise.all([getAreaList(), dictDataCache(), getUserById(), areaSelect(),getAllUserSimpleList()]).then(res => {
dictData.state.area = res[0].data
dictData.state.basic = res[1].data
// dictData.state.userList=res[4].data
adminInfo.dataFill(res[2].data)
// dictData.state.areaTree = res[3].data
})
/**
* 后台初始化请求,获取站点配置,动态路由等信息
@@ -62,11 +64,16 @@ const init = async () => {
getRouteMenu().then((res: any) => {
const handlerMenu = (data: any) => {
data.forEach((item: any) => {
item.routePath = item.routePath[0] == '/' ? item.routePath.substring(1, item.routePath.length) : item.routePath
item.routePath =
item.routePath[0] == '/' ? item.routePath.substring(1, item.routePath.length) : item.routePath
item.path = item.routePath
item.name = item.routePath
item.keepalive = item.routePath
item.component = item.routeName || '/src/views/Event-boot/Region/overview.vue'
item.component = item.routeName
? item.routeName.indexOf('/src/views/') > -1
? item.routeName
: `/src/views/${item.routeName}/index.vue`
: ''
item.type = item.children && item.children.length > 0 ? 'menu_dir' : 'menu'
item.menu_type = item.children && item.children.length > 0 ? null : 'tab'
if (item.children) {