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