{"remainingRequest":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\examine-fvue\\src\\views\\menuContent.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\examine-fvue\\src\\views\\menuContent.vue","mtime":1667280204733},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.array.find\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { mapState, mapActions } from 'vuex';\nimport templateHref from '@/components/dataTemplate/templateHref.vue';\nimport deepmerge from \"deepmerge\";\nexport default {\n name: 'menuContent',\n components: {\n templateHref: templateHref\n },\n computed: mapState({\n menuAll: function menuAll(state) {\n return state.menu.all;\n },\n menus: function menus(state) {\n var alias = '';\n\n if (state.menu.currentMenu.alias) {\n alias = state.menu.currentMenu.alias;\n } else if (sessionStorage.menu_alias) {\n alias = sessionStorage.menu_alias;\n }\n\n return state.menu.menuMaps[alias];\n },\n currentMenu: function currentMenu(state) {\n return state.menu.currentMenu;\n }\n }),\n data: function data() {\n return {\n asideShow: true,\n activeMenuIndex: '',\n href: '' //url菜单地址\n\n };\n },\n methods: {\n findCurrentMenuName: function findCurrentMenuName() {\n var _this = this;\n\n var obj = this.menus.find(function (it) {\n return it.alias === _this.activeMenuIndex;\n });\n var name = \"\";\n\n if (obj) {\n name = obj.name;\n } else {\n var _menus = deepmerge({}, this.menus, {\n clone: true\n });\n\n var item = this.getChidlren(this.activeMenuIndex, _menus);\n\n if (item) {\n name = item.name;\n }\n }\n\n return name;\n },\n getChidlren: function getChidlren(alias, _menus) {\n var hasFound = false,\n // 表示是否有找到id值\n result = null;\n\n var fn = function fn(data) {\n if (Array.isArray(data) && !hasFound) {\n // 判断是否是数组并且没有的情况下,\n data.forEach(function (item) {\n if (item.alias === alias) {\n // 数据循环每个子项,并且判断子项下边是否有id值\n result = item; // 返回的结果等于每一项\n\n hasFound = true; // 并且找到id值\n } else if (item.children && item.children.length > 0) {\n fn(item.children); // 递归调用下边的子项\n }\n });\n }\n };\n\n fn(_menus); // 调用一下\n\n return result;\n },\n handleSelect: function handleSelect(key) {\n //当前点击菜单的父级菜单路由\n var path = this.currentMenu.alias || sessionStorage.menu_alias;\n\n if (path.indexOf('/') < 0) {\n path = '/' + path;\n }\n\n sessionStorage.menu_path = path + '/' + key;\n this.href = ''; //判断4级URL菜单\n\n var item = this.getChidlren(key, this.menus);\n\n if (item.href) {\n this.href = item.href;\n }\n\n this.activeMenuIndex = key;\n this.$router.push({\n path: sessionStorage.menu_path\n });\n },\n selectCurentMenu: function selectCurentMenu(newVal) {\n //当前点击菜单的父级菜单路由\n var path = '';\n this.currentMenu.alias ? path = this.currentMenu.alias : path = sessionStorage.menu_alias; // if(this.currentMenu.alias){\n // path = this.currentMenu.alias;\n // }else{\n // path = sessionStorage.menu_alias;\n // }\n\n if (path.indexOf('/') < 0) {\n path = '/' + path;\n }\n\n var paths = [];\n\n if (this.$router.history.pending) {\n paths = this.$router.history.pending.fullPath.split(path + '/');\n } else {\n paths = this.$router.history.current.fullPath.split(path + '/');\n }\n\n if (paths.length > 0) {\n this.activeMenuIndex = paths[1];\n } else {\n this.activeMenuIndex = paths[0];\n }\n\n var isFlag = true; //是否需要默认加载一级菜单的第一个二级菜单\n\n this.href = '';\n\n for (var i = 0; i < this.menus.length; i++) {\n //判断是否是URL菜单\n if (this.menus[i].href) {\n if (this.activeMenuIndex == this.menus[i].alias) {\n this.href = this.menus[i].href;\n isFlag = false;\n break;\n }\n\n var falg = false; //判断菜单是否有下一级,且只能有一个下一级\n\n if (this.menus[i].children.length > 0) {\n for (var o = 0; o < this.menus[i].children.length; o++) {\n //判断是否是URL菜单\n if (this.activeMenuIndex == this.menus[i].children[o].alias) {\n this.href = this.menus[i].children[o].href;\n falg = true;\n break;\n }\n }\n\n if (falg) {\n break;\n }\n }\n }\n } //默认加载一级菜单的第一个二级菜单\n\n\n if (isFlag && (!this.activeMenuIndex || this.activeMenuIndex && this.activeMenuIndex.indexOf('href/template') != -1)) {\n this.activeMenuIndex = this.getLastChildren(); //判断是否是URL地址菜单\n\n if (this.menus[0].href) {\n this.href = this.menus[0].href;\n } //判断菜单是否有下一级,且只能有一个下一级\n\n\n if (this.menus[0].children.length > 0) {\n for (var k = 0; k < this.menus[0].children.length; k++) {\n //判断是否是URL菜单\n if (this.menus[0].children[k].href) {\n this.href = this.menus[0].children[k].href;\n this.activeMenuIndex = this.menus[0].children[k].alias;\n break;\n }\n }\n }\n\n sessionStorage.menu_path = path + '/' + this.activeMenuIndex;\n this.$router.push({\n path: sessionStorage.menu_path\n });\n }\n },\n getLastChildren: function getLastChildren() {\n // 获取最后个children的第一个菜单\n var _alias = this.menus[0].alias;\n var _menus = this.menus[0];\n\n while (_menus.children && _menus.children.length > 0) {\n _alias = _menus.children[0].alias;\n _menus = _menus.children[0];\n }\n\n return _alias;\n },\n setCurrentMenu: function setCurrentMenu(path) {\n var that = this;\n\n for (var i = 0; i < that.menuAll.length; i++) {\n if (that.menuAll[i].alias === path) {\n if (path.indexOf('/') > -1) {\n path = path.replace('/', '');\n }\n\n this.$store.dispatch('menu/getCurrentMenu', {\n alias: that.menuAll[i].code,\n name: that.menuAll[i].name\n });\n break;\n }\n }\n },\n inCurrentMenu: function inCurrentMenu(newVal) {\n if (newVal && newVal.length > 0) {\n for (var i = 0; i < newVal.length; i++) {\n if (newVal[i].alias == this.activeMenuIndex) {\n return true;\n }\n\n if (newVal[i].children && newVal[i].children.length > 0) {\n var inCur = this.inCurrentMenu(newVal[i].children);\n\n if (inCur) {\n return true;\n }\n }\n }\n }\n }\n },\n watch: {\n menus: {\n handler: function handler(newVal) {\n //判断当前菜单是否还在新菜单列表里\n var menuChange = !this.inCurrentMenu(newVal); //window.self === window.top 判断页面是否被嵌入iframe里面\n\n if (newVal && newVal.length > 0 && window.self === window.top && menuChange) {\n this.selectCurentMenu(newVal);\n } //切换一级菜单时情况URL地址\n\n\n if (!newVal || newVal.length == 0) {\n if (this.href != '') {\n this.href = '';\n }\n }\n },\n deep: true,\n immediate: true\n }\n },\n beforeRouteEnter: function beforeRouteEnter(to, from, next) {\n next(function (vm) {\n vm.$root.$emit('updateTopMenuActive', from.name);\n });\n },\n beforeRouteUpdate: function beforeRouteUpdate(to, from, next) {\n next();\n }\n};",null]}