headCenter.vue
7.2 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
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
<template>
<div style="width: 100%;height: 100%;display: flex;">
<div style="width: 15%;height: 100%;">
<div style="width: 100%; height: 100%; position: relative; left: 0vw; top: 0vw;">
<div class="location">
<div class="item" style="margin-bottom: 10px;">
<div class="name">智能精密定长切割坡口加工中心</div>
<div class="value">{{ deviceInfo.hanji }}台</div>
</div>
<div class="item" style="margin-bottom: 10px;">
<div class="name">高速智能数控带锯床系统</div>
<div class="value">{{ deviceInfo.daijuchuang }}台</div>
</div>
<div class="item" style="margin-bottom: 10px;">
<div class="name">数字化氩弧焊机</div>
<div class="value">{{ deviceInfo.qiepo }}台</div>
</div>
<div class="item">
<div class="name">智能数控弯管中心</div>
<div class="value">{{ deviceInfo.wanguan }}台</div>
</div>
</div>
</div>
</div>
<div style="width: 60%;height: 100%;border: 2px solid #3879c9;">
<div class="title-text">在线设备</div>
<div class="container">
<!-- 每列数据 -->
<div v-for="(item, index) in dataList" :key="index" class="column-wrapper">
<div class="data-column">
<!-- 上半部分:实际电流 -->
<div class="data-item">
<div class="value2">{{ item.Value1 }}</div>
<div class="label">{{ item.unit1 }}</div>
</div>
<!-- 虚线分隔 -->
<div class="divider"></div>
<!-- 下半部分:实际电压 -->
<div class="data-item">
<div class="value2">{{ item.Value2 }}</div>
<div class="label">{{ item.unit2 }}</div>
</div>
<div class="data-item">
<div :class="{
'status_run': item.status === '在线',
'status_error': item.status === '故障'
}">
{{ item.status }}
</div>
</div>
</div>
<!-- 列标题 -->
<div class="column-title">{{ item.EquipmentName }}</div>
</div>
</div>
</div>
<div style="width: 25%;height: 100%;">
<div
style="width: 100%; height: 100%; position: relative; left: 0.5vw; top: 0vw;border: 2px solid #3879c9; width: 96%;">
<div class="title-text">在线设备</div>
<div class="location2">
<div id="dayPie" style="width: 50%;height: 100%;"></div>
<div id="weekPie" style="width: 50%;height: 100%;"></div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
sysinfo: [],
form: {
online: 0,
error: 0
},
deviceInfo: {
hanji: 0,
daijuchuang: 0,
qiepo: 0,
wanguan: 0
},
dataList: [],
dayPieChartOption: dayPieChartOption,
weekPieChartOption: weekPieChartOption
// dataList: [
// { Value1: '22A', Value2: '220V', EquipmentName: '1号焊机', status: '在线', unit1: '实际电流', unit2: '实际电压' },
// { Value1: '22A', Value2: '220V', EquipmentName: '2号焊机', status: '在线', unit1: '实际电流', unit2: '实际电压' },
// // { current: '22A', voltage: '220V', title: '1号弯管机', status: '故障' },
// // { current: '22A', voltage: '220V', title: '2号弯管机', status: '故障' },
// // { current: '22A', voltage: '220V', title: '带锯床', status: '在线' },
// // { current: '22A', voltage: '220V', title: '切坡一体机', status: '在线' }
// ]
}
},
methods: {
sed(data) {
this.dataList = data;
this.dataList.forEach(item => {
item.status = "在线"
if (item.EquipmentName == "切坡一体机") {
item.unit1 = "转速"
item.unit2 = "入刀速度"
} else if (item.EquipmentName.includes("带锯床")) {
item.unit1 = "锯轮线速度"
item.unit2 = "工进速度"
} else {
item.unit1 = "实际电流"
item.unit2 = "实际电压"
}
})
},
getDayPie(rawData) {
// console.log(rawData)
// const dates = rawData.map(item => item.CurryDate);
// const quantities = rawData.map(item => item.Quantity);
let myChart = this.$echarts.init(document.getElementById('dayPie'))
// this.warehouseHealthOption.xAxis.data = dates
// this.warehouseHealthOption.series[0].data = quantities
myChart.clear()
myChart.setOption(this.dayPieChartOption)
let myChart2 = this.$echarts.init(document.getElementById('weekPie'))
// this.warehouseHealthOption.xAxis.data = dates
// this.warehouseHealthOption.series[0].data = quantities
myChart2.clear()
myChart2.setOption(this.weekPieChartOption)
window.addEventListener('resize', () => {
myChart.resize();
myChart2.resize();
});
},
setOnlineInfo(data) {
this.form = data;
},
setDeviceInfo(data) {
this.deviceInfo.hanji = data[0]
this.deviceInfo.daijuchuang = data[1]
this.deviceInfo.qiepo = data[2]
this.deviceInfo.wanguan = data[3]
},
},
mounted() {
debugger
this.getDayPie();
},
}
</script>
<style lang="scss" scoped>
.title-text {
width: 100%;
height: 2vh;
font-size: 2vh;
font-weight: 600;
color: #fff;
text-align: left;
padding-left: 1vw;
}
.location {
height: 100%;
display: flex;
// border: 2px solid #3879c9;
flex-direction: column;
justify-content: space-between;
// align-items: center;
margin: 0vh 3vh 0px 1vh;
}
.location2 {
height: 100%;
display: flex;
// border: 2px solid #3879c9;
flex-direction: row;
justify-content: space-between;
// align-items: center;
margin: 0px 0 7px 7px;
}
.box {
flex: 1;
/* 左右各占50%宽度 */
height: 100%;
display: flex;
// flex-direction: column;
/* 内部item上下排列 */
justify-content: space-around;
/* item均匀分布 */
// align-items: center;
/* item水平居中 */
}
.item {
width: 90%;
height: 44%;
border-radius: 5px;
border: 1px solid #67c8fb;
display: flex;
flex-direction: row;
justify-content: space-between;
/* 名称左、数值右 */
align-items: center;
/* 内容垂直居中 */
padding: 0 10px;
/* 内容不贴边框 */
background-color: #062448;
}
/* 名称/数值样式区分 */
.name {
color: #fff;
font-size: 2vh;
max-width: 70%;
word-wrap: break-word;
/* 允许长单词/URL换行 */
word-break: break-all;
/* 强制在任意字符处断行(适合中文)*/
white-space: normal;
/* 允许正常换行(默认值,但显式声明更安全)*/
overflow-wrap: break-word;
/* 现代标准,等效于 word-wrap */
}
.value {
color: #67c8fb;
font-size: 3vh;
font-weight: bold;
}
.container {
display: flex;
flex-wrap: wrap;
gap: 0.1vw;
/* 列之间的间距 */
padding: 1vh;
// background-color: #0a1428;
color: #fff;
}
.column-wrapper {
display: flex;
flex-direction: column;
align-items: center;
// 控制整体列宽
min-width: 9.5vw;
height: 100%;
}
.data-column {
width: 100%;
border: 2px solid #00bfff;
border-radius: 8px;
padding: 1vh;
box-sizing: border-box;
text-align: center;
}
.data-item {
// margin-bottom: 16px;
text-align: center;
}
.value2 {
font-size: 3vh;
font-weight: bold;
color: #00bfff;
margin-bottom: 0.4vh;
}
.label {
font-size: 12px;
color: #ccc;
}
.status_run {
font-size: 12px;
color: #45f505;
}
.status_error {
font-size: 12px;
color: #e4072c;
}
.divider {
width: 100%;
height: 1px;
border-top: 1px dashed #00bfff;
margin: 2px 0;
// color: #e30b0ba5;
}
.column-title {
font-size: 14px;
color: #ccc;
margin-top: 5px;
text-align: center;
}
</style>