|
@@ -12,6 +12,7 @@ import { trackOf } from './workOrderTimeline.js'
|
|
|
import { facilityStatusTone } from './facilityStatus.js'
|
|
import { facilityStatusTone } from './facilityStatus.js'
|
|
|
import { pumpStationTypeText } from './facilityTypeDict.js'
|
|
import { pumpStationTypeText } from './facilityTypeDict.js'
|
|
|
import { DICT_TYPES, dictLabel } from './dictLabels.js'
|
|
import { DICT_TYPES, dictLabel } from './dictLabels.js'
|
|
|
|
|
+import { looksLikeInternalId } from './internalId.js'
|
|
|
export { facilityStatusTone } from './facilityStatus.js'
|
|
export { facilityStatusTone } from './facilityStatus.js'
|
|
|
|
|
|
|
|
export const ENTITY_DETAIL_KIND = Object.freeze({
|
|
export const ENTITY_DETAIL_KIND = Object.freeze({
|
|
@@ -135,18 +136,42 @@ function normalizeAsset(identity, source) {
|
|
|
const attributes = source.attributes && typeof source.attributes === 'object' ? source.attributes : {}
|
|
const attributes = source.attributes && typeof source.attributes === 'object' ? source.attributes : {}
|
|
|
// 编码字段只跟随源表的列:没有业务编码列就不生成该字段(防护目标的 riskId 是主键,不是编码)。
|
|
// 编码字段只跟随源表的列:没有业务编码列就不生成该字段(防护目标的 riskId 是主键,不是编码)。
|
|
|
const hasCodeColumn = !ASSET_WITHOUT_BUSINESS_CODE.has(category)
|
|
const hasCodeColumn = !ASSET_WITHOUT_BUSINESS_CODE.has(category)
|
|
|
- const displayCode = hasCodeColumn ? text(source.code) : ''
|
|
|
|
|
- const name = text(source.name || source.facilityName || source.resourceName || source.title) || (emergency ? '应急对象名称未提供' : '设施名称未提供')
|
|
|
|
|
|
|
+ // 编码与名称都不得回显主键形状的值:现网确有设备直接以 32 位主键命名。
|
|
|
|
|
+ const rawCode = hasCodeColumn ? text(source.code) : ''
|
|
|
|
|
+ const displayCode = looksLikeInternalId(rawCode) ? '' : rawCode
|
|
|
|
|
+ const rawName = text(source.name || source.facilityName || source.resourceName || source.title)
|
|
|
|
|
+ const name = (looksLikeInternalId(rawName) ? '' : rawName) || (emergency ? '应急对象名称未提供' : '设施名称未提供')
|
|
|
// 状态是码值时翻成中文(设施:0 正常 / 1 异常;后端若直接给人话则原样用)。
|
|
// 状态是码值时翻成中文(设施:0 正常 / 1 异常;后端若直接给人话则原样用)。
|
|
|
const statusRaw = source.status ?? source.state ?? source.statusName ?? source.stateName
|
|
const statusRaw = source.status ?? source.state ?? source.statusName ?? source.stateName
|
|
|
const isRiskTarget = category === 'PROTECTION_TARGET'
|
|
const isRiskTarget = category === 'PROTECTION_TARGET'
|
|
|
|
|
+ const isHazard = category === 'HAZARD'
|
|
|
const status = (isRiskTarget ? riskLevelText(statusRaw) : emergency ? undefinedEnumText(statusRaw) : facilityStatusText(statusRaw)) || '状态未发布'
|
|
const status = (isRiskTarget ? riskLevelText(statusRaw) : emergency ? undefinedEnumText(statusRaw) : facilityStatusText(statusRaw)) || '状态未发布'
|
|
|
// 防护目标的「状态」就是风险等级(规格 §5):抬头只留一个「风险等级」徽标,配色跟 risk_color。
|
|
// 防护目标的「状态」就是风险等级(规格 §5):抬头只留一个「风险等级」徽标,配色跟 risk_color。
|
|
|
const riskColorRaw = isRiskTarget ? attributes.riskColor ?? statusRaw : ''
|
|
const riskColorRaw = isRiskTarget ? attributes.riskColor ?? statusRaw : ''
|
|
|
|
|
+ // 隐患等级是抬头第二个徽标,排在状态徽标右侧(维护者 2026-12-01)。
|
|
|
|
|
+ const levelLabel = isHazard ? dictOrCode(DICT_TYPES.hazardLevel, attributes.level) : ''
|
|
|
const location = text(source.address || source.location || source.position)
|
|
const location = text(source.address || source.location || source.position)
|
|
|
const fields = assetFields(category, attributes)
|
|
const fields = assetFields(category, attributes)
|
|
|
const kindLabel = emergency ? '应急对象' : '设施'
|
|
const kindLabel = emergency ? '应急对象' : '设施'
|
|
|
const noun = emergency ? '对象' : '设施'
|
|
const noun = emergency ? '对象' : '设施'
|
|
|
|
|
+ // 「类别」只保留在其它设施类别的基本信息里;隐患台账有类型徽标,不再重复。
|
|
|
|
|
+ const basicFields = [
|
|
|
|
|
+ ...(hasCodeColumn ? [field(`${noun}编码`, displayCode || '未提供', true)] : []),
|
|
|
|
|
+ ...(isHazard ? [] : [field(`${noun}类别`, facilityCategoryText(category))]),
|
|
|
|
|
+ field('数据更新时间', formatEventTime(source.updatedAt)),
|
|
|
|
|
+ ]
|
|
|
|
|
+ const layout = assetLayout(category, {
|
|
|
|
|
+ basic: basicFields,
|
|
|
|
|
+ business: fields,
|
|
|
|
|
+ related: assetRows(HAZARD_RELATED_ROWS, category, attributes),
|
|
|
|
|
+ }) || {
|
|
|
|
|
+ tabs: [tab('overview', '基本信息'), tab('business', '业务详情'), tab('related', '关联信息')],
|
|
|
|
|
+ sections: [
|
|
|
|
|
+ section('基本信息', basicFields, 'overview'),
|
|
|
|
|
+ section('位置与归属', [field('位置描述', location, true), field('所属片区', source.districtName), field('坐标', coordinatesText(source.coordinates), true)], 'overview'),
|
|
|
|
|
+ section('业务详情', fields, 'business'),
|
|
|
|
|
+ ],
|
|
|
|
|
+ }
|
|
|
return {
|
|
return {
|
|
|
...identity, category, name, title: name, displayCode,
|
|
...identity, category, name, title: name, displayCode,
|
|
|
kindLabel,
|
|
kindLabel,
|
|
@@ -154,24 +179,47 @@ function normalizeAsset(identity, source) {
|
|
|
subtitle: assetSubtitle(kindLabel, displayCode, hasCodeColumn),
|
|
subtitle: assetSubtitle(kindLabel, displayCode, hasCodeColumn),
|
|
|
statusText: status, statusCaption: isRiskTarget ? '风险等级' : '',
|
|
statusText: status, statusCaption: isRiskTarget ? '风险等级' : '',
|
|
|
tone: isRiskTarget ? riskTone(riskColorRaw) : emergency ? 'neutral' : facilityStatusTone(source.status),
|
|
tone: isRiskTarget ? riskTone(riskColorRaw) : emergency ? 'neutral' : facilityStatusTone(source.status),
|
|
|
|
|
+ levelLabel,
|
|
|
|
|
+ levelTone: isHazard ? hazardLevelTone(attributes.level) : '',
|
|
|
raw: source,
|
|
raw: source,
|
|
|
categoryText: facilityCategoryText(category),
|
|
categoryText: facilityCategoryText(category),
|
|
|
coordinates: source.coordinates || null,
|
|
coordinates: source.coordinates || null,
|
|
|
summary: assetSummary(category, attributes, location),
|
|
summary: assetSummary(category, attributes, location),
|
|
|
- tabs: [tab('overview', '基本信息'), tab('business', '业务详情'), tab('related', '关联信息')],
|
|
|
|
|
|
|
+ tabs: layout.tabs,
|
|
|
people: assetPeople(attributes),
|
|
people: assetPeople(attributes),
|
|
|
devices: assetDevices(attributes),
|
|
devices: assetDevices(attributes),
|
|
|
attachments: assetAttachments(attributes),
|
|
attachments: assetAttachments(attributes),
|
|
|
- sections: compactSections([
|
|
|
|
|
- section('基本信息', [
|
|
|
|
|
- ...(hasCodeColumn ? [field(`${noun}编码`, displayCode || '未提供', true)] : []),
|
|
|
|
|
- field(`${noun}类别`, facilityCategoryText(category)),
|
|
|
|
|
- field('数据更新时间', formatEventTime(source.updatedAt)),
|
|
|
|
|
- ]),
|
|
|
|
|
- section('位置与归属', [field('位置描述', location, true), field('所属片区', source.districtName), field('坐标', coordinatesText(source.coordinates), true)]),
|
|
|
|
|
- section('业务详情', fields),
|
|
|
|
|
- ]),
|
|
|
|
|
|
|
+ sections: compactSections(layout.sections),
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 两类应急对象的页签分区(维护者 2026-12-01 重排)。
|
|
|
|
|
+ *
|
|
|
|
|
+ * · 隐患台账:基本信息(业务详情栏并入其下)+ 关联信息 + 附件;
|
|
|
|
|
+ * · 风险评估:只有业务详情 + 附件 —— 基本信息整栏删掉(只剩对象类别与数据更新时间,
|
|
|
|
|
+ * 抬头已经有类型徽标与更新时间),三个关联对象里它只有管网,所以也不单独开关联页签。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 其它设施类别保持原来的三页签;返回 null 表示走默认布局。
|
|
|
|
|
+ */
|
|
|
|
|
+function assetLayout(category, { basic, business, related }) {
|
|
|
|
|
+ if (category === 'HAZARD') {
|
|
|
|
|
+ return {
|
|
|
|
|
+ tabs: [tab('overview', '基本信息'), tab('related', '关联信息'), tab('attachments', '附件')],
|
|
|
|
|
+ sections: [
|
|
|
|
|
+ section('基本信息', basic, 'overview'),
|
|
|
|
|
+ section('业务详情', business, 'overview'),
|
|
|
|
|
+ section('关联信息', related, 'related'),
|
|
|
|
|
+ ],
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (category === 'PROTECTION_TARGET') {
|
|
|
|
|
+ return {
|
|
|
|
|
+ tabs: [tab('business', '业务详情'), tab('attachments', '附件')],
|
|
|
|
|
+ sections: [section('业务详情', business, 'business')],
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ return null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -191,7 +239,7 @@ const COMMON_UNITS = {
|
|
|
pumpCount: '台',
|
|
pumpCount: '台',
|
|
|
powerCapacity: 'kW',
|
|
powerCapacity: 'kW',
|
|
|
assetValue: '元',
|
|
assetValue: '元',
|
|
|
- useLifeYears: '年',
|
|
|
|
|
|
|
+ expectedServiceYears: '年',
|
|
|
riskScore: '分',
|
|
riskScore: '分',
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -240,6 +288,9 @@ const SUMMARY_LABELS = {
|
|
|
fmodel: '型号',
|
|
fmodel: '型号',
|
|
|
model: '型号',
|
|
model: '型号',
|
|
|
specification: '规格',
|
|
specification: '规格',
|
|
|
|
|
+ deviceModel: '型号',
|
|
|
|
|
+ deviceSpec: '规格',
|
|
|
|
|
+ expectedServiceYears: '预计使用年限',
|
|
|
maintainer: '维护人',
|
|
maintainer: '维护人',
|
|
|
level: '等级',
|
|
level: '等级',
|
|
|
rectifyDeadline: '整改期限',
|
|
rectifyDeadline: '整改期限',
|
|
@@ -288,7 +339,7 @@ function assetSummary(category, attributes, location) {
|
|
|
HAZARD: ['level', 'rectifyDeadline', 'rectifyPerson'],
|
|
HAZARD: ['level', 'rectifyDeadline', 'rectifyPerson'],
|
|
|
// 风险等级由抬头徽标承担,摘要不再重复同一个词(票面「只出现一次」)。
|
|
// 风险等级由抬头徽标承担,摘要不再重复同一个词(票面「只出现一次」)。
|
|
|
PROTECTION_TARGET: ['riskScore', 'assessmentTime'],
|
|
PROTECTION_TARGET: ['riskScore', 'assessmentTime'],
|
|
|
- EMERGENCY_RESOURCE: ['model', 'specification', 'maintainer'],
|
|
|
|
|
|
|
+ EMERGENCY_RESOURCE: ['deviceModel', 'deviceSpec', 'maintainer'],
|
|
|
}
|
|
}
|
|
|
const labels = { ...SUMMARY_LABELS, ...SUMMARY_LABELS_BY_CATEGORY[category] }
|
|
const labels = { ...SUMMARY_LABELS, ...SUMMARY_LABELS_BY_CATEGORY[category] }
|
|
|
const rows = (byCategory[category] || []).map((key) => {
|
|
const rows = (byCategory[category] || []).map((key) => {
|
|
@@ -302,10 +353,13 @@ function assetSummary(category, attributes, location) {
|
|
|
return summaryItems([...rows, ['位置', location]])
|
|
return summaryItems([...rows, ['位置', location]])
|
|
|
}
|
|
}
|
|
|
function assetPeople(a) { return peopleItems([['负责人', a.principal], ['维护人', a.maintainer], ['整改人', a.rectifyPerson], ['联系电话', a.contactPhone || a.maintainerPhone]]) }
|
|
function assetPeople(a) { return peopleItems([['负责人', a.principal], ['维护人', a.maintainer], ['整改人', a.rectifyPerson], ['联系电话', a.contactPhone || a.maintainerPhone]]) }
|
|
|
-function assetAttachments(a) { return attachmentItems(a.images || a.image) }
|
|
|
|
|
|
|
+function assetAttachments(a) { return attachmentItems(a.images || a.image || a.latestImage) }
|
|
|
function assetDevices(a) {
|
|
function assetDevices(a) {
|
|
|
if (Array.isArray(a.devices)) return a.devices.map((item) => ({
|
|
if (Array.isArray(a.devices)) return a.devices.map((item) => ({
|
|
|
- id: item.id || '', code: text(item.code), name: item.name || item.code || '设备名称未提供',
|
|
|
|
|
|
|
+ // id 只留给联动用,不进任何展示字段;编码/名称形如主键时同样不展示。
|
|
|
|
|
+ id: item.id || '',
|
|
|
|
|
+ code: looksLikeInternalId(item.code) ? '' : text(item.code),
|
|
|
|
|
+ name: (!looksLikeInternalId(item.name) && item.name) || (!looksLikeInternalId(item.code) && text(item.code)) || '设备名称未提供',
|
|
|
type: item.type || '', location: item.location || '', status: deviceStatusText(item),
|
|
type: item.type || '', location: item.location || '', status: deviceStatusText(item),
|
|
|
}))
|
|
}))
|
|
|
return String(a.equipmentIds || a.equipmentId || '').split(',').map((id) => id.trim()).filter(Boolean).map((id) => ({ id, name: '设备名称未提供', code: '', type: '', location: '', status: '状态未发布' }))
|
|
return String(a.equipmentIds || a.equipmentId || '').split(',').map((id) => id.trim()).filter(Boolean).map((id) => ({ id, name: '设备名称未提供', code: '', type: '', location: '', status: '状态未发布' }))
|
|
@@ -502,31 +556,30 @@ const ASSET_FIELD_ROWS = {
|
|
|
{ label: '联系电话', key: 'contactPhone' },
|
|
{ label: '联系电话', key: 'contactPhone' },
|
|
|
{ label: '备注', key: 'remark', wide: true },
|
|
{ label: '备注', key: 'remark', wide: true },
|
|
|
],
|
|
],
|
|
|
|
|
+ // 键名对齐后端设备档案契约(票 05):deviceTypeName 是设备类型表的名字,不是 equipment_type 字典;
|
|
|
|
|
+ // 设备类型主键 equipmentTypeId 不再下发,也不再有「设备类型」这种只可能显示 id 的行。
|
|
|
|
|
+ // 设备图片不进明细:它以附件区(latestImage 缩略图 + 放大)出现在业务详情末尾(规格 §3)。
|
|
|
EMERGENCY_RESOURCE: [
|
|
EMERGENCY_RESOURCE: [
|
|
|
- { label: '设备类型', key: 'equipmentTypeId' },
|
|
|
|
|
- { label: '型号', key: 'model' },
|
|
|
|
|
- { label: '规格', key: 'specification', wide: true },
|
|
|
|
|
|
|
+ { label: '设备类型', key: 'deviceTypeName' },
|
|
|
|
|
+ { label: '型号', key: 'deviceModel' },
|
|
|
|
|
+ { label: '规格', key: 'deviceSpec', wide: true },
|
|
|
{ label: '制造商', key: 'manufacturer' },
|
|
{ label: '制造商', key: 'manufacturer' },
|
|
|
{ label: '资产价值', key: 'assetValue' },
|
|
{ label: '资产价值', key: 'assetValue' },
|
|
|
- { label: '预计使用年限', key: 'useLifeYears' },
|
|
|
|
|
|
|
+ { label: '预计使用年限', key: 'expectedServiceYears' },
|
|
|
{ label: '安装时间', key: 'installTime' },
|
|
{ label: '安装时间', key: 'installTime' },
|
|
|
{ label: '维护人', key: 'maintainer' },
|
|
{ label: '维护人', key: 'maintainer' },
|
|
|
{ label: '维护电话', key: 'maintainerPhone' },
|
|
{ label: '维护电话', key: 'maintainerPhone' },
|
|
|
{ label: '权属单位', key: 'ownershipUnit' },
|
|
{ label: '权属单位', key: 'ownershipUnit' },
|
|
|
- { label: '设备图片', key: 'image' },
|
|
|
|
|
{ label: '备注', key: 'remark', wide: true },
|
|
{ label: '备注', key: 'remark', wide: true },
|
|
|
],
|
|
],
|
|
|
// 隐患类型/等级/来源是业务库字典码(0/1/2 不能直接上屏);
|
|
// 隐患类型/等级/来源是业务库字典码(0/1/2 不能直接上屏);
|
|
|
// 三个关联对象是后端下发的业务引用(票 06),不再有 equipmentId/networkId/workOrderId。
|
|
// 三个关联对象是后端下发的业务引用(票 06),不再有 equipmentId/networkId/workOrderId。
|
|
|
// 隐患图片不进明细:它以附件区(缩略图 + 放大)出现在业务详情末尾。
|
|
// 隐患图片不进明细:它以附件区(缩略图 + 放大)出现在业务详情末尾。
|
|
|
HAZARD: [
|
|
HAZARD: [
|
|
|
|
|
+ // 隐患等级不再进明细:它已经是抬头那个带色徽标(维护者 2026-12-01)。
|
|
|
{ label: '隐患类型', key: 'hazardType', dict: DICT_TYPES.hazardType },
|
|
{ label: '隐患类型', key: 'hazardType', dict: DICT_TYPES.hazardType },
|
|
|
- { label: '隐患等级', key: 'level', dict: DICT_TYPES.hazardLevel },
|
|
|
|
|
{ label: '来源', key: 'source', dict: DICT_TYPES.hazardSource },
|
|
{ label: '来源', key: 'source', dict: DICT_TYPES.hazardSource },
|
|
|
{ label: '隐患描述', key: 'description', wide: true },
|
|
{ label: '隐患描述', key: 'description', wide: true },
|
|
|
- { label: '关联管网', key: 'network' },
|
|
|
|
|
- { label: '关联设备', key: 'equipment' },
|
|
|
|
|
- { label: '关联工单', key: 'workOrder' },
|
|
|
|
|
{ label: '报告单位', key: 'reportUnit' },
|
|
{ label: '报告单位', key: 'reportUnit' },
|
|
|
{ label: '报告时间', key: 'reportTime' },
|
|
{ label: '报告时间', key: 'reportTime' },
|
|
|
{ label: '整改方案', key: 'rectifyPlan', wide: true },
|
|
{ label: '整改方案', key: 'rectifyPlan', wide: true },
|
|
@@ -537,17 +590,24 @@ const ASSET_FIELD_ROWS = {
|
|
|
],
|
|
],
|
|
|
// 风险等级与风险颜色不再进明细:已由抬头那一个「风险等级」徽标承担(规格 §5)。
|
|
// 风险等级与风险颜色不再进明细:已由抬头那一个「风险等级」徽标承担(规格 §5)。
|
|
|
// 风险因素改成键值网格,不再把一整串 JSON 打在页面上。
|
|
// 风险因素改成键值网格,不再把一整串 JSON 打在页面上。
|
|
|
|
|
+ // 风险分值与评估时间已经在摘要卡(维护者 2026-12-01:不同处重复显示需删除);
|
|
|
|
|
+ // 关联管网与评估模型各独占一行。
|
|
|
PROTECTION_TARGET: [
|
|
PROTECTION_TARGET: [
|
|
|
- { label: '关联管网', key: 'network' },
|
|
|
|
|
- { label: '风险分值', key: 'riskScore' },
|
|
|
|
|
- { label: '评估模型', key: 'assessmentModel' },
|
|
|
|
|
- { label: '评估时间', key: 'assessmentTime' },
|
|
|
|
|
|
|
+ { label: '关联管网', key: 'network', wide: true },
|
|
|
|
|
+ { label: '评估模型', key: 'assessmentModel', wide: true },
|
|
|
{ label: '风险因素', key: 'riskFactors', wide: true, pairs: true },
|
|
{ label: '风险因素', key: 'riskFactors', wide: true, pairs: true },
|
|
|
{ label: '危险源', key: 'hazardSources', wide: true },
|
|
{ label: '危险源', key: 'hazardSources', wide: true },
|
|
|
{ label: '备注', key: 'remark', wide: true },
|
|
{ label: '备注', key: 'remark', wide: true },
|
|
|
],
|
|
],
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 危险源的三个业务引用:单独成一张表,放进「关联信息」页签。 */
|
|
|
|
|
+const HAZARD_RELATED_ROWS = [
|
|
|
|
|
+ { label: '关联管网', key: 'network' },
|
|
|
|
|
+ { label: '关联设备', key: 'equipment' },
|
|
|
|
|
+ { label: '关联工单', key: 'workOrder' },
|
|
|
|
|
+]
|
|
|
|
|
+
|
|
|
/** 读数 + 单位(认不出的值留给 field() 变占位符,不拼半截 "— m")。 */
|
|
/** 读数 + 单位(认不出的值留给 field() 变占位符,不拼半截 "— m")。 */
|
|
|
function withUnitText(value, unit) {
|
|
function withUnitText(value, unit) {
|
|
|
if (value === null || value === undefined || String(value).trim() === '') return ''
|
|
if (value === null || value === undefined || String(value).trim() === '') return ''
|
|
@@ -587,6 +647,15 @@ function riskTone(value) {
|
|
|
return RISK_TONE_BY_CODE[text(value)] || 'neutral'
|
|
return RISK_TONE_BY_CODE[text(value)] || 'neutral'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 隐患等级 → 四色:一级最重(红),逐级降到蓝(维护者 2026-12-01)。
|
|
|
|
|
+ * 与风险等级共用同一套红橙黄蓝色阶,所以色键沿用 `risk-*`。
|
|
|
|
|
+ */
|
|
|
|
|
+const HAZARD_LEVEL_TONE = { 1: 'risk-1', 2: 'risk-2', 3: 'risk-3', 4: 'risk-4' }
|
|
|
|
|
+function hazardLevelTone(value) {
|
|
|
|
|
+ return HAZARD_LEVEL_TONE[text(value)] || ''
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 风险因素 → 键值对(规格 §2「风险因素从字符串改为键值组结构」)。
|
|
* 风险因素 → 键值对(规格 §2「风险因素从字符串改为键值组结构」)。
|
|
|
*
|
|
*
|
|
@@ -686,11 +755,17 @@ function assetFieldValue(key, a) {
|
|
|
if (key === 'riskColor') return riskColorText(a[key])
|
|
if (key === 'riskColor') return riskColorText(a[key])
|
|
|
if (ASSET_TIMESTAMP_KEYS.has(key)) return formatAssetTime(a[key])
|
|
if (ASSET_TIMESTAMP_KEYS.has(key)) return formatAssetTime(a[key])
|
|
|
if (ASSET_DATE_KEYS.has(key)) return formatAssetDate(a[key])
|
|
if (ASSET_DATE_KEYS.has(key)) return formatAssetDate(a[key])
|
|
|
- return a[key]
|
|
|
|
|
|
|
+ // 摘要卡不走 display(),这里补同一道闸:形如主键的值一律「未提供」。
|
|
|
|
|
+ return looksLikeInternalId(a[key]) ? '未提供' : a[key]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function assetFields(category, a) {
|
|
function assetFields(category, a) {
|
|
|
const rows = category === 'PIPE_NETWORK' ? pipesFields(a) : ASSET_FIELD_ROWS[category] || []
|
|
const rows = category === 'PIPE_NETWORK' ? pipesFields(a) : ASSET_FIELD_ROWS[category] || []
|
|
|
|
|
+ return assetRows(rows, category, a)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 一批字段行 → 展示项(码值字典、三类业务引用、单位都在这里收口)。 */
|
|
|
|
|
+function assetRows(rows, category, a) {
|
|
|
return rows.map((row) => {
|
|
return rows.map((row) => {
|
|
|
// 码值字段:业务库字典是唯一权威,没取到就回原码(不回显 0/1/2 之外的编造词)。
|
|
// 码值字段:业务库字典是唯一权威,没取到就回原码(不回显 0/1/2 之外的编造词)。
|
|
|
if (row.dict) return field(row.label, dictOrCode(row.dict, a[row.key]), row.wide === true)
|
|
if (row.dict) return field(row.label, dictOrCode(row.dict, a[row.key]), row.wide === true)
|
|
@@ -1030,12 +1105,19 @@ function orderLevelTone(value) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function tab(key, label) { return { key, label } }
|
|
function tab(key, label) { return { key, label } }
|
|
|
-function relatedAlarm(item) { const code = text(item.code || item.alarmNo || item.alarm_no || item.alarmCode || item.alarmId || item.alarm_id || item.id); const name = item.alarmName || item.alarm_name || item.content || item.alarmContent || item.alarm_content || item.deviceName || item.device_name || item.title || (code ? `报警 ${code}` : '关联报警'); return { id: item.alarmId || item.alarm_id || item.id || '', code, name, status: eventStatusText(mobileAlarmStatus(item.alarmStatus ?? item.alarm_status) || item.status || item.auditStatusName || item.alarmStatusName, 'ALARM') } }
|
|
|
|
|
-function summaryItems(entries) { return entries.filter(([,value]) => value !== null && value !== undefined && String(value).trim() !== '').map(([label,value,tone]) => ({ label, value: String(value), tone: tone || '' })) }
|
|
|
|
|
-function peopleItems(entries) { return entries.filter(([,name]) => name).map(([role,name]) => ({ role, name: String(name) })) }
|
|
|
|
|
|
|
+function relatedAlarm(item) {
|
|
|
|
|
+ // code 的回退链里含 id 字段:真业务编码照常显示,主键形状的一律不显示。
|
|
|
|
|
+ const rawCode = text(item.code || item.alarmNo || item.alarm_no || item.alarmCode || item.alarmId || item.alarm_id || item.id)
|
|
|
|
|
+ const code = looksLikeInternalId(rawCode) ? '' : rawCode
|
|
|
|
|
+ const rawName = item.alarmName || item.alarm_name || item.content || item.alarmContent || item.alarm_content || item.deviceName || item.device_name || item.title
|
|
|
|
|
+ const name = (looksLikeInternalId(rawName) ? '' : rawName) || (code ? `报警 ${code}` : '关联报警')
|
|
|
|
|
+ return { id: item.alarmId || item.alarm_id || item.id || '', code, name, status: eventStatusText(mobileAlarmStatus(item.alarmStatus ?? item.alarm_status) || item.status || item.auditStatusName || item.alarmStatusName, 'ALARM') }
|
|
|
|
|
+}
|
|
|
|
|
+function summaryItems(entries) { return entries.filter(([,value]) => value !== null && value !== undefined && String(value).trim() !== '').map(([label,value,tone]) => ({ label, value: looksLikeInternalId(value) ? '未提供' : String(value), tone: tone || '' })) }
|
|
|
|
|
+function peopleItems(entries) { return entries.filter(([,name]) => name && !looksLikeInternalId(name)).map(([role,name]) => ({ role, name: String(name) })) }
|
|
|
function deviceItems(source) {
|
|
function deviceItems(source) {
|
|
|
- const name = source.deviceName || source.monitoringPointName || ''
|
|
|
|
|
- const code = source.deviceCode || source.monitoringPointCode || ''
|
|
|
|
|
|
|
+ const name = looksLikeInternalId(source.deviceName || source.monitoringPointName) ? '' : source.deviceName || source.monitoringPointName || ''
|
|
|
|
|
+ const code = looksLikeInternalId(source.deviceCode || source.monitoringPointCode) ? '' : source.deviceCode || source.monitoringPointCode || ''
|
|
|
return name || code ? [{ name: name || code, code, location: source.location || source.address || '' }] : []
|
|
return name || code ? [{ name: name || code, code, location: source.location || source.address || '' }] : []
|
|
|
}
|
|
}
|
|
|
function attachmentItems(value) {
|
|
function attachmentItems(value) {
|
|
@@ -1122,9 +1204,11 @@ function compactSections(sections) {
|
|
|
.map((group) => ({ ...group, fields: group.fields.filter((item) => item.always || item.pairs || item.value !== PLACEHOLDER) }))
|
|
.map((group) => ({ ...group, fields: group.fields.filter((item) => item.always || item.pairs || item.value !== PLACEHOLDER) }))
|
|
|
.filter((group) => group.fields.length)
|
|
.filter((group) => group.fields.length)
|
|
|
}
|
|
}
|
|
|
-function section(title, fields) { return { title, fields } }
|
|
|
|
|
|
|
+/** 分区也能声明自己属于哪个页签(维护者 2026-12-01:不同对象的分区归位不一样)。 */
|
|
|
|
|
+function section(title, fields, tabKey = '') { return { title, fields, tab: tabKey } }
|
|
|
function field(label, value, wide = false, extra = {}) { return { label, value: display(value), wide, always: false, note: '', ...extra } }
|
|
function field(label, value, wide = false, extra = {}) { return { label, value: display(value), wide, always: false, note: '', ...extra } }
|
|
|
-function display(value) { return value === null || value === undefined || String(value).trim() === '' ? PLACEHOLDER : String(value) }
|
|
|
|
|
|
|
+/** 文案出口:空值与「形如内部主键」的值都显示占位符,主键不上屏的最后一道闸。 */
|
|
|
|
|
+function display(value) { return value === null || value === undefined || String(value).trim() === '' || looksLikeInternalId(value) ? PLACEHOLDER : String(value) }
|
|
|
function text(value) { return value === null || value === undefined ? '' : String(value).trim() }
|
|
function text(value) { return value === null || value === undefined ? '' : String(value).trim() }
|
|
|
/**
|
|
/**
|
|
|
* 读数 + 单位。三条纪律(维护者 2026-10-29):
|
|
* 读数 + 单位。三条纪律(维护者 2026-10-29):
|