commonOption.vue
2.75 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
<template>
<div>
<!-- 分析层面 -->
<div class="analysis-level-wrapper" style="border-top: 1px solid #000;">
<div class="analysis-level-left">
<i class="el-icon-search"></i>
<span class="analysis-level-text">{{$t('asisTab.level')}}</span>
</div>
<div class="analysis-level-right">
<ul class="analysis-type-box">
<li :class="item.className" v-for="(item, index) in tabList" :key="item.value" @click="tabClickHandle(index)">
<span class="analysis-item-title">{{ i18nFormatter(item.label) }}</span>
</li>
</ul>
</div>
</div>
<!-- 数据选项 -->
<common-option-content :activeTab="activeTabItem"></common-option-content>
</div>
</template>
<script>
// 调用方式, 传入分析层面
// let tabList = [{
// label: 'mall',
// value: 'mall',
// className: 'analysis-item'
// cascade: [] // 所需级联
// }, {
// label: 'floor',
// value: 'floor',
// className: 'analysis-item'
// },
// ...]
import mallOptionContent from './mallOptionContent'
import floorOptionContent from './floorOptionContent'
import zoneOptionContent from './zoneOptionContent'
import gateOptionContent from './gateOptionContent'
import commonOptionContent from './commonOptionContent'
export default {
props: {
tabList: {
type: Array,
required: true,
default: []
}
},
components: {
'mall-option-content': mallOptionContent,
'floor-option-content': floorOptionContent,
'zone-option-content': zoneOptionContent,
'gate-option-content': gateOptionContent,
'common-option-content': commonOptionContent,
},
data() {
return {
activeTabItem: ''
}
},
created() {
this.tabClickHandle(0)
},
methods: {
i18nFormatter(label){
let langeLabel = 'asisTab.' + label;
return this.$t(langeLabel)
},
tabClickHandle(index) {
if(this.tabList[index].className === 'analysis-item') {
this.tabList.forEach(element => {
element.className = 'analysis-item';
});
this.tabList[index].className = 'analysis-item tabs-active';
this.activeTabItem = this.tabList[index];
}
}
}
}
</script>
<style scoped>
/* .analysis-item {
float: left;
list-style: none;
font-size: 13px;
color: #666;
cursor: pointer;
padding: 0 30px;
position: relative;
}
.analysis-item.tabs-active {
color: #3BB8FF;
} */
</style>