bodyRight.vue
6.62 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<template>
<div class="dv-content-body-center-list-center">
<div class="dv-content-body-center-list-center-head">
<div class="stuts-style" style="padding-top: 2px;">
<span class="div-span-title">设备故障统计</span>
<div class="inner-div">
<!-- 运行状态 -->
<div class="status-item run">
<div class="status-dot run"></div>
<span class="status-text">总数</span>
</div>
<!-- 故障状态 -->
<div class="status-item error">
<div class="status-dot error"></div>
<span class="status-text">故障</span>
</div>
</div>
</div>
</div>
<div class="dv-content-body-center-list-center-barChart" id="warehouseHealth5"></div>
</div>
</template>
<!--趋势图-->
<script>
// import { warehouseHealthOption } from '../../public/static/echartsConfig'
export default {
data() {
return {
// 各自动仓库状况
baseUrlOff: 'http://127.0.0.1:6001/api/BulletinBoard/Mes/V1/ReadData5',
baseUrlOnLine: window.appConfig.baseUrlOnLine5,
sysData: {
getwarehouseHealth: null,
},
tempEcharts: [
{ name: 'SRM32', index: null },
{ name: 'SRM31', index: null },
{ name: 'SRM21', index: null },
{ name: 'SRM11', index: null },
{ name: 'SRM41', index: null },
{ name: 'SRM11_PLCHeatBeat', index: null },
{ name: 'SRM21_PLCHeatBeat', index: null },
{ name: 'SRM31_PLCHeatBeat', index: null },
{ name: 'SRM32_PLCHeatBeat', index: null },
{ name: 'SRM41_PLCHeatBeat', index: null },
],
getwarehouseHealth: null,
warehouseHealthOption: warehouseHealthOption3,
}
},
methods: {
// 中间柱状图
getData() {
let opt = {
urlSuffix: window.baseOnLineOrOff ? this.baseUrlOnLine : this.baseUrlOff,
logTitle: '中间柱状图',
isUrlALL: true,
headers: window.baseOnLineOrOff,
// header: window.baseOnLineOrOff,
}
let callBackFn = (res) => {
if (!this.ajaxSuccessDataBefore(res, opt.logTitle)) return
this.sysData.getwarehouseHealth = res.data.data
// this.dataAnalysis(res.data.data)
this.getwarehouseHealthbar(res.data.data)
}
''.ajax(this, opt, callBackFn)
},
// 中间柱状图
getwarehouseHealthbar(item) {
let myChart = this.$echarts.init(document.getElementById('warehouseHealth5'))
this.warehouseHealthOption.xAxis.data = item.x
this.warehouseHealthOption.series[0].data = item.running
this.warehouseHealthOption.series[1].data = item.error
myChart.clear()
myChart.setOption(this.warehouseHealthOption)
window.addEventListener('resize', () => {
myChart.resize();
});
},
ajaxSuccessDataBefore(res, title) {
if (res.data == null || res.data.data.length == 0) {
''.Log(title + '无数据', 'getData')
return false
}
return true
},
},
mounted() {
// this.getData()
// const item = {
// x: ['1号堆垛机', '1号RGV', '2号RGV'],
// running: [50, 40, 44],
// free: [49, 59, 55],
// error: [1, 1, 0.9],
// }
// this.getwarehouseHealthbar(item)
},
}
</script>
<style lang="less" scoped>
.dv-content-body-center-list-center {
box-sizing: border-box;
width: 34vw;
height: 95%;
// background-color: #441f75;
.dv-content-body-center-list-center-head {
box-sizing: border-box;
// padding-top: 0.7vw;
width: 100%;
height: 20%;
.stuts-style {
display: flex;
height: 100%;
font-weight: 800;
font-size: 1vw;
color: aliceblue;
text-indent: 1vw;
box-sizing: border-box;
.div-span-title {
font-size: 2vh;
font-weight: 600;
margin-top: 0.6vh;
}
/* 右侧小div容器 */
.inner-div {
width: 50%;
/* 占大div的50%宽度 */
height: 100%;
/* 与大div同高 */
margin-left: auto;
/* 靠右对齐 */
display: flex;
/* 启用flex布局,用于内部子元素排列 */
}
/* 三个子div的共同样式 */
.status-item {
flex: 1;
/* 均等分配宽度 */
height: 100%;
/* 与父元素同高 */
display: flex;
/* 内部flex布局,用于排列方块和文字 */
align-items: center;
/* 垂直居中 */
justify-content: center;
/* 水平居中 */
padding: 0 4px;
/* 减少左右内边距,使整体更紧凑 */
}
/* 状态指示小方块 - 缩小与文字的间距 */
.status-dot {
width: 10px;
/* 方块宽度 */
height: 10px;
/* 方块高度 */
margin-right: -6px;
/* 减小右外边距(原6px),拉近与文字的距离 */
border-radius: 1px;
/* 轻微圆角 */
}
/* 运行状态的绿色方块 */
.status-dot.run {
background-color: #04efcd;
/* 深绿色 */
}
/* 待机状态的黄色方块 */
.status-dot.standby {
background-color: #ffab20;
/* 深黄色 */
}
/* 故障状态的红色方块 */
.status-dot.error {
background-color: #ff5447;
/* 深红色 */
}
// .status-text {
// color: #0eadfc;
// }
}
}
.dv-content-body-center-list-center-barChart {
width: 99%;
height: 80%;
.bar-vhart {
width: 100%;
height: 100%;
}
}
}
</style>