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
<template>
<div class="headerLayout">
<div class="tabList flex-1">
<div v-for="(item,index) in buttenList" :key="index" @click="change(index)">
<el-button class="tabButton" size="mini" :class="num==index?'is-active':''">{{item}}</el-button>
</div>
</div>
<h3 class="flex-1">企业运行图谱</h3>
<div class="flex-1 header-right-box">
<div class="time">{{nowDate | moment("YYYY/MM/DD")}} {{nowDate | moment("HH:mm:ss")}} 星期{{week | weekFilter}}</div>
<div class="right-menu">
<el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper">
<img src="~@/assets/img/timg.jpg" class="user-avatar">
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown" class="user-dropdown">
<router-link to="/">
<el-dropdown-item>
Home
</el-dropdown-item>
</router-link>
<el-dropdown-item divided @click.native="logout">
<span style="display:block; width: 60px">Log Out</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
screenWidth: document.body.clientWidth,
num: 0,
nowDate: '',
week: '',
hour: '',
monthData: {
id: 'dataByMonth',
xData: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
yData: [70, 90, 110, 108, 100, 110, 130, 140, 150, 120, 110, 98],
colors: ['RGBA(27, 157, 247, 1)', 'RGBA(30, 201, 251, 1)']
},
buttenList: ['概况', '运营', '商机', '客户', '组织人才', '管理端']
}
},
filters: {
weekFilter: function (value) {
let nvalue = ''
switch (value) {
case 1:
nvalue = '一'
break
case 2:
nvalue = '二'
break
case 3:
nvalue = '三'
break
case 4:
nvalue = '四'
break
case 5:
nvalue = '五'
break
case 6:
nvalue = '六'
break
case 0:
nvalue = '日'
break
}
return nvalue
}
},
watch: {
screenwidth (val) {
if (!this.timer) {
this.screenWidth = val
this.timer = true
const that = this
setTimeout(function () {
console.log(that.screenWidth)
that.timer = false
}, 400)
}
}
},
mounted () {
this.init()
this.getDate()
const that = this
window.onresize = () => {
return (() => {
window.screenWidth = document.body.clientWidth
that.screenWidth = window.screenWidth
})()
}
},
methods: {
logout () {
this.$router.push('/login')
},
init () {
this.num = sessionStorage.getItem('num')
const user = JSON.parse(sessionStorage.getItem('user'))
if (user.role === 1) {
this.buttenList.push('管理端')
}
},
getDate () {
const vm = this
this.nowDate = new Date()
this.week = new Date().getDay()
setTimeout(function () {
vm.getDate()
}, 1000)
},
change (index) {
this.num = index
sessionStorage.setItem('num', index)
const token = sessionStorage.getItem('token')
switch (index) {
case 0:
this.$router.replace('/index')
break
case 1:
this.$router.replace('/content/operation/page')
break
case 2:
this.$router.replace('/content/business/page')
break
case 3:
this.$router.replace('/content/client/page')
break
case 4:
this.$router.replace('/content/organization/page')
break
case 5:
window.open('http://111.203.232.175:8085/#/dashboard?token=' + token)
// window.open('http://localhost:9528/#/dashboard?token=' + token)
}
}
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/fonts/font.css';
@import '~@/assets/style/headerLayout.scss';
</style>