bodyCenterRight.vue
4.3 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
<template>
<div class="dv-content-body-center-list-right">
<dv-border-box-12>
<div class="div-center-d">
<div class="stuts-style" style="padding-top: 2px">
<span style="padding: 0" class="div-span-title">{{ $gl('running state of stacking machine') }}
</span>
<div>
<div class="yuxing">
<div class="yuxing-style"></div>
</div>
<span>运行</span>
</div>
<div>
<div class="daiji">
<div class="daiji-style"></div>
</div>
<span>待机</span>
</div>
<div>
<div class="guzhang">
<div class="guzhang-style"></div>
</div>
<span>故障</span>
</div>
</div>
<div class="dv-content-body-center-list-barChart">
<div id="warehouseHealth" style="width: 33%;height: 100%;"></div>
<div id="warehouseHealth2" style="width: 33%;height: 100%;"></div>
<div id="warehouseHealth3" style="width: 33%;height: 100%;"></div>
</div>
</div>
</dv-border-box-12>
</div>
</template>
<script>
export default {
data() {
return {
sysData: {
getwarehouseHealth: null,
},
getwarehouseHealth: null,
warehouseHealthOption: window.warehouseHealthOption,
runningPieChartOption: window.runningPieChartOption,
}
},
methods: {
// 中间柱状图
bingDataSource(data) {
let myChart = this.$echarts.init(document.getElementById('warehouseHealth'))
let myChart2 = this.$echarts.init(document.getElementById('warehouseHealth2'))
let myChart3 = this.$echarts.init(document.getElementById('warehouseHealth3'))
// this.warehouseHealthOption.series[0].data = data.running
// this.warehouseHealthOption.series[1].data = data.free
// this.warehouseHealthOption.series[2].data = data.error
// this.warehouseHealthOption.xAxis.data = data.xSeries
const index = data.xSeries.indexOf('SRM01'); // index = 2
// 按照业务含义构建饼图数据
const series1 = [
{ value: data.running[index], name: '运行中' },
{ value: data.free[index], name: '待机' },
{ value: data.error[index], name: '故障' }
];
this.runningPieChartOption.series[0].data = series1
this.runningPieChartOption.title[0].subtext = 'SRM01'
myChart.clear()
myChart.setOption(this.runningPieChartOption)
const index2 = data.xSeries.indexOf('SRM02'); // index = 2
// 按照业务含义构建饼图数据
const series2 = [
{ value: data.running[index2], name: '运行中' },
{ value: data.free[index2], name: '待机' },
{ value: data.error[index2], name: '故障' }
];
this.runningPieChartOption.series[0].data = series2
this.runningPieChartOption.title[0].subtext = 'SRM02'
myChart2.clear()
myChart2.setOption(this.runningPieChartOption)
const index3 = data.xSeries.indexOf('SRM03'); // index = 2
// 按照业务含义构建饼图数据
const series3 = [
{ value: data.running[index3], name: '运行中' },
{ value: data.free[index3], name: '待机' },
{ value: data.error[index3], name: '故障' }
];
this.runningPieChartOption.series[0].data = series3
this.runningPieChartOption.title[0].subtext = 'SRM03'
myChart3.clear()
myChart3.setOption(this.runningPieChartOption)
// window.onresize = myChart.resize
window.addEventListener('resize', function () {
myChart.resize()
myChart2.resize()
myChart3.resize()
})
},
},
}
</script>
<style lang="less" scoped>
.dv-content-body-center-list-right {
width: 49vw;
height: 95%;
box-sizing: border-box;
.stuts-style {
display: flex;
height: 20%;
font-weight: 800;
font-size: 1.3vw;
color: aliceblue;
text-indent: 1vw;
box-sizing: border-box;
div {
display: flex;
margin-left: 1vw;
.yuxing {
position: relative;
}
.yuxing-style {
position: absolute;
left: -1.7vw;
top: 0.6vw;
width: 1vw;
height: 1vw;
background-color: #04efcd;
}
.daiji {
position: relative;
}
.daiji-style {
position: absolute;
left: -1.7vw;
top: 0.6vw;
width: 1vw;
height: 1vw;
background-color: #fdb300;
}
.guzhang {
position: relative;
}
.guzhang-style {
position: absolute;
left: -1.7vw;
top: 0.6vw;
width: 1vw;
height: 1vw;
background-color: #f43d33;
}
}
}
.dv-content-body-center-list-barChart {
display: flex;
width: 100%;
height: 32vh;
}
}
</style>