From d4dff5c4179c405d9a76962fb3f073eb94be8efc Mon Sep 17 00:00:00 2001 From: JiuContinent Date: Sat, 24 Oct 2026 16:11:58 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(realtime):=20=E6=96=B0=E5=A2=9E=20RI?= =?UTF-8?q?D=20=E7=9B=AE=E6=A0=87=E4=B8=8E=E7=99=BB=E8=AE=B0=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E7=9A=84=E4=BA=BA=E5=B7=A5=E5=85=B3=E8=81=94=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 target_binding 模块,支持在目标详情面板中搜索、绑定和 解除 RID 与本地登记档案的人工关联 - 实时目标详情中移除内联档案查询逻辑,改用 TargetBinding 组件 - 档案保存后自动将搜索框设为新记录序列号并跳回首页,避免分页 遗漏;监听 rid-workspace-view 和 focus 事件以刷新档案列表 - 重构首页卡片预览图为 SVG 方案,增加 caption 说明文字, 调整白色主题配色以匹配新设计 ``` --- crates/web-ui/public/home.css | 68 ++++---- crates/web-ui/public/target-lists.css | 11 ++ crates/web-ui/src/main.rs | 1 + crates/web-ui/src/realtime_ui.rs | 45 +----- crates/web-ui/src/registry.rs | 32 +++- crates/web-ui/src/target_binding.rs | 224 ++++++++++++++++++++++++++ crates/web-ui/src/workspace.html | 6 +- doc/registry/rust/使用说明.md | 4 + scripts/test-package.ps1 | 2 +- src/http.rs | 11 ++ src/main.rs | 1 + src/map_settings.rs | 43 +++-- src/store.rs | 1 + src/target_bindings.rs | 211 ++++++++++++++++++++++++ 启动Rust版.cmd | 1 + 15 files changed, 575 insertions(+), 86 deletions(-) create mode 100644 crates/web-ui/src/target_binding.rs create mode 100644 src/target_bindings.rs diff --git a/crates/web-ui/public/home.css b/crates/web-ui/public/home.css index 95028f6..3102549 100644 --- a/crates/web-ui/public/home.css +++ b/crates/web-ui/public/home.css @@ -18,45 +18,55 @@ .home-card-title{display:block;font-size:18px;font-weight:600;line-height:1.5;margin-top:22px} .home-card-desc{display:block;min-height:50px;font-size:14px;line-height:1.85;color:var(--work-muted);margin-top:8px} .home-card-preview{display:block;width:100%;margin-top:23px;pointer-events:none} -.home-card .mini{display:block;height:109px;width:100%;border-radius:10px;border:1px solid #b7d1ef1c;background:#08132166;overflow:hidden;position:relative;opacity:.85} -.home-card .registry{display:flex;padding:12px;gap:10px} -.home-card .mini-side{display:block;width:24%;border-right:1px solid #809dbe1f;padding-right:9px;padding-top:3px} -.home-card .mini-side i{display:block;height:6px;width:100%;background:#6b89ac26;margin-bottom:9px;border-radius:2px} -.home-card .mini-side i:first-child{background:#6a9ac54a} -.home-card .mini-body{display:block;width:49%} -.home-card .mini-body b{display:block;width:45%;height:5px;border-radius:2px;background:#a4bcd040;margin:2px 0 9px} -.home-card .mini-body>span{display:block;height:12px;border:1px solid #7e9ab526;border-radius:3px;margin:5px 0} -.home-card .mini-body em{display:block;height:10px;width:39%;margin-top:8px;background:#5784b14a;border-radius:3px;float:right} -.home-card .mini-qr{display:grid;width:22%;place-items:center} -.home-card .mini-qr i{display:block;width:34px;height:34px;border:5px solid #93abc038;border-radius:3px;box-shadow:inset 0 0 0 3px #0e1c2b;position:relative} -.home-card .mini-qr i:before{content:'';position:absolute;top:4px;left:4px;width:6px;height:6px;background:#b7d0e155} -.home-card .radar{background:#122b3459} -.home-card .radar-grid{position:absolute;inset:0;background-image:linear-gradient(#91b1c111 1px,transparent 1px),linear-gradient(90deg,#91b1c111 1px,transparent 1px);background-size:29px 27px} -.home-card .radar-line{position:absolute;left:45px;top:29px;width:140px;height:48px;border-bottom:1px dashed #a1d3d47d;transform:rotate(-17deg)} -.home-card .radar i{width:6px;height:6px;position:absolute;background:#b3ddd6;clip-path:polygon(50% 0,100% 100%,50% 80%,0 100%)} -.home-card .radar i:nth-of-type(1){left:22%;top:65%}.home-card .radar i:nth-of-type(2){left:65%;top:28%}.home-card .radar i:nth-of-type(3){left:79%;top:60%} -.home-card .map-label{position:absolute;top:12px;left:12px;width:42px;height:8px;background:#8caab822;border-radius:3px} -.home-card .appearance{padding:14px 13px;display:grid;grid-template-columns:repeat(3,1fr);gap:8px;align-content:start} -.home-card .wall{display:block;height:44px;border:1px solid #a9bdce26;border-radius:5px} -.home-card .wall-one{background:linear-gradient(135deg,#3b4a5b,#101b29)}.home-card .wall-two{background:linear-gradient(135deg,#41728f,#193a54)}.home-card .wall-three{background:linear-gradient(135deg,#dae4ec,#8c9eaf)} -.home-card .setting-line{display:flex;grid-column:1/4;justify-content:space-between;border-top:1px solid #a7c3e11c;margin-top:4px;padding-top:10px} -.home-card .setting-line i{width:45px;height:4px;background:#8dacc32d;border-radius:3px}.home-card .setting-line i:last-child{width:65px} +/* Static feature illustrations, not live device data or nested controls. */ +.home-card .mini{display:flex;flex-direction:column;height:119px;width:100%;border-radius:10px;border:1px solid #33475e;background:#111f30;overflow:hidden;position:relative;color:#c1d1e1} +.home-preview-art{display:block;width:100%;height:88px;min-height:0;flex:1} +.home-card .home-preview-caption{display:block;flex-shrink:0;padding:3px 11px 7px;font-size:11px;line-height:17px;white-space:nowrap;color:#bacbde} +.home-card .preview-sheet{fill:#172b42;stroke:#466689} +.home-card .preview-icon-bg{fill:#355a80} +.home-card .preview-symbol{fill:none;stroke:#c1dcf7;stroke-width:2} +.home-card .preview-title{fill:#deebfb;font-size:12px} +.home-card .preview-detail{fill:#a8bfd8;font-size:10px} +.home-card .preview-lines{fill:none;stroke:#708fb1;stroke-width:3;stroke-linecap:round} +.home-card .preview-arrow{fill:none;stroke:#82aad5} +.home-card .preview-code{fill:#192f47;stroke:#81a4ca} +.home-card .preview-code-mark{fill:none;stroke:#c7dbef;stroke-width:3} +.home-card .preview-code-pixels{fill:#c7dbef} +.home-card .radar{background:#10272e} +.home-card .preview-map-grid{fill:none;stroke:#28474f;stroke-width:.8} +.home-card .preview-map-roads{fill:none;stroke:#40636c;stroke-width:7;opacity:.45} +.home-card .preview-track{fill:none;stroke:#8dc8c3;stroke-width:2;stroke-dasharray:4 4} +.home-card .preview-target-ring{fill:#73beb622;stroke:#73beb677} +.home-card .preview-target{fill:#b5e9e1} +.home-card .home-preview-swatches{display:flex;gap:7px;padding:12px 12px 0;flex:1;min-height:0} +.home-card .home-preview-swatch{display:flex;flex:1;min-width:0;flex-direction:column;gap:4px;text-align:center;font-size:11px;line-height:17px} +.home-card .wall{display:block;height:47px;position:relative;flex-shrink:0;border:1px solid #53667c;border-radius:5px} +.home-card .wall-one{background:linear-gradient(135deg,#425264,#152030)} +.home-card .wall-two{background:linear-gradient(135deg,#3a6c92,#172e4d);border:2px solid #95bde7} +.home-card .wall-three{background:linear-gradient(135deg,#e2e9ef,#849caf)} +.home-card .home-preview-check{position:absolute;right:4px;bottom:2px;font-size:11px;color:#e3f3ff} .home-card-open{display:flex;align-items:center;justify-content:space-between;width:100%;border-top:1px solid #b1cbe429;padding-top:18px;margin-top:23px;color:var(--work-text);font-size:14px} .theme-blue .home-top{background:#0d274775}.theme-blue .home-card{background:linear-gradient(145deg,#4a78a84d,#173c6673),#081a30a0;border-color:#b0d6ff36} .theme-white .home-top{background:#eff6ffd1;border-color:#56718c29} .theme-white .home-card{background:linear-gradient(145deg,#ffffff70,#e1edf96e),#eff6ffd0;border-color:#ffffffb0;box-shadow:0 1px 0 #fff9 inset,0 14px 35px #263e5b12} .theme-white .home-card:hover{background:linear-gradient(145deg,#ffffff90,#e1edf98e),#eff6ffd9;border-color:#8eb4dc80} -.theme-white .home-card .mini{background:#c4d4e344;border-color:#6f8eac29} -.theme-white .home-card .mini-side i,.theme-white .home-card .mini-body b,.theme-white .home-card .setting-line i{background:#698baa4d} -.theme-white .home-card .mini-body>span{border-color:#6b8baa3d}.theme-white .home-card .mini-qr i{border-color:#698dad66;box-shadow:none} -.theme-white .home-card .radar-line{border-color:#4b7a947d}.theme-white .home-card .radar i{background:#3d788b} -.theme-white .home-card .radar-grid{background-image:linear-gradient(#587c9d19 1px,transparent 1px),linear-gradient(90deg,#587c9d19 1px,transparent 1px)} +.theme-white .home-card .mini{background:#e3edf6;border-color:#9ab0c7;color:#34516c} +.theme-white .home-card .home-preview-caption{color:#34516c} +.theme-white .home-card .preview-sheet{fill:#d3e3f2;stroke:#7393b3} +.theme-white .home-card .preview-title{fill:#203f5d} +.theme-white .home-card .preview-detail{fill:#34516c} +.theme-white .home-card .radar{background:#dfefee} +.theme-white .home-card .preview-map-grid{stroke:#9bbcbf} +.theme-white .home-card .preview-map-roads{stroke:#8aafb4} +.theme-white .home-card .preview-track{stroke:#346f72} +.theme-white .home-card .preview-target-ring{fill:#346f7214;stroke:#346f7277} +.theme-white .home-card .preview-target{fill:#285f62} .theme-white .home-card-open{border-color:#6c8da834} .theme-white .home-launcher.homescreen{background:linear-gradient(130deg,#f1f7ffd9,#d9e7f5bf)!important;backdrop-filter:blur(6px)} body[data-custom-wallpaper="true"]:not(.theme-white) .home-launcher.homescreen{background:#050f1aad!important} body[data-custom-wallpaper="true"]:not(.theme-white) .home-heading p{color:#b6c8dc} .settings-layout .wall-grid{grid-template-columns:repeat(4,minmax(0,1fr))} -@media(max-width:1100px){.home-launcher.homescreen{padding:35px 30px 55px}.home-cards{gap:15px}.home-card{padding:21px}.home-card-desc{font-size:14px}.home-card .mini{height:100px}} +@media(max-width:1100px){.home-launcher.homescreen{padding:35px 30px 55px}.home-cards{gap:15px}.home-card{padding:21px}.home-card-desc{font-size:14px}} @media(max-width:760px){.home-top{padding:0 20px}.home-launcher.homescreen{align-items:flex-start;padding:34px 22px 40px}.home-space{margin:0}.home-heading{margin-bottom:24px}.home-heading h1{font-size:25px}.home-cards{grid-template-columns:1fr;gap:15px}.home-card{display:grid;grid-template-columns:65px minmax(0,1fr) 19px;gap:4px 17px;padding:19px;min-height:134px}.home-app-icon{width:65px;height:65px;grid-row:1/3}.home-card-title{grid-column:2;grid-row:1;margin:0;align-self:end;font-size:17px}.home-card-desc{grid-column:2;grid-row:2;margin:0;min-height:0;align-self:start;font-size:13px}.home-card-preview{display:none}.home-card-open{grid-column:3;grid-row:1/3;display:block;overflow:hidden;width:19px;height:22px;font-size:0;padding:0;margin:0;border:0}.home-card-open svg{display:block;position:absolute}.settings-layout .wall-grid{grid-template-columns:repeat(2,minmax(0,1fr))}} @media(prefers-reduced-motion:reduce){.home-card{transition:none}.home-card:hover{transform:none}} @media(max-width:760px){.workspace-home-link{min-width:24px;padding:4px}.workspace-home-link>span,.workspace-crumb-separator{display:none}} diff --git a/crates/web-ui/public/target-lists.css b/crates/web-ui/public/target-lists.css index 5ef8e4a..dc7f715 100644 --- a/crates/web-ui/public/target-lists.css +++ b/crates/web-ui/public/target-lists.css @@ -60,3 +60,14 @@ body.b[data-screen=realtime] .live-panel-restores{top:64px;left:calc(var(--navig @media(max-width:1199px){#rt-list-entry-form{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}#rt-list-entry-form .rt-inline-note{grid-column:1/-1}#rt-list-entry-form .rt-inline-editor-actions{grid-column:1/-1;text-align:right}#rt-list-entry-form .primary{width:auto;min-width:150px}} @media(max-width:900px),(max-height:570px){.rt-list-category-panel{padding:12px}.rt-list-category-panel>h3,.rt-list-category-panel .rt-list-policy{display:none}.rt-list-category-panel .rt-list-tabs{flex-direction:row}.rt-list-category-panel .rt-list-tabs button{width:auto}.rt-list-table-panel{min-height:380px}} @media(max-width:767px){.rt-list-rows table{min-width:0;table-layout:auto;display:block}.rt-list-rows thead{display:none}.rt-list-rows tbody{display:block}.rt-list-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:14px;border-bottom:1px solid var(--work-line)}.rt-list-rows .rt-list-row td{display:block;border:0;padding:0;min-width:0}.rt-list-row-note{grid-column:1/-1}.rt-list-row-actions{grid-column:1/-1;display:flex!important;justify-content:flex-end}.rt-inline-editor-row,.rt-inline-editor-row>td{display:block;width:100%}.rt-list-rows .rt-inline-editor-row>td{padding:14px}#rt-list-entry-form{display:flex;flex-direction:column;align-items:stretch;gap:14px}.rt-inline-editor-heading{width:100%}#rt-list-entry-form .primary{width:100%}.rt-list-rows{max-height:600px}.rt-list-category-panel .rt-list-tabs{gap:5px}.rt-list-category-panel .rt-list-tabs button{font-size:11px;padding:9px}.rt-list-search{flex-basis:auto;width:100%;max-width:none}} + +/* Approved A: RID association within the existing target detail panel. */ +.rt-binding { margin: 16px 0; padding: 14px 0; border-top: 1px solid var(--work-line); } +.rt-binding h3 { font-size: 14px; margin: 0 0 10px; } +.rt-binding p { font-size: 12px; line-height: 1.7; color: var(--work-muted); overflow-wrap: anywhere; } +.rt-binding label { display: block; font-size: 12px; margin: 10px 0 5px; } +.mc-layout-b .rt-binding input,.mc-layout-b .rt-binding select { width: 100%; min-width: 0; padding: 9px; color: var(--work-text); background: var(--work-panel, #091927); border: 1px solid var(--work-line); border-radius: 5px; } +.mc-layout-b .rt-binding button { padding: 8px; font-size: 12px; margin-top: 8px; } +.rt-binding-actions { display: flex; flex-wrap: wrap; gap: 7px; } +.rt-binding :focus-visible { outline: 2px solid #8bbdff; outline-offset: 2px; } +.rt-binding button:disabled { opacity: .5; cursor: not-allowed; } diff --git a/crates/web-ui/src/main.rs b/crates/web-ui/src/main.rs index 087e587..fa68169 100644 --- a/crates/web-ui/src/main.rs +++ b/crates/web-ui/src/main.rs @@ -5,6 +5,7 @@ mod realtime_layout; mod realtime_ui; mod receiver_ui; mod registry; +mod target_binding; mod target_lists; mod workspace; diff --git a/crates/web-ui/src/realtime_ui.rs b/crates/web-ui/src/realtime_ui.rs index 2c23965..98d202a 100644 --- a/crates/web-ui/src/realtime_ui.rs +++ b/crates/web-ui/src/realtime_ui.rs @@ -179,48 +179,6 @@ pub fn Realtime(lists: Lists) -> impl IntoView { layout.select(); if selected.get_untracked() != id { selected.set(id.clone()); - record.set(None); - lookup.set("正在比对本地档案…".into()); - let expected = id.clone(); - spawn_local(async move { - let result = async { - let response = gloo_net::http::Request::get(&format!( - "/api/records?q={}", - js_sys::encode_uri_component( - &expected.chars().take(60).collect::() - ) - )) - .send() - .await - .ok()?; - if !response.ok() { - return None; - } - response.json::().await.ok() - } - .await; - if selected.get_untracked() != expected { - return; - } - if let Some(value) = result { - let found = value["records"].as_array().and_then(|rows| { - rows.iter() - .find(|r| r["serialNo"].as_str() == Some(&expected)) - .cloned() - }); - lookup.set( - if found.is_some() { - "已匹配本地登记档案" - } else { - "未匹配本地档案(仅按目标标识比对)" - } - .into(), - ); - record.set(found); - } else { - lookup.set("本地档案查询失败".into()); - } - }); } let coords = map_call("select", &[id.into()]) .ok() @@ -646,12 +604,13 @@ pub fn Realtime(lists: Lists) -> impl IntoView {
{move||if selected.get().is_empty(){"请选择目标".into()}else{selected.get()}}

{move||lookup.get()}

+
"经度"{move||position.get().map(|p|format!("{:.6}",p[0])).unwrap_or_else(||"—".into())}
"纬度"{move||position.get().map(|p|format!("{:.6}",p[1])).unwrap_or_else(||"—".into())}
"高度(数据源)"{move||position.get().map(|p|format!("{:.1} m",p[2])).unwrap_or_else(||"—".into())}
"航向"{move||position.get().map(|p|format!("{:.0}°",p[3])).unwrap_or_else(||"—".into())}
"登记机型"
{move||record.get().and_then(|r|r["modelName"].as_str().map(str::to_owned)).unwrap_or_else(||"—".into())}
"登记人"
{move||record.get().and_then(|r|r["ownerName"].as_str().map(str::to_owned)).unwrap_or_else(||"—".into())}

"未收到的字段显示 —。未匹配本地记录不代表违法或未官方备案。"

-
"查看本地登记"
+
"查看本地登记"