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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
| <!DOCTYPE html>
| <html lang="en">
| <head>
| <meta charset="UTF-8">
| <title>大屏可视化</title>
| <link rel="stylesheet" href="css/index.css">
| <link rel="stylesheet" href="css/swiper-bundle.min.css">
| <script src="js/jquery-3.3.1.min.js"></script>
| <script src="js/swiper-bundle.min.js"></script>
| <script src="js/echarts/echarts.min.js"></script>
| </head>
| <body>
| <div class="container" id="app">
| <div class="head">
| <div class="head-title">自动仓库监控平台</div>
| </div>
| <div class="body">
| <div class="area">
| <div class="box">
| <div class="box-title">图标1</div>
| <div class="box-body">
| <div style="display: flex"><div style="flex: 1">库位号</div><div style="flex: 1">库位状态</div><div style="flex: 1">测试状态</div></div>
| <div class="swiper">
| <div class="swiper-wrapper">
| </div>
| </div>
| </div>
| </div>
| <div class="box">
| <div class="box-title">早8晚8</div>
| <div class="box-body" id="smoothedLineChart"></div>
| </div>
| </div>
| <div class="area">
| <div class="box">
| <div class="box-title">使用率</div>
| <div class="box-body" id="stackedColumnChart"></div>
| </div>
| <div class="box">
| <div class="box-title">合格率</div>
| <div style="display: flex;"class="box-body">
| <div class="box-body2" id="barLabelRotation"></div>
| <div class="box-body3" >
| <div class="percentage">60%</div>
| <div class="percentage">40%</div>
| </div>
| </div>
| </div>
| </div>
| </div>
| </div>
| </body>
| </html>
| <script>
| var item = [
| {
| locNo:'0100101',
| loc_sts: 'F',
| packStatus$: '未完成'
| },
| {
| locNo:'0100102',
| loc_sts: 'F',
| packStatus$: '未完成'
| },
| {
| locNo:'0100103',
| loc_sts: 'F',
| packStatus$: '未完成'
| },]
| var el
| var box = ''
| for (var i = 0; i < item.length; i++) {
| el = "<div class='swiper-slide' style='display: flex'><div style='flex: 1'>"
| + item[i].locNo + "</div><div style='flex: 1'>"
| + item[i].loc_sts + "</div><div style='flex: 1'>"
| + item[i].packStatus$
| + "</div></div>"
| box = box + el
| }
| $('.swiper-wrapper').append(box)
| var mySwiper = new Swiper ('.swiper', {
| direction: 'vertical', // 垂直切换选项
| loop: true, // 循环模式选项
| autoplay:true,
| slidesPerView: 3,
| // 如果需要分页器
| pagination: {
| el: '.swiper-pagination',
| },
| })
| /**
| * 堆叠柱状图 -- 使用率
| * */
| // 基于准备好的dom,初始化echarts实例
| var stackedColumnChart = echarts.init(document.getElementById('stackedColumnChart'));
| // 指定图表的配置项和数据
| var option = {
| // 全局调色盘。
| color: [
| '#2f89cf',
| '#27d08a',
| ],
| tooltip: {
| trigger: 'axis',
| axisPointer: {
| type: 'shadow'
| }
| },
| legend: {
| textStyle:{color:'#FFF'},
| },
| grid: {
| left: '3%',
| right: '4%',
| bottom: '3%',
| containLabel: true
| },
| xAxis: [
| {
| type: 'category',
| axisLine: {
| lineStyle: {
| color: '#FFF'
| }
| },
| data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
| }
| ],
| yAxis: [
| {
| type: 'value',
| axisLine: {
| lineStyle: {
| color: '#FFF'
| }
| },
| }
| ],
| series: [
| {
| name: 'Email',
| type: 'bar',
| stack: 'Ad',
| emphasis: {
| focus: 'series'
| },
| label: {
| show: true
| },
| barWidth:'50%',
| data: [50, 132, 101, 134, 90]
| },
| {
| name: 'Union Ads',
| type: 'bar',
| stack: 'Ad',
| emphasis: {
| focus: 'series'
| },
| label: {
| show: true
| },
| data: [300, 182, 191, 234, 290]
| },
| ]
| };
|
| // 使用刚指定的配置项和数据显示图表。
| stackedColumnChart.setOption(option);
|
| /**
| * 柱状图标签旋转 -- 合格率
| * */
| var chartDom = document.getElementById('barLabelRotation');
| var barLabelRotation = echarts.init(chartDom);
| var option;
|
| option = {
| tooltip: {
| trigger: 'axis',
| axisPointer: {
| type: 'shadow'
| }
| },
| legend: {
| textStyle:{color:'#FFF'},
| },
| grid: {
| left: '3%',
| right: '4%',
| bottom: '3%',
| containLabel: true
| },
| xAxis: {
| type: 'value',
| axisLine: {
| lineStyle: {
| color: '#FFF'
| }
| },
| boundaryGap: [0, 0.01]
| },
| yAxis: {
| type: 'category',
| axisLine: {
| lineStyle: {
| color: '#FFF'
| }
| },
| data: ['合格', '不合格']
| },
| series: [
| {
| name: '本周',
| type: 'bar',
| data: [10, 1]
| },
| {
| name: '上周',
| type: 'bar',
| data: [9, 3]
| }
| ]
| };
|
| option && barLabelRotation.setOption(option);
|
|
| var smoothedLineChart = echarts.init(document.getElementById('smoothedLineChart'));
| var option;
|
| option = {
| legend: {
| data: ['上午出库', '上午入库', '下午出库', '下午入库'],
| textStyle:{color:'#FFF'},
| lineStyle: {
| width: 10,
|
| },
| },
| grid: { // 图表距离边框的距离,可用百分比和数字(px)配置
| top: '20%',
| left: '3%',
| right: '10%',
| bottom: '5%',
| containLabel: true
| },
| xAxis: {
| type: 'category',
| axisLine: {
| lineStyle: {
| color: '#FFF'
| }
| },
| data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
| },
| yAxis: {
| type: 'value',
| axisLine: {
| lineStyle: {
| color: '#FFF'
| }
| },
| },
| series: [
| {
| name: '上午出库',
| type: 'line',
| lineStyle: {
| normal: {
| width: 4
| }
| },
| smooth: true,
| stack: 'Total',
| data: [10, 10, 10, 10, 10, 10, 10]
| },
| {
| name: '上午入库',
| type: 'line',
| lineStyle: {
| normal: {
| width: 4
| }
| },
| smooth: true,
| stack: 'Total',
| data: [10, 10, 10, 10, 10, 10, 10]
| },
| {
| name: '下午出库',
| type: 'line',
| lineStyle: {
| normal: {
| width: 4
| }
| },
| smooth: true,
| stack: 'Total',
| data: [10, 10, 10, 10, 10, 10, 10]
| },
| {
| name: '下午入库',
| type: 'line',
| lineStyle: {
| normal: {
| width: 4
| }
| },
| smooth: true,
| stack: 'Total',
| data: [10, 1, 10, 10, 10, 10, 10]
| },
| ]
| };
|
| option && smoothedLineChart.setOption(option);
|
| </script>
|
|