Commit d0a3430dc4f3be80efd9b4743defad3d7dd1720c
Merge branch 'fix/alarm-device-history' into 'main_dev'
fix: 修改告警徽标数和设备历史数据问题 See merge request yunteng/thingskit-app!131
Showing
3 changed files
with
29 additions
and
14 deletions
@@ -67,7 +67,8 @@ | @@ -67,7 +67,8 @@ | ||
67 | endTs: "", | 67 | endTs: "", |
68 | recordList: [], //实时数据 | 68 | recordList: [], //实时数据 |
69 | isScrollable: false, | 69 | isScrollable: false, |
70 | - attrList: [] | 70 | + attrList: [], |
71 | + getAttrList:[] | ||
71 | }; | 72 | }; |
72 | }, | 73 | }, |
73 | onUnload() { | 74 | onUnload() { |
@@ -96,9 +97,9 @@ | @@ -96,9 +97,9 @@ | ||
96 | } | 97 | } |
97 | this.isScrollable = this.list.length > 4; | 98 | this.isScrollable = this.list.length > 4; |
98 | if (res.deviceProfileId) { | 99 | if (res.deviceProfileId) { |
99 | - const getAttrList = await api.deviceApi.getAttribute(res.deviceProfileId) | ||
100 | - if (Array.isArray(getAttrList)) { | ||
101 | - this.attrList = getAttrList.map(m => { | 100 | + this.getAttrList = await api.deviceApi.getAttribute(res.deviceProfileId) |
101 | + if (Array.isArray(this.getAttrList)) { | ||
102 | + this.attrList = this.getAttrList.map(m => { | ||
102 | return m.identifier | 103 | return m.identifier |
103 | }) | 104 | }) |
104 | } | 105 | } |
@@ -163,7 +164,10 @@ | @@ -163,7 +164,10 @@ | ||
163 | }); | 164 | }); |
164 | }); | 165 | }); |
165 | const keys = await getDeviceKeys(tbDeviceId); | 166 | const keys = await getDeviceKeys(tbDeviceId); |
166 | - this.keys = [keys]; | 167 | + console.log(this.getAttrList.map(item=>item.identifier),'aaaaaaaa') |
168 | + | ||
169 | + this.keys = [this.getAttrList.map(item=>item.identifier)]; | ||
170 | + console.log(this,keys,this.keys)//123 | ||
167 | // 昨天 | 171 | // 昨天 |
168 | this.yesterday = moment().subtract(1, "days").format("YYYY-MM-DD"); | 172 | this.yesterday = moment().subtract(1, "days").format("YYYY-MM-DD"); |
169 | // 今天 | 173 | // 今天 |
@@ -218,4 +222,4 @@ | @@ -218,4 +222,4 @@ | ||
218 | height: 100vh; | 222 | height: 100vh; |
219 | background-color: #f8f9fa; | 223 | background-color: #f8f9fa; |
220 | } | 224 | } |
221 | -</style> | ||
225 | +</style> |
@@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
23 | </template> | 23 | </template> |
24 | 24 | ||
25 | <script> | 25 | <script> |
26 | +import {mapActions } from 'vuex' | ||
26 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; | 27 | import fTabbar from '@/components/module/f-tabbar/f-tabbar'; |
27 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; | 28 | import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; |
28 | import api from '@/api/index.js' | 29 | import api from '@/api/index.js' |
@@ -113,6 +114,7 @@ | @@ -113,6 +114,7 @@ | ||
113 | } | 114 | } |
114 | }, | 115 | }, |
115 | methods: { | 116 | methods: { |
117 | + ...mapActions(['updateBadgeTotal']), | ||
116 | inputChanged(e) { | 118 | inputChanged(e) { |
117 | this.resetQuery(); | 119 | this.resetQuery(); |
118 | this.topBack(); | 120 | this.topBack(); |
@@ -175,15 +177,22 @@ | @@ -175,15 +177,22 @@ | ||
175 | load: false | 177 | load: false |
176 | } | 178 | } |
177 | }) | 179 | }) |
178 | - if (!res) return | ||
179 | - uni.stopPullDownRefresh(); | ||
180 | - that.mescroll.endByPage(res.items.length, res.total); //必传参数(当前页的数据个数, 总页数) | ||
181 | - that.alarmTotal = res.total; | ||
182 | - if (page == 1) { | ||
183 | - that.list = res.items; | ||
184 | - } else { | ||
185 | - that.list = that.list.concat(res.items); | 180 | + if(res){ |
181 | + const resAlarm = await uni.$u.http.get('/yt/homepage/app?login=true'); | ||
182 | + if (resAlarm) { | ||
183 | + //异步实时更新告警徽标数 | ||
184 | + await this.updateBadgeTotal(resAlarm.totalAlarm?.activedAlarm); | ||
185 | + } | ||
186 | + uni.stopPullDownRefresh(); | ||
187 | + that.mescroll.endByPage(res.items.length, res.total); //必传参数(当前页的数据个数, 总页数) | ||
188 | + that.alarmTotal = res.total; | ||
189 | + if (page == 1) { | ||
190 | + that.list = res.items; | ||
191 | + } else { | ||
192 | + that.list = that.list.concat(res.items); | ||
193 | + } | ||
186 | } | 194 | } |
195 | + | ||
187 | }, | 196 | }, |
188 | close() { | 197 | close() { |
189 | this.show = false; | 198 | this.show = false; |