customer.vue
6.79 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<template>
<div class="analysis-wrapper customer-wrapper">
<el-container>
<el-aside width="200px" height="100%">
<el-menu
class="aside-menu-wrapper"
:default-active="activeIndex"
background-color="#414755"
text-color="#fff"
@select="menuSelect"
unique-opened>
<el-submenu :index="item.path" v-for="item in customerMenu" :key="item.path" style="text-align:left" v-if="permissControl(item.path) && hasChildPermission(item.children)">
<template slot="title">
<i :class="item.iconClass"></i>
<span>{{i18n(item.name)}}</span>
</template>
<el-menu-item-group>
<el-menu-item :index="child.path" v-for="child in item.children" :key="child.path" v-if="permissControl(child.path)">
<i :class="child.iconClass"></i>
<span slot="title">{{i18n(child.name)}}</span>
</el-menu-item>
</el-menu-item-group>
</el-submenu>
</el-menu>
</el-aside>
<el-container>
<router-view></router-view>
</el-container>
</el-container>
</div>
</template>
<script>
export default {
data() {
return {
activeIndex: '',
moreOptVisible: false,
customerMenu:[{
path: 'humanface',
iconClass: 'icon font_family icon-residencetime_icon custom-icon residencetime-icon',
name: 'HumanFaceAsis',
children: [
{
path: 'customtrack',
iconClass: 'icon font_family icon-customtrack_icon custom-icon customtrack-icon',
name: 'CustomTrack',
},
{
path: 'trafficdirection',
iconClass: 'icon font_family icon-ftmoveline_icon custom-icon ftmoveline-icon',
name: 'TrafficDirection',
},
{
path: 'moveline',
iconClass: 'icon font_family icon-tftrackheat_icon custom-icon tftrackheat-icon',
name: 'MoveLineAnalysis',
},
{
path: 'zonedirection',
iconClass: 'icon font_family icon-ftmoveline_icon custom-icon ftmoveline-icon',
name: 'ZoneTrafficDirection'
},
{
path: 'residencetime',
iconClass: 'icon font_family icon-residencetime_icon custom-icon residencetime-icon',
name: 'ResidenceTime',
},
{
path: 'happinessindex',
iconClass: 'icon font_family icon-residencetime_icon custom-icon residencetime-icon',
name: 'HappinessIndex',
},
]
},{
path: 'fisheyethermal',
iconClass: 'icon font_family icon-areaheat_icon custom-icon areaheat-icon',
name: 'FisheyeThermal',
children: [
{
path: 'storeheat',
iconClass: 'icon font_family icon-areaheat_icon custom-icon areaheat-icon',
name: 'Areaheat',
},
{
path: 'boothheat',
iconClass: 'icon font_family icon-faceheat_icon custom-icon faceheat-icon',
name: 'Trackheat',
},
]
}],
menuArr: [],
}
},
components: {},
methods: {
i18n(name){
let languageLable = 'asis.' + 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) {
if((window.location.href.split('/')).indexOf(key) === -1) {
this.$router.push('/customer/' + key);
}
},
refreshSelect(path){
this.$router.push('/customer/' + path);
},
refresh(){
let name = this.$router.history.current.name;
let path = this.$router.history.current.path;
let newPath = path.split('/')[2];
let obj = {
pointheat: 'pointheat',
flowheat: 'flowheat',
floortrafficheat: 'floortrafficheat',
floorheat: 'floorheat',
trafficeline: 'trafficeline',
residencetime: 'residencetime',
trafficdirection: 'trafficdirection',
customtrack: 'customtrack',
storeheat: 'storeheat',
boothheat: 'boothheat',
moveline: 'moveline',
happinessindex: 'happinessindex',
zonedirection: 'zonedirection'
};
if(obj.hasOwnProperty(newPath)){
this.activeIndex = obj[newPath]
this.refreshSelect(obj[newPath])
}
},
},
created() {
if(!window._vionConfig.allMenu){
this.menuArr = JSON.parse(window.localStorage.getItem('menuName'));
}
},
mounted() {
let firstPath,name;
if(window._vionConfig.allMenu){
firstPath = 'customtrack'
}else{
firstPath = this.menuArr[this.menuArr.indexOf('customer') + 2];
}
name = this.$router.history.current.name;
// let path = this.$router.history.current.path;
if(!name){
this.activeIndex = firstPath;
this.menuSelect(firstPath, [firstPath]);
}else{
this.refresh()
}
}
}
</script>
<style>
.test-opt-time .time-opt .el-input__inner {
height: 100% !important;
}
.customer-wrapper .custom-icon {
font-size: 14px;
}
</style>