|
@@ -20,7 +20,8 @@ export default {
|
|
|
routes,
|
|
|
main,
|
|
|
menu:[],
|
|
|
- tmpRoute:[]
|
|
|
+ tmpRoute:[],
|
|
|
+ replaceLock:false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -47,15 +48,23 @@ export default {
|
|
|
let temp = this.tmpRoute.filter(item=>{
|
|
|
return item.key == newVal
|
|
|
})
|
|
|
- this.$store.commit("SetActiveMenu", temp[0]);
|
|
|
+
|
|
|
+ this.$store.commit("SetActiveMenu", temp[0] || this.tmpRoute[0]);
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ tmpRoute(newVal,oldVal){
|
|
|
+ if (oldVal.length<=0&&!this.replaceLock&&newVal[0].key != "scene") {
|
|
|
+ // this.$router.
|
|
|
+ // this.$store.commit("SetActiveMenu", newVal[0]);
|
|
|
+ this.goto(newVal[0],true)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- goto (item) {
|
|
|
+ goto (item,replace=null) {
|
|
|
let path = {path:`/${item.key}${item.param?`/${item.param.map(tt=>tt.default).join('/')}`:''}`}
|
|
|
- this.$router.push(path)
|
|
|
+ replace ? this.$router.replace(path) : this.$router.push(path)
|
|
|
},
|
|
|
async getResource(){
|
|
|
let result = await this.$http({
|
|
@@ -68,38 +77,44 @@ export default {
|
|
|
result.data.forEach(sub=>{
|
|
|
|
|
|
if (item.name == sub.name) {
|
|
|
-
|
|
|
+
|
|
|
if (sub.name =='操作日志') {
|
|
|
sub.authority = sub.children[0].authority
|
|
|
}
|
|
|
+
|
|
|
+ let ttmp = ''
|
|
|
+
|
|
|
+ for (let i = 0; i < sub.children.length; i++) {
|
|
|
+ let item = sub.children[i];
|
|
|
+ if (item.children) {
|
|
|
+ ttmp = item.children.find(tttt=>tttt.authority)
|
|
|
+ break
|
|
|
+ } else{
|
|
|
+ ttmp = item.authority
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (sub.authority) {
|
|
|
+ if (ttmp) {
|
|
|
+ sub.authority = true
|
|
|
tmp = sub
|
|
|
}
|
|
|
+
|
|
|
+ // if (sub.authority) {
|
|
|
+ // }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- // if (item.type == "system") {
|
|
|
- // // if (window.localStorage.getItem("role") == 'sys_admin') {
|
|
|
- // // tmp = item
|
|
|
- // // }
|
|
|
- // // else{
|
|
|
- // // tmp = ''
|
|
|
- // // }
|
|
|
- // tmp = item
|
|
|
-
|
|
|
- // }
|
|
|
return tmp ? Object.assign(item,tmp) : tmp
|
|
|
});
|
|
|
|
|
|
- // console.log(this.tmpRoute);
|
|
|
|
|
|
let temp = this.tmpRoute.filter(item=>{
|
|
|
return item.key == this.activeIdx
|
|
|
})
|
|
|
- this.$store.commit("SetActiveMenu", temp[0]);
|
|
|
|
|
|
- // console.log(temp[0]);
|
|
|
+ this.$store.commit("SetActiveMenu", temp[0] || this.tmpRoute[0]);
|
|
|
+
|
|
|
|
|
|
this.menu = main.filter(item=>{
|
|
|
let route = []
|
|
@@ -112,7 +127,6 @@ export default {
|
|
|
return route.length>0 && item
|
|
|
})
|
|
|
|
|
|
- console.log(this.menu);
|
|
|
}
|
|
|
},
|
|
|
created () {
|