flx:修改企业后台 menu太多会掉入第二行

This commit is contained in:
X_Rian 2024-07-04 15:50:56 +08:00
parent 2ba35dcc92
commit e6f970a027

View File

@ -4,24 +4,47 @@
<div class="title_l flex"> <div class="title_l flex">
<!-- <img v-if="LOGO_white" :src="'./img/logo/'+LOGO_white+'.png'" class="icon" /> <!-- <img v-if="LOGO_white" :src="'./img/logo/'+LOGO_white+'.png'" class="icon" />
<span>{{$t('message.companyDiagram.pageTitle')}}</span> --> <span>{{$t('message.companyDiagram.pageTitle')}}</span> -->
<img v-if="systemInfo.platformLogo" :src="systemInfo.platformLogo" class="logo" height="25" /> <img
<img v-else-if="LOGO_white" :src="'./img/logo/'+LOGO_white+'.png'" class="logo" height="25" /> v-if="systemInfo.platformLogo"
<span v-if="company != 'nanchang'" style="cursor: pointer" @click="back">{{systemInfo.platformName}} </span> :src="systemInfo.platformLogo"
class="logo"
height="25"
/>
<img
v-else-if="LOGO_white"
:src="'./img/logo/' + LOGO_white + '.png'"
class="logo"
height="25"
/>
<span v-if="company != 'nanchang'" style="cursor: pointer" @click="back"
>{{ systemInfo.platformName }}
</span>
<span v-if="company != 'nanchang'"> - </span> <span v-if="company != 'nanchang'"> - </span>
<span v-if="company != 'nanchang'">{{$t('message.companyDiagram.pageTitle')}}</span> <span v-if="company != 'nanchang'">{{
$t("message.companyDiagram.pageTitle")
}}</span>
<!-- 南昌地铁头部样式 --> <!-- 南昌地铁头部样式 -->
<span v-if="company == 'nanchang'" style="cursor: pointer" @click="back">{{$t('message.companyDiagram.pageTitle')}}</span> <span
v-if="company == 'nanchang'"
style="cursor: pointer"
@click="back"
>{{ $t("message.companyDiagram.pageTitle") }}</span
>
</div> </div>
<!-- <div class="title_near flex" v-if="![1,2].includes($store.state.userInfo.accountType)"> <!-- <div class="title_near flex" v-if="![1,2].includes($store.state.userInfo.accountType)">
<userChange></userChange> <userChange></userChange>
</div> --> </div> -->
<div class="title_near-tow flex" v-if="![11,1,2].includes($store.state.userInfo.accountType) && workSpaceShow"> <div
class="title_near-tow flex"
v-if="
![11, 1, 2].includes($store.state.userInfo.accountType) &&
workSpaceShow
"
>
<div class="divider-line"></div> <div class="divider-line"></div>
<centerChange></centerChange> <centerChange></centerChange>
</div> </div>
<div <div class="title_r flex">
class="title_r flex"
>
<account></account> <account></account>
</div> </div>
</div> </div>
@ -34,24 +57,22 @@
active-text-color="#5181F6" active-text-color="#5181F6"
router router
> >
<div class="wrapper" ref="wrapper">
<div class="cont" ref="cont">
<div <div
v-for="(item, index) in menuList" v-for="(item, index) in menuList"
:key="index" :key="index"
class="menuInnerBox" class="menuInnerBox"
> >
<el-menu-item class="firstLevelMenu" <el-menu-item
class="firstLevelMenu"
v-if="!hasSubMenu(item.menuList)" v-if="!hasSubMenu(item.menuList)"
:index="item.modulePath" :index="item.modulePath"
> >
{{ item.moduleName}} {{ item.moduleName }}
</el-menu-item> </el-menu-item>
<el-submenu <el-submenu :index="item.modulePath" v-else>
:index="item.modulePath" <template slot="title">{{ item.moduleName }}</template>
v-else
>
<template slot="title">{{
item.moduleName
}}</template>
<el-menu-item <el-menu-item
:index="data.path" :index="data.path"
v-for="(data, i) in item.menuList" v-for="(data, i) in item.menuList"
@ -60,6 +81,8 @@
> >
</el-submenu> </el-submenu>
</div> </div>
</div>
</div>
<!-- <el-menu-item :index="item.modulePath" v-for="(item,index) in menuList" :key="index">{{item.moduleName}}</el-menu-item> --> <!-- <el-menu-item :index="item.modulePath" v-for="(item,index) in menuList" :key="index">{{item.moduleName}}</el-menu-item> -->
</el-menu> </el-menu>
</div> </div>
@ -74,24 +97,19 @@
import account from "@/components/account.vue"; import account from "@/components/account.vue";
import userChange from "@/components/userChange.vue"; import userChange from "@/components/userChange.vue";
import centerChange from "@/components/centerChange.vue"; import centerChange from "@/components/centerChange.vue";
import { import BScroll from "better-scroll";
getNewUserAllModulePageApi, import { getNewUserAllModulePageApi } from "@/assets/js/api/jxjadmin.js";
} from "@/assets/js/api/jxjadmin.js";
export default { export default {
data() { data() {
return { return {
LOGO_white:LOGO_white, LOGO_white: LOGO_white,
currentUrl:'', currentUrl: "",
menuList:[ menuList: [
// { name: this.$t('message.companyDiagram.menuName1'), url: "/companyAdmin/companyDiagram" }, // { name: this.$t('message.companyDiagram.menuName1'), url: "/companyAdmin/companyDiagram" },
// { name: '', url: "/companyAdmin/systemSetup/enterpriseInfo" }, // { name: '', url: "/companyAdmin/systemSetup/enterpriseInfo" },
// { name: '', url: "/companyAdmin/docManage" }, // { name: '', url: "/companyAdmin/docManage" },
// { name: '', url: "/companyAdmin/basicSetup/checkItem" }, // { name: '', url: "/companyAdmin/basicSetup/checkItem" },
// { name: '', url: "/companyAdmin/companyDiagram" }, // { name: '', url: "/companyAdmin/companyDiagram" },
// { name: '', url: "/companyAdmin/basicSetup/checkItem" }, // { name: '', url: "/companyAdmin/basicSetup/checkItem" },
// { name: '', url: "/companyAdmin/firmNotice/notice" }, // { name: '', url: "/companyAdmin/firmNotice/notice" },
// { name: '', url: "/companyAdmin/systemSetup/index" }, // { name: '', url: "/companyAdmin/systemSetup/index" },
@ -99,35 +117,42 @@ export default {
// { name: '', url: "/companyAdmin/progressOfWorks/index" }, // { name: '', url: "/companyAdmin/progressOfWorks/index" },
// { name: '', url: "/companyAdmin/studyManage/courseList" }, // { name: '', url: "/companyAdmin/studyManage/courseList" },
], ],
systemInfo:{ systemInfo: {
"loginBackgroundImage": "", loginBackgroundImage: "",
"loginLogo": "", loginLogo: "",
"platformLogo": "", platformLogo: "",
"platformName": "智慧工地云平台" platformName: "智慧工地云平台",
}, },
workSpaceShow: false workSpaceShow: false,
}; };
}, },
components:{ components: {
account, account,
userChange, userChange,
centerChange centerChange,
}, },
created() { created() {
this.company = COMPANY; this.company = COMPANY;
console.log(COMPANY) console.log(COMPANY);
if(this.$store.state.projectSn){ if (this.$store.state.projectSn) {
this.getModuleList(); this.getModuleList();
} }
}, },
mounted(){ mounted() {
this.getAllModule() this.getAllModule();
if(localStorage.getItem('systemInfo')){ if (localStorage.getItem("systemInfo")) {
this.systemInfo=JSON.parse(localStorage.getItem('systemInfo')) this.systemInfo = JSON.parse(localStorage.getItem("systemInfo"));
} }
document.title='企业后台' document.title = "企业后台";
console.log('mounted',this.$route.path) console.log("mounted", this.$route.path);
this.$nextTick(() => {
let timer = setTimeout(() => {
if (timer) {
clearTimeout(timer);
this.verScroll();
}
}, 0);
});
}, },
methods: { methods: {
// () // ()
@ -161,11 +186,11 @@ export default {
// console.log("onoff", onoff); // console.log("onoff", onoff);
return onoff; return onoff;
}, },
getAllModule(){ getAllModule() {
var half = this.$store.state.userInfo.menuAuthority.moduleList var half = this.$store.state.userInfo.menuAuthority.moduleList;
half.forEach(element => { half.forEach((element) => {
if(element.moduleType==3){ if (element.moduleType == 3) {
this.menuList.push(element) this.menuList.push(element);
} }
}); });
// getAllModuleApi({moduleType:4}).then(res => { // getAllModuleApi({moduleType:4}).then(res => {
@ -189,16 +214,49 @@ export default {
// this.$store.dispatch('currentUrl',url) // this.$store.dispatch('currentUrl',url)
}, },
back() { back() {
this.$router.push("/firm/projectManage") this.$router.push("/firm/projectManage");
},
verScroll() {
// console.log(this.$route.path)
if (
this.$route.path.indexOf("/firm/") != -1 ||
this.$route.path.indexOf("/page") != -1
) {
this.$refs.cont.style.width = "100%";
return;
} else {
// let width = this.$store.state.menuList.length * 150//
// this.$refs.cont.style.width = width + 'px'
this.$refs.cont.style.width = "max-content";
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;
},
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.el-menu.el-menu--horizontal { .el-menu.el-menu--horizontal {
box-sizing: border-box; box-sizing: border-box;
padding: 0 162px 4px; // padding: 0 162px 4px;
margin: 0 40px;
border-bottom: none; border-bottom: none;
overflow:hidden;
} }
.el-menu--horizontal { .el-menu--horizontal {
.el-menu-item, .el-menu-item,
@ -219,13 +277,15 @@ export default {
} }
} }
} }
/deep/.el-submenu__title{
padding-right: 20px!important; /deep/.el-submenu__title {
.el-submenu__icon-arrow{ padding-right: 20px !important;
.el-submenu__icon-arrow {
right: 0px; right: 0px;
} }
} }
.el-menu--horizontal .firstLevelMenu.is-active,/deep/.is-active .el-submenu__title { .el-menu--horizontal .firstLevelMenu.is-active,
/deep/.is-active .el-submenu__title {
border-bottom: 3px solid #409eff; border-bottom: 3px solid #409eff;
} }
.menuInnerBox { .menuInnerBox {
@ -260,7 +320,7 @@ export default {
// .menuInnerBox { // .menuInnerBox {
// display: inline-block; // display: inline-block;
// } // }
.menuBox{ .menuBox {
position: relative; position: relative;
} }
.title { .title {
@ -272,7 +332,7 @@ export default {
height: 61px; height: 61px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end justify-content: flex-end;
} }
.title_l { .title_l {
font-family: PingFangSC-Semibold; font-family: PingFangSC-Semibold;
@ -284,14 +344,14 @@ export default {
margin-right: 14px; margin-right: 14px;
} }
} }
.title_near{ .title_near {
margin-right: 50px; margin-right: 50px;
} }
.title_near-tow{ .title_near-tow {
.divider-line{ .divider-line {
width: 1px; width: 1px;
height: 16px; height: 16px;
background: #FFFFFF; background: #ffffff;
margin-right: 50px; margin-right: 50px;
} }
} }