2022-06-08 14:51:11 +08:00
< template >
< div class = "fullHeight pages" >
< vhead showR = "true" > < / vhead >
<!-- 点击标题跳转项目概况首页 , 菜单导航栏渲染的数据是vuex中的projectManageMenuList -- >
2023-06-26 16:24:12 +08:00
< div
2024-02-29 19:28:07 +08:00
v - if = "tabsShow && ($route.path.indexOf('/firm/') != -1 || $route.path.indexOf('/page') != -1)"
2023-06-26 16:24:12 +08:00
class = "menuBox"
2024-02-29 19:28:07 +08:00
: class = "{ big: ($route.path.indexOf('/firm/') != -1 || $route.path.indexOf('/page') != -1) }"
2023-06-26 16:24:12 +08:00
>
2022-06-08 14:51:11 +08:00
< el-menu
: default - active = "$route.path"
class = "el-menu-demo"
2023-06-26 16:24:12 +08:00
: class = "{ isIframe: isIframe }"
2022-06-08 14:51:11 +08:00
mode = "horizontal"
@ select = "handleSelect"
active - text - color = "#5181F6"
router
>
< div class = "wrapper" ref = "wrapper" >
< div class = "cont" ref = "cont" >
< div
v - for = "(item, index) in $store.state.projectManageMenuList"
: key = "index"
2023-06-26 16:24:12 +08:00
@ click = "clickItem(item)"
class = "menuInnerBox"
v - if = "
company != 'xingxuan' &&
item . target != '_blank' &&
( item . menuName != 'LED大屏显示器' || company != 'nanchang' )
"
2022-06-08 14:51:11 +08:00
>
2023-06-26 16:24:12 +08:00
< el-menu-item
class = "firstLevelMenu"
2022-06-08 14:51:11 +08:00
v - if = "!hasSubMenu(item.menuList)"
: index = "item.modulePath ? item.modulePath : item.path"
>
{ { item . moduleName ? item . moduleName : item . menuName } }
< / el-menu-item >
< el-submenu
: index = "item.modulePath ? item.modulePath : item.path"
v - else
>
< template slot = "title" > { {
item . moduleName ? item . moduleName : item . menuName
} } < / template >
< el-menu-item
: index = "data.path"
v - for = "(data, i) in item.menuList"
: key = "i"
> { { data . menuName } } < / e l - m e n u - i t e m
>
< / el-submenu >
< / div >
< / div >
< / div >
< / el-menu >
2024-04-22 00:24:17 +08:00
<!-- v - show = "$store.state.isShowBackIndex" -- >
< el-button
v - if = "$store.state.userInfo.accountType == 11 && $store.state.selectedGroupSn"
class = "backtoIndex"
type = "primary"
plain
@ click = "backtoIndex()"
size = "mini"
> 返回主菜单 < / e l - b u t t o n
>
2022-06-08 14:51:11 +08:00
< el-button
2024-04-22 00:24:17 +08:00
v - if = "$store.state.userInfo.accountType != 11 && $store.state.isShowBackIndex"
2022-06-08 14:51:11 +08:00
class = "backtoIndex"
type = "primary"
plain
@ click = "backtoIndex()"
size = "mini"
> 返回主菜单 < / e l - b u t t o n
>
< / div >
2023-06-26 16:24:12 +08:00
< div
v - else
class = "menuBox"
2024-02-29 20:07:50 +08:00
: class = "{ big: ($route.path.indexOf('/firm/') != -1 || $route.path.indexOf('/page') != -1) }"
2023-06-26 16:24:12 +08:00
>
2022-06-08 14:51:11 +08:00
< el-menu
: default - active = "$route.path"
class = "el-menu-demo"
2023-06-26 16:24:12 +08:00
: class = "{ isIframe: isIframe }"
2022-06-08 14:51:11 +08:00
mode = "horizontal"
@ select = "handleSelect"
active - text - color = "#5181F6"
router
>
< div class = "wrapper" ref = "wrapper" >
< div class = "cont" ref = "cont" >
< div
2024-10-26 09:14:35 +08:00
v - for = "(item, index) in filterMenuList"
2022-06-08 14:51:11 +08:00
: key = "index"
2023-06-26 16:24:12 +08:00
@ click = "clickItem(item)"
class = "menuInnerBox"
2022-06-08 14:51:11 +08:00
>
2023-06-26 16:24:12 +08:00
< el-menu-item
class = "firstLevelMenu"
2022-06-08 14:51:11 +08:00
v - if = "!hasSubMenu(item.menuList)"
: index = "item.modulePath ? item.modulePath : item.path"
>
{ { item . moduleName ? item . moduleName : item . menuName } }
< / el-menu-item >
< el-submenu
: index = "item.modulePath ? item.modulePath : item.path"
v - else
>
< template slot = "title" > { {
item . moduleName ? item . moduleName : item . menuName
} } < / template >
< el-menu-item
: index = "data.path"
v - for = "(data, i) in item.menuList"
: key = "i"
> { { data . menuName } } < / e l - m e n u - i t e m
>
< / el-submenu >
< / div >
< / div >
< / div >
<!-- < el-menu-item v-show ="item.target!='_blank'" :index="item.modulePath?item.modulePath:item.path" v-for="(item,index) in $store.state.menuList" :key ="index" >
{ { item . moduleName ? item . moduleName : item . menuName } }
< / el-menu-item > -- >
<!-- < el-submenu :index = "item.modulePath?item.modulePath:item.path" v-show ="item.target!='_blank'" v-for="(item,index) in $store.state.menuList" :key ="index" >
< template slot = "title" > { { item . moduleName ? item . moduleName : item . menuName } } < / template >
< el-menu-item v-if ="item.menuList" :index="data.path" v-for="(data,i) in item.menuList" :key ="i" > {{ data.menuName }} < / el -menu -item >
< / el-submenu > -- >
< / el-menu >
< el-button
2024-04-22 00:24:17 +08:00
v - if = "$store.state.userInfo.accountType == 11 && $store.state.selectedGroupSn"
class = "backtoIndex"
type = "primary"
plain
@ click = "backtoIndex()"
size = "mini"
> 返回主菜单 < / e l - b u t t o n
>
< el-button
v - if = "$store.state.userInfo.accountType != 11 && $store.state.isShowBackIndex"
2022-06-08 14:51:11 +08:00
class = "backtoIndex"
type = "primary"
plain
@ click = "backtoIndex()"
size = "mini"
> 返回主菜单 < / e l - b u t t o n
>
< / div >
< div class = "pageContainer" >
< div class = "pageDataContainer" >
2024-02-29 19:28:07 +08:00
< template v-if = "moduleData.pathType == 1 || !moduleData.pathType" >
< keep-alive >
< router-view v-if = "$route.meta.keepAlive" > < / router -view >
< / keep-alive >
< router-view v-if = "!$route.meta.keepAlive" > < / router -view >
< / template >
< template v-else >
< iframe :key = "key" :src = "moduleData.embedUrl" frameborder = "0" style = "width: 100%;height: 100%;" > < / iframe >
< / template >
2022-06-08 14:51:11 +08:00
< / div >
< / div >
<!-- < el-backtop target = ".pages" > < / el-backtop > -- >
< / div >
< / template >
< script >
import vhead from "./header" ;
import BScroll from 'better-scroll'
export default {
components : { vhead } ,
2023-06-26 16:24:12 +08:00
inject : [ 'reload' ] ,
2022-06-08 14:51:11 +08:00
data ( ) {
return {
2023-06-26 16:24:12 +08:00
selfScrollTop : '' ,
2022-06-08 14:51:11 +08:00
tabsShow ,
// menuList: [{ name: "企业注册审核", url: "/registerAudit" }],
currentUrl : "" ,
scroll : '' ,
2023-06-26 16:24:12 +08:00
company : COMPANY ,
2024-02-29 19:28:07 +08:00
isIframe : false ,
moduleData : {
pathType : 1
} , // 点击的模块数据
key : new Date ( ) . getTime ( )
2022-06-08 14:51:11 +08:00
} ;
} ,
2024-02-29 19:28:07 +08:00
created ( ) {
this . moduleData = this . $store . state . menuList [ 0 ]
if ( this . $route . path != this . $store . state . menuList [ 0 ] . modulePath ) {
this . $router . push ( this . $store . state . menuList [ 0 ] . modulePath ) ;
}
console . log ( this . $store . state . menuList , '7778888' )
console . log ( this . moduleData , '7778888' )
} ,
2024-10-26 09:14:35 +08:00
computed : {
filterMenuList ( ) {
2024-10-30 19:12:04 +08:00
let list = this . $store . state . menuList . filter ( item => {
2024-10-26 09:14:35 +08:00
return this . company != 'xingxuan' &&
item . target != '_blank' &&
( item . menuName != 'LED大屏显示器' || this . company != 'nanchang' ) ;
2024-10-30 19:12:04 +08:00
} )
// 非数据中台页面,过滤数据中台菜单
if ( this . $route . path . includes ( 'equipmentCenter' ) ) {
return list
} else {
return list . filter ( item => ! item . menuEquipment ) ;
}
2024-10-26 09:14:35 +08:00
}
} ,
2022-06-08 14:51:11 +08:00
mounted ( ) {
2024-02-29 19:28:07 +08:00
console . log ( "mounted" , this . $route ) ;
2022-06-08 14:51:11 +08:00
this . $nextTick ( ( ) => {
let timer = setTimeout ( ( ) => {
if ( timer ) {
clearTimeout ( timer )
this . verScroll ( )
}
} , 0 )
} )
2023-06-26 16:24:12 +08:00
if ( window . localStorage . getItem ( 'isIframe' ) ) {
if ( window . localStorage . getItem ( 'isIframe' ) == '1' ) {
2022-06-08 14:51:11 +08:00
this . isIframe = true
// this.$nextTick(()=>{
// setOffset(2180,360)
// })
2023-06-26 16:24:12 +08:00
2022-06-08 14:51:11 +08:00
}
console . log ( window . localStorage . getItem ( 'isIframe' ) )
}
} ,
2023-09-15 14:51:27 +08:00
2022-06-08 14:51:11 +08:00
methods : {
2023-06-26 16:24:12 +08:00
clickItem ( item ) {
2024-02-29 19:28:07 +08:00
console . log ( item )
this . moduleData = item ;
2023-09-15 14:51:27 +08:00
//金林湾跳转
if ( this . company == 'jlw' ) {
if ( item . menuName == '工地可视化' ) {
this . $router . push ( {
path : item . path ,
// params: {
// companyProject: 'jlw'
// }
} ) ;
// window.open(this.$router.resolve(item.path).href, '_self');
}
} else {
window . _paq . push ( [ 'trackEvent' , '点击' , item . moduleName ? item . moduleName : item . menuName , '切换到' + ( item . moduleName ? item . moduleName : item . menuName ) ] ) ;
}
2024-02-29 19:28:07 +08:00
this . $forceUpdate ( ) ;
2022-06-08 14:51:11 +08:00
} ,
hasSubMenu ( list ) {
//用于判断有没有下级菜单
let onoff = false ;
// console.log("list", list);
if ( list && list . length > 0 ) {
list . forEach ( ( element ) => {
if ( element . menuName ) {
onoff = true ;
return ;
}
} ) ;
}
// console.log("onoff", onoff);
return onoff ;
} ,
backtoIndex ( ) {
// window._paq.push(['trackEvent', '点击', '返回主菜单','返回主菜单' ])
var url = window . location . href ;
2024-04-11 19:15:19 +08:00
// this.$router.push("/workSpace");
if ( url . indexOf ( "equipmentCenter.html" ) != - 1 ) {
this . $router . push ( "/equipmentCenterIndx" ) ;
2024-04-22 00:24:17 +08:00
} else if ( url . indexOf ( "/supplier/" ) != - 1 ) {
2024-04-20 19:07:58 +08:00
this . $router . push ( "/supplierIndex" ) ;
2024-04-11 19:15:19 +08:00
} else {
this . $router . push ( "/projectIndex" ) ;
}
2022-06-08 14:51:11 +08:00
} ,
2023-06-26 16:24:12 +08:00
handleSelect ( key , keyPath ) {
2022-06-08 14:51:11 +08:00
console . log ( key )
console . log ( keyPath )
// console.log(index)
// this.$store.commit('setCurrentUrl',url)
// this.$store.dispatch('currentUrl',url)
} ,
2023-06-26 16:24:12 +08:00
verScroll ( ) {
2022-06-08 14:51:11 +08:00
// console.log(this.$route.path)
2024-02-29 20:07:50 +08:00
if ( this . $route . path . indexOf ( '/firm/' ) != - 1 || this . $route . path . indexOf ( '/page' ) != - 1 ) {
2022-06-08 14:51:11 +08:00
this . $refs . cont . style . width = "100%" ;
return ;
} else {
2024-05-22 17:25:30 +08:00
// let width = this.$store.state.menuList.length * 150// 动态计算出滚动区域的大小,前面已经说过了,产生滚动的原因是滚动区域宽度大于父盒子宽度
// this.$refs.cont.style.width = width + 'px'
this . $refs . cont . style . width = 'max-content' ;
2022-06-08 14:51:11 +08:00
this . $nextTick ( ( ) => {
if ( ! this . scroll ) {
this . scroll = new BScroll ( this . $refs . wrapper , {
startX : 0 ,
click : true ,
mouseWheel : true ,
scrollX : true ,
scrollY : false ,
eventPassthrough : 'vertical'
} )
} else {
console . log ( this . scroll . refresh ( ) )
this . scroll . refresh ( ) //如果dom结构发生改变调用该方法
}
console . log ( this . scroll )
} )
}
this . reload ;
}
} ,
2024-02-29 19:28:07 +08:00
watch : {
$route : {
handler ( val ) {
this . key = new Date ( ) . getTime ( ) ;
} ,
immediate : true
}
}
2022-06-08 14:51:11 +08:00
} ;
< / script >
< style lang = "less" scoped >
// .el-menu.el-menu--horizontal {
// box-sizing: border-box;
// padding: 0 100px 4px;
// border-bottom: none;
// }
. el - menu . el - menu -- horizontal {
box - sizing : border - box ;
// padding: 0 !important;
border - bottom : none ;
margin - left : 50 px ;
margin - right : 120 px ;
white - space : nowrap ;
overflow : hidden ;
}
2023-06-26 16:24:12 +08:00
. isIframe {
/deeep/ . el - menu . el - menu -- horizontal {
2022-06-08 14:51:11 +08:00
margin : 0 ;
}
}
. el - menu -- horizontal {
. el - menu - item ,
/deep/ . el - submenu _ _title {
font - family : PingFangSC - Medium ;
font - size : 14 px ;
letter - spacing : 0 ;
height : 44 px ;
line - height : 44 px ;
padding : 0 ;
margin - right : 80 px ;
& : hover ,
& : focus {
background - color : transparent ;
}
& : hover {
color : # 5181 f6 ;
}
}
}
2023-06-26 16:24:12 +08:00
/deep/ . el - submenu _ _title {
padding - right : 20 px ! important ;
. el - submenu _ _icon - arrow {
2022-06-08 14:51:11 +08:00
right : 0 px ;
}
}
2023-06-26 16:24:12 +08:00
. el - menu -- horizontal . firstLevelMenu . is - active ,
/deep/ . is - active . el - submenu _ _title {
2022-06-08 14:51:11 +08:00
border - bottom : 3 px solid # 409 eff ;
}
. menuInnerBox {
display : inline - block ;
}
. menuBox {
position : relative ;
& . big {
. el - menu . el - menu -- horizontal {
padding : 0 ;
display : flex ;
2023-06-26 16:24:12 +08:00
. cont {
2022-06-08 14:51:11 +08:00
display : flex ;
}
. menuInnerBox {
width : 100 % ;
// flex: 1;
}
. el - menu - item {
flex : 1 ;
margin - right : 0 ;
text - align : center ;
border - bottom : none ;
height : 48 px ;
line - height : 48 px ;
& . is - active ,
& : hover {
background - color : @ -- color - primary ;
color : # fff ! important ;
}
}
}
}
}
. backtoIndex {
position : absolute ;
right : 20 px ;
top : 12 px ;
font - size : 14 px ;
padding : 4 px 5 px ;
}
. toOverview {
right : 120 px ;
}
@ media screen and ( max - width : 1500 px ) {
. el - menu . el - menu -- horizontal {
padding : 0 40 px 4 px ;
}
}
2023-06-26 16:24:12 +08:00
. big {
2022-06-08 14:51:11 +08:00
. el - menu . el - menu -- horizontal {
margin : 0 ;
width : 100 % ;
2023-06-26 16:24:12 +08:00
. wrapper {
2022-06-08 14:51:11 +08:00
width : 100 % ;
}
2023-06-26 16:24:12 +08:00
. cont {
2022-06-08 14:51:11 +08:00
width : 100 % ;
}
}
}
< / style >
2022-07-15 09:47:14 +08:00