Showing
5 changed files
with
39 additions
and
25 deletions
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 | @close="calendarClose"></u-calendar> |
63 | 63 | <u-picker :show="showTimeGap" :columns="columns" keyName="label" closeOnClickOverlay @confirm="confirmTimeGap" |
64 | 64 | @cancel="cancelTimeGap" @close="cancelTimeGap" :defaultIndex="[3]"></u-picker> |
65 | - <u-picker :show="showSelectType" :columns="keys" closeOnClickOverlay @confirm="confirmTypeGap" | |
65 | + <u-picker :show="showSelectType" :columns="[keys.map(item=>({label:item.name,value:item.identifier}))]" keyName="label" closeOnClickOverlay @confirm="confirmTypeGap" | |
66 | 66 | @cancel="cancelTypeGap" @close="cancelTypeGap"></u-picker> |
67 | 67 | <u-picker :show="showSelectAvg" :columns="avgColumns" keyName="label" closeOnClickOverlay |
68 | 68 | @confirm="confirmAvgGap" @cancel="showSelectAvg=false" @close="showSelectAvg=false"></u-picker> |
... | ... | @@ -163,7 +163,7 @@ |
163 | 163 | chartData: { |
164 | 164 | categories: this.historyData.length && this.historyData.map(item => item.ts), |
165 | 165 | series: [{ |
166 | - name: this.keys[0][0], | |
166 | + name: this.keys[0].identifier, | |
167 | 167 | data: this.historyData.length && this.historyData.map(item => Number(item.value)) |
168 | 168 | }] |
169 | 169 | }, |
... | ... | @@ -199,7 +199,7 @@ |
199 | 199 | timeData: { |
200 | 200 | selectTime: this.yesterday + ' 至 ' + this.today, |
201 | 201 | getTimeGap: this.timeDiff, |
202 | - getType: this.keys[0][0], | |
202 | + getType: this.keys[0].name, | |
203 | 203 | limit: 7, |
204 | 204 | agg: 'NONE' |
205 | 205 | }, |
... | ... | @@ -214,7 +214,7 @@ |
214 | 214 | } else { |
215 | 215 | this.chartData.categories = newValue.map(item => item.ts); |
216 | 216 | this.chartData.series = [{ |
217 | - name: this.keys[0][0], | |
217 | + name: this.keys[0].name, | |
218 | 218 | data: newValue.map(item => Number(item.value)) |
219 | 219 | }]; |
220 | 220 | } |
... | ... | @@ -363,18 +363,18 @@ |
363 | 363 | }, |
364 | 364 | async confirmTypeGap(time) { |
365 | 365 | this.showSelectType = false; |
366 | - this.timeData.getType = time.value[0]; | |
366 | + this.timeData.getType = time.value[0].label; | |
367 | 367 | const interval = this.columns[0].find(item => item.label === this.timeData.getTimeGap); |
368 | 368 | const data = await getHistoryData({ |
369 | 369 | startTs: this.startTs, |
370 | 370 | endTs: this.endTs, |
371 | - keys: this.timeData.getType, | |
371 | + keys:time.value[0].value, | |
372 | 372 | interval: this.limitFlag ? null : interval.value, |
373 | 373 | entityId: this.entityId, |
374 | 374 | limit: this.timeData.limit, |
375 | 375 | agg: this.timeData.agg |
376 | 376 | }); |
377 | - this.$emit('update', data[this.timeData.getType]); | |
377 | + this.$emit('update', data[time.value[0].value]); | |
378 | 378 | }, |
379 | 379 | cancelTypeGap() { |
380 | 380 | this.showSelectType = false; | ... | ... |
... | ... | @@ -2,8 +2,8 @@ |
2 | 2 | <view class="realtime-page"> |
3 | 3 | <view class="item" v-for="(item, index) in recordList" :key="index"> |
4 | 4 | <view class="item-top"> |
5 | - <view>{{ item.key }}</view> | |
6 | - <view class="item-value">{{ item.value }}</view> | |
5 | + <view>{{ item.name }}</view> | |
6 | + <view class="item-value">{{ item.value || '' }}</view> | |
7 | 7 | </view> |
8 | 8 | <view class="item-time">{{ item.time }}</view> |
9 | 9 | </view> |
... | ... | @@ -18,10 +18,10 @@ |
18 | 18 | type: Array, |
19 | 19 | default: () => [] |
20 | 20 | } |
21 | - } | |
21 | + }, | |
22 | 22 | }; |
23 | 23 | </script> |
24 | 24 | |
25 | 25 | <style lang="scss" scoped> |
26 | 26 | @import "../static/realtime-data.scss"; |
27 | -</style> | |
\ No newline at end of file | ||
27 | +</style> | ... | ... |
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | if (res.deviceProfileId) { |
100 | 100 | this.getAttrList = await api.deviceApi.getAttribute(res.deviceProfileId) |
101 | 101 | if (Array.isArray(this.getAttrList)) { |
102 | - this.attrList = this.getAttrList.map(m => { | |
102 | + this.attrList = this.getAttrList?.map(m => { | |
103 | 103 | return m.identifier |
104 | 104 | }) |
105 | 105 | } |
... | ... | @@ -156,15 +156,24 @@ |
156 | 156 | this.recordList.unshift(item); |
157 | 157 | } |
158 | 158 | }); |
159 | - this.recordList = this.recordList.map((item) => { | |
159 | + this.recordList = this.recordList?.map((item) => { | |
160 | 160 | return { |
161 | 161 | ...item, |
162 | 162 | time: formatToDate(item.time, "YYYY-MM-DD HH:mm:ss"), |
163 | 163 | }; |
164 | 164 | }); |
165 | + if(this.getAttrList){ | |
166 | + this.getAttrList.forEach(item=>{ | |
167 | + this.recordList?.forEach(item1=>{ | |
168 | + if(item.identifier===item1.key){ | |
169 | + item1.name=item.name | |
170 | + } | |
171 | + }) | |
172 | + }) | |
173 | + } | |
165 | 174 | }); |
166 | 175 | const keys = await getDeviceKeys(tbDeviceId); |
167 | - this.keys = [this.getAttrList.map(item=>item.identifier)]; | |
176 | + this.keys=this.getAttrList || [] | |
168 | 177 | // 昨天 |
169 | 178 | this.yesterday = moment().subtract(1, "days").format("YYYY-MM-DD"); |
170 | 179 | // 今天 | ... | ... |
... | ... | @@ -15,6 +15,11 @@ |
15 | 15 | font-weight: bold; |
16 | 16 | .item-value { |
17 | 17 | font-weight: bold; |
18 | + width:200rpx; | |
19 | + text-align: right; | |
20 | + overflow: hidden; | |
21 | + text-overflow: ellipsis; | |
22 | + white-space: nowrap; | |
18 | 23 | } |
19 | 24 | } |
20 | 25 | .item-time { |
... | ... | @@ -23,4 +28,4 @@ |
23 | 28 | color: #999; |
24 | 29 | } |
25 | 30 | } |
26 | -} | |
\ No newline at end of file | ||
31 | +} | ... | ... |
... | ... | @@ -122,16 +122,16 @@ |
122 | 122 | message: '请输入正确的手机号码' |
123 | 123 | } |
124 | 124 | ], |
125 | - email: [{ | |
126 | - required: true, | |
127 | - message: '请输入正确的邮箱号', | |
128 | - trigger: 'change' | |
129 | - }, | |
130 | - { | |
131 | - pattern: /^[0-9a-zA-Z]+@(([0-9a-zA-Z]+)[.])+[a-z]{3}$/, | |
132 | - message: '请输入正确的邮箱号' | |
133 | - } | |
134 | - ] | |
125 | + // email: [{ | |
126 | + // required: true, | |
127 | + // message: '请输入正确的邮箱号', | |
128 | + // trigger: 'change' | |
129 | + // }, | |
130 | + // { | |
131 | + // pattern: /^[0-9a-zA-Z]+@(([0-9a-zA-Z]+)[.])+[a-z]{3}$/, | |
132 | + // message: '请输入正确的邮箱号' | |
133 | + // } | |
134 | + // ] | |
135 | 135 | }, |
136 | 136 | showDate: false, |
137 | 137 | dateTime: Number(new Date()), | ... | ... |