Commit ed57d3d8fb444de9c658acc77e4ed4a516e442f5

Authored by loveumiko
1 parent a4341e8d

fix: 修改告警记录别名显示和场景联动编辑回显问题

@@ -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 () => {
@@ -151,14 +151,14 @@ @@ -151,14 +151,14 @@
151 return temp; 151 return temp;
152 }; 152 };
153 const handleDataFormat = (deviceDetail: any, attributes: any) => { 153 const handleDataFormat = (deviceDetail: any, attributes: any) => {
154 - const { name, tbDeviceId } = deviceDetail; 154 + const { name, tbDeviceId, alias } = deviceDetail;
155 const attribute = attributes.map((item) => ({ 155 const attribute = attributes.map((item) => ({
156 identifier: item.identifier, 156 identifier: item.identifier,
157 name: item.name, 157 name: item.name,
158 detail: item.detail, 158 detail: item.detail,
159 })); 159 }));
160 return { 160 return {
161 - name, 161 + name: alias || name,
162 tbDeviceId, 162 tbDeviceId,
163 attribute, 163 attribute,
164 }; 164 };
@@ -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('请选择设备');