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,6 +113,10 @@ export const alarmColumns: BasicColumn[] = [ | ||
113 | title: '告警设备', | 113 | title: '告警设备', |
114 | dataIndex: 'deviceName', | 114 | dataIndex: 'deviceName', |
115 | width: 100, | 115 | width: 100, |
116 | + customRender: ({ record }) => { | ||
117 | + const { deviceAlias, deviceName } = record || {}; | ||
118 | + return deviceAlias || deviceName; | ||
119 | + }, | ||
116 | }, | 120 | }, |
117 | { | 121 | { |
118 | title: '告警场景', | 122 | title: '告警场景', |
@@ -46,14 +46,16 @@ | @@ -46,14 +46,16 @@ | ||
46 | const alarmStatus = ref(''); | 46 | const alarmStatus = ref(''); |
47 | const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { | 47 | const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { |
48 | await resetFields(); | 48 | await resetFields(); |
49 | + const { deviceAlias, deviceName, severity, status, details, id } = data || {}; | ||
49 | await setFieldsValue({ | 50 | await setFieldsValue({ |
50 | ...data, | 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 | const handleAlarm = async () => { | 61 | const handleAlarm = async () => { |
@@ -155,14 +155,14 @@ | @@ -155,14 +155,14 @@ | ||
155 | return temp; | 155 | return temp; |
156 | }; | 156 | }; |
157 | const handleDataFormat = (deviceDetail: any, attributes: any) => { | 157 | const handleDataFormat = (deviceDetail: any, attributes: any) => { |
158 | - const { name, tbDeviceId } = deviceDetail; | 158 | + const { name, tbDeviceId, alias } = deviceDetail; |
159 | const attribute = attributes.map((item) => ({ | 159 | const attribute = attributes.map((item) => ({ |
160 | identifier: item.identifier, | 160 | identifier: item.identifier, |
161 | name: item.name, | 161 | name: item.name, |
162 | detail: item.detail, | 162 | detail: item.detail, |
163 | })); | 163 | })); |
164 | return { | 164 | return { |
165 | - name, | 165 | + name: alias || name, |
166 | tbDeviceId, | 166 | tbDeviceId, |
167 | attribute, | 167 | attribute, |
168 | }; | 168 | }; |
@@ -175,6 +175,10 @@ export const alarmColumns: BasicColumn[] = [ | @@ -175,6 +175,10 @@ export const alarmColumns: BasicColumn[] = [ | ||
175 | title: '告警设备', | 175 | title: '告警设备', |
176 | dataIndex: 'deviceName', | 176 | dataIndex: 'deviceName', |
177 | width: 120, | 177 | width: 120, |
178 | + customRender: ({ record }) => { | ||
179 | + const { deviceAlias, deviceName } = record || {}; | ||
180 | + return deviceAlias || deviceName; | ||
181 | + }, | ||
178 | }, | 182 | }, |
179 | { | 183 | { |
180 | title: '告警场景', | 184 | title: '告警场景', |
@@ -52,13 +52,15 @@ | @@ -52,13 +52,15 @@ | ||
52 | const alarmStatus = ref(''); | 52 | const alarmStatus = ref(''); |
53 | const [registerModal, { closeModal }] = useModalInner(async (data) => { | 53 | const [registerModal, { closeModal }] = useModalInner(async (data) => { |
54 | await resetFields(); | 54 | await resetFields(); |
55 | + const { deviceAlias, deviceName, severity, status, id } = data || {}; | ||
55 | await setFieldsValue({ | 56 | await setFieldsValue({ |
56 | ...data, | 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 | const handleAlarm = async () => { | 66 | const handleAlarm = async () => { |
@@ -143,14 +143,14 @@ | @@ -143,14 +143,14 @@ | ||
143 | return temp; | 143 | return temp; |
144 | }; | 144 | }; |
145 | const handleDataFormat = (deviceDetail: any, attributes: any) => { | 145 | const handleDataFormat = (deviceDetail: any, attributes: any) => { |
146 | - const { name, tbDeviceId } = deviceDetail; | 146 | + const { name, alias, tbDeviceId } = deviceDetail; |
147 | const attribute = attributes.map((item) => ({ | 147 | const attribute = attributes.map((item) => ({ |
148 | identifier: item.identifier, | 148 | identifier: item.identifier, |
149 | name: item.name, | 149 | name: item.name, |
150 | detail: item.detail, | 150 | detail: item.detail, |
151 | })); | 151 | })); |
152 | return { | 152 | return { |
153 | - name, | 153 | + name: alias || name, |
154 | tbDeviceId, | 154 | tbDeviceId, |
155 | attribute, | 155 | attribute, |
156 | }; | 156 | }; |
@@ -268,6 +268,7 @@ | @@ -268,6 +268,7 @@ | ||
268 | //ft-add-2022-11-22 | 268 | //ft-add-2022-11-22 |
269 | const type = validate?.outTarget; | 269 | const type = validate?.outTarget; |
270 | if (type === 'DEVICE_OUT') { | 270 | if (type === 'DEVICE_OUT') { |
271 | + if (!validate.deviceType) return createMessage.error('请选择类型'); | ||
271 | if (!validate.deviceProfileId) return createMessage.error('请选择产品'); | 272 | if (!validate.deviceProfileId) return createMessage.error('请选择产品'); |
272 | if (validate.device == 'PART' && validate.deviceId == undefined) | 273 | if (validate.device == 'PART' && validate.deviceId == undefined) |
273 | return createMessage.error('请选择设备'); | 274 | return createMessage.error('请选择设备'); |