bodyCenterRight.vue
3.5 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
<template>
<div class="dv-content-body-center-list-right">
<div class="div-span-title" style="margin-bottom: 2vh">AGV充电状态</div>
<div
style="display: flex;
height: 90%;
width: 98%;
flex-wrap: wrap;
justify-content: center;
margin-left: 3vw;
"
>
<div class="div-span-title-bottom" v-for="(item, index) in agvDataList" :key="index">
<div class="agvFont">{{ item.agvNumber }}</div>
<div class="BottomStyleTop">
<!-- <div class="BottomStyle">速度:{{ item.speed / 100 }}m/s</div> -->
<div class="dianchiCss">
<div class="agvFont" style="width: 30%;">电量:</div>
<div class="agvFont" style="width: 50%;height: 60%;" :id="createChartId(index)"></div>
<div class="agvFont" style="width: 6%;">{{ item.battery }}%</div>
</div>
</div>
<div class="agvFont">
状态:<a :style="getStatus(item.status)">{{ item.status }}</a>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
agvDataList: [],
sysData: {},
baseUrlOff: 'http://127.0.0.1:6001/api/BulletinBoard/Mes/V1/ReadData1',
baseUrlOnLine: window.appConfig.baseUrlint,
}
},
methods: {
getData(data) {
let myChart = this.$echarts.init(document.getElementById('mind'))
overviewOfLibraryInformation_bodyCenterRight.series.data = []
overviewOfLibraryInformation_bodyCenterRight.series.data = data
myChart.clear()
myChart.setOption(overviewOfLibraryInformation_bodyCenterRight)
},
createChartId(index) {
return 'main_' + index
},
getStatus(s) {
if (s == '在线' || s == '充电中') {
return {
color: 'green',
textDecoration: 'none',
}
} else if (s == '离线') {
return {
color: 'gray',
textDecoration: 'none',
}
} else if (s == '故障') {
return {
color: 'red',
textDecoration: 'none',
}
} else {
return {
color: 'gray',
textDecoration: 'none',
}
}
},
agv() {
let opt = {
urlSuffix: window.baseOnLineOrOff ? this.baseUrlOnLine : this.baseUrlOff,
logTitle: 'agv',
isUrlALL: true,
headers: window.baseOnLineOrOff,
isHanderAjaxSuccessActionLoad: true,
}
let callBackFn = (res) => {
if (!this.ajaxSuccessDataBefore(res, opt.logTitle)) return
this.agvDataList = this.sysData
setTimeout(() => {
this.getDianliang()
}, 300)
}
''.ajax(this, opt, callBackFn)
},
getDianliang() {
for (let i = 0; i < this.agvDataList.length; i++) {
let myChart = this.$echarts.init(document.getElementById('main_' + i))
dianLiangOne.series[1].data = [this.agvDataList[i].battery]
myChart.clear()
myChart.setOption(dianLiangOne)
window.onresize = myChart.resize
}
},
ajaxSuccessDataBefore(res, title) {
if (res.data.data == null || res.data.data.length == 0) {
this.sysData = []
''.Log(title + '无数据', 'getData')
return false
}
return true
},
},
mounted() {
this.agv()
setInterval(() => {
this.agv()
}, 10000)
},
}
</script>
<style lang="less" scoped>
.dv-content-body-center-list-right {
width: 49%;
height: 95%;
border: 1.5px solid hsl(208.57deg 51.22% 40.2%);
}
.div-span-title-bottom {
// display: flex;
width: 33%;
height: 20%;
}
.agvFont {
font-size: 1.3vw;
color: #fff;
display: contents;
}
.BottomStyleTop {
height: 1%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.dianchiCss {
display: flex;
font-size: 13px;
color: aliceblue;
// margin: 20px 0 0 20px;
align-items: center;
}
</style>