|
|
@@ -47,7 +47,7 @@ import {
|
|
|
ringScaleAt,
|
|
|
} from '../domain/markerMetrics.js'
|
|
|
// 票 83:几何读数(本体宽 / 绘制宽 / pad)与计划读数同一出口,走查不读 DOM 内部结构。
|
|
|
-import { markerGeometryDataset } from '../domain/markerPlan.js'
|
|
|
+import { markerGeometryDataset, innerIconFor } from '../domain/markerPlan.js'
|
|
|
// 本票:未关联设备的屏幕拥挤聚合(纯 domain;本层只负责投影/渲染/点击)。
|
|
|
import { AGGREGATE_KIND, aggregateBadge, canZoomAggregate, groupUnassociatedByScreen, planMemberList } from '../domain/pointAggregation.js'
|
|
|
|
|
|
@@ -906,30 +906,99 @@ export function markerLabelState(hovered) {
|
|
|
|
|
|
// ---- 本票:未关联设备聚合徽章与成员列表 ----
|
|
|
|
|
|
-function buildUnassociatedAggregateNode(key, badge) {
|
|
|
+function badgeFingerprint(badge) {
|
|
|
+ const statusFp = (badge.statuses || []).map((item) => item.status + ':' + item.count).join(',')
|
|
|
+ const typeFp = (badge.types || []).map((item) => item.key + ':' + item.count).join(',')
|
|
|
+ return [
|
|
|
+ badge.count,
|
|
|
+ badge.primaryStatus,
|
|
|
+ badge.abnormal ? badge.abnormal.status : '',
|
|
|
+ badge.abnormal ? badge.abnormal.count : 0,
|
|
|
+ badge.otherAbnormalCount,
|
|
|
+ badge.mixedIndustry ? '1' : '0',
|
|
|
+ badge.industryKey,
|
|
|
+ badge.effect,
|
|
|
+ badge.tone,
|
|
|
+ statusFp,
|
|
|
+ typeFp,
|
|
|
+ ].join(FP_SEP)
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 聚合徽章节点(规格 69–72):圆形 40px,常驻「类别 + 准确成员数」,
|
|
|
+ * 左上角是类型图案(同质单一行业)/通用“混”,右上角是最高优先级异常及数量(+N 种),
|
|
|
+ * 外圈按最高优先级异常挂**唯一一套**聚合级特效,title 汇总类型与状态分布。
|
|
|
+ */
|
|
|
+function buildUnassociatedAggregateNode(key, badge, tones) {
|
|
|
+ const palette = tones || {}
|
|
|
+ const toneHex = palette[badge.tone] || palette.neutral || '#01abea'
|
|
|
+
|
|
|
const root = document.createElement('div')
|
|
|
root.className = NODE_CLASS + ' ' + NODE_CLASS + '--aggregate'
|
|
|
root.dataset.markerOverlayKey = key
|
|
|
root.dataset.markerOverlayKind = AGGREGATE_KIND
|
|
|
root.dataset.markerOverlayCode = key
|
|
|
root.dataset.markerOverlayAggregate = 'yes'
|
|
|
- root.dataset.aggregateCount = String(badge.count)
|
|
|
- root.dataset.aggregateCategory = badge.category
|
|
|
- root.style.cssText = 'position:absolute;left:0;top:0;pointer-events:auto;cursor:pointer;transform-origin:50% 50%;display:flex;flex-direction:column;align-items:center;gap:2px;'
|
|
|
+ root.style.cssText = 'position:absolute;left:0;top:0;width:40px;height:40px;pointer-events:auto;cursor:pointer;transform-origin:50% 50%;'
|
|
|
+ root.style.setProperty('--marker-tone', toneHex)
|
|
|
+ root.title = badge.tooltip || badge.label
|
|
|
+
|
|
|
+ // 聚合级特效:每组最多一套,与最高优先级异常一致(不叠加成员级光环)。
|
|
|
+ let fxHost = null
|
|
|
+ if (badge.effect && badge.effectStatus) {
|
|
|
+ const profile = effectProfileFor(badge.effectStatus)
|
|
|
+ if (profile && profile.effect === badge.effect) {
|
|
|
+ fxHost = buildFxLayers({ effect: profile.effect, profile, converge: null }, { draw: { width: 40 } }, toneHex, key)
|
|
|
+ root.appendChild(fxHost)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const circle = document.createElement('div')
|
|
|
- circle.style.cssText = 'display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;border:2px solid #01abea;background:rgba(2,9,27,0.92);color:#e8f7ff;font:600 14px/1 monospace;box-shadow:0 0 10px rgba(1,171,234,0.55)'
|
|
|
+ circle.style.cssText = 'position:absolute;left:0;top:0;width:40px;height:40px;border-radius:50%;border:2px solid ' + toneHex + ';background:rgba(2,9,27,0.92);display:flex;align-items:center;justify-content:center;box-shadow:0 0 10px ' + toneHex + '66;'
|
|
|
const countEl = document.createElement('span')
|
|
|
countEl.textContent = String(badge.count)
|
|
|
+ countEl.style.cssText = 'color:#fff;font:600 15px/1 monospace;'
|
|
|
circle.appendChild(countEl)
|
|
|
+ root.appendChild(circle)
|
|
|
+
|
|
|
+ // 类型图案:同质单一行业 → 该行业图案;混合 → 通用「混」。
|
|
|
+ const typeEl = document.createElement('div')
|
|
|
+ typeEl.style.cssText = 'position:absolute;left:-6px;top:-6px;width:18px;height:18px;border-radius:50%;background:rgba(2,9,27,0.96);border:1px solid rgba(1,171,234,0.55);display:flex;align-items:center;justify-content:center;overflow:hidden;color:#9fd8f2;font:600 10px/1 sans-serif;'
|
|
|
+ const iconKey = badge.industryKey ? innerIconFor(badge.industryKey) : ''
|
|
|
+ if (iconKey) {
|
|
|
+ const img = document.createElement('img')
|
|
|
+ img.alt = badge.typeLabel
|
|
|
+ img.style.cssText = 'width:14px;height:14px;display:block;'
|
|
|
+ renderInnerIconUrl(iconKey).then((url) => { img.src = url }).catch(() => {})
|
|
|
+ typeEl.appendChild(img)
|
|
|
+ } else {
|
|
|
+ typeEl.textContent = badge.mixedIndustry ? '混' : String(badge.typeLabel || '设').slice(0, 1)
|
|
|
+ }
|
|
|
+ typeEl.title = '类型:' + badge.typeLabel
|
|
|
+ root.appendChild(typeEl)
|
|
|
+
|
|
|
+ // 角标:最高优先级异常及数量;其余异常用 +N 种状态提示。
|
|
|
+ const statusEl = document.createElement('div')
|
|
|
+ if (badge.abnormal) {
|
|
|
+ statusEl.textContent = badge.abnormal.count + (badge.otherAbnormalCount > 0 ? ' +' + badge.otherAbnormalCount : '')
|
|
|
+ statusEl.title = badge.abnormal.label + ' ' + badge.abnormal.count
|
|
|
+ + (badge.otherAbnormalCount > 0 ? ' · 另有 ' + badge.otherAbnormalCount + ' 种异常状态' : '')
|
|
|
+ const abnormalTone = palette[badge.abnormal.tone] || toneHex
|
|
|
+ statusEl.style.cssText = 'position:absolute;right:-10px;top:-10px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:' + abnormalTone + ';color:#02091b;font:700 10px/16px monospace;text-align:center;box-shadow:0 0 6px ' + abnormalTone + ';'
|
|
|
+ } else {
|
|
|
+ statusEl.style.display = 'none'
|
|
|
+ }
|
|
|
+ root.appendChild(statusEl)
|
|
|
+
|
|
|
const label = document.createElement('span')
|
|
|
label.textContent = badge.category
|
|
|
- label.style.cssText = 'padding:0 4px;border-radius:3px;background:rgba(2,9,27,0.9);color:#9fd8f2;font:11px/1.4 sans-serif;white-space:nowrap'
|
|
|
- root.appendChild(circle)
|
|
|
+ label.style.cssText = 'position:absolute;left:50%;top:42px;transform:translateX(-50%);padding:1px 5px;border-radius:3px;background:rgba(2,9,27,0.92);color:#9fd8f2;font:11px/1.4 sans-serif;white-space:nowrap;'
|
|
|
root.appendChild(label)
|
|
|
- return { root, countEl }
|
|
|
+
|
|
|
+ return { root, countEl, typeEl, statusEl, labelEl: label, fxHost, fp: badgeFingerprint(badge) }
|
|
|
}
|
|
|
|
|
|
-function renderAggregates(groups) {
|
|
|
+function renderAggregates(groups, tones) {
|
|
|
aggregateGroups.clear()
|
|
|
const active = new Set()
|
|
|
for (const group of groups || []) {
|
|
|
@@ -939,18 +1008,24 @@ function renderAggregates(groups) {
|
|
|
active.add(key)
|
|
|
aggregateGroups.set(key, group)
|
|
|
let record = aggregatePool.get(key)
|
|
|
- if (!record) {
|
|
|
- record = buildUnassociatedAggregateNode(key, badge)
|
|
|
+ const fp = badgeFingerprint(badge)
|
|
|
+ if (!record || record.fp !== fp) {
|
|
|
+ if (record && record.root.parentNode) record.root.parentNode.removeChild(record.root)
|
|
|
+ record = buildUnassociatedAggregateNode(key, badge, tones)
|
|
|
aggregatePool.set(key, record)
|
|
|
hostNode.appendChild(record.root)
|
|
|
}
|
|
|
const transform = 'translate(' + group.screen.x + 'px, ' + group.screen.y + 'px) translate(-50%, -50%)'
|
|
|
if (record.root.style.transform !== transform) record.root.style.transform = transform
|
|
|
- if (record.root.style.display !== 'flex') record.root.style.display = 'flex'
|
|
|
- // 走查读数:组成员数与屏幕离散(不参与业务)。
|
|
|
+ if (record.root.style.display !== 'block') record.root.style.display = 'block'
|
|
|
+ // 走查读数(不参与业务):数量/离散/可缩放/最高异常/+N/类型/特效。
|
|
|
+ record.root.dataset.aggregateCount = String(badge.count)
|
|
|
record.root.dataset.aggregateSpread = String(Math.round(group.spreadPx))
|
|
|
record.root.dataset.aggregateZoom = canZoomAggregate(group) ? 'yes' : 'no'
|
|
|
- if (record.countEl.textContent !== String(group.count)) record.countEl.textContent = String(group.count)
|
|
|
+ record.root.dataset.aggregateStatus = badge.abnormal ? badge.abnormal.status : badge.primaryStatus
|
|
|
+ record.root.dataset.aggregateOther = String(badge.otherAbnormalCount)
|
|
|
+ record.root.dataset.aggregateType = badge.typeLabel
|
|
|
+ record.root.dataset.aggregateEffect = badge.effect
|
|
|
}
|
|
|
for (const [key, record] of aggregatePool.entries()) {
|
|
|
if (active.has(key)) continue
|
|
|
@@ -986,6 +1061,13 @@ function openMemberList(group, onPick) {
|
|
|
close.style.cssText = 'pointer-events:auto;background:transparent;border:1px solid rgba(1,171,234,0.5);color:#9fd8f2;border-radius:4px;padding:1px 6px;cursor:pointer;font:11px sans-serif'
|
|
|
header.appendChild(title)
|
|
|
header.appendChild(close)
|
|
|
+ // 类型与状态分布摘要:打开列表前就能看到「聚合了哪些类型、各是什么状态」。
|
|
|
+ const subtitle = document.createElement('div')
|
|
|
+ subtitle.style.cssText = 'color:#7fb8d8;font-size:11px;line-height:1.45;margin-bottom:6px;'
|
|
|
+ const typeText = (group.industrySummary || []).map((item) => item.label + ' ' + item.count).join(' / ')
|
|
|
+ const statusText = ((group.statusSummary && group.statusSummary.statuses) || []).map((item) => item.label + ' ' + item.count).join(' / ')
|
|
|
+ subtitle.textContent = '类型 ' + (typeText || '未标注') + ' · 状态 ' + (statusText || '状态未发布')
|
|
|
+ subtitle.title = subtitle.textContent
|
|
|
const input = document.createElement('input')
|
|
|
input.type = 'search'
|
|
|
input.placeholder = '搜索名称 / 编码'
|
|
|
@@ -1010,7 +1092,7 @@ function openMemberList(group, onPick) {
|
|
|
const name = document.createElement('span')
|
|
|
name.textContent = row.name || row.code
|
|
|
const meta = document.createElement('span')
|
|
|
- meta.textContent = ' · ' + row.code + ' · ' + (row.status || '状态未发布')
|
|
|
+ meta.textContent = ' · ' + row.code + ' · ' + (row.industryLabel || '未标注') + ' · ' + (row.statusLabel || row.status || '状态未发布')
|
|
|
meta.style.cssText = 'color:#7fb8d8;font-size:11px'
|
|
|
button.appendChild(name)
|
|
|
button.appendChild(meta)
|
|
|
@@ -1021,6 +1103,7 @@ function openMemberList(group, onPick) {
|
|
|
input.addEventListener('input', () => renderRows(input.value))
|
|
|
input.addEventListener('pointerdown', (event) => event.stopPropagation())
|
|
|
root.appendChild(header)
|
|
|
+ root.appendChild(subtitle)
|
|
|
root.appendChild(input)
|
|
|
root.appendChild(list)
|
|
|
renderRows('')
|
|
|
@@ -1163,7 +1246,7 @@ export function syncMarkerOverlay({ markers, devices, aggregates, facilities, se
|
|
|
}
|
|
|
|
|
|
// 本票:聚合徽章(未关联设备按屏幕拥挤合并后的显示入口)。
|
|
|
- renderAggregates(badgeGroups)
|
|
|
+ renderAggregates(badgeGroups, tones)
|
|
|
|
|
|
// 关联设备(票 47 维护者反馈②根因:设备是独立 billboard 图层,此前 DOM 只渲染
|
|
|
// 摘要标记计划、关联设备根本没进 DOM)。行由引擎每帧投影产出(屏幕坐标真值 +
|
|
|
@@ -1483,3 +1566,4 @@ export function unmountMarkerOverlay() {
|
|
|
aggregateSelectedCode = ''
|
|
|
pool.clear()
|
|
|
}
|
|
|
+
|