Commit 5f48324a95fdce1cfea50b2502c2fd8fc5575b68
Merge branch 'fix/DEFECT-1835' into 'main_dev'
fix: 修复小程序告警记录中,设备全部为暂无数据,暂无数据,告警条件和值都为空 See merge request yunteng/thingskit-app!124
Showing
6 changed files
with
69 additions
and
21 deletions
@@ -94,6 +94,7 @@ | @@ -94,6 +94,7 @@ | ||
94 | if (e.data !== null) { | 94 | if (e.data !== null) { |
95 | let params = JSON.parse(decodeURIComponent(e.data)); | 95 | let params = JSON.parse(decodeURIComponent(e.data)); |
96 | const {deviceName,severity,organizationName,details,type,createdTime,status,id} = params | 96 | const {deviceName,severity,organizationName,details,type,createdTime,status,id} = params |
97 | + | ||
97 | this.detailId = id | 98 | this.detailId = id |
98 | this.alarmDetail = [{label: '告警场景:',value: type},{label: '告警级别:',value: severity},{label: '所属组织:',value: organizationName},{label: '告警设备:',value: ''},{label: '告警条件:',value: ''},{label: '告警值:',value: ''},{label: '告警时间:',value: createdTime},{label: '告警状态:',value: status},] | 99 | this.alarmDetail = [{label: '告警场景:',value: type},{label: '告警级别:',value: severity},{label: '所属组织:',value: organizationName},{label: '告警设备:',value: ''},{label: '告警条件:',value: ''},{label: '告警值:',value: ''},{label: '告警时间:',value: createdTime},{label: '告警状态:',value: status},] |
99 | this.formatAlarmDevice(details) | 100 | this.formatAlarmDevice(details) |
@@ -147,11 +148,13 @@ | @@ -147,11 +148,13 @@ | ||
147 | const keys = Object.keys(e) | 148 | const keys = Object.keys(e) |
148 | const dataFormat = await this.handleAlarmDetailFormat(keys); | 149 | const dataFormat = await this.handleAlarmDetailFormat(keys); |
149 | const values = keys.reduce((acc, curr) => { | 150 | const values = keys.reduce((acc, curr) => { |
151 | + const items = e[curr]?.triggerData | ||
150 | dataFormat.forEach((dataItem => { | 152 | dataFormat.forEach((dataItem => { |
151 | if (dataItem.tbDeviceId === curr) { | 153 | if (dataItem.tbDeviceId === curr) { |
152 | - const findAttribute = dataItem.attribute.find(findItem => findItem.identifier === e[curr].key) | 154 | + const findAttribute = dataItem.attribute.find(findItem => findItem.identifier === items?.key) |
155 | + if(!items?.realValue && !findAttribute.name) return | ||
153 | acc.push( | 156 | acc.push( |
154 | - `${findAttribute.name}:${e[curr].realValue}${!findAttribute.detail?.dataType?.specs?.unit?.key?'':findAttribute.detail?.dataType?.specs?.unit?.key}` | 157 | + `${findAttribute.name}:${items.realValue}${!findAttribute.detail?.dataType?.specs?.unit?.key?'':findAttribute.detail?.dataType?.specs?.unit?.key}` |
155 | ) | 158 | ) |
156 | } | 159 | } |
157 | })) | 160 | })) |
@@ -164,8 +167,8 @@ | @@ -164,8 +167,8 @@ | ||
164 | const keys = Object.keys(e) | 167 | const keys = Object.keys(e) |
165 | const values = keys.reduce((acc, curr) => { | 168 | const values = keys.reduce((acc, curr) => { |
166 | acc.push({ | 169 | acc.push({ |
167 | - login: e[curr].logic, | ||
168 | - logicValue: e[curr].logicValue | 170 | + login: e[curr]?.triggerData?.logic, |
171 | + logicValue: e[curr]?.triggerData?.logicValue | ||
169 | }) | 172 | }) |
170 | return acc | 173 | return acc |
171 | }, []) | 174 | }, []) |
@@ -221,4 +224,4 @@ | @@ -221,4 +224,4 @@ | ||
221 | background-color: #377dff !important; | 224 | background-color: #377dff !important; |
222 | border-color: #377dff !important; | 225 | border-color: #377dff !important; |
223 | } | 226 | } |
224 | -</style> | ||
227 | +</style> |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <view @click="$emit('openAlertDetail',item)" class="list-item" v-for="(item, index) in list" :key="index"> | 3 | <view @click="$emit('openAlertDetail',item)" class="list-item" v-for="(item, index) in list" :key="index"> |
4 | <view class="u-flex item"> | 4 | <view class="u-flex item"> |
5 | <view class="item-text text-clip"> | 5 | <view class="item-text text-clip"> |
6 | - <text class="text-bold">{{ item.deviceName == null ? '暂无数据' : item.deviceName }}</text> | 6 | + <text class="text-bold">{{ item.deviceAlias || item.deviceName || '暂无数据' }}</text> |
7 | </view> | 7 | </view> |
8 | <view class="item-text text-clip"> | 8 | <view class="item-text text-clip"> |
9 | <text class="text-muted">{{ item.details == null ? '暂无数据' : formatDetailText(item.details) }}</text> | 9 | <text class="text-muted">{{ item.details == null ? '暂无数据' : formatDetailText(item.details) }}</text> |
@@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
36 | alarmSeverity, | 36 | alarmSeverity, |
37 | alarmStatus | 37 | alarmStatus |
38 | } from '../config/data.js'; | 38 | } from '../config/data.js'; |
39 | + import {findLogin} from './config' | ||
39 | 40 | ||
40 | export default { | 41 | export default { |
41 | props: { | 42 | props: { |
@@ -67,11 +68,14 @@ | @@ -67,11 +68,14 @@ | ||
67 | bindImageUrl(e) { | 68 | bindImageUrl(e) { |
68 | return this.alarmSeverity.find(item => item.value === e).icon | 69 | return this.alarmSeverity.find(item => item.value === e).icon |
69 | }, | 70 | }, |
70 | - formatDetailText(e) { | ||
71 | - const keys = Object.keys(e) | ||
72 | - if(!keys) return | ||
73 | - const values = keys.reduce((acc, curr) => { | ||
74 | - acc.push(`${!e[curr].key?'暂无数据':e[curr].key}:${!e[curr].realValue?'暂无数据':e[curr].realValue}`) | 71 | + formatDetailText(details) { |
72 | + const deviceIdKeys = Object.keys(details) | ||
73 | + if(!deviceIdKeys) return | ||
74 | + const values = deviceIdKeys.reduce((acc, curr) => { | ||
75 | + const items = details[curr]?.triggerData | ||
76 | + if(items?.key && items?.logicValue && items.realValue){ | ||
77 | + acc.push(`触发属性:${items.key ||'暂无数据'} 触发条件:${findLogin(items)+items.logicValue || '暂无数据'} 触发值:${items?.realValue || '暂无数据'} `) | ||
78 | + } | ||
75 | return acc | 79 | return acc |
76 | }, []) | 80 | }, []) |
77 | return values.join(',') | 81 | return values.join(',') |
@@ -103,10 +107,10 @@ | @@ -103,10 +107,10 @@ | ||
103 | align-items: center; | 107 | align-items: center; |
104 | height: 211rpx; | 108 | height: 211rpx; |
105 | margin-top: 8rpx; | 109 | margin-top: 8rpx; |
106 | - margin-left: 37rpx; | 110 | + margin-left: 20rpx; |
107 | 111 | ||
108 | .item-text { | 112 | .item-text { |
109 | - width: 400rpx; | 113 | + width: 500rpx; |
110 | text-align: left; | 114 | text-align: left; |
111 | margin-top: 13rpx; | 115 | margin-top: 13rpx; |
112 | line-height: 40rpx; | 116 | line-height: 40rpx; |
@@ -149,4 +153,4 @@ | @@ -149,4 +153,4 @@ | ||
149 | } | 153 | } |
150 | } | 154 | } |
151 | } | 155 | } |
152 | -</style> | ||
156 | +</style> |
pages/alarm/components/config.js
0 → 100644
1 | + | ||
2 | +export const StringOperationEnum = { | ||
3 | + EQUAL : 'EQUAL', | ||
4 | + NOT_EQUAL : 'NOT_EQUAL', | ||
5 | + STARTS_WITH : 'STARTS_WITH', | ||
6 | + ENDS_WITH : 'ENDS_WITH', | ||
7 | + CONTAINS : 'CONTAINS', | ||
8 | + NOT_CONTAINS : 'NOT_CONTAINS', | ||
9 | +} | ||
10 | +export const BooleanOperationEnum = { | ||
11 | + EQUAL : 'EQUAL', | ||
12 | + NOT_EQUAL : 'NOT_EQUAL', | ||
13 | +} | ||
14 | + | ||
15 | +export const operationNumber_OR_TIME = [ | ||
16 | + { label: '等于', value: 'EQUAL', symbol: '=' }, | ||
17 | + { label: '不等于', value: 'NOT_EQUAL', symbol: '!=' }, | ||
18 | + { label: '小于', value: 'LESS', symbol: '<' }, | ||
19 | + { label: '小于等于', value: 'LESS_OR_EQUAL', symbol: '<=' }, | ||
20 | + { label: '大于', value: 'GREATER', symbol: '>' }, | ||
21 | + { label: '大于等于', value: 'GREATER_OR_EQUAL', symbol: '>=' }, | ||
22 | +]; | ||
23 | +export const operationString = [ | ||
24 | + { label: '等于', value: StringOperationEnum.EQUAL, symbol: '=' }, | ||
25 | + { label: '不等于', value: StringOperationEnum.NOT_EQUAL, symbol: '!=' }, | ||
26 | + { label: '开始于', value: StringOperationEnum.STARTS_WITH, symbol: '开始于' }, | ||
27 | + { label: '结束于', value: StringOperationEnum.ENDS_WITH, symbol: '结束于' }, | ||
28 | + { label: '包含', value: StringOperationEnum.CONTAINS, symbol: '包含' }, | ||
29 | + { label: '不包含', value: StringOperationEnum.NOT_CONTAINS, symbol: '不包含' }, | ||
30 | +]; | ||
31 | +export const operationBoolean = [ | ||
32 | + { label: '等于', value: BooleanOperationEnum.EQUAL, symbol: '=' }, | ||
33 | + { label: '不等于', value: BooleanOperationEnum.NOT_EQUAL, symbol: '!=' }, | ||
34 | +]; | ||
35 | + | ||
36 | +export const findLogin = (curr) =>{ | ||
37 | + return [...operationNumber_OR_TIME, ...operationString, ...operationBoolean].find( | ||
38 | + (item) => item.value === curr?.logic | ||
39 | + )?.symbol; | ||
40 | +} |
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | }, | 42 | }, |
43 | data() { | 43 | data() { |
44 | return { | 44 | return { |
45 | - imageSrc:'/static/org.png', | 45 | + imageSrc:'/static/camer.png', |
46 | page: { | 46 | page: { |
47 | num: 0, | 47 | num: 0, |
48 | size: 10 | 48 | size: 10 |
@@ -157,4 +157,4 @@ | @@ -157,4 +157,4 @@ | ||
157 | 157 | ||
158 | <style lang="scss" scoped> | 158 | <style lang="scss" scoped> |
159 | @import '../../static/camera.scss'; | 159 | @import '../../static/camera.scss'; |
160 | -</style> | ||
160 | +</style> |
1 | <template> | 1 | <template> |
2 | - <view> | 2 | + <view class="configuation-detail-page"> |
3 | + <!-- 公共组件-每个页面必须引入 --> | ||
4 | + <public-module></public-module> | ||
3 | <web-view :src="visualBoardUrl"></web-view> | 5 | <web-view :src="visualBoardUrl"></web-view> |
4 | </view> | 6 | </view> |
5 | - | ||
6 | </template> | 7 | </template> |
7 | 8 | ||
8 | <script> | 9 | <script> |
@@ -26,12 +27,12 @@ | @@ -26,12 +27,12 @@ | ||
26 | async createShareUrl(record){ | 27 | async createShareUrl(record){ |
27 | const userInfo = uni.getStorageSync('userInfo') | 28 | const userInfo = uni.getStorageSync('userInfo') |
28 | const { id } = record; | 29 | const { id } = record; |
29 | - // http://192.168.10.131:8083 | ||
30 | return `${config.baseVisualUrl}${this.getUrl(id,userInfo.userId)}`; | 30 | return `${config.baseVisualUrl}${this.getUrl(id,userInfo.userId)}`; |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } | 33 | } |
34 | </script> | 34 | </script> |
35 | 35 | ||
36 | -<style> | 36 | +<style lang="scss" scoped> |
37 | + @import '../../static/configuration.scss'; | ||
37 | </style> | 38 | </style> |