Commit 07db9bf6f138863e5e6f963a3abd77a0477e4dcd

Authored by fengtao
1 parent 2dc70eb1

refractor:首页告警跳转代码优化

Showing 1 changed file with 15 additions and 30 deletions
@@ -39,19 +39,19 @@ @@ -39,19 +39,19 @@
39 <text class="item-text home-text-muted">告警统计</text> 39 <text class="item-text home-text-muted">告警统计</text>
40 </view> 40 </view>
41 <view class="item-child-bottom u-flex"> 41 <view class="item-child-bottom u-flex">
42 - <view @click="navatorAlertUnhandle()" class="u-flex sigle-child"> 42 + <view @click="navigatorAlarmStatus(['ACTIVE_UNACK', 'ACTIVE_ACK'])" class="u-flex sigle-child">
43 <view class="sigle-text"> 43 <view class="sigle-text">
44 <text class="home-text-total">{{ alertData.noHandle }}</text> 44 <text class="home-text-total">{{ alertData.noHandle }}</text>
45 </view> 45 </view>
46 <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view> 46 <view class="sigle-value"><text class="home-text-total-bottom">未处理</text></view>
47 </view> 47 </view>
48 - <view @click="navatorAlertHandle('CLEARED_ACK')" class="u-flex sigle-child"> 48 + <view @click="navigatorAlarmStatus('CLEARED_ACK')" class="u-flex sigle-child">
49 <view class="sigle-text"> 49 <view class="sigle-text">
50 <text class="home-text-total">{{ alertData.doneHandle }}</text> 50 <text class="home-text-total">{{ alertData.doneHandle }}</text>
51 </view> 51 </view>
52 <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view> 52 <view class="sigle-value"><text class="home-text-total-bottom">已处理</text></view>
53 </view> 53 </view>
54 - <view @click="navatorAlertFalseAlarm('CLEARED_UNACK')" class="u-flex sigle-child"> 54 + <view @click="navigatorAlarmStatus('CLEARED_UNACK')" class="u-flex sigle-child">
55 <view class="sigle-text"> 55 <view class="sigle-text">
56 <text class="home-text-total">{{ alertData.errorReport }}</text> 56 <text class="home-text-total">{{ alertData.errorReport }}</text>
57 </view> 57 </view>
@@ -123,21 +123,16 @@ export default { @@ -123,21 +123,16 @@ export default {
123 }, 123 },
124 methods: { 124 methods: {
125 getDeviceTotalData() { 125 getDeviceTotalData() {
126 - uni.$u.http  
127 - .get('/yt/homepage/app')  
128 - .then(res => {  
129 - if (res) {  
130 - this.deviceData.onLine = res.totalDevice.onLine;  
131 - this.deviceData.unLine = res.totalDevice.offLine;  
132 - this.deviceData.noActive = res.totalDevice.inActive;  
133 - this.alertData.noHandle = res.totalAlarm.activedAlarm;  
134 - this.alertData.doneHandle = res.totalAlarm.clearedAck;  
135 - this.alertData.errorReport = res.totalAlarm.clearedUnack;  
136 - }  
137 - })  
138 - .catch(e => {  
139 - // uni.$u.toast(e.data?.message);  
140 - }); 126 + uni.$u.http.get('/yt/homepage/app').then(res => {
  127 + if (res) {
  128 + this.deviceData.onLine = res.totalDevice.onLine;
  129 + this.deviceData.unLine = res.totalDevice.offLine;
  130 + this.deviceData.noActive = res.totalDevice.inActive;
  131 + this.alertData.noHandle = res.totalAlarm.activedAlarm;
  132 + this.alertData.doneHandle = res.totalAlarm.clearedAck;
  133 + this.alertData.errorReport = res.totalAlarm.clearedUnack;
  134 + }
  135 + });
141 }, 136 },
142 openCamera() { 137 openCamera() {
143 uni.navigateTo({ 138 uni.navigateTo({
@@ -149,18 +144,8 @@ export default { @@ -149,18 +144,8 @@ export default {
149 url: 'configuration/configuration' 144 url: 'configuration/configuration'
150 }); 145 });
151 }, 146 },
152 - navatorAlertUnhandle() {  
153 - let obj = ['ACTIVE_UNACK', 'ACTIVE_ACK'];  
154 - uni.reLaunch({  
155 - url: '../alarm/alarm?type=' + JSON.stringify(obj)  
156 - });  
157 - },  
158 - navatorAlertHandle(e) {  
159 - uni.reLaunch({  
160 - url: '../alarm/alarm?type=' + JSON.stringify(e)  
161 - });  
162 - },  
163 - navatorAlertFalseAlarm(e) { 147 + //告警状态查询
  148 + navigatorAlarmStatus(e) {
164 uni.reLaunch({ 149 uni.reLaunch({
165 url: '../alarm/alarm?type=' + JSON.stringify(e) 150 url: '../alarm/alarm?type=' + JSON.stringify(e)
166 }); 151 });