diff --git a/src/views/companyAdmin/layout.vue b/src/views/companyAdmin/layout.vue index 44656ea3..a6e9ff3d 100644 --- a/src/views/companyAdmin/layout.vue +++ b/src/views/companyAdmin/layout.vue @@ -4,24 +4,47 @@
- - - {{systemInfo.platformName}} + + + {{ systemInfo.platformName }} + - - {{$t('message.companyDiagram.pageTitle')}} + {{ + $t("message.companyDiagram.pageTitle") + }} - {{$t('message.companyDiagram.pageTitle')}} + {{ $t("message.companyDiagram.pageTitle") }}
-
+
-
+
@@ -34,31 +57,31 @@ active-text-color="#5181F6" router > - @@ -74,60 +97,62 @@ import account from "@/components/account.vue"; import userChange from "@/components/userChange.vue"; import centerChange from "@/components/centerChange.vue"; -import { - getNewUserAllModulePageApi, -} from "@/assets/js/api/jxjadmin.js"; +import BScroll from "better-scroll"; +import { getNewUserAllModulePageApi } from "@/assets/js/api/jxjadmin.js"; export default { data() { return { - LOGO_white:LOGO_white, - currentUrl:'', - menuList:[ + LOGO_white: LOGO_white, + currentUrl: "", + menuList: [ // { name: this.$t('message.companyDiagram.menuName1'), url: "/companyAdmin/companyDiagram" }, // { name: '系统设置', url: "/companyAdmin/systemSetup/enterpriseInfo" }, // { name: '文档管理', url: "/companyAdmin/docManage" }, // { name: '质量检查模板设置', url: "/companyAdmin/basicSetup/checkItem" }, - - - // { name: '权限管理', url: "/companyAdmin/companyDiagram" }, - // { name: '基础设置', url: "/companyAdmin/basicSetup/checkItem" }, // { name: '企业发文', url: "/companyAdmin/firmNotice/notice" }, // { name: '系统设置', url: "/companyAdmin/systemSetup/index" }, // { name: '质量及安全管理', url: "/companyAdmin/qualityAndSafety/evaluate" }, // { name: '工程进度', url: "/companyAdmin/progressOfWorks/index" }, // { name: '学习管理', url: "/companyAdmin/studyManage/courseList" }, - ], - systemInfo:{ - "loginBackgroundImage": "", - "loginLogo": "", - "platformLogo": "", - "platformName": "智慧工地云平台" - }, - workSpaceShow: false + ], + systemInfo: { + loginBackgroundImage: "", + loginLogo: "", + platformLogo: "", + platformName: "智慧工地云平台", + }, + workSpaceShow: false, }; }, - components:{ + components: { account, userChange, - centerChange + centerChange, }, created() { this.company = COMPANY; - console.log(COMPANY) - if(this.$store.state.projectSn){ + console.log(COMPANY); + if (this.$store.state.projectSn) { this.getModuleList(); } }, - mounted(){ - this.getAllModule() - if(localStorage.getItem('systemInfo')){ - this.systemInfo=JSON.parse(localStorage.getItem('systemInfo')) + mounted() { + this.getAllModule(); + if (localStorage.getItem("systemInfo")) { + this.systemInfo = JSON.parse(localStorage.getItem("systemInfo")); } - document.title='企业后台' - console.log('mounted',this.$route.path) - + document.title = "企业后台"; + console.log("mounted", this.$route.path); + this.$nextTick(() => { + let timer = setTimeout(() => { + if (timer) { + clearTimeout(timer); + this.verScroll(); + } + }, 0); + }); }, methods: { // 查询全部模块(拿到工作流的模块菜单) @@ -161,44 +186,77 @@ export default { // console.log("onoff", onoff); return onoff; }, - getAllModule(){ - var half = this.$store.state.userInfo.menuAuthority.moduleList - half.forEach(element => { - if(element.moduleType==3){ - this.menuList.push(element) - } - }); - // getAllModuleApi({moduleType:4}).then(res => { - // if (res.success) { - // var all = res.result - // all.forEach((element,index) => { - // all[index].operation=false - // half.forEach(element2 => { - // if(element2.moduleId==element.moduleId){ - // all[index].operation=true - // all[index].menuList=element2.menuList - // } - // }); - // }); - // this.menuList=all - // } - // }) + getAllModule() { + var half = this.$store.state.userInfo.menuAuthority.moduleList; + half.forEach((element) => { + if (element.moduleType == 3) { + this.menuList.push(element); + } + }); + // getAllModuleApi({moduleType:4}).then(res => { + // if (res.success) { + // var all = res.result + // all.forEach((element,index) => { + // all[index].operation=false + // half.forEach(element2 => { + // if(element2.moduleId==element.moduleId){ + // all[index].operation=true + // all[index].menuList=element2.menuList + // } + // }); + // }); + // this.menuList=all + // } + // }) }, handleSelect(url) { // this.$store.commit('setCurrentUrl',url) // this.$store.dispatch('currentUrl',url) }, 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; + }, }, }; \ No newline at end of file +