Showing
3 changed files
with
11 additions
and
3 deletions
| ... | ... | @@ -31,4 +31,12 @@ Component({ |
| 31 | 31 | // 在组件实例被从页面节点树移除时执行 |
| 32 | 32 | }, |
| 33 | 33 | }, |
| 34 | + ready() { | |
| 35 | + console.log(this.data.deviceInfo, 'deviceInfo----deviceInfo') | |
| 36 | + const deviceInfo = this.data.deviceInfo | |
| 37 | + const res = Math.floor(((deviceInfo.inactiveCount / deviceInfo.deviceTotal) * 100)) | |
| 38 | + this.setData({ | |
| 39 | + onlinePercent: res | |
| 40 | + }) | |
| 41 | + } | |
| 34 | 42 | }) | ... | ... |
| ... | ... | @@ -2,10 +2,10 @@ |
| 2 | 2 | <view class="circle_main_left"> |
| 3 | 3 | <view class="circle_left_show"> |
| 4 | 4 | |
| 5 | - <van-circle value="{{ (deviceInfo.inactiveCount / deviceInfo.deviceTotal) * 100 }}" clockwise="{{ false }}" stroke-width="17" size="120" layer-color="#F3F3F3" color="#46B3FD"> | |
| 5 | + <van-circle value="{{ onlinePercent }}" clockwise="{{ false }}" stroke-width="17" size="120" layer-color="#F3F3F3" color="#46B3FD"> | |
| 6 | 6 | <view class="deviceText"> |
| 7 | 7 | <view class="deviceNum"> |
| 8 | - {{(deviceInfo.inactiveCount / deviceInfo.deviceTotal) * 100}}% | |
| 8 | + {{onlinePercent}}% | |
| 9 | 9 | </view> |
| 10 | 10 | <view class="deviceCont"> |
| 11 | 11 | 在线率 | ... | ... |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | </view> |
| 33 | 33 | <view class="deviceStatistics"> |
| 34 | 34 | <topTitle topTitleName="设备统计"></topTitle> |
| 35 | - <circularDiagram deviceInfo="{{allData.deviceInfo}}"></circularDiagram> | |
| 35 | + <circularDiagram wx:if="{{allData&&allData.deviceInfo }}" deviceInfo="{{allData.deviceInfo}}"></circularDiagram> | |
| 36 | 36 | <deviceData deviceDataList="{{deviceDataList}}"></deviceData> |
| 37 | 37 | </view> |
| 38 | 38 | <view class="overallOperationStatus"> | ... | ... |