From a62f7ff10f28b5df7aeff75dbdee20e5e4715add Mon Sep 17 00:00:00 2001 From: xiaosi <2652281683@qq.com> Date: Fri, 28 Aug 2026 15:35:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=A5=E5=BA=93=20mapLabels=20?= =?UTF-8?q?=E5=B9=B6=E9=98=BB=E6=96=AD=E8=B6=85=E6=97=B6=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E5=9C=A8=E9=80=94=E8=BD=AE=E8=AF=A2=E5=9B=9E=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补交 MonitorView 依赖的 mapLabels 模块;客户端 deadline 到达时递增 commandProgressEpoch,避免迟到响应清掉超时文案。 --- src/utils/mapLabels.js | 33 +++++++++++++++++++++++++++ src/views/MonitorView/MonitorView.vue | 1 + 2 files changed, 34 insertions(+) create mode 100644 src/utils/mapLabels.js diff --git a/src/utils/mapLabels.js b/src/utils/mapLabels.js new file mode 100644 index 0000000..15ff5a6 --- /dev/null +++ b/src/utils/mapLabels.js @@ -0,0 +1,33 @@ +/** + * Prefer Simplified Chinese labels on Mapbox basemap symbol layers. + * Falls back to name_zh / name when localized fields are absent. + */ +export function applyChineseLabels(map) { + if (!map?.getStyle) return + let layers = [] + try { + layers = map.getStyle()?.layers || [] + } catch (_) { + return + } + + const textField = [ + 'coalesce', + ['get', 'name_zh-Hans'], + ['get', 'name_zh'], + ['get', 'name'], + ] + + for (const layer of layers) { + if (layer?.type !== 'symbol') continue + if (!layer.layout?.['text-field']) continue + // Keep app-owned overlays (device/route labels) on their own text-field + const id = String(layer.id || '') + if (id.startsWith('laic-') || id.startsWith('monitor-') || id.startsWith('route-')) continue + try { + map.setLayoutProperty(layer.id, 'text-field', textField) + } catch (_) { + /* layer may not support text-field mutation */ + } + } +} diff --git a/src/views/MonitorView/MonitorView.vue b/src/views/MonitorView/MonitorView.vue index 4e63097..3c2c86a 100644 --- a/src/views/MonitorView/MonitorView.vue +++ b/src/views/MonitorView/MonitorView.vue @@ -1535,6 +1535,7 @@ function startCommandProgress(cmd, title, deviceName) { if (Date.now() > deadline) { clearInterval(commandPollTimer) commandPollTimer = null + commandProgressEpoch += 1 if (!COMMAND_STATUS[commandProgress.status]?.terminal) { commandProgress.error = '等待超时,请稍后在操作记录查看' commandProgress.step = 3