Commit e76e232af85845a7dccd784919b5617aff74fc19

Authored by 张 峰林
Committed by xp.Huang
1 parent ab30c83c

fix: 修改告警徽标数和设备历史数据问题

... ... @@ -172,6 +172,8 @@
172 172 label: '5分钟',
173 173 value: 300000
174 174 },
  175 +
  176 +
175 177 {
176 178 label: '10分钟',
177 179 value: 600000
... ...
... ... @@ -67,7 +67,8 @@
67 67 endTs: "",
68 68 recordList: [], //实时数据
69 69 isScrollable: false,
70   - attrList: []
  70 + attrList: [],
  71 + getAttrList:[]
71 72 };
72 73 },
73 74 onUnload() {
... ... @@ -96,9 +97,9 @@
96 97 }
97 98 this.isScrollable = this.list.length > 4;
98 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 103 return m.identifier
103 104 })
104 105 }
... ... @@ -163,7 +164,10 @@
163 164 });
164 165 });
165 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 172 this.yesterday = moment().subtract(1, "days").format("YYYY-MM-DD");
169 173 // 今天
... ... @@ -218,4 +222,4 @@
218 222 height: 100vh;
219 223 background-color: #f8f9fa;
220 224 }
221   -</style>
\ No newline at end of file
  225 +</style>
... ...
... ... @@ -23,6 +23,7 @@
23 23 </template>
24 24
25 25 <script>
  26 +import {mapActions } from 'vuex'
26 27 import fTabbar from '@/components/module/f-tabbar/f-tabbar';
27 28 import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
28 29 import api from '@/api/index.js'
... ... @@ -113,6 +114,7 @@
113 114 }
114 115 },
115 116 methods: {
  117 + ...mapActions(['updateBadgeTotal']),
116 118 inputChanged(e) {
117 119 this.resetQuery();
118 120 this.topBack();
... ... @@ -175,15 +177,22 @@
175 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 197 close() {
189 198 this.show = false;
... ...