Explorar el Código

fix(cockpit): 基础设施模式也揭示定位目标,设施卡补地下视图入口

- 定位设备在基础设施模式下「只飞过去、图标与详情都不出现」的根因:
  modeLayerPlan 里有两处「该模式一律不补定位目标」的早退(withLocateTarget 与 selectionVisible)。
  用户正是在基础设施点定位按钮,等于按钮失效。改为只补**被定位的那一个**对象,不改该模式常规图层。
- 管网聚焦打开的是设施卡(不是实体详情抽屉):设施卡的「查看详情」原先只认设施点行,
  而管段不在设施点图层里,所以入口永远不出现。现在补一条按实体身份判定的分支,
  并按详情里的**业务编码**(不是 sourceId)选中地下管线视图。
- 该按钮统一为靠右的蓝色文字「查看详情 →」,并补 data-entity-underground 标记方便走查。
ChenJZ hace 7 horas
padre
commit
c219c4de09

+ 33 - 11
src/modules/cockpit/CockpitShell.vue

@@ -1278,7 +1278,7 @@ function focusWarningType(code) {
     if (!key) return false
     uiStore.setMode('warningResponse')
     eventStore.clearWarningTypeFilter()
-    eventStore.setHistoryTypeFilter(key, warningTypeLabel(key))
+    eventStore.setHistoryTypeFilter(key, warningTypeLabel(key), EVENT_FAMILY.WARNING)
     void eventStore.loadPanels({ mode: EVENT_FAMILY.WARNING, range: '30d' })
     return true
 }
@@ -1291,7 +1291,7 @@ function focusHistoryType(code) {
         eventStore.clearHistoryTypeFilter()
         return true
     }
-    eventStore.setHistoryTypeFilter(key, warningTypeLabel(key))
+    eventStore.setHistoryTypeFilter(key, warningTypeLabel(key), EVENT_FAMILY.WARNING)
     return true
 }
 
@@ -1545,9 +1545,17 @@ const currentFacilityRow = computed(() => {
 const undergroundFacilityComponent = computed(() => facilityAsComponent(currentFacilityRow.value))
 
 /** 设施能否进「地下管线详情视图」:只看自身有没有可渲染的 3D 模型与坐标。 */
-const facilityUndergroundReady = computed(() => Boolean(
-    facilityDetailOpen.value && facilityUndergroundTarget(currentFacilityRow.value),
-))
+/**
+ * 设施卡上的「查看详情」是否可用。
+ *
+ * 常规设施靠「能不能定位到一条真实可见的管段」判定;但管网聚焦打开的就是这张设施卡,
+ * 而管段不在设施点图层里,currentFacilityRow 恒为空 —— 所以补一条按实体身份判定的分支,
+ * 否则管网详情永远看不到这个入口(维护者 2026-12-02)。
+ */
+const facilityUndergroundReady = computed(() => {
+    if (facilityUndergroundTarget(currentFacilityRow.value)) return true
+    return Boolean(entityDetailStore.identity && entityDetailStore.identity.category === 'PIPE_NETWORK')
+})
 
 /** 实体详情抽屉里的地下设施能否进「地下管线详情视图」:管网一定能(按管段编码选中),窨井沿用设施判定。 */
 const undergroundReadyForDetail = computed(() => {
@@ -1643,17 +1651,31 @@ const pipeColorCountsView = computed(() => pipeColorCounts(pipeNetworkStore.laye
  * 其它地下设施仍走原有判定(要有可渲染的 3D 模型与坐标)。
  */
 function openUndergroundFromDetail() {
-    const identity = entityDetailStore.identity
-    if (identity && identity.category === 'PIPE_NETWORK' && identity.id) {
-        return pipeEnhancementStore.select(PIPE_ENHANCEMENT_KIND.PIPE, identity.id)
-    }
+    if (openNetworkUnderground()) return
     openFacilityUnderground()
 }
 
+/**
+ * 管网进地下视图:select 认的是**管段业务编码**,而实体详情的 identity.id 是 sourceId(raw_*),
+ * 所以取详情里的业务编码,退不到才用 identity.id。
+ */
+function openNetworkUnderground() {
+    const identity = entityDetailStore.identity
+    if (!identity || identity.category !== 'PIPE_NETWORK') return false
+    const code = (entityDetailStore.detail && entityDetailStore.detail.displayCode) || identity.code || identity.id
+    if (!code) return false
+    pipeEnhancementStore.select(PIPE_ENHANCEMENT_KIND.PIPE, code)
+    return true
+}
+
 function openFacilityUnderground() {
     const target = facilityUndergroundTarget(currentFacilityRow.value)
-    if (!target) return
-    pipeEnhancementStore.select(target.kind, target.code)
+    if (target) {
+        pipeEnhancementStore.select(target.kind, target.code)
+        return
+    }
+    // 设施卡由管网聚焦打开时没有设施点行,改按实体详情身份进地下视图。
+    openNetworkUnderground()
 }
 
 function selectPipeEnhancement(hit) {

+ 7 - 3
src/modules/cockpit/components/FacilityDetailCard.vue

@@ -22,14 +22,16 @@
             <EntityDetailSections :detail="store.detail" presentation="device" @locate-device="code => emit('locate-device', code)" @focus-network="code => emit('focus-network', code)" @open-work-order="code => emit('open-work-order', code)">
                 <!-- 维护者 2026-11-16:「查看详情」放在「基本信息/业务信息/关联信息」TAB 行右侧。 -->
                 <template #tabs-action>
+                    <!-- 蓝色文字入口,靠页签行右侧(维护者 2026-12-02);两个 data 标记方便走查定位。 -->
                     <button
                         v-if="undergroundReady"
                         type="button"
-                        class="facility-detail__action facility-detail__tabs-action"
+                        class="facility-detail__tabs-action"
                         data-facility-detail-underground
+                        data-entity-underground
                         title="进入地下管线详情视图查看该设施的三维位置"
                         @click="emit('open-underground')"
-                    >查看详情</button>
+                    >查看详情 →</button>
                 </template>
             </EntityDetailSections>
         </div>
@@ -80,7 +82,9 @@ const code = computed(() => store.detail?.displayCode || '未提供')
 .facility-detail__body :deep(.entity-sections__tabs) { display:flex; align-items:center; gap:var(--space-2,8px); }
 .facility-detail__body :deep(.entity-sections__tabs button) { font:inherit; font-size:var(--fs-caption); }
 /* 动作位推到最右(维护者 2026-11-16)。 */
-.facility-detail__tabs-action { margin-left:auto; }
+.facility-detail__tabs-action { margin-left:auto; padding:0; border:0; background:none; color:var(--cyan-hi,#35d8ff); font:inherit; font-size:var(--fs-caption,10.5px); cursor:pointer; white-space:nowrap; }
+.facility-detail__tabs-action:hover,
+.facility-detail__tabs-action:focus-visible { color:var(--text-strong,#eaf6ff); }
 .facility-detail__body :deep(.entity-sections__tabs > .facility-detail__tabs-action) { margin-left:auto; }
 .facility-detail__body :deep(.entity-sections__grid) { display:grid; grid-template-columns:1fr; gap:calc(4 * var(--u,1px)); }
 .facility-detail__body :deep(.entity-sections__grid > div) { display:grid; grid-template-columns:calc(90 * var(--u,1px)) minmax(0,1fr); gap:calc(8 * var(--u,1px)); }

+ 5 - 2
src/modules/cockpit/domain/modeLayerPlan.js

@@ -114,7 +114,10 @@ function displayStatusFor(code, fallback, statusIndex) {
  * @param {{code:string}|null} locateTarget 当前定位目标
  */
 function withLocateTarget(visible, objects, mode, locateTarget) {
-    if (!locateTarget || mode === MODE_LAYER.INFRASTRUCTURE) return visible
+    if (!locateTarget) return visible
+    // 基础设施模式原本整体不呈现监测设备;但「定位」的语义是让目标可见 ——
+    // 用户在这个模式点了「定位设备」却看不到图标,等于按钮失效(维护者 2026-12-02)。
+    // 这里只补**被定位的那一个**对象,不改该模式的常规图层。
     // 关联设备的目标是设备图层(由 deviceLayerStore 临时补行),不再额外补宿主点位标记:
     // 宿主点图标更大,叠在设备点上会把设备图标盖住(#135 走查:定位成功但设备点“丢了”)。
     // 即使宿主点位本身在本模式可见,定位设备期间也先让位,避免遮挡设备点。
@@ -222,7 +225,7 @@ function selectionVisible({ mode, selection, objects, markers, associatedDevices
     if (!current.level || current.level === 'none') return false
     // 定位目标本身必须可见(#127):定位的语义是「让目标可见」,不是只把相机开过去。
     // 基础设施模式整体不呈现监测设备,该模式不破例;目标没被坐标准入收下时也不画面板。
-    if (locateTarget && mode !== MODE_LAYER.INFRASTRUCTURE) {
+    if (locateTarget) {
         const targetCode = String(locateTarget.code || '').trim()
         const targetDevice = String(locateTarget.deviceCode || '').trim()
         // 关联设备的目标点在设备图层(`associatedDevices` 里的临时 drawn 行),不在摘要 markers。