Commit 9fd33ee3d6e3138a5e24be80353becaad5e82c57
Merge branch 'fix/DEFECT-1596' into 'main_dev'
fix: 修改告警记录别名显示和场景联动编辑回显问题 See merge request yunteng/thingskit-front!887
Showing
7 changed files
with
26 additions
and
13 deletions
... | ... | @@ -113,6 +113,10 @@ export const alarmColumns: BasicColumn[] = [ |
113 | 113 | title: '告警设备', |
114 | 114 | dataIndex: 'deviceName', |
115 | 115 | width: 100, |
116 | + customRender: ({ record }) => { | |
117 | + const { deviceAlias, deviceName } = record || {}; | |
118 | + return deviceAlias || deviceName; | |
119 | + }, | |
116 | 120 | }, |
117 | 121 | { |
118 | 122 | title: '告警场景', | ... | ... |
... | ... | @@ -46,14 +46,16 @@ |
46 | 46 | const alarmStatus = ref(''); |
47 | 47 | const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { |
48 | 48 | await resetFields(); |
49 | + const { deviceAlias, deviceName, severity, status, details, id } = data || {}; | |
49 | 50 | await setFieldsValue({ |
50 | 51 | ...data, |
51 | - severity: alarmLevel(data.severity), | |
52 | - status: statusType(data.status), | |
53 | - details: JSON.stringify(data.details), | |
52 | + deviceName: deviceAlias || deviceName, | |
53 | + severity: alarmLevel(severity), | |
54 | + status: statusType(status), | |
55 | + details: JSON.stringify(details), | |
54 | 56 | }); |
55 | - alarmStatus.value = data.status; | |
56 | - alarmId.value = data.id; | |
57 | + alarmStatus.value = status; | |
58 | + alarmId.value = id; | |
57 | 59 | }); |
58 | 60 | // 处理报警 |
59 | 61 | const handleAlarm = async () => { | ... | ... |
... | ... | @@ -155,14 +155,14 @@ |
155 | 155 | return temp; |
156 | 156 | }; |
157 | 157 | const handleDataFormat = (deviceDetail: any, attributes: any) => { |
158 | - const { name, tbDeviceId } = deviceDetail; | |
158 | + const { name, tbDeviceId, alias } = deviceDetail; | |
159 | 159 | const attribute = attributes.map((item) => ({ |
160 | 160 | identifier: item.identifier, |
161 | 161 | name: item.name, |
162 | 162 | detail: item.detail, |
163 | 163 | })); |
164 | 164 | return { |
165 | - name, | |
165 | + name: alias || name, | |
166 | 166 | tbDeviceId, |
167 | 167 | attribute, |
168 | 168 | }; | ... | ... |
... | ... | @@ -175,6 +175,10 @@ export const alarmColumns: BasicColumn[] = [ |
175 | 175 | title: '告警设备', |
176 | 176 | dataIndex: 'deviceName', |
177 | 177 | width: 120, |
178 | + customRender: ({ record }) => { | |
179 | + const { deviceAlias, deviceName } = record || {}; | |
180 | + return deviceAlias || deviceName; | |
181 | + }, | |
178 | 182 | }, |
179 | 183 | { |
180 | 184 | title: '告警场景', | ... | ... |
... | ... | @@ -52,13 +52,15 @@ |
52 | 52 | const alarmStatus = ref(''); |
53 | 53 | const [registerModal, { closeModal }] = useModalInner(async (data) => { |
54 | 54 | await resetFields(); |
55 | + const { deviceAlias, deviceName, severity, status, id } = data || {}; | |
55 | 56 | await setFieldsValue({ |
56 | 57 | ...data, |
57 | - severity: alarmLevel(data.severity), | |
58 | - status: statusType(data.status), | |
58 | + deviceName: deviceAlias || deviceName, | |
59 | + severity: alarmLevel(severity), | |
60 | + status: statusType(status), | |
59 | 61 | }); |
60 | - alarmId.value = data.id; | |
61 | - alarmStatus.value = data.status; | |
62 | + alarmId.value = id; | |
63 | + alarmStatus.value = status; | |
62 | 64 | }); |
63 | 65 | // 处理报警 |
64 | 66 | const handleAlarm = async () => { | ... | ... |
... | ... | @@ -143,14 +143,14 @@ |
143 | 143 | return temp; |
144 | 144 | }; |
145 | 145 | const handleDataFormat = (deviceDetail: any, attributes: any) => { |
146 | - const { name, tbDeviceId } = deviceDetail; | |
146 | + const { name, alias, tbDeviceId } = deviceDetail; | |
147 | 147 | const attribute = attributes.map((item) => ({ |
148 | 148 | identifier: item.identifier, |
149 | 149 | name: item.name, |
150 | 150 | detail: item.detail, |
151 | 151 | })); |
152 | 152 | return { |
153 | - name, | |
153 | + name: alias || name, | |
154 | 154 | tbDeviceId, |
155 | 155 | attribute, |
156 | 156 | }; | ... | ... |
... | ... | @@ -268,6 +268,7 @@ |
268 | 268 | //ft-add-2022-11-22 |
269 | 269 | const type = validate?.outTarget; |
270 | 270 | if (type === 'DEVICE_OUT') { |
271 | + if (!validate.deviceType) return createMessage.error('请选择类型'); | |
271 | 272 | if (!validate.deviceProfileId) return createMessage.error('请选择产品'); |
272 | 273 | if (validate.device == 'PART' && validate.deviceId == undefined) |
273 | 274 | return createMessage.error('请选择设备'); | ... | ... |