Przeglądaj źródła

feat(cockpit): 地图摘要六态计数与首次落图动效

右上既有摘要区显示命中/已加载/可上图/符号数,加载态明确部分覆盖;首次进入的真实点位用 16px 落图动画、徽章淡入,后续刷新/筛选/状态更新不重播,尊重 reduced-motion 与页面隐藏。
ChenJZ 1 dzień temu
rodzic
commit
a9e4ca71e3

+ 28 - 0
src/modules/cockpit/CockpitShell.vue

@@ -192,6 +192,12 @@
                     <span class="cockpit-shell__map-summary-text" data-map-summary-label :title="mapSummaryView.detail">
                         {{ mapSummaryView.label }}
                     </span>
+                    <span
+                        class="cockpit-shell__map-summary-counts"
+                        data-map-summary-counts
+                        :data-map-summary-partial="mapSummaryPartial ? 'yes' : 'no'"
+                        :title="mapSummaryCountsText"
+                    >{{ mapSummaryCountsText }}</span>
                 </div>
 
                 <!--
@@ -1766,6 +1772,16 @@ const overallFreshnessLabel = computed(() => overallFreshnessText(overallFreshne
 
 // ---- 地图摘要渐进加载(票 08):顶栏只展示状态与一个动作,分页/快照参数都在适配层 ----
 const mapSummaryView = computed(() => mapStore.view)
+// 票 08:右上既有摘要区把「命中/已加载/可上图/当前符号」分开报;未知总数保持未知。
+const mapSummaryCountsText = computed(() => {
+    const counts = mapSummaryView.value.counts || {}
+    const total = Number.isFinite(mapStore.summary.total) ? mapStore.summary.total : '—'
+    const loaded = Number.isFinite(counts.loaded) ? counts.loaded : '—'
+    const mappable = Number.isFinite(counts.mappable) ? counts.mappable : '—'
+    const displayed = Number.isFinite(counts.displayed) ? counts.displayed : '—'
+    return '命中 ' + total + ' · 已加载 ' + loaded + ' · 可上图 ' + mappable + ' · 符号 ' + displayed
+})
+const mapSummaryPartial = computed(() => mapSummaryView.value.counts && mapSummaryView.value.counts.partial === true)
 
 /** 收起态只留一条最新状态,展开态才显示全部诊断字段。 */
 const statusSummaryText = computed(() => {
@@ -3127,6 +3143,18 @@ const mapDataSourceCredits = computed(() => getDataSourceCredits())
     gap: calc(5 * var(--u));
     min-width: 0;
     overflow: hidden;
+    flex-wrap: wrap;
+}
+
+.cockpit-shell__map-summary-counts {
+    min-width: 0;
+    max-width: min(420px, 40vw);
+    overflow: hidden;
+    color: var(--muted);
+    font-size: var(--fs-caption, 10.5px);
+    letter-spacing: 0.02em;
+    text-overflow: ellipsis;
+    white-space: nowrap;
 }
 
 .cockpit-shell__status-summary {

+ 12 - 0
src/modules/cockpit/components/MapCanvas.vue

@@ -518,6 +518,16 @@ function engineSettled() {
  * 只同步**点位标记**(揭示节拍用;管线/设施引用未变,不必每拍重同步)。
  * @returns {boolean} 是否已真正画到地图上(引擎未就绪时为 false)
  */
+function updateDisplayedSymbols() {
+    const host = hostRef.value
+    if (!host) return
+    let count = 0
+    for (const node of host.querySelectorAll('.marker-overlay-node')) {
+        if (node.style.display !== 'none') count += 1
+    }
+    mapStore.setDisplayedSymbols(count)
+}
+
 function syncPointMarkersOnly() {
     const visibleMarkers = currentVisibleMarkers()
     const painted = syncPointMarkersForPlan({
@@ -527,6 +537,7 @@ function syncPointMarkersOnly() {
         byStatus: summarizeMarkerStatuses(visibleMarkers),
     })
     markerState.value = getPointMarkerState()
+    updateDisplayedSymbols()
     return painted
 }
 
@@ -548,6 +559,7 @@ function applyMarkers() {
     if (host && host.dataset) {
         host.dataset.mapDegraded = modePlan.value.degradedNotes.map((note) => note.key).join(',') || ''
     }
+    updateDisplayedSymbols()
 
     // 画上了就收工;引擎已定局(失败/关闭/没有宿主)也不用再等 —— 图例仍要显示。
     if (painted || engineSettled()) return

+ 3 - 2
src/modules/cockpit/domain/mapSummary.js

@@ -327,7 +327,8 @@ export function mapSummaryCounts(state) {
         loaded,
         mappable,
         blocked: blocked.length,
-        displayed: mappable,
+        // 票 08:有实际符号读数时用它(单体 + 聚合徽章),否则退回可上图口径。
+        displayed: Number.isFinite(current.displayedSymbols) ? current.displayedSymbols : mappable,
         total: Number.isFinite(current.total) ? current.total : 0,
         // 加载中(还有页没取完)即「部分加载」:右上角据此保留 partial 标识,完成后消除。
         partial: current.phase === MAP_SUMMARY_PHASE.LOADING || current.phase === MAP_SUMMARY_PHASE.IDLE,
@@ -356,7 +357,7 @@ export function summaryView(state) {
 
     if (phase === MAP_SUMMARY_PHASE.LOADING) {
         const attempt = current.attemptPage || current.nextPage || 1
-        return { phase, tone: 'lv2', label: `地图摘要加载中 · 第 ${attempt} 页 · 已加载 ${counts.loaded} / ${counts.total} 个`, detail: '', counts }
+        return { phase, tone: 'lv2', label: `地图摘要部分覆盖 · 第 ${attempt} 页 · 已加载 ${counts.loaded} / ${counts.total} 个`, detail: '', counts }
     }
     if (phase === MAP_SUMMARY_PHASE.COMPLETE) {
         return { phase, tone: 'lv4', label: `地图摘要加载完成 · 已加载 ${counts.loaded} 个 · ${onMap.label}`, detail: '', counts }

+ 8 - 1
src/modules/cockpit/stores/mapStore.js

@@ -357,6 +357,13 @@ export const useMapStore = defineStore('mapStore', () => {
      * @param {object} pointStates `{ [pointCode]: { status } }`
      * @returns {Array<string>} 被改写状态的编码(空数组 = 没有任何变化)
      */
+    /** 票 08:当前实际画在地图上的符号数(单体 + 聚合徽章;由 MapCanvas 读 DOM 后回写)。 */
+    function setDisplayedSymbols(count) {
+        const next = Number.isFinite(count) ? Math.max(0, Math.round(count)) : null
+        if (summary.value.displayedSymbols === next) return
+        summary.value = { ...summary.value, displayedSymbols: next }
+    }
+
     function applyPointStates(pointStates) {
         const table = pointStates && typeof pointStates === 'object' ? pointStates : {}
         // 先记下来:即使当前没有对应对象(还没翻到那一页)也要记住,供后续翻页补写。
@@ -388,5 +395,5 @@ export const useMapStore = defineStore('mapStore', () => {
         return loader ? loader.hasObject(kind, code) : false
     }
 
-    return { summary, view, counts, statusDistribution, statusAxes, coordinate, locationVerdict: locationVerdictOf, loaded, busy, settled, refreshing, filters, hasSnapshotObject, setup, advance, refresh, applyFilters, applyPointStates, reset }
+    return { summary, view, counts, statusDistribution, statusAxes, coordinate, locationVerdict: locationVerdictOf, loaded, busy, settled, refreshing, filters, hasSnapshotObject, setup, advance, refresh, applyFilters, applyPointStates, setDisplayedSymbols, reset }
 })

+ 1 - 1
tests/markerOverlay.test.js

@@ -25,7 +25,7 @@ function makeMarkers(count) {
         longitude: 110 + index / 10000,
         latitude: 28 + index / 10000,
         screenX: 10 + (index % 30) * 30,
-        screenY: 10 + Math.floor(index / 30) * 18,
+        screenY: 10 + Math.floor(index / 30) * 28,
     }))
 }