优化 ”组件“ 隐藏菜单 还需要访问路由的问题

修复 图片字段为空 报错的问题
This commit is contained in:
吕金泽 2022-07-09 20:37:31 +08:00
parent d1b078f134
commit f8c4f3ae70
4 changed files with 44 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,8 +40,8 @@
<a v-else-if="col.type == 'downloadAll'" @click="$common.downloadMore(scope.row[col.field])" href="javascript:;">下载</a>
<el-image
v-else-if="col.type === 'image'"
:src="scope.row[col.field].startsWith('http') ? scope.row[col.field] : $global.baseApi + scope.row[col.field]"
:preview-src-list="[scope.row[col.field].startsWith('http') ? scope.row[col.field] : $global.baseApi + scope.row[col.field]]"
:src="scope.row[col.field] && scope.row[col.field].startsWith('http') ? scope.row[col.field] : $global.baseApi + scope.row[col.field]"
:preview-src-list="[scope.row[col.field] && scope.row[col.field].startsWith('http') ? scope.row[col.field] : $global.baseApi + scope.row[col.field]]"
/>
<span v-else-if="col.type === 'html'" v-html="scope.row[col.field]"></span>
<span v-else-if="col.click">

View File

@ -1,5 +1,5 @@
<template>
<div v-if="!item.hidden">
<div v-if="item.isShow == 1">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">

View File

@ -14,11 +14,15 @@ export const filterAsyncRouter = (routers, level) => {
router.props = { url: router.url }
router.path = "/" + sha256(router.url)
}
if(router.url.startsWith('http')){
var setLayout = () => {
router.path = "/" + common.uuid()
router.component = level > 0 ? layoutModules[`../layout/none.vue`] : loadLayoutView()
}
if(router.url && router.url.startsWith('http')){
if(router.openMode == '0'){
setIframe()
}
} else if(router.url.startsWith('/') && router.url.indexOf('.htm') != -1) {
} else if(router.url && router.url.startsWith('/') && router.url.indexOf('.htm') != -1) {
if(router.openMode == '0'){
setIframe()
}else{
@ -30,16 +34,30 @@ export const filterAsyncRouter = (routers, level) => {
} else if (router.component) {
const component = router.component
if (component === 'Layout') {
router.path = "/" + common.uuid()
router.component = level > 0 ? layoutModules[`../layout/none.vue`] : loadLayoutView(component)
if (router.children && router.children.length > 0) {
const children = filterAsyncRouter(router.children, level + 1);
if(!children.some(it => it.isShow == 0)){
router.children = children
setLayout()
}else{
router.children = undefined
router.alwaysShow = false
router.redirect = ''
router.path = router.path.startsWith('/') ? router.path : '/' + router.path
router.component = loadView(router.path) || layoutModules[`../layout/empty.vue`]
}
}else{
setLayout()
}
} else {
router.path = router.path.startsWith('/') ? router.path : '/' + router.path
router.component = loadView(component) || layoutModules[`../layout/empty.vue`]
}
}
if (router.children && router.children.length) {
router.children = filterAsyncRouter(router.children, level + 1)
}
return true
} else if (router.componentName) {
router.component = loadView(`/common/show-component`)
router.props = { name: router.componentName }
return true
}
return false
@ -47,7 +65,7 @@ export const filterAsyncRouter = (routers, level) => {
return accessedRouters
}
export const loadLayoutView = (view) => {
export const loadLayoutView = () => {
return layoutModules[`../layout/layout.vue`]
}