index.vue
3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
<div class="analysis-wrapper warp">
<el-aside width="200px" height="100%">
<el-menu class="aside-menu-wrapper" :default-active="activeIndex" background-color="#fff" text-color="#515a6e"
@select="menuSelect" unique-opened>
<el-menu-item-group>
<el-submenu :index="item.path" v-for="item in customerMenu" :key="item.path" style="text-align:left">
<template slot="title">
<i :class="['icon', 'font_family', 'custom-icon', `icon-${item.icon}_icon`, `${item.icon}-icon`]"></i>
<!-- <span :title="i18nFomatter(item.name)">{{i18nFomatter(item.name)}}</span> -->
<span >{{langFormat(item.label,item.nodeTw,item.nodeEn)}}</span>
</template>
<el-menu-item-group>
<el-menu-item :index="child.path" v-for="(child,index) in item.children" :key="child.path+index">
<!-- <span slot="title">{{i18nFomatter(child.name)}}</span> -->
<span slot="title">{{langFormat(child.label,child.nodeTw,child.nodeEn)}}</span>
</el-menu-item>
</el-menu-item-group>
</el-submenu>
</el-menu-item-group>
</el-menu>
</el-aside>
<div class="analysis-page">
<router-view></router-view>
</div>
</div>
</template>
<script>
export default {
data() {
return {
activeIndex: '',
moreOptVisible: false,
customerMenu: [],
menuArr: [],
}
},
components: {},
methods: {
i18nFomatter(name) {
let languageLable = 'businessAnalysis.' + name
return this.$t(languageLable)
},
permissControl(path) {
if (window._vionConfig.allMenu) {
return true
}
if (this.menuArr.includes(path)) {
return true
} else {
return false
}
},
hasChildPermission(children) {
if (window._vionConfig.allMenu) {
return true
}
if (!children.length) {
return false
}
let hasPermission = children.map(item => {
return this.menuArr.includes(item.path)
}).filter(Boolean)
return hasPermission.length > 0
},
menuSelect(key, path) {
this.navigateTo(this,'businessAnalysis',key);
},
refreshSelect(path) {
this.$router.push('/businessAnalysis/' + path);
},
refresh() {
let name = this.$router.history.current.name;
let path = this.$router.history.current.path;
let newPath = path.split('/')[2];
this.activeIndex = newPath;
this.refreshSelect(newPath)
},
},
created() {
if (!window._vionConfig.allMenu) {
this.menuArr = JSON.parse(window.localStorage.getItem('menuName'));
}
},
mounted() {
let firstPath, name;
if (window._vionConfig.allMenu) {
firstPath = 'competitivePassengerFlow'
} else {
firstPath = this.menuArr[this.menuArr.indexOf('businessAnalysis') + 2];
}
this.customerMenu = []
let menu = JSON.parse(window.localStorage.getItem('menu'))
menu.children.forEach((item,index)=>{
if(item.path=="businessAnalysis"){
this.customerMenu = item.children
}
})
name = this.$router.history.current.name;
if (!name) {
this.activeIndex = firstPath;
this.menuSelect(firstPath, [firstPath]);
} else {
this.refresh()
}
}
}
</script>
<style>
.analysis-page {
width: 100%;
height: 100%;
overflow: auto;
min-width: 1000px;
}
</style>