From a0c6df78b68824b5bbc5cbab7d2a2bd6f6918b5b Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Mon, 20 Jul 2026 11:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8F=9C=E5=8D=95=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=92=8C=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/web/ui.go | 26 ++++++++-------- internal/web/ui/assets/style.css | 13 ++++++-- internal/web/ui/templates/layout.html | 43 +++++++++++++++++++-------- 3 files changed, 54 insertions(+), 28 deletions(-) diff --git a/internal/web/ui.go b/internal/web/ui.go index 9697622..8863502 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -1001,7 +1001,7 @@ func (u *UI) pageDashboard(w http.ResponseWriter, r *http.Request) { func (u *UI) pageConsole(w http.ResponseWriter, r *http.Request) { u.ensureDevicesLoaded() - data := PageData{Title: "管控台"} + data := PageData{Title: "运行看板"} data.Message = strings.TrimSpace(r.URL.Query().Get("msg")) devices := u.registry.GetDevices() data.Devices = devices @@ -1584,7 +1584,7 @@ func (u *UI) actionDiscoverySearch(w http.ResponseWriter, r *http.Request) { online++ } } - data := PageData{Title: "设备", Devices: devices, Found: found, FoundCount: len(found), DeviceCount: len(devices), OnlineCount: online, OfflineCount: len(devices) - online} + data := PageData{Title: "设备管理", Devices: devices, Found: found, FoundCount: len(found), DeviceCount: len(devices), OnlineCount: online, OfflineCount: len(devices) - online} if err != nil { data.Error = err.Error() } @@ -2820,7 +2820,7 @@ func (u *UI) pageAssetTemplateGraph(w http.ResponseWriter, r *http.Request) { data.Error = strings.TrimSpace(r.URL.Query().Get("error")) } if u.preview == nil { - data.Error = "配置中心服务未初始化" + data.Error = "资产管理服务未初始化" u.render(w, r, "asset_templates", data) return } @@ -3135,7 +3135,7 @@ func (u *UI) actionPlanSaveWithName(w http.ResponseWriter, r *http.Request, name ) if strings.TrimSpace(name) == "" { data = u.assetPageData("") - data.Title = "场景管理" + data.Title = "场景模板" _ = r.ParseForm() editor = service.ConfigProfileEditor{ Name: strings.TrimSpace(r.FormValue("profile_name")), @@ -3162,7 +3162,7 @@ func (u *UI) actionPlanSaveWithName(w http.ResponseWriter, r *http.Request, name } if err := u.preview.SaveProfileEditor(editor); err != nil { data.Error = err.Error() - data.Title = "场景管理" + data.Title = "场景模板" data.AssetProfileEditing = true u.render(w, r, "scene_templates", data) return @@ -3446,7 +3446,7 @@ func (u *UI) actionDeviceAssignmentDelete(w http.ResponseWriter, r *http.Request func (u *UI) pageAssetVideoSources(w http.ResponseWriter, r *http.Request) { data := u.assetPageData("video-sources") - data.Title = "配置中心" + data.Title = "资产管理" data.Message = strings.TrimSpace(r.URL.Query().Get("msg")) if data.Error == "" { data.Error = strings.TrimSpace(r.URL.Query().Get("error")) @@ -3501,7 +3501,7 @@ func (u *UI) actionAssetVideoSourceSave(w http.ResponseWriter, r *http.Request) } if err := u.preview.SaveVideoSourceAsset(asset); err != nil { data := u.assetPageData("video-sources") - data.Title = "配置中心" + data.Title = "资产管理" data.Error = err.Error() data.AssetVideoSource = &asset data.AssetVideoSource.SourceTypeLabel = serviceVideoSourceTypeLabel(asset.SourceType) @@ -3626,7 +3626,7 @@ func (u *UI) actionVideoSourceCSVImport(w http.ResponseWriter, r *http.Request) func (u *UI) pageAssetIntegrations(w http.ResponseWriter, r *http.Request) { data := u.assetPageData("integrations") - data.Title = "配置中心" + data.Title = "资产管理" data.Message = strings.TrimSpace(r.URL.Query().Get("msg")) if data.Error == "" { data.Error = strings.TrimSpace(r.URL.Query().Get("error")) @@ -3814,7 +3814,7 @@ func (u *UI) actionAssetOverlaySave(w http.ResponseWriter, r *http.Request) { raw := map[string]any{} if err := json.Unmarshal([]byte(rawText), &raw); err != nil { data := u.assetPageData("overlays") - data.Title = "配置中心" + data.Title = "资产管理" data.Error = "调试参数 JSON 格式不正确:" + err.Error() data.AssetOverlayEditing = true data.AssetOverlay = &service.ConfigOverlayAsset{Name: name, Description: description, Raw: raw} @@ -3825,7 +3825,7 @@ func (u *UI) actionAssetOverlaySave(w http.ResponseWriter, r *http.Request) { asset := service.ConfigOverlayAsset{Name: name, Description: description, Raw: raw} if err := u.preview.SaveOverlayAsset(asset, raw); err != nil { data := u.assetPageData("overlays") - data.Title = "配置中心" + data.Title = "资产管理" data.Error = err.Error() data.AssetOverlayEditing = true data.AssetOverlay = &asset @@ -3898,11 +3898,11 @@ func (u *UI) actionAssetOverlayDelete(w http.ResponseWriter, r *http.Request) { func (u *UI) assetPageData(tab string) PageData { data := PageData{ - Title: "配置中心", + Title: "资产管理", AssetTab: tab, } if u.preview == nil { - data.Error = "配置中心服务未初始化" + data.Error = "资产管理服务未初始化" return data } sources, err := u.preview.ListSources() @@ -4907,7 +4907,7 @@ func (u *UI) deviceOverviewPageData(r *http.Request, selectedIDs []string, errMs } selectedIDs = filterSelectedDeviceIDs(devices, selectedIDs) data := PageData{ - Title: "设备", + Title: "设备管理", Devices: devices, DeviceRows: rows, DeviceCount: len(devices), diff --git a/internal/web/ui/assets/style.css b/internal/web/ui/assets/style.css index e9b108d..cf79a32 100644 --- a/internal/web/ui/assets/style.css +++ b/internal/web/ui/assets/style.css @@ -129,12 +129,21 @@ code,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace} .side-nav .nav-group summary{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:var(--radius);color:var(--sidebar-text);font-size:13px;font-weight:500;list-style:none;cursor:pointer;user-select:none} .side-nav .nav-group summary:hover{background:var(--sidebar-hover)} .side-nav .nav-group summary::-webkit-details-marker{display:none} -.side-nav .nav-group summary::after{content:"";margin-left:auto;width:7px;height:7px;border-right:1.5px solid var(--sidebar-muted);border-bottom:1.5px solid var(--sidebar-muted);transform:rotate(45deg);transition:transform .16s ease,border-color .16s ease} -.side-nav .nav-group[open] summary::after{transform:rotate(225deg);border-color:var(--sidebar-text)} +.side-nav .nav-group > summary::after{content:"";margin-left:auto;width:7px;height:7px;border-right:1.5px solid var(--sidebar-muted);border-bottom:1.5px solid var(--sidebar-muted);transform:rotate(45deg);transition:transform .16s ease,border-color .16s ease} +.side-nav .nav-group[open] > summary::after{transform:rotate(225deg);border-color:var(--sidebar-text)} .side-nav .nav-group[open] summary{background:var(--sidebar-hover)} .side-nav .nav-group-items{display:flex;flex-direction:column;gap:4px;margin-top:4px} .side-nav .nav-subitem{padding:8px 10px 8px 34px;font-size:12px;font-weight:500;color:var(--sidebar-muted)} .side-nav .nav-subitem:hover{background:var(--sidebar-hover);color:var(--sidebar-text)} +.side-nav .nav-subgroup{margin:0} +.side-nav .nav-subgroup summary{display:flex;align-items:center;gap:10px;padding:8px 10px 8px 34px;color:var(--sidebar-muted);font-size:12px;font-weight:500;list-style:none;cursor:pointer;user-select:none} +.side-nav .nav-subgroup summary:hover{background:var(--sidebar-hover);color:var(--sidebar-text)} +.side-nav .nav-subgroup summary::-webkit-details-marker{display:none} +.side-nav .nav-subgroup summary::after{content:"";margin-left:auto;width:7px;height:7px;border-right:1.5px solid var(--sidebar-muted);border-bottom:1.5px solid var(--sidebar-muted);transform:rotate(45deg);transition:transform .16s ease} +.side-nav .nav-subgroup[open] summary::after{transform:rotate(225deg)} +.side-nav .nav-subgroup[open] summary{color:var(--sidebar-text)} +.side-nav .nav-subgroup-items{display:flex;flex-direction:column;gap:2px;margin-top:2px} +.side-nav .nav-subgroup .nav-subitem{padding-left:48px} .side-nav .nav-subicon{width:22px;height:20px;font-size:9px} .side-nav .nav-subicon .ui-icon{width:12px;height:12px} .nav-icon{width:28px;height:24px;border-radius:3px;border:1px solid rgba(255,255,255,.12);display:grid;place-items:center;font-size:10px;color:var(--primary)} diff --git a/internal/web/ui/templates/layout.html b/internal/web/ui/templates/layout.html index 8a9c9a1..1dbb346 100644 --- a/internal/web/ui/templates/layout.html +++ b/internal/web/ui/templates/layout.html @@ -6,8 +6,8 @@ {{.Title}} - - + +
@@ -19,13 +19,13 @@
@@ -341,13 +348,23 @@ path === "/ui/device-assignments" || path === "/ui/assets" || path === "/ui/models" || - path === "/ui/resources" || path === "/ui/audit" || path === "/ui/api" ) { systemNavGroup.open = true; } } + const detectionGroup = document.getElementById("detection-config-group"); + if (detectionGroup) { + const path = window.location.pathname || ""; + if ( + path === "/ui/scene-templates" || + path === "/ui/recognition-units" || + path === "/ui/device-assignments" + ) { + detectionGroup.open = true; + } + } var modeKey = "safesight-mode"; function applyMode(mode, persist) {