This commit is contained in:
liuye
2022-08-02 11:27:25 +08:00
parent 2eff172e2a
commit 315109a947
2 changed files with 6 additions and 2 deletions

View File

@@ -26,7 +26,7 @@
<p>离线</p> <p>离线</p>
</div> </div>
<div class="item"> <div class="item">
<h3>{{ onlineRate * 100 || 0 }}%</h3> <h3>{{ onlineRateNum || 0 }}%</h3>
<p>在线率</p> <p>在线率</p>
</div> </div>
</div> </div>
@@ -63,6 +63,7 @@ export default {
count: {}, count: {},
Echart: null, Echart: null,
onlineRate: '', onlineRate: '',
onlineRateNum: 0,
offlineRate: '' offlineRate: ''
} }
}, },
@@ -95,6 +96,7 @@ export default {
this.list = res.data.list this.list = res.data.list
this.count = res.data.count this.count = res.data.count
this.onlineRate = (this.count.online / this.count.sum).toFixed(2) this.onlineRate = (this.count.online / this.count.sum).toFixed(2)
this.onlineRateNum = parseInt(this.onlineRate * 100)
this.offlineRate = (1 - this.onlineRate).toFixed(2) this.offlineRate = (1 - this.onlineRate).toFixed(2)
this.initEchart() this.initEchart()
} }

View File

@@ -32,7 +32,7 @@
<p>离线</p> <p>离线</p>
</div> </div>
<div class="item"> <div class="item">
<h3>{{ onlineRate * 100 || 0 }}%</h3> <h3>{{ onlineRateNum || 0 }}%</h3>
<p>在线率</p> <p>在线率</p>
</div> </div>
</div> </div>
@@ -81,6 +81,7 @@ export default {
count: {}, count: {},
Echart: null, Echart: null,
onlineRate: '', onlineRate: '',
onlineRateNum: 0,
offlineRate: '' offlineRate: ''
} }
}, },
@@ -113,6 +114,7 @@ export default {
this.list = res.data.list this.list = res.data.list
this.count = res.data.count || 0 this.count = res.data.count || 0
this.onlineRate = (this.count.online / this.count.sum).toFixed(2) this.onlineRate = (this.count.online / this.count.sum).toFixed(2)
this.onlineRateNum = parseInt(this.onlineRate * 100)
this.offlineRate = (1 - this.onlineRate).toFixed(2) this.offlineRate = (1 - this.onlineRate).toFixed(2)
this.initEchart() this.initEchart()
} }