Pārlūkot izejas kodu

fix(cockpit): 目标离开视口时详情面板收起,重定位改为强制重飞

票 13(关联设备定位)。同一批改动收口三轮真机走查:

- 定位揭示目标改由当前选择派生(新增 domain/locateReveal):选择关掉揭示自动消失,
  不再依赖会被「关闭详情 / 返回点位 / 切模式 / 改图例」清掉的一次性记录;
- 揭示行统一发布到地图服务(此前只写 store 不发布,图标永远不出现),
  syncForSelection 的返回与 painted 读数改为与事实一致;
- 独立设备的详情锚点认设备图层标记(此前认摘要标记,基础设施模式下恒空,面板锚不上);
- 目标离开视口时详情面板收起,不再停在一个没有依据的位置;按维护者要求,
  底部「点位标记已离开地图画面」提示已删除,「强制重飞」保留为设备选中入口的 refly 能力;
- 修复类型徽标复发(#135 同因):揭示行会顶掉计划行,行业改为「设备卡 → 点位详情 →
  宿主点位」继承,并在替换处用 mergeRevealRow 兜底;
- 定位判定收进 domain/locateSteps,执行统一为三步:飞到目标坐标 / 揭示目标点 / 展开详情。

闸门:新增 tests/t13-locate-reveal.test.js(8)、tests/locate-steps.test.js(5);
回归 point-locate 6、t127 9、facilityNetworkLocate 4、markerOverlay 2、markerProjection 2、
deviceStatusStats 8、legendLabels 1、cameraContextMenu 4、overviewPerceptionCards 4、
detailStorePreload 1,共 12 个文件 54 条全绿。按项目规则未跑 build。
真机走查记录与截图见 .scratch/cockpit-emergency-detail/(票 13)。
ChenJZ 1 dienu atpakaļ
vecāks
revīzija
5103ef94de

+ 40 - 54
src/modules/cockpit/CockpitShell.vue

@@ -252,14 +252,6 @@
                     现在它是主体区底部的浮层(见 cockpit-shell__notice),这里只留注释锚点。
                 -->
 
-                <span v-if="detailOpen && !introVisible && !fixedLocationReason && !anchorLayout.visible"
-                    class="cockpit-shell__chip cockpit-shell__anchor-status" data-anchor-hidden
-                    :data-anchor-reason="anchorLayout.reason" role="status">
-                    {{ selectedDetailCode }} · {{ hiddenAnchorText }}
-                    <button v-if="canRelocate" type="button" data-anchor-relocate @click="relocateSelected">重新定位</button>
-                    <button type="button" data-anchor-close @click="closeActiveDetail">关闭</button>
-                </span>
-
                 <!--
                     票 42(规格 14:刷新核对链):换新快照期间设备图层已挂起,详情进入「待核对」;
                     顶栏如实提示并保留关闭入口(关闭按钮在上方 data-anchor-hidden chip 里)。
@@ -569,8 +561,7 @@ import { responseEfficiencyTitle } from './domain/warningResponsePanels.js'
 import { EVENT_FAMILY } from './domain/events.js'
 import { LOCATE_RESULT } from './domain/mapLocate.js'
 import { resolveDetailAnchor, resolveFacilityDetailAnchor, detailAnchorLocation } from './domain/detailAnchor.js'
-import { DEVICE_LAYER_KIND } from './domain/deviceLayer.js'
-import { ANCHOR_HIDDEN, solvePointAnchor } from './domain/pointAnchor.js'
+import { solvePointAnchor } from './domain/pointAnchor.js'
 import {
     overallFreshness,
     overallFreshnessText,
@@ -612,6 +603,8 @@ import { STARTUP_ACTION, planCockpitStartup } from './domain/startupPlan.js'
 import { selectMonitoringPoint } from './pointSelection.js'
 // 票 46:模式图层计划(唯一裁决点)+ 模式切换的选择态语义判定。
 import { planModeLayers, planModeSelectionTransition } from './domain/modeLayerPlan.js'
+// #13:定位揭示目标**由选择派生**(选择关掉揭示就消失,不再靠一次性选项传递)。
+import { deriveLocateReveal } from './domain/locateReveal.js'
 // 本票(主场景渐进显示与完整加载):显示就绪门控(区域锁定 + 相机归位 + 至少一帧真实渲染)。
 import { DISPLAY_GATE, armDisplayGate, createDisplayGate, disarmDisplayGate, displayReady, observeDisplayGate } from './domain/displayReadiness.js'
 import { PIPE_ENHANCEMENT_KIND, planPipeEnhancement } from './domain/pipeEnhancement.js'
@@ -1064,7 +1057,7 @@ async function locateDeviceFromDetail(deviceCode) {
  * 这里包一层 computed,使之与下游所有 `selection.value.xxx` 的写法一致。
  */
 const selection = computed(() => detailStore.selection || { level: DETAIL_LEVEL.NONE, pointCode: '', deviceCode: '' })
-    const opened = selection && selection.level === DETAIL_LEVEL.EQUIPMENT && selection.deviceCode === deviceCode
+    const opened = selection.value.level === DETAIL_LEVEL.EQUIPMENT && selection.value.deviceCode === deviceCode
     // 兜底时**必须把定位链设好的揭示目标带上**:openDevice 内部会 setLocateTarget(options.locateTarget || null),
     // 传空对象等于把 reveal 清成 null,详情面板的可见性判据随即失去「这是定位目标」的依据而被隐藏
     // (维护者 2026-12-02:定位成功、浮层节点也在,却被 v-show 置成 display:none)。
@@ -1392,15 +1385,22 @@ const deviceFilterActive = computed(
     () => industryQuery(industry.value) !== '' || districtQuery(scope.value) !== '' || String(deviceType.value || '').trim() !== '',
 )
 
-/** 定位状态兜底:detailStore 的揭示目标被清空时,用最近一次定位的编码在摘要里找回那一行。 */
-function revealFromLocateState() {
-    const state = pointLocateStore.locate
-    const deviceCode = (state && (state.deviceCode || state.code)) || ''
-    if (!deviceCode) return null
-    const device = (mapStore.summary.objects || []).find((item) => item && item.code === deviceCode) || null
-    if (!device) return null
-    return { code: deviceCode, deviceCode: state.deviceCode || '', device }
-}
+/**
+ * 当前定位揭示目标(#13):**由选择派生**,不是由定位链传下来的一次性选项。
+ *
+ * 选择是「用户正在看谁」的唯一真相;揭示只是它的投影。于是:
+ * 关闭详情 → 选择清空 → 揭示自动消失;定位完成后数据到达 → 揭示自动补上。
+ * 原先读 `detailStore.locateTarget`(会被关闭/返回/切模式/改图例清空)的链路正是
+ * 「定位成功之后图标与锚定又没了」的成因。
+ *
+ * 兜底仍保留一次性记录:坐标只在设备档案里(要异步取)时,派生拿不到,
+ * 但定位链当场已经把那一行交过来了。
+ */
+const locateReveal = computed(() => deriveLocateReveal({
+    selection: selection.value,
+    objects: mapStore.summary.objects,
+    pointDetail: sections.value.pointDetail && sections.value.pointDetail.data,
+}) || detailStore.locateTarget || null)
 
 function syncDeviceLayer(options = {}) {
     // 票 46:`entered` 跟随引导态 —— 进入前关联设备图层整体不呈现(规格 18 的引导列)。
@@ -1409,8 +1409,8 @@ function syncDeviceLayer(options = {}) {
     const maxFan = options.maxFan || (mapConfig && mapConfig.overlap && mapConfig.overlap.maxFan) || 10
     // #135:关联设备定位时,宿主点位可能被当前模式隐藏;设备图层仍要按揭示目标常驻,
     // 否则 parentVisible=false 会把刚补出来的设备点又撤掉(表现就是“定位成功但图标丢失”)。
-    const locateReveal = detailStore.locateTarget
-    const revealParent = Boolean(locateReveal && locateReveal.deviceCode && locateReveal.code === selection.value.pointCode)
+    const reveal = locateReveal.value
+    const revealParent = Boolean(reveal && reveal.deviceCode && reveal.code === selection.value.pointCode)
     return deviceLayerStore.syncForSelection({
         ...options,
         mode: mode.value,
@@ -1421,10 +1421,9 @@ function syncDeviceLayer(options = {}) {
         filterActive: deviceFilterActive.value,
         // #131:关联设备定位时把揭示目标(含设备自身坐标)交给设备图层,正常/离线也能临时上图。
         //
-        // detailStore.locateTarget 会被后续的 close/回收链路清掉(实测定位完成后读已是 null),
-        // 一旦为空,设备图层就补不出揭示行 —— 图标与锚定全都失去依据。
-        // 所以这里再从定位状态本身兜底构造一次:定位已知设备编码时,用摘要里的那一行。
-        revealDevice: detailStore.locateTarget || revealFromLocateState(),
+        // 揭示目标由**选择派生**(见上方 locateReveal):关闭详情就自动消失,
+        // 不再依赖"谁记得清 / 谁记得再写一次"。
+        revealDevice: reveal,
     })
 }
 
@@ -1513,11 +1512,12 @@ const modeDeviceFacts = computed(() => {
 })
 
 /**
- * 当前定位揭示目标(#127):由 `detailStore` 在定位成功后写入,关闭/换选择/切模式/改图例筛选时清除。
- * 只把「目标本身是摘要对象」的情况交给计划层;关联设备揭示的是宿主点位标记,仍由设备层按标签状态着色。
+ * 交给计划层的定位揭示目标(#127):与设备图层同源,都读**选择派生**的 `locateReveal`。
+ * 只把「目标本身是摘要对象」的情况交给计划层;关联设备揭示的是宿主点位标记,
+ * 仍由设备层按标签状态着色。
  */
 const modeLocateTarget = computed(() => {
-    const target = detailStore.locateTarget
+    const target = locateReveal.value
     if (!target || !target.code) return null
     const onMap = (mapStore.summary.objects || []).some((object) => object && object.code === target.code)
     return onMap ? { code: target.code, deviceCode: target.deviceCode || '' } : null
@@ -1872,10 +1872,6 @@ const detailOpen = computed(() => {
     const current = selection.value
     return Boolean(current && current.level && current.level !== DETAIL_LEVEL.NONE)
 })
-function closeActiveDetail() {
-    if (facilityDetailOpen.value) entityDetailStore.close()
-    else detailStore.closeDetail()
-}
 
 // ---- 票 41:详情面板锚定跟随监测点标记(决策票 04 / 规格票 12 的修订节)----
 //
@@ -1923,13 +1919,6 @@ const fixedLocationReason = computed(() => {
     return verdict.present && !verdict.renderable ? verdict.reasonText : ''
 })
 
-const hiddenAnchorText = computed(() => ANCHOR_HIDDEN[anchorLayout.value.reason] || '点位标记当前不可见')
-/** 仅**标记仍有效**时才给重新定位入口(不对已消失的标记发无效定位)。 */
-const canRelocate = computed(() => {
-    if (introVisible.value || !detailTarget.value || fixedLocationReason.value) return false
-    return hasMapMarker(detailTarget.value.kind, detailTarget.value.code, detailTarget.value.pointCode, detailTarget.value.key)
-})
-
 /**
  * 求当前锚点的落位。
  * 返回 `{ canvas, layout }`:`canvas` 只作内部判定输入,`layout` 才是写进视图的对象
@@ -2005,11 +1994,17 @@ const detailStyle = computed(() => {
     // (`display:none` 会让 `scrollHeight` 变 0,恢复后面板会先塌成 1px)。
     // **必须同时关掉 `pointer-events`**:本组件是 `pointer-events: auto` 的绝对定位浮层,
     // 只隐藏视觉仍会**拦截它覆盖区域内的地图点击**(看不见却吃掉交互)。
-    // 锚定不到(目标还没上图 / 不在视口内)时**仍要显示**,只是改回 CSS 的靠右固定位置:
-    // 用户点「定位设备」是为了读详情,看不看得见图标不该决定详情能不能读。
-    // 早先这里整块 visibility:hidden,于是面板虽然渲染了、有尺寸,却谁也看不见
-    // (维护者 2026-12-02:data-detail-open 1 of 1、display:flex、618×618,但不可见)。
-    if (!layout.visible) return { visibility: 'visible', pointerEvents: 'auto' }
+    //
+    // 锚定不到(目标还没上图 / 已离开视口)时**暂隐**,由顶栏 `data-anchor-hidden` chip
+    // 说明原因并给「重新定位 / 关闭」入口。
+    //
+    // 这条改了两轮,两个极端都踩过,不要再来回翻:
+    //   · 2026-12-02 之前直接 `visibility:hidden`,但当时目标根本没能上图,于是面板"渲染了却谁也看不见";
+    //   · 2026-12-02 改成"退回 CSS 固定位置",把病根挪到了锚定链上——真机表现为
+    //     **目标离开视口后面板自己固定到一个不该存在的位置**(维护者 2026-12-03 报的正是这条)。
+    // 现在图标与锚定都能正常解析,所以恢复"锚不到就暂隐":看不见目标时不该给一张
+    // 位置无依据的面板;无地图位置的那一类仍走上面的 `fixedLocationReason` 固定详情。
+    if (!layout.visible) return { visibility: 'hidden', pointerEvents: 'none' }
     const origin = anchorOrigin.value
     return {
         left: `${layout.rect.left - origin.left}px`,
@@ -2041,15 +2036,6 @@ const anchorLeadStyle = computed(() => {
     }
 })
 
-/** 暂隐入口的「重新定位」:只对仍有效的监测点标记走统一选择入口(不发明第二条定位路径)。 */
-function relocateSelected() {
-    const target = detailTarget.value
-    if (!target) return
-    if (target.kind === 'facility-point') return facilityPointStore.select(entityDetailStore.identity, entityDetailStore.detail?.raw)
-    if (target.kind === DEVICE_LAYER_KIND) deviceLayerStore.selectDevice(target.code)
-    else if (target.kind === MAP_OBJECT_KIND.MONITORING_POINT) selectMonitoringPoint(target.code)
-}
-
 /**
  * 详情选择或地图对象变化 → 立即重算一次落位(不等下一帧)。
  * `nextTick` 是等卡片挂载/换内容后再量高度:刚打开时 `scrollHeight` 还是 0,

+ 8 - 0
src/modules/cockpit/domain/detailAnchor.js

@@ -12,6 +12,14 @@ export function resolveDetailAnchor({ selection, objects = [], devices = [] } =
             const device = devices.find((item) => item.code === current.deviceCode && item.pointCode === current.pointCode) || null
             return { kind: DEVICE_LAYER_KIND, code: current.deviceCode, pointCode: current.pointCode, object: device }
         }
+        // 独立设备没有宿主点位:定位揭示画出来的是**设备图层标记**(设备图层的临时揭示行),
+        // 不是摘要标记。锚点必须认同一族 —— 否则 `hasMapMarker` 去查 `markerPlan.markers`
+        // (基础设施模式下恒空),面板永远锚不上,表现为「固定在右侧」(2026-12-03 复核 #13)。
+        // 没有揭示行时才退回摘要里的未关联设备标记(原行为)。
+        const revealed = devices.find((item) => item && item.code === current.deviceCode) || null
+        if (revealed) {
+            return { kind: DEVICE_LAYER_KIND, code: current.deviceCode, pointCode: revealed.pointCode || '', object: revealed }
+        }
         const device = objects.find((item) => item.kind === MAP_OBJECT_KIND.UNASSOCIATED_EQUIPMENT && item.code === current.deviceCode) || null
         return { kind: MAP_OBJECT_KIND.UNASSOCIATED_EQUIPMENT, code: current.deviceCode, object: device }
     }

+ 20 - 0
src/modules/cockpit/domain/deviceLayer.js

@@ -277,6 +277,26 @@ export function countPlacements(rows) {
     return counts
 }
 
+/**
+ * 定位揭示行与被它**顶掉**的计划行合并(#13 / #135 的同一个坑)。
+ *
+ * 揭示行只保证"这个设备现在必须能上图",它的可视字段来自定位链;而定位链未必拿得到
+ * 行业(设备卡契约没有 industry,点位详情也不一定带)。直接用它替换计划行,就会把
+ * 本来带类型徽标的那一行换成空徽标的一行 —— 图标在、中心徽标没了。
+ *
+ * 所以:揭示行缺的可视字段一律从被顶掉的行继承,谁都不会因为"临时揭示"而丢徽标。
+ * 纯函数,便于脱浏览器断言(这个缺陷已经复发过一次,需要闸门钉住)。
+ */
+export function mergeRevealRow(forced, replaced) {
+    if (!forced) return replaced || null
+    if (!replaced) return forced
+    return {
+        ...forced,
+        industry: forced.industry || replaced.industry || '',
+        typeName: forced.typeName || replaced.typeName || '',
+    }
+}
+
 /**
  * 关联设备图例(**独立于监测点图例**,规格与票 09 的边界都要求分开)。
  *

+ 69 - 0
src/modules/cockpit/domain/locateReveal.js

@@ -0,0 +1,69 @@
+/**
+ * 定位揭示目标:**由当前选择派生**(#13,2026-12-03 复核)。
+ *
+ * 背景:揭示原本由定位链用一次性选项写进 `detailStore.locateTarget`,那条记录会在
+ * 「关闭详情 / 返回点位 / 切模式 / 改图例」时被清空;此后任何一次设备层重算读不到它,
+ * 揭示行就被撤下 —— 表现是「定位成功之后图标与浮层锚定又没了」。
+ *
+ * 选择本来就是「用户正在看谁」的唯一真相,揭示只是它的投影,所以改成纯函数派生:
+ * 选择清空,揭示自然消失;选择还在,数据一到揭示就补上,谁都不用记得写、记得清。
+ *
+ * 只做**同步**派生:坐标能从地图摘要(独立设备带自身坐标)或已加载的点位设备卡取到才算数。
+ * 取不到时返回 null,由调用方兜底(例如坐标只在设备档案里、要异步取的情形)。
+ */
+import { DETAIL_LEVEL } from './detailFlow.js'
+import { MAP_OBJECT_KIND } from './mapSummary.js'
+
+/** 设备卡/地图对象 → 可揭示设备(只留揭示需要的字段)。 */
+function deviceShape(source, fallbackIndustry = '') {
+    if (!source) return null
+    if (!Number.isFinite(source.longitude) || !Number.isFinite(source.latitude)) return null
+    return {
+        kind: source.kind || 'monitoring-device',
+        code: source.code,
+        name: source.name || source.code,
+        typeName: source.typeName || '',
+        // 设备卡契约实测没有 industry:必须继承所属点位,否则揭示点中心的内层类型徽标是空的(#135)。
+        industry: source.industry || fallbackIndustry || '',
+        status: source.status || '',
+        longitude: source.longitude,
+        latitude: source.latitude,
+        coordinate: source.coordinate || { state: 'VALID', renderable: true, crs: 'WGS84' },
+    }
+}
+
+/**
+ * @param {object} params
+ * @param {object} params.selection 当前两级详情选择
+ * @param {Array} [params.objects] 已加载的地图摘要对象
+ * @param {object|null} [params.pointDetail] 已加载的点位摘要(含 `devices[]`)
+ * @returns {{code:string, deviceCode:string, device:object}|null}
+ */
+export function deriveLocateReveal({ selection, objects = [], pointDetail = null } = {}) {
+    const current = selection || {}
+    if (current.level !== DETAIL_LEVEL.EQUIPMENT) return null
+    const deviceCode = String(current.deviceCode || '').trim()
+    if (!deviceCode) return null
+    const pointCode = String(current.pointCode || '').trim()
+
+    if (pointCode) {
+        const data = pointDetail && pointDetail.code === pointCode ? pointDetail : null
+        const cards = data && Array.isArray(data.devices) ? data.devices : []
+        // 行业继承的顺序必须与设备图层的正常行一致(`planAssociatedDevices` 用摘要点位的 industry):
+        // 设备卡 → 点位摘要 → **地图摘要里的宿主点位**。少最后一档就是 2026-12-03 复发的
+        // 「图标里没有类型徽标」:点位详情有时不带 industry,揭示行 industry 为空又把带徽标的
+        // 计划行顶掉了(#135 修过一次,这一轮按同因再修)。
+        const host = (Array.isArray(objects) ? objects : []).find(
+            (item) => item && item.kind === MAP_OBJECT_KIND.MONITORING_POINT && item.code === pointCode,
+        ) || null
+        const fallbackIndustry = (data && data.industry) || (host && host.industry) || ''
+        const device = deviceShape(cards.find((item) => item && item.code === deviceCode), fallbackIndustry)
+        // 关联设备:`code` 仍是宿主点位(与定位链同一口径),设备卡只用来取设备级坐标。
+        return device ? { code: pointCode, deviceCode, device } : null
+    }
+
+    const object = (Array.isArray(objects) ? objects : []).find((item) => item && item.code === deviceCode) || null
+    const device = deviceShape(object)
+    // 独立设备:它自己就是地图对象,`code` 用设备编码、`deviceCode` 留空(与 #131 同一口径)。
+    return device ? { code: deviceCode, deviceCode: '', device } : null
+}

+ 89 - 0
src/modules/cockpit/domain/locateSteps.js

@@ -0,0 +1,89 @@
+/**
+ * 定位的**统一计划**(#13 收尾重构)。
+ *
+ * 一次定位,无论目标是监测点、关联设备还是未关联设备,最终都落成同样三件事:
+ *   ① 相机到目标坐标;② 目标点可见(揭示行);③ 详情面板展开。
+ * 过去这三件事散在 `pointLocateStore.locateMapObject` 的分支里,每加一种目标就复制一份
+ * "先飞再开/先开再飞"的编排,出现了同一个缺陷(徽标丢失、面板不锚、图标不出)在多个分支
+ * 分别复发的局面。
+ *
+ * 这里把**判定**收成纯函数:给定目标编码与已加载数据,输出一份计划
+ * (飞谁、什么档、要不要先解析设备、开哪一级详情、揭示谁)。执行侧只按计划做上面三件事。
+ *
+ * 设备坐标的解析(点位设备卡 → 设备档案)是异步 IO,**不放在本层**:计划只说明
+ * `needsDevice` 与 `devicePointCode`,由 store 去取。
+ */
+import { MAP_OBJECT_KIND } from './mapSummary.js'
+import { LOCATE_RESULT, planLocate } from './mapLocate.js'
+
+/** 定位目标类型(与 `pointLocateStore.locateTarget` 的入参一致)。 */
+export const LOCATE_TARGET_KIND = {
+    MAP_OBJECT: 'map-object',
+    EVENT: 'event',
+    FACILITY: 'facility',
+}
+
+/** 定位后要展开的详情级别。 */
+export const DETAIL_STEP = {
+    NONE: '',
+    POINT: 'point',
+    DEVICE: 'device',
+}
+
+/**
+ * 地图对象(监测点 / 关联设备 / 未关联设备)的定位计划。
+ *
+ * @param {object} params
+ * @param {string} params.code 目标编码(监测点编码或设备编码)
+ * @param {Array} [params.objects] 已加载的地图摘要对象
+ * @param {boolean} [params.mapReady] 地图能否接受相机指令
+ * @returns {{
+ *   kind: string, result: string, reasonText: string,
+ *   code: string, pointCode: string, deviceCode: string,
+ *   object: object|null, cameraTier: string, needsDevice: boolean,
+ *   devicePointCode: string, open: {level:string, pointCode:string, deviceCode:string}|null,
+ *   reveal: {code:string, deviceCode:string}|null, archiveCode: string
+ * }}
+ */
+export function planMapObjectLocate({ code = '', objects = [], mapReady = true } = {}) {
+    const plan = planLocate({ objects, pointCode: code, mapReady })
+    const object = plan.object || null
+    const isPoint = Boolean(object && object.kind === MAP_OBJECT_KIND.MONITORING_POINT)
+    const associated = isPoint && Boolean(plan.deviceCode)
+    const base = {
+        kind: LOCATE_TARGET_KIND.MAP_OBJECT,
+        result: plan.result,
+        reasonText: plan.reasonText,
+        code,
+        pointCode: plan.pointCode,
+        deviceCode: plan.deviceCode || '',
+        object,
+        cameraTier: '',
+        needsDevice: false,
+        devicePointCode: '',
+        open: null,
+        reveal: null,
+        archiveCode: '',
+    }
+
+    // 目标不在当前摘要里(还没上图 / 被筛选掉):只留一条"退到设备档案取坐标"的计划。
+    // 档案取不到时执行侧直接报原结果,不伪造定位成功。
+    if (plan.result !== LOCATE_RESULT.OK) {
+        return { ...base, needsDevice: true, cameraTier: 'device', archiveCode: code }
+    }
+
+    return {
+        ...base,
+        // 关联设备要越过宿主点位飞**设备自身**坐标(设备档);未关联设备本身即设备;点位按点位档。
+        cameraTier: isPoint && !associated ? '' : 'device',
+        needsDevice: associated || !isPoint,
+        devicePointCode: associated ? object.code : '',
+        open: isPoint
+            ? (associated
+                ? { level: DETAIL_STEP.DEVICE, pointCode: object.code, deviceCode: plan.deviceCode }
+                : { level: DETAIL_STEP.POINT, pointCode: object.code, deviceCode: '' })
+            : { level: DETAIL_STEP.DEVICE, pointCode: '', deviceCode: code },
+        // 揭示目标:关联设备揭示的是宿主点位 + 设备;未关联设备揭示的是它自己(deviceCode 留空)。
+        reveal: { code: isPoint ? object.code : code, deviceCode: plan.deviceCode || '' },
+    }
+}

+ 8 - 3
src/modules/cockpit/domain/modeLayerPlan.js

@@ -264,11 +264,16 @@ function selectionVisible({ mode, selection, objects, markers, associatedDevices
         //   点设备卡片后 `selectionVisible=false` ⇒ 外壳 `<aside v-if>` 卸载 ⇒ 摘要面板消失。)
         const row = (Array.isArray(associatedDevices) ? associatedDevices : [])
             .find((item) => item && item.code === current.deviceCode)
-        if (row) {
+        if (row && row.pointCode) {
             const parent = (Array.isArray(objects) ? objects : []).find((item) =>
                 item && item.kind === MAP_OBJECT_KIND.MONITORING_POINT && item.code === row.pointCode)
-            return Boolean(parent && isAssociatedDeviceVisible(mode, row.status) &&
-                (mode !== MODE_LAYER.WARNING_RESPONSE || isAttentionPoint(parent, abnormalCodes, statusIndex)))
+            if (parent) {
+                return Boolean(isAssociatedDeviceVisible(mode, row.status) &&
+                    (mode !== MODE_LAYER.WARNING_RESPONSE || isAttentionPoint(parent, abnormalCodes, statusIndex)))
+            }
+            // 独立设备的**定位揭示行**也长在 `associatedDevices` 里,但它的 `pointCode` 是设备自己,
+            // 没有宿主监测点。按"关联设备"判会让 `parent` 恒为 null ⇒ 面板被误判成"不该显示"
+            // 而整体隐藏(2026-12-03 复核 #13)。这类行落到下面的未关联设备口径。
         }
         // 未关联设备:以地图对象身份判(基础设施整体隐藏;预警处置只认异常设备/预警标签)。
         const object = (Array.isArray(objects) ? objects : [])

+ 35 - 12
src/modules/cockpit/stores/deviceLayerStore.js

@@ -24,6 +24,7 @@ import {
     associatedLegend,
     countPlacements,
     crossEndpointNotice,
+    mergeRevealRow,
     planAssociatedDevices,
     uniqueCodes,
 } from '../domain/deviceLayer.js'
@@ -231,16 +232,29 @@ export const useDeviceLayerStore = defineStore('deviceLayerStore', () => {
             if (revealDevice) {
                 token += 1
                 pointCode.value = ''
-                rows.value = markRaw([revealDevice])
-                counts.value = countPlacements([revealDevice])
+                const layerRows = [revealDevice]
+                rows.value = markRaw(layerRows)
+                counts.value = countPlacements(layerRows)
                 total.value = 1
                 legend.value = associatedLegend(counts.value)
                 overlap.value = { k: 1, n: 1, maxFan: 10, groups: [], active: false, degraded: false }
                 effectsPlan.value = null
                 notice.value = { risky: false, text: '' }
-                painted.value = false
                 lastPlanKey = ''
-                return { total: 1, drawn: 1 }
+                // **必须发布到地图服务**:只写 store 不发布,引擎里没有实体、DOM 覆盖层没有节点,
+                // 表现就是「定位成功但图标不出现」——这是 2026-12-03 复核 #13 抓到的真根因
+                // (与下面正常路径同一个发布口,不能另开一条)。
+                const mine = token
+                painted.value = syncAssociatedDevices(layerRows, {
+                    maxFan: options.maxFan,
+                    overlapGroups: [],
+                    effects: null,
+                })
+                if (painted.value) clearEngineRetry()
+                else scheduleEngineRetry(options)
+                syncDeviceReactions()
+                if (mine === token) loading.value = false
+                return { total: 1, drawn: renderableRows(layerRows).length }
             }
             token += 1
             pointCode.value = ''
@@ -326,7 +340,11 @@ export const useDeviceLayerStore = defineStore('deviceLayerStore', () => {
             const forced = reveal.device ? revealRow(reveal.device, reveal.code) : null
             if (forced) {
                 const exclude = reveal.deviceCode || (reveal.device && reveal.device.code) || reveal.code || ''
-                layerRows = [...layerRows.filter((row) => row.code !== exclude), forced]
+                // 揭示行会**顶掉**计划里本来就有的那一行,所以它缺的可视字段必须从被顶掉的行继承:
+                // 上游(定位链)拿不到行业时,直接用它替换会把带类型徽标的设备点换成没有徽标的
+                // ——「图标在、中心徽标没了」正是这么复发的(#135 修过,2026-12-03 再修一次)。
+                const replaced = layerRows.find((row) => row.code === exclude) || null
+                layerRows = [...layerRows.filter((row) => row.code !== exclude), mergeRevealRow(forced, replaced)]
             } else {
                 layerRows = layerRows.map((row) => (row.code === reveal.deviceCode && row.placement !== DEVICE_PLACEMENT.DRAWN
                     ? {
@@ -455,7 +473,10 @@ export const useDeviceLayerStore = defineStore('deviceLayerStore', () => {
      *   ③ 按**层级变化**决定镜头怎么动(`planDeviceFlight` 纯判定:首次飞设备档、
      *      A→B 只换中心、返回点位回点位档)。
      * @param {string} deviceCode 设备编码
-     * @param {object} [options] `{ fly }` 传 false 表示只换选中不联动镜头(三维 hover 不调它)
+     * @param {object} [options] `{ fly, refly }`:
+     *   · `fly: false` 只换选中不联动镜头(三维 hover 不调它);
+     *   `· refly: true` **强制重新飞一次设备档** —— 给"详情已开但目标离开了视口"的
+     *     重新定位入口用:同设备同层级时 `planDeviceFlight` 返回 NONE,不强制就成了死按钮。
      */
     function selectDevice(deviceCode, options = {}) {
         const code = typeof deviceCode === 'string' ? deviceCode.trim() : ''
@@ -470,12 +491,14 @@ export const useDeviceLayerStore = defineStore('deviceLayerStore', () => {
         // 进设备级(**唯一**的取数入口,票 11 的契约)。
         void detailStore.selectDevice(code)
 
-        const flight = planDeviceFlight({
-            fromLevel: before.level,
-            toLevel: DETAIL_LEVEL.EQUIPMENT,
-            fromDeviceCode: before.deviceCode,
-            toDeviceCode: code,
-        })
+        const flight = options.refly === true
+            ? DEVICE_FLIGHT.DEVICE_TIER
+            : planDeviceFlight({
+                fromLevel: before.level,
+                toLevel: DETAIL_LEVEL.EQUIPMENT,
+                fromDeviceCode: before.deviceCode,
+                toDeviceCode: code,
+            })
         if (options.fly !== false) applyDeviceFlight(flight, code)
 
         lastLevel = DETAIL_LEVEL.EQUIPMENT

+ 84 - 71
src/modules/cockpit/stores/pointLocateStore.js

@@ -26,8 +26,10 @@ import {
     locateFacilityPoint,
     locateMonitoringPoint,
 } from '../services/mapService.js'
-import { LOCATE_RESULT, locateFailureText, planLocate } from '../domain/mapLocate.js'
+import { LOCATE_RESULT, locateFailureText } from '../domain/mapLocate.js'
 import { EVENT_DETAIL_RESULT, planEventLocate } from '../domain/eventDetail.js'
+// 定位的判定收在 domain(`planMapObjectLocate`),本 store 只按计划执行三件事。
+import { DETAIL_STEP, planMapObjectLocate } from '../domain/locateSteps.js'
 import { TERRAIN_LOCATE_REASON } from '../domain/pointLocate.js'
 import { MAP_OBJECT_KIND } from '../domain/mapSummary.js'
 import { facilityIdentity, resolveFacilityPoint } from '../domain/facilitySelection.js'
@@ -100,35 +102,94 @@ export const usePointLocateStore = defineStore('pointLocateStore', () => {
         }
     }
 
-    async function locateMapObject(code, options = {}) {
-        const objects = options.objects || mapStore.summary.objects
-        const mapReady = options.mapReady === undefined ? !!getCameraState() : !!options.mapReady
-        const flyPoint = options.flyPoint || locateMonitoringPoint
-        const openPoint = options.openPoint || ((value, opts) => detailStore.openPoint(value, opts))
-        const openDevice = options.openDevice || ((value, opts) => detailStore.openDevice(value, opts))
-        const selectDevice = options.selectDevice || ((value, opts) => detailStore.selectDevice(value, opts))
+    /**
+     * 关联设备 / 未关联设备:解析"揭示来源"要的那一行设备(点位设备卡 → 设备档案)。
+     * 关联设备**无论调用方是否已经给了设备行**都要先打开宿主点位详情:那一份点位摘要是
+     * 设备卡片与「返回点位」的依据,不是可省的中间态(t131 闸门钉着这一步)。
+     */
+    async function resolveLocateDevice(plan, deps, preset = null) {
+        const object = plan.object
+        if (!object) return preset
+        // 未关联设备:它自己就是设备行,坐标已在摘要里。
+        if (object.kind !== MAP_OBJECT_KIND.MONITORING_POINT) return preset || object
+        // 关联设备:设备坐标不在摘要里,先打开宿主点位详情取设备卡,卡片缺失再退设备档案。
+        await deps.openPoint(object.code)
+        if (preset) return preset
+        const pointDetail = detailStore.sections && detailStore.sections.pointDetail
+            && detailStore.sections.pointDetail.data
+        // 设备卡没有 industry,内层类型徽标继承所属点位(与正常关联设备行同一口径)。
+        const pointIndustry = (pointDetail && pointDetail.industry) || object.industry || ''
+        const device = deviceFromCard(detailStore.deviceCard(object.code, plan.deviceCode), pointIndustry)
+            || await deviceFromAggregate(plan.deviceCode, pointIndustry)
+        return device && !device.industry ? { ...device, industry: pointIndustry } : device
+    }
+
+    /** 按计划展开详情(第三件事)。设备级保留宿主点位编码,供「返回点位」使用。 */
+    async function openLocateDetail(open, reveal, deps) {
+        if (!open) return
+        if (open.level === DETAIL_STEP.DEVICE) {
+            if (open.pointCode) return deps.selectDevice(open.deviceCode, { locateTarget: reveal })
+            return deps.openDevice(open.deviceCode, { locateTarget: reveal })
+        }
+        if (open.level === DETAIL_STEP.POINT) return deps.openPoint(open.pointCode, { locateTarget: reveal })
+    }
 
-        const plan = planLocate({ objects, pointCode: code, mapReady })
+    /**
+     * 一次定位的**统一执行**:① 相机飞到目标坐标 ② 揭示目标点 ③ 展开详情。
+     * 后两件与飞行**并行**,且不依赖飞行结果 —— 地形/引擎导致的飞行失败不该连带详情也打不开
+     * (维护者 2026-12-02:只飞到位置、看不到设备详情)。
+     * @returns {Promise<{applied:boolean, failure:string}>}
+     */
+    async function runLocateSteps(plan, deps) {
+        const device = deps.device || null
+        let failure = TERRAIN_LOCATE_REASON.MAP
+        const camera = device || plan.object
+        const flying = camera
+            ? Promise.resolve()
+                .then(() => deps.flyPoint(camera, {
+                    ...(device && plan.cameraTier === 'device' ? { tier: 'device' } : {}),
+                    onFailure: (reason) => { failure = reason },
+                }))
+                .catch(() => false)
+            : Promise.resolve(false)
+        const reveal = plan.reveal ? { ...plan.reveal, ...(device ? { device } : {}) } : null
+        await openLocateDetail(plan.open, reveal, deps)
+        const applied = await flying
+        return { applied, failure }
+    }
+
+    async function locateMapObject(code, options = {}) {
+        const deps = {
+            flyPoint: options.flyPoint || locateMonitoringPoint,
+            openPoint: options.openPoint || ((value, opts) => detailStore.openPoint(value, opts)),
+            openDevice: options.openDevice || ((value, opts) => detailStore.openDevice(value, opts)),
+            selectDevice: options.selectDevice || ((value, opts) => detailStore.selectDevice(value, opts)),
+        }
+        const plan = planMapObjectLocate({
+            code,
+            objects: options.objects || mapStore.summary.objects,
+            mapReady: options.mapReady === undefined ? !!getCameraState() : !!options.mapReady,
+        })
         const base = {
             result: plan.result,
             code,
             pointCode: plan.pointCode,
-            deviceCode: plan.deviceCode || '',
+            deviceCode: plan.deviceCode,
             reasonText: plan.reasonText,
         }
+
+        // 目标还没上图:退到设备档案取坐标;档案也拿不到就如实报原结果(不伪造定位成功)。
         if (plan.result !== LOCATE_RESULT.OK) {
-            // 目标不在当前地图摘要里(还没上图 / 被筛选掉):关联设备仍可以从**设备档案**取坐标。
-            // 不补这条,「点定位设备」的表现就是什么都没发生(维护者 2026-12-02)。
-            const archive = await deviceFromAggregate(code)
+            const archive = await deviceFromAggregate(plan.archiveCode)
             if (!archive) return setLocate(base)
-            let failure = TERRAIN_LOCATE_REASON.MAP
-            const flying = Promise.resolve()
-                .then(() => flyPoint(archive, { tier: 'device', onFailure: (reason) => { failure = reason } }))
-                .catch(() => false)
-            // 揭示目标带上设备行与设备编码:图层能补点,详情面板的可见性判据也认得出它。
-            const reveal = { code, deviceCode: archive.code || code, device: archive }
-            await openDevice(code, { locateTarget: reveal })
-            const applied = await flying
+            const fallback = {
+                ...plan,
+                object: archive,
+                cameraTier: 'device',
+                open: { level: DETAIL_STEP.DEVICE, pointCode: '', deviceCode: code },
+                reveal: { code, deviceCode: archive.code || code },
+            }
+            const { applied, failure } = await runLocateSteps(fallback, { ...deps, device: archive })
             return setLocate({
                 result: applied === true ? LOCATE_RESULT.OK : LOCATE_RESULT.UNAVAILABLE,
                 code,
@@ -138,56 +199,8 @@ export const usePointLocateStore = defineStore('pointLocateStore', () => {
             })
         }
 
-        // #131 补充:关联设备要**越过宿主监测点**直接飞到设备自己的坐标。
-        // 设备坐标不在 map-snapshot(关联设备不带坐标),必须先打开宿主点位详情,
-        // 从设备卡取 `longitude/latitude/coordinateValidation`;卡片缺失再退到设备档案。
-        let device = options.device || null
-        if (plan.object.kind === MAP_OBJECT_KIND.MONITORING_POINT && plan.deviceCode) {
-            await openPoint(plan.object.code)
-            const pointDetail = detailStore.sections && detailStore.sections.pointDetail
-                && detailStore.sections.pointDetail.data
-            // 设备卡没有 industry,内层类型徽标继承所属点位(与正常关联设备行同一口径)。
-            const pointIndustry = (pointDetail && pointDetail.industry) || plan.object.industry || ''
-            if (!device) device = deviceFromCard(detailStore.deviceCard(plan.object.code, plan.deviceCode), pointIndustry)
-            if (!device) device = await deviceFromAggregate(plan.deviceCode, pointIndustry)
-            if (device && !device.industry) device = { ...device, industry: pointIndustry }
-        }
-
-        // 独立设备没有宿主点位:对象自身就是设备,把它作为揭示来源交给设备图层,
-        // 否则揭示目标里没有设备行,图层无处可画(表现就是「定位成功但图标丢了」)。
-        if (!device && plan.object.kind !== MAP_OBJECT_KIND.MONITORING_POINT) device = plan.object
-
-        // 揭示目标 = 要看的对象;关联设备把设备坐标一起带给设备图层,
-        // 使它在当前模式/状态(例如 NORMAL)下也能临时画出并锚定详情。
-        const reveal = {
-            code: plan.object.code,
-            deviceCode: plan.deviceCode || '',
-            ...(device ? { device } : {}),
-        }
-
-        // 飞行与开详情**并行**,而且开详情不依赖飞行结果:
-        // 定位的意义是「看到它」,地形/引擎导致的飞行失败不该连带详情也打不开
-        // (维护者 2026-12-02:只飞到位置、看不到设备详情)。
-        let failure = TERRAIN_LOCATE_REASON.MAP
-        const flying = Promise.resolve()
-            .then(() => flyPoint(device || plan.object, {
-                ...(device ? { tier: 'device' } : {}),
-                onFailure: (reason) => { failure = reason },
-            }))
-            .catch(() => false)
-
-        if (plan.object.kind === MAP_OBJECT_KIND.MONITORING_POINT) {
-            if (plan.deviceCode) {
-                await selectDevice(plan.deviceCode, { locateTarget: reveal })
-            } else {
-                await openPoint(plan.object.code, { locateTarget: reveal })
-            }
-        } else {
-            // 独立设备没有宿主点位:直接用设备编码进设备级详情(openDevice('') 打不开任何东西)。
-            await openDevice(plan.pointCode || code, { locateTarget: reveal })
-        }
-
-        const applied = await flying
+        const device = plan.needsDevice ? await resolveLocateDevice(plan, deps, options.device || null) : null
+        const { applied, failure } = await runLocateSteps(plan, { ...deps, device })
         if (applied !== true) {
             return setLocate({ ...base, result: LOCATE_RESULT.UNAVAILABLE, reasonText: locateFailureText(failure) })
         }

+ 75 - 0
tests/locate-steps.test.js

@@ -0,0 +1,75 @@
+/**
+ * 定位计划闸门(#13 收尾重构):
+ * 一次定位最终都落成三件事 —— ① 相机到目标坐标 ② 目标点可见(揭示)③ 详情面板展开。
+ * 本测试钉住**计划层**对三种目标的判定,执行侧(pointLocateStore)只按计划做事。
+ */
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+
+import { DETAIL_STEP, planMapObjectLocate } from '../src/modules/cockpit/domain/locateSteps.js'
+
+const coordinate = { state: 'VALID', reason: null, renderable: true, crs: 'WGS84' }
+const point = {
+    kind: 'monitoring-point',
+    code: 'MP-T',
+    name: '测试点位',
+    status: 'NORMAL',
+    industry: 'DRAINAGE',
+    deviceCodes: ['DEV-A'],
+    longitude: 110.4,
+    latitude: 28.4,
+    coordinate,
+}
+const independent = {
+    kind: 'unassociated-equipment',
+    code: 'DEV-FREE',
+    name: '独立设备',
+    status: 'NORMAL',
+    longitude: 110.41,
+    latitude: 28.41,
+    coordinate,
+}
+
+test('监测点:飞到点位档、开点位级详情、揭示点位自身', () => {
+    const plan = planMapObjectLocate({ code: 'MP-T', objects: [point], mapReady: true })
+    assert.equal(plan.result, 'ok')
+    assert.equal(plan.cameraTier, '', '点位按点位档(不带 device 档)')
+    assert.equal(plan.needsDevice, false, '点位不需要解析设备行')
+    assert.deepEqual(plan.open, { level: DETAIL_STEP.POINT, pointCode: 'MP-T', deviceCode: '' })
+    assert.deepEqual(plan.reveal, { code: 'MP-T', deviceCode: '' })
+})
+
+test('关联设备:越过宿主点位飞设备档、开设备级详情(保留宿主点位)、揭示宿主+设备', () => {
+    const plan = planMapObjectLocate({ code: 'DEV-A', objects: [point], mapReady: true })
+    assert.equal(plan.result, 'ok')
+    assert.equal(plan.cameraTier, 'device')
+    assert.equal(plan.needsDevice, true, '关联设备坐标要先去设备卡/档案解析')
+    assert.equal(plan.devicePointCode, 'MP-T', '解析设备时要知道宿主点位')
+    assert.deepEqual(plan.open, { level: DETAIL_STEP.DEVICE, pointCode: 'MP-T', deviceCode: 'DEV-A' })
+    assert.deepEqual(plan.reveal, { code: 'MP-T', deviceCode: 'DEV-A' })
+})
+
+test('未关联设备:它自己就是相机目标与揭示来源,设备级的点位编码为空', () => {
+    const plan = planMapObjectLocate({ code: 'DEV-FREE', objects: [independent], mapReady: true })
+    assert.equal(plan.result, 'ok')
+    assert.equal(plan.cameraTier, 'device')
+    assert.equal(plan.needsDevice, true)
+    assert.equal(plan.devicePointCode, '')
+    assert.deepEqual(plan.open, { level: DETAIL_STEP.DEVICE, pointCode: '', deviceCode: 'DEV-FREE' })
+    assert.deepEqual(plan.reveal, { code: 'DEV-FREE', deviceCode: '' })
+})
+
+test('目标不在摘要里:保留原因,并给出「退设备档案取坐标」的计划', () => {
+    const plan = planMapObjectLocate({ code: 'DEV-NOT-LOADED', objects: [point], mapReady: true })
+    assert.equal(plan.result, 'missing')
+    assert.equal(plan.archiveCode, 'DEV-NOT-LOADED', '执行侧据此去设备档案兜底')
+    assert.equal(plan.open, null, '计划层不假装能开详情')
+    assert.equal(plan.reveal, null)
+})
+
+test('地图未就绪:结果如实为不可用,不改判定为可定位', () => {
+    const plan = planMapObjectLocate({ code: 'MP-T', objects: [point], mapReady: false })
+    assert.equal(plan.result, 'unavailable')
+    assert.equal(plan.open, null)
+    assert.equal(plan.needsDevice, true)
+})

+ 170 - 0
tests/t13-locate-reveal.test.js

@@ -0,0 +1,170 @@
+/**
+ * #13 回归:定位揭示目标由**选择**派生、揭示行必须发布到地图服务、
+ * 独立设备的详情锚点必须认设备图层标记。
+ *
+ * 这三条分别对应 .scratch/cockpit-emergency-detail/research/13-locate-reveal-and-anchor.md
+ * 里的根因 A / B / C,都是纯逻辑可断言的,不依赖网络与浏览器。
+ */
+import assert from 'node:assert/strict'
+import { after, test } from 'node:test'
+import { createPinia, setActivePinia } from 'pinia'
+
+import { deriveLocateReveal } from '../src/modules/cockpit/domain/locateReveal.js'
+import { mergeRevealRow } from '../src/modules/cockpit/domain/deviceLayer.js'
+import { resolveDetailAnchor } from '../src/modules/cockpit/domain/detailAnchor.js'
+import { planModeLayers, MODE_LAYER } from '../src/modules/cockpit/domain/modeLayerPlan.js'
+import { __setInstanceForTest } from '../src/modules/cockpit/services/mapService.js'
+import { useDeviceLayerStore } from '../src/modules/cockpit/stores/deviceLayerStore.js'
+
+const DEVICE_CODE = '2607230190000022'
+const coordinate = { state: 'VALID', reason: null, renderable: true, crs: 'WGS84' }
+/** 独立设备:出现在地图摘要里,自己是地图对象(没有宿主监测点)。 */
+const independent = {
+    kind: 'unassociated-equipment',
+    code: DEVICE_CODE,
+    name: '可燃气体-022',
+    status: 'NORMAL',
+    industry: 'GAS',
+    longitude: 110.361206,
+    latitude: 28.45557,
+    coordinate,
+}
+const equipmentSelection = { level: 'equipment', pointCode: '', deviceCode: DEVICE_CODE }
+const pointCode = 'MP-T13'
+const pointSelection = { level: 'equipment', pointCode, deviceCode: 'DEV-T13' }
+const pointDetail = { code: pointCode, industry: 'DRAINAGE', devices: [{ code: 'DEV-T13', name: '排水设备', status: 'NORMAL', longitude: 110.4, latitude: 28.4 }] }
+
+after(() => __setInstanceForTest(null))
+
+test('揭示目标:独立设备由选择派生,取摘要里的自身坐标', () => {
+    const reveal = deriveLocateReveal({ selection: equipmentSelection, objects: [independent] })
+    assert.ok(reveal, '设备级选择应派生揭示目标')
+    assert.equal(reveal.code, DEVICE_CODE)
+    assert.equal(reveal.deviceCode, '', '独立设备的 deviceCode 留空(与 #131 同一口径)')
+    assert.equal(reveal.device.longitude, independent.longitude)
+    assert.equal(reveal.device.latitude, independent.latitude)
+})
+
+test('揭示目标:关联设备由点位设备卡派生,行业继承点位', () => {
+    const reveal = deriveLocateReveal({ selection: pointSelection, pointDetail })
+    assert.ok(reveal)
+    assert.equal(reveal.code, pointCode, '关联设备的 code 仍是宿主点位')
+    assert.equal(reveal.deviceCode, 'DEV-T13')
+    assert.equal(reveal.device.industry, 'DRAINAGE', '设备卡没有 industry 时继承点位(#135)')
+})
+
+test('类型徽标不复发(#135):点位详情没给 industry 时继承摘要里的宿主点位', () => {
+    const hostPoint = {
+        kind: 'monitoring-point',
+        code: pointCode,
+        name: '城北排水监测点01',
+        industry: 'DRAINAGE',
+        deviceCodes: ['DEV-T13'],
+        longitude: 110.4,
+        latitude: 28.4,
+        coordinate,
+    }
+    // 真实数据形态:点位详情不带 industry,设备卡也不带(契约如此)。
+    const detailWithoutIndustry = { code: pointCode, devices: [{ code: 'DEV-T13', name: '排水设备', longitude: 110.4, latitude: 28.4 }] }
+    const reveal = deriveLocateReveal({ selection: pointSelection, objects: [hostPoint], pointDetail: detailWithoutIndustry })
+    assert.ok(reveal)
+    assert.equal(reveal.device.industry, 'DRAINAGE', '行业必须继承摘要里的宿主点位,否则图标中心徽标为空')
+})
+
+test('类型徽标不复发(#135):揭示行缺可视字段时从被顶掉的计划行继承', () => {
+    const forced = { code: DEVICE_CODE, pointCode: DEVICE_CODE, industry: '', typeName: '', placement: 'drawn' }
+    const replaced = { code: DEVICE_CODE, pointCode: 'MP-T13', industry: 'GAS', typeName: '可燃气体检测终端', placement: 'hidden' }
+    const merged = mergeRevealRow(forced, replaced)
+    assert.equal(merged.industry, 'GAS', '隐含行业不能让揭示行把带徽标的行换成空徽标')
+    assert.equal(merged.typeName, '可燃气体检测终端')
+    assert.equal(merged.placement, 'drawn', '揭示行自己的可上图事实不能被覆盖')
+    // 揭示行自带行业时以它为准;没有被顶掉的行时原样返回。
+    assert.equal(mergeRevealRow({ ...forced, industry: 'WATER_SUPPLY' }, replaced).industry, 'WATER_SUPPLY')
+    assert.equal(mergeRevealRow(forced, null).industry, '')
+})
+
+test('揭示目标:选择关闭 / 非设备级 / 无坐标都不派生', () => {
+    assert.equal(deriveLocateReveal({ selection: { level: 'none', pointCode: '', deviceCode: '' }, objects: [independent] }), null)
+    assert.equal(deriveLocateReveal({ selection: { level: 'point', pointCode: 'MP-1', deviceCode: '' }, objects: [independent] }), null)
+    assert.equal(deriveLocateReveal({ selection: equipmentSelection, objects: [] }), null)
+    const noCoordinate = { ...independent, longitude: null }
+    assert.equal(deriveLocateReveal({ selection: equipmentSelection, objects: [noCoordinate] }), null)
+})
+
+test('锚点:独立设备优先认设备图层揭示行,没有行才退回摘要标记', () => {
+    const revealRow = {
+        code: DEVICE_CODE,
+        pointCode: DEVICE_CODE,
+        longitude: independent.longitude,
+        latitude: independent.latitude,
+        coordinate,
+        placement: 'drawn',
+    }
+    const anchored = resolveDetailAnchor({
+        selection: equipmentSelection,
+        objects: [independent],
+        devices: [revealRow],
+    })
+    assert.equal(anchored.kind, 'monitoring-device', '揭示行是设备图层标记,锚点必须同一族')
+    assert.equal(anchored.code, DEVICE_CODE)
+    assert.equal(anchored.pointCode, DEVICE_CODE)
+
+    const fallback = resolveDetailAnchor({ selection: equipmentSelection, objects: [independent], devices: [] })
+    assert.equal(fallback.kind, 'unassociated-equipment', '没有揭示行时保持原口径')
+})
+
+test('设备级可见性:独立设备的揭示行不会被误判成"宿主点位缺失的关联设备"', () => {
+    const revealRow = {
+        code: DEVICE_CODE,
+        pointCode: DEVICE_CODE,
+        status: 'NORMAL',
+        longitude: independent.longitude,
+        latitude: independent.latitude,
+        coordinate,
+        placement: 'drawn',
+    }
+    const plan = planModeLayers({
+        mode: MODE_LAYER.OVERVIEW,
+        objects: [independent],
+        abnormalDevices: [],
+        associatedDevices: [revealRow],
+        deviceFilter: null,
+        deviceFacts: null,
+        locateTarget: null,
+        selection: equipmentSelection,
+        entered: true,
+    })
+    assert.equal(plan.selection.visible, true, '揭示行的 pointCode 不是宿主点位,不该让面板整体隐藏')
+})
+
+test('揭示行必须发布到地图服务(只写 store 不发布 = 图标永远不出现)', () => {
+    setActivePinia(createPinia())
+    const published = []
+    __setInstanceForTest({
+        viewer: {},
+        host: null,
+        engine: {
+            syncAssociatedDevices(viewer, devices) {
+                published.push(devices)
+                return { rendered: devices.length, skipped: 0 }
+            },
+            applyDeviceReactions() {},
+            applyDeviceEffects() { return false },
+            clearDeviceLead() {},
+            syncDeviceLead() { return true },
+        },
+    })
+    const store = useDeviceLayerStore()
+    const result = store.syncForSelection({
+        revealDevice: { code: DEVICE_CODE, deviceCode: '', device: independent },
+    })
+
+    assert.equal(published.length, 1, '揭示行必须交给地图服务')
+    assert.equal(published[0].length, 1)
+    assert.equal(published[0][0].code, DEVICE_CODE)
+    assert.equal(published[0][0].placement, 'drawn')
+    assert.equal(store.rows.length, 1)
+    assert.equal(result.total, 1)
+    assert.equal(result.drawn, 1)
+    __setInstanceForTest(null)
+})