|
|
@@ -786,6 +786,7 @@ function normalizeEvent(identity, source) {
|
|
|
disposalHistory: envelope.disposalHistory || basic.disposalHistory,
|
|
|
attachmentList: envelope.attachmentList || basic.attachmentList,
|
|
|
alarmList: envelope.alarmList || basic.alarmList,
|
|
|
+ relations: envelope.relations || basic.relations,
|
|
|
gisLocation: envelope.gisLocation || basic.gisLocation,
|
|
|
}
|
|
|
const family = String(identity.family || source.family || source.eventFamily || (source.alarmId || source.alarmNo ? 'ALARM' : source.warningId || source.warningNo ? 'WARNING' : '')).toUpperCase()
|
|
|
@@ -801,7 +802,7 @@ function normalizeEvent(identity, source) {
|
|
|
// 报警族的处置记录/附件在不同后端版本字段不一,这里做兼容收集(预警族字段不变)。
|
|
|
const auditRecords = collectAuditRecords(source)
|
|
|
const attachments = collectAttachmentItems(source)
|
|
|
- const relations = eventRelations(family, source)
|
|
|
+ const relations = Array.isArray(source.relations) ? source.relations : eventRelations(family, source)
|
|
|
return {
|
|
|
...identity,
|
|
|
name,
|
|
|
@@ -912,23 +913,24 @@ function alarmRelation(item) {
|
|
|
code,
|
|
|
name: name || code,
|
|
|
status: text(item && (item.status || item.alarmStatusName)) || '',
|
|
|
- meta: '',
|
|
|
+ meta: '查看报警详情',
|
|
|
+ detailId: code,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function warningRelation(source) {
|
|
|
- const actualWarning = text(source.warningNo || source.warningId)
|
|
|
- const code = text(actualWarning || source.warningCode)
|
|
|
+ // warning_code 是报警类型;没有真实 warning_no/warning_id 时不冒充关联预警。
|
|
|
+ const code = text(source.warningNo || source.warningId)
|
|
|
+ if (!code) return null
|
|
|
const name = text(source.warningName || source.warningTypeName || source.warningContent)
|
|
|
- if (!code && !name) return null
|
|
|
return {
|
|
|
kind: 'warning',
|
|
|
- // 只有真实预警编号才叫「预警」;仅有 warning_code 时它是预警类型,不能冒充关联预警。
|
|
|
- kindLabel: actualWarning ? '预警' : '预警类型',
|
|
|
+ kindLabel: '预警',
|
|
|
code,
|
|
|
name: name || code,
|
|
|
status: eventStatusText(source.warningStatus || source.status, 'WARNING'),
|
|
|
- meta: '',
|
|
|
+ meta: '查看预警详情',
|
|
|
+ detailId: code,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -967,19 +969,9 @@ function normalizeWorkOrder(identity, source) {
|
|
|
track = trackOf(toWorkOrderTimeline(source))
|
|
|
}
|
|
|
const stateText = order.stateName || workOrderStateName(order.stateCode)
|
|
|
- const relations = []
|
|
|
- const device = deviceRelation(order)
|
|
|
- if (device) relations.push(device)
|
|
|
- if (order.code) {
|
|
|
- relations.push({
|
|
|
- kind: 'work-order',
|
|
|
- kindLabel: '工单',
|
|
|
- code: order.code,
|
|
|
- name: order.description || order.code,
|
|
|
- status: stateText,
|
|
|
- meta: order.orderLevel === null ? '' : `优先级 ${orderLevelText(order.orderLevel)}`,
|
|
|
- })
|
|
|
- }
|
|
|
+ const relations = Array.isArray(source.relations) && source.relations.length
|
|
|
+ ? source.relations
|
|
|
+ : [deviceRelation(order)].filter(Boolean)
|
|
|
return {
|
|
|
...identity,
|
|
|
name: order.description || order.code || '工单名称未提供',
|