| | |
| | | }, |
| | | created() { |
| | | }, |
| | | mounted () { |
| | | window.addEventListener('beforeunload', e => { |
| | | sessionStorage.setItem('beforeunload', 1); |
| | | }); |
| | | // 监听页面刷新 |
| | | if (sessionStorage.getItem('beforeunload') == 1) { |
| | | let name = sessionStorage.getItem("routerName"); |
| | | if (name) { |
| | | this.$nextTick(function () { |
| | | this.$router.push({ path: name }); //如果sessionStorage存在路由,去缓存的路由 |
| | | }) |
| | | } else { |
| | | this.$nextTick(function () { |
| | | this.$router.push({ path: '/' }); //不存在存储,去主页 |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | beforeDestroy() { }, |
| | | }; |
| | | </script> |
| | |
| | | this.$store.commit('getPermsEntity', res.result); |
| | | |
| | | if (res.result.length != 0) { |
| | | sessionStorage.setItem('routerName', '/Synthesis') |
| | | this.$router.push('/'); |
| | | } |
| | | this.loading = false |
| | |
| | | listMenu: [], |
| | | showFlag: null, |
| | | language: true, |
| | | |
| | | nowPage: [ |
| | | { |
| | | name: '/Archive', |
| | | index: 3 |
| | | }, |
| | | { |
| | | name: '/dataApplication', |
| | | index: 3 |
| | | }, |
| | | { |
| | | name: '/ExportMap', |
| | | index: 3 |
| | | }, |
| | | { |
| | | name: '/Synthesis', |
| | | index: 3 |
| | | }, |
| | | { |
| | | name: '/dataController', |
| | | index: 4 |
| | | }, |
| | | { |
| | | name: '/mochaitmo', |
| | | index: 5 |
| | | } |
| | | ] |
| | | }; |
| | | }, |
| | | created() { }, |
| | |
| | | this.showFlag = null; |
| | | } |
| | | } |
| | | |
| | | sessionStorage.setItem('changeSelectStyle', index) |
| | | this.changeSelectStyle = index; |
| | | }, |
| | | closeAllChildren() { |
| | |
| | | }, |
| | | setLiClick(res, index) { |
| | | setTimeout(() => { |
| | | // debu |
| | | this.changeliSelect = res.cnName; |
| | | if (res.url.indexOf('http') != -1) { |
| | | this.$store.reporturl = res.url; |
| | | this.$store.reporturl = res.url; |
| | | sessionStorage.setItem('iframehttpurl', this.$store.reporturl) |
| | | this.$router.push('/QualityInspection'); |
| | | // if (location.href.indexOf('/WareInspection') == -1) { |
| | | // this.$store.reporturl = res.url; |
| | |
| | | // } |
| | | } else { |
| | | this.$store.reporturl = null; |
| | | sessionStorage.setItem('iframehttpurl', null) |
| | | this.$router.push(res.url); |
| | | this.$store.commit('currentPerms', res.perms); |
| | | } |
| | |
| | | |
| | | } |
| | | this.listMenu.push(res[i]); |
| | | this.changeSelectStyle = this.listMenu.length - 1; |
| | | // this.changeSelectStyle = this.listMenu.length - 1; |
| | | // this.changeSelectStyle = 0 |
| | | // const nowPage = this.nowPage |
| | | // if (sessionStorage.getItem('routerName')) { |
| | | // for (let index = 0; index < nowPage.length; index++) { |
| | | // if (this.$route.path === nowPage[index].name) { |
| | | // this.$set(this, 'changeSelectStyle', nowPage[index].index) |
| | | // } |
| | | // } |
| | | // } else { |
| | | // this.changeSelectStyle = this.listMenu.length - 1; |
| | | // } |
| | | this.changeSelectStyle = sessionStorage.getItem('changeSelectStyle') |
| | | // var strartMneu = res[i].children[0]; |
| | | // this.$store.commit('currentPerms', strartMneu.perms); |
| | | // this.changeliSelect = strartMneu.cnName; |
| | |
| | | const originalPush = VueRouter.prototype.push; |
| | | |
| | | VueRouter.prototype.push = function push(location) { |
| | | return originalPush.call(this, location).catch((err) => err); |
| | | const nowPage = sessionStorage.getItem('routerName') |
| | | const page = { |
| | | path: nowPage |
| | | } |
| | | if (page === location || location === '/') { |
| | | return originalPush.call(this, page).catch((err) => err); |
| | | } else { |
| | | return originalPush.call(this, location).catch((err) => err); |
| | | } |
| | | }; |
| | | |
| | | // 群组管理 |
| | |
| | | }); |
| | | //路由守卫 |
| | | router.beforeEach((to, from, next) => { |
| | | sessionStorage.setItem('routerName', to.path) |
| | | next(); |
| | | if (to.matched.some((auth) => auth.meta.requireAuth)) { |
| | | // 获取token |
| | |
| | | |
| | | }, |
| | | showChangeIfream(res) { |
| | | // debugger |
| | | console.log(res) |
| | | if (this.$store.state.themeflag == true) { |
| | | if (res.indexOf('theme=white') != -1) { |
| | | res = res.replace('theme=white', 'theme=dark'); |
| | |
| | | this.$store.state.reporturl = res; |
| | | this.reportUrl = res; |
| | | this.url = res |
| | | // sessionStorage.setItem('routerName', this.reportUrl) |
| | | console.log("2", this.reportUrl) |
| | | } |
| | | }, |
| | | |
| | | setLiClick(res, index) { |
| | | var timer = setTimeout(function () { |
| | | if (res.indexOf('http') != -1) { |
| | | this.$store.reporturl = res; |
| | | // sessionStorage.setItem('iframehttpurl', this.$store.reporturl) |
| | | this.$router.push('/QualityInspection'); |
| | | // if (location.href.indexOf('/WareInspection') == -1) { |
| | | // this.$store.reporturl = res.url; |
| | | // this.$router.push('/WareInspection'); |
| | | // } else { |
| | | // this.$bus.$emit('changeNaveUrl', res.url); |
| | | // } |
| | | } |
| | | this.setShowFalseDiv(false) |
| | | }, 100) |
| | | clearTimeout(timer) |
| | | }, |
| | | setShowFalseDiv(bolean) { |
| | | var index = this.showFlag; |
| | | if (index != null) { |
| | | let newItem = this.listMenu[index]; |
| | | |
| | | newItem.show = bolean; |
| | | Vue.set(this.listMenu, index, newItem); |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.showChangeIfream(this.$store.reporturl) |
| | | // console.log(sessionStorage.getItem('iframehttpurl')) |
| | | // debugger |
| | | if (sessionStorage.getItem('routerName') === '/WareInspection') { |
| | | |
| | | this.showChangeIfream(sessionStorage.getItem('iframehttpurl')) |
| | | this.setLiClick(sessionStorage.getItem('iframehttpurl')) |
| | | |
| | | this.$bus.$on('changeNaveUrl', (res) => { |
| | | this.showChangeIfream(res) |
| | | }); |
| | | this.$bus.$on('changeNaveUrl', (res) => { |
| | | this.showChangeIfream(res) |
| | | }); |
| | | } else { |
| | | this.showChangeIfream(this.$store.reporturl) |
| | | |
| | | this.$bus.$on('changeNaveUrl', (res) => { |
| | | this.showChangeIfream(res) |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | methods: { |
| | | setTopReturn() { |
| | | this.$router.push('/Synthesis'); |
| | | sessionStorage.setItem('changeSelectStyle', 3) |
| | | }, |
| | | changeRightList(res) { |
| | | this.changeSelectli = res.id; |
| | |
| | | this.menuList = this.treeData(menuList); |
| | | |
| | | this.setViewController(this.menuList[0]); |
| | | |
| | | const hanleselectindex = sessionStorage.getItem('hanleselectindex') |
| | | if (hanleselectindex) { |
| | | this.$nextTick(function (){ |
| | | this.handleselecttwo(JSON.parse(hanleselectindex).url, JSON.parse(hanleselectindex)) |
| | | this.setViewController(JSON.parse(hanleselectindex)) |
| | | }) |
| | | } |
| | | } else { |
| | | |
| | | this.$message.error('暂无菜单栏数据'); |
| | |
| | | }, |
| | | |
| | | handleselect(index, indexPath, e) { |
| | | const a = JSON.stringify(e.$attrs.perms) |
| | | sessionStorage.setItem('hanleselectindex', a) |
| | | var data = e.$attrs.perms; |
| | | this.$store.state.currentPerms = data.perms; |
| | | var index = data.url; |
| | |
| | | } |
| | | this.setMenuFlag = index; |
| | | }, |
| | | |
| | | handleselecttwo(index, e) { |
| | | const a = JSON.stringify(e) |
| | | sessionStorage.setItem('hanleselectindex', a) |
| | | var data = e; |
| | | this.$store.state.currentPerms = data.perms; |
| | | var index = data.url; |
| | | |
| | | if (index != null) { |
| | | if (index.indexOf('http') != -1) { |
| | | this.$store.commit('getIframe', data.url); |
| | | index = 'dataIfream'; |
| | | } |
| | | } |
| | | this.setMenuFlag = index; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | }); |
| | | this.menuList = this.treeData(menuList); |
| | | this.getCookies(); |
| | | const hanleselectmochaitmo = sessionStorage.getItem('hanleselectmochaitmo') |
| | | if (hanleselectmochaitmo) { |
| | | this.$nextTick(function (){ |
| | | this.handleselecttwo(JSON.parse(hanleselectmochaitmo).url, JSON.parse(hanleselectmochaitmo)) |
| | | this.setViewController(JSON.parse(hanleselectmochaitmo)) |
| | | }) |
| | | } |
| | | // |
| | | } else { |
| | | alert('暂无菜单栏数据'); |
| | |
| | | |
| | | handleselect(index, indexPath, e) { |
| | | this.getTimeCookies(); |
| | | |
| | | const a = JSON.stringify(e.$attrs.perms) |
| | | sessionStorage.setItem('hanleselectmochaitmo', a) |
| | | |
| | | var data = e.$attrs.perms; |
| | | this.$store.state.currentPerms = data.perms; |
| | | var index = data.url; |
| | |
| | | this.setMenuFlag = index; |
| | | |
| | | }, |
| | | handleselecttwo(index, e) { |
| | | this.getTimeCookies(); |
| | | |
| | | const a = JSON.stringify(e) |
| | | sessionStorage.setItem('hanleselectmochaitmo', a) |
| | | |
| | | var data = e; |
| | | this.$store.state.currentPerms = data.perms; |
| | | var index = data.url; |
| | | if (index != null) { |
| | | if (index.indexOf('http') != -1) { |
| | | this.$store.commit('getIframe', data.url); |
| | | index = 'dataIfream'; |
| | | } |
| | | } |
| | | this.setMenuFlag = index; |
| | | |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |