|
@@ -137,6 +137,7 @@ function normalizeAsset(identity, source) {
|
|
|
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 ? '对象' : '设施'
|
|
|
return {
|
|
return {
|
|
|
...identity, category, name, title: name, displayCode,
|
|
...identity, category, name, title: name, displayCode,
|
|
|
kindLabel,
|
|
kindLabel,
|
|
@@ -145,16 +146,15 @@ function normalizeAsset(identity, source) {
|
|
|
statusText: status, tone: emergency ? 'neutral' : facilityStatusTone(source.status), raw: source,
|
|
statusText: status, tone: emergency ? 'neutral' : facilityStatusTone(source.status), raw: source,
|
|
|
categoryText: facilityCategoryText(category),
|
|
categoryText: facilityCategoryText(category),
|
|
|
coordinates: source.coordinates || null,
|
|
coordinates: source.coordinates || null,
|
|
|
- summary: assetSummary(category, attributes, status, location),
|
|
|
|
|
|
|
+ summary: assetSummary(category, attributes, location),
|
|
|
tabs: [tab('overview', '基本信息'), tab('business', '业务详情'), tab('related', '关联信息')],
|
|
tabs: [tab('overview', '基本信息'), tab('business', '业务详情'), tab('related', '关联信息')],
|
|
|
people: assetPeople(attributes),
|
|
people: assetPeople(attributes),
|
|
|
devices: assetDevices(attributes),
|
|
devices: assetDevices(attributes),
|
|
|
attachments: assetAttachments(attributes),
|
|
attachments: assetAttachments(attributes),
|
|
|
sections: compactSections([
|
|
sections: compactSections([
|
|
|
section('基本信息', [
|
|
section('基本信息', [
|
|
|
- ...(hasCodeColumn ? [field('设施编码', displayCode || '未提供')] : []),
|
|
|
|
|
- field('设施类别', facilityCategoryText(category)),
|
|
|
|
|
- field('运行状态', status),
|
|
|
|
|
|
|
+ ...(hasCodeColumn ? [field(`${noun}编码`, displayCode || '未提供', true)] : []),
|
|
|
|
|
+ field(`${noun}类别`, facilityCategoryText(category)),
|
|
|
field('数据更新时间', formatEventTime(source.updatedAt)),
|
|
field('数据更新时间', formatEventTime(source.updatedAt)),
|
|
|
]),
|
|
]),
|
|
|
section('位置与归属', [field('位置描述', location, true), field('所属片区', source.districtName), field('坐标', coordinatesText(source.coordinates), true)]),
|
|
section('位置与归属', [field('位置描述', location, true), field('所属片区', source.districtName), field('坐标', coordinatesText(source.coordinates), true)]),
|
|
@@ -261,7 +261,7 @@ const SUMMARY_LABELS_BY_CATEGORY = {
|
|
|
WATER_FIRE_HYDRANT: { ownershipUnit: '产权单位' },
|
|
WATER_FIRE_HYDRANT: { ownershipUnit: '产权单位' },
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function assetSummary(category, a, status, location) {
|
|
|
|
|
|
|
+function assetSummary(category, attributes, location) {
|
|
|
// 摘要只挑"一眼要看的读数",键与明细同源;单位统一由 METRIC_UNITS 提供。
|
|
// 摘要只挑"一眼要看的读数",键与明细同源;单位统一由 METRIC_UNITS 提供。
|
|
|
const byCategory = {
|
|
const byCategory = {
|
|
|
WATER_PLANT: ['currentCapacity', 'designCapacity', 'treatmentProcess'],
|
|
WATER_PLANT: ['currentCapacity', 'designCapacity', 'treatmentProcess'],
|
|
@@ -281,12 +281,13 @@ function assetSummary(category, a, status, location) {
|
|
|
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) => {
|
|
|
const unit = unitOf(category, key)
|
|
const unit = unitOf(category, key)
|
|
|
- const raw = assetFieldValue(key, a)
|
|
|
|
|
|
|
+ const raw = assetFieldValue(key, attributes)
|
|
|
// 只有真有单位时才拼单位;纯文本字段(材质/负责人…)原样。
|
|
// 只有真有单位时才拼单位;纯文本字段(材质/负责人…)原样。
|
|
|
const value = unit ? withUnitText(raw, unit) : raw
|
|
const value = unit ? withUnitText(raw, unit) : raw
|
|
|
return [labels[key] || SUMMARY_LABELS[key] || key, value]
|
|
return [labels[key] || SUMMARY_LABELS[key] || key, value]
|
|
|
})
|
|
})
|
|
|
- return summaryItems([['状态', status], ...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) }
|