|
1
|
<template>
|
|
2
|
<el-container class="device-monitor">
|
|
3
|
<el-aside width="225px">
|
|
4
5
6
7
8
|
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>概览</span>
</div>
<div class="container">
|
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<div
v-for="(item, index) in overyviewsList"
:key="item.code"
class="text item"
>
<div
:style="
index == 0
? 'background-color:#1E9FFF'
: index == 1
? 'background-color:#009688'
: index == 2
? 'background-color:#FFB800'
: 'background-color:#1E9FFF'
"
>
|
|
25
26
|
<el-row>
<el-col :span="14">
|
|
27
|
{{ item.name }}
|
|
28
29
30
|
</el-col>
<el-col :span="10">
<!-- <br/> -->
|
|
31
|
<span>{{ item.description }}</span>
|
|
32
33
|
</el-col>
</el-row>
|
|
34
35
36
37
|
</div>
</div>
</div>
</el-card>
|
|
38
|
<el-card class="box-card device-info">
|
|
39
40
41
|
<div slot="header" class="clearfix">
<span>设备概览</span>
</div>
|
|
42
43
44
45
46
47
|
<el-divider
v-if="srmList.length > 0"
content-position="center"
style="width: 100vw"
>堆垛机</el-divider
>
|
|
48
49
50
|
<el-tag
v-for="item in srmList"
:key="item.name"
|
|
51
|
:type="getTagType(item)"
|
|
52
|
effect="dark"
|
|
53
54
|
class="tag-item"
>
|
|
55
56
|
{{ item.name }}
</el-tag>
|
|
57
58
59
|
<el-divider v-if="stationList.length > 0" content-position="center"
>站台</el-divider
>
|
|
60
61
62
|
<el-tag
v-for="item in stationList"
:key="item.name"
|
|
63
|
:type="getTagTypePort(item)"
|
|
64
|
effect="dark"
|
|
65
66
|
class="tag-item"
>
|
|
67
68
|
{{ item.name }}
</el-tag>
|
|
69
70
71
|
<el-divider v-if="rgvList.length > 0" content-position="center"
>RGV</el-divider
>
|
|
72
73
74
|
<el-tag
v-for="item in rgvList"
:key="item.name"
|
|
75
|
:type="getTagType(item)"
|
|
76
|
effect="dark"
|
|
77
78
|
class="tag-item"
>
|
|
79
80
|
{{ item.name }}
</el-tag>
|
|
81
82
83
|
<el-divider v-if="crgvList.length > 0" content-position="center"
>CRGV</el-divider
>
|
|
84
85
86
|
<el-tag
v-for="item in crgvList"
:key="item.name"
|
|
87
|
:type="getTagTypePort(item)"
|
|
88
|
effect="dark"
|
|
89
90
|
class="tag-item"
>
|
|
91
92
|
{{ item.name }}
</el-tag>
|
|
93
94
|
</el-card>
</el-aside>
|
|
95
|
<el-main>
|
|
96
|
<map-module ref="map" />
|
|
97
|
</el-main>
|
|
98
|
</el-container>
|
|
99
100
101
|
</template>
<script>
|
|
102
103
104
105
106
107
108
109
|
import {
getCRGVInfo,
getOverviews,
getRGVInfo,
getSRMInfo,
getStationMonitorInfo,
} from "@/api/main";
import MapModule from "@/components/MapModule";
|
|
110
111
|
export default {
name: "DeviceMonitor",
|
|
112
|
components: {
|
|
113
|
MapModule,
|
|
114
|
},
|
|
115
|
data() {
|
|
116
|
return {
|
|
117
|
//详情列表
|
|
118
|
overyviewsList: [],
|
|
119
|
//堆垛机列表
|
|
120
|
srmList: [],
|
|
121
|
//站台列表
|
|
122
|
stationList: [],
|
|
123
|
//rgv列表
|
|
124
|
rgvList: [],
|
|
125
|
//crgv列表
|
|
126
|
crgvList: [],
|
|
127
|
interval: null,
|
|
128
|
isCurrentTab: false,
|
|
129
|
isOpenServer: false,
|
|
130
131
|
};
},
|
|
132
133
134
135
136
137
138
139
140
141
|
props: {
// 定义接收的 startDeal 变量
startDeal: {
type: Boolean,
default: false,
},
},
watch: {
// 监听 startDeal 变量的变化
startDeal(newValue, oldValue) {
|
|
142
143
|
// console.log('处理状态发生变化:', newValue);
this.isOpenServer = newValue;
|
|
144
145
|
if (this.isCurrentTab) {
if (newValue) {
|
|
146
|
this.start();
|
|
147
|
} else {
|
|
148
149
150
|
this.stop();
}
}
|
|
151
152
|
},
},
|
|
153
|
beforeDestroy() {
|
|
154
|
clearInterval(this.interval);
|
|
155
|
},
|
|
156
|
mounted() {
|
|
157
|
// console.log(this.$dict);
|
|
158
159
160
|
},
methods: {
//开始刷新数据
|
|
161
|
start() {
|
|
162
|
this.isCurrentTab = true;
|
|
163
|
if (this.isOpenServer) {
|
|
164
165
166
167
168
|
// this.srmList = window.srmData;
// this.rgvList = window.rgvData;
// this.stationList = window.stationData;
// // console.log(this.srmList, this.rgvList, this.stationList)
// this.$refs.map.updateData(this.srmList, this.rgvList, this.stationList);
|
|
169
|
|
|
170
|
this.interval = setInterval(() => {
|
|
171
|
getOverviews().then((response) => {
|
|
172
173
174
|
// console.log(response);
this.overyviewsList = response.data;
});
|
|
175
|
getSRMInfo().then((response) => {
|
|
176
177
|
this.srmList = response.data;
});
|
|
178
|
getRGVInfo().then((response) => {
|
|
179
180
|
this.rgvList = response.data;
});
|
|
181
|
getCRGVInfo().then((response) => {
|
|
182
183
|
this.crgvList = response.data;
});
|
|
184
|
getStationMonitorInfo().then((response) => {
|
|
185
186
|
this.stationList = response.data;
});
|
|
187
188
189
190
191
192
193
|
this.$refs.map.updateData(
this.srmList,
this.rgvList,
this.stationList
);
}, 3000);
}
|
|
194
195
|
},
//停止刷新数据
|
|
196
|
stop() {
|
|
197
|
this.isCurrentTab = false;
|
|
198
|
clearInterval(this.interval);
|
|
199
200
201
202
203
|
},
getTagType(item) {
if (item.operationModel == "5") {
if (item.totalError == "True") {
|
|
204
|
return "danger"; // 报警
|
|
205
|
} else {
|
|
206
207
208
209
210
|
if (
item.fork1TaskExcuteStatus == "2" ||
item.fork1TaskExcuteStatus == "3"
) {
return ""; // 正常
|
|
211
|
} else if (item.fork1TaskExcuteStatus == "1") {
|
|
212
|
return "success"; // 待机
|
|
213
|
} else {
|
|
214
|
return "danger"; // 报警
|
|
215
216
217
|
}
}
} else {
|
|
218
|
return "warning"; // 非自动
|
|
219
220
221
222
223
224
|
}
},
getTagTypePort(item) {
if (item.stationMonitorAutomation == "1") {
if (item.stationError == "1") {
|
|
225
|
return "danger"; // 报警
|
|
226
227
|
} else {
if (item.stationMonitorOccupied == "1") {
|
|
228
|
return ""; // 正常
|
|
229
|
} else {
|
|
230
|
return "success"; // 报警
|
|
231
232
233
|
}
}
} else {
|
|
234
|
return "warning"; // 非自动
|
|
235
|
}
|
|
236
|
},
|
|
237
238
239
240
241
|
},
};
</script>
<style lang="scss" scoped>
|
|
242
243
244
|
.container {
width: 100%;
}
|
|
245
|
|
|
246
247
248
249
|
.text {
font-size: 14px;
color: white;
}
|
|
250
|
|
|
251
252
253
254
|
.text span {
font-size: 16px;
font-weight: bolder;
}
|
|
255
|
|
|
256
257
258
259
260
261
262
|
.item {
border: 1px black solid;
text-align: center;
width: 100%;
line-height: 3vh;
margin-bottom: 5px;
}
|
|
263
|
|
|
264
265
266
267
268
|
.clearfix {
height: 14px;
font-size: 14px;
color: #409eff;
}
|
|
269
|
|
|
270
271
272
|
.tag-item {
margin: 0px 5px 5px 0px;
}
|
|
273
|
|
|
274
275
276
277
278
279
|
.device-info {
display: flex;
flex-wrap: wrap; // 允许元素换行
max-height: 70vh; // 设置最大高度,超出显示滚动条
overflow-y: auto; // 超出最大高度时显示纵向滚动条
}
|
|
280
|
</style>
|
|
281
282
283
|
<style>
.device-monitor {
|
|
284
|
.el-card__body {
|
|
285
286
287
288
|
width: 225px;
}
}
</style>
|