```
feat(protocol): Observation坐标字段可选化及协议v2扩展 - 将Observation中longitude/latitude/altitude_m/heading_deg改为Option类型, 支持无位置信息的观测数据 - 新增DeviceTelemetry结构体承载设备遥测扩展字段(serial, mac, model, rssi, speed, vertical_speed, pressure_altitude, geometric_altitude, height_agl, pilot_position等) - 新增LegacyObservation兼容结构体及From转换,保持旧接收器协议输入兼容 - PROTOCOL_VERSION从1升至2 - 新增coordinates()辅助方法统一提取有效坐标 - validate()适配Option类型,允许坐标字段同时缺失 - Store新增position_generation机制追踪位置可用性变化,确保合并帧间的 位置丢失仍能正确断开轨迹 - geofence-map-adapter过滤无效坐标避免渲染异常 - 新增appearance.css外观主题系统,支持blue/graphite/white三套配色 ```
This commit is contained in:
@@ -27,6 +27,7 @@ struct State {
|
||||
photos: photos::Shared,
|
||||
menu: Option<(String, String)>,
|
||||
edit_return: String,
|
||||
saved_identity: Option<(String, String)>,
|
||||
}
|
||||
type Shared = Rc<RefCell<State>>;
|
||||
type Result<T> = std::result::Result<T, String>;
|
||||
@@ -513,15 +514,21 @@ async fn save_inner(state: Shared, editing: bool) -> Result<()> {
|
||||
draw(&state, payload["record"].clone());
|
||||
}
|
||||
} else {
|
||||
let code = field(&payload["record"], "uasCode");
|
||||
input("uas-code").set_value(code.strip_prefix("FPV").unwrap_or(code));
|
||||
state.borrow_mut().saved_identity = Some((
|
||||
field(&payload["record"], "serialNo").to_owned(),
|
||||
code.to_owned(),
|
||||
));
|
||||
state.borrow_mut().dirty = false;
|
||||
text("draft-state", "已保存 · 修改后可再次保存");
|
||||
draw(&state, payload["record"].clone());
|
||||
message(
|
||||
"form-message",
|
||||
if payload["existing"] == true {
|
||||
"该 SN 已登记,照片和填写的信息已保存。"
|
||||
&if payload["existing"] == true {
|
||||
format!("该 SN 已登记,沿用编号 {code},资料已保存。")
|
||||
} else {
|
||||
"登记成功,二维码已生成。"
|
||||
format!("登记成功,编号 {code} 已回填,二维码已生成。")
|
||||
},
|
||||
false,
|
||||
);
|
||||
@@ -697,6 +704,9 @@ pub fn init() {
|
||||
&e,
|
||||
true,
|
||||
);
|
||||
if !editing {
|
||||
el("form-message").scroll_into_view_with_bool(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -716,6 +726,18 @@ pub fn init() {
|
||||
&& matches!(target.id().as_str(), "serial-no" | "uas-code")
|
||||
{
|
||||
clear_field_error(&target.id());
|
||||
if target.id() == "serial-no" {
|
||||
let saved = state.borrow().saved_identity.clone();
|
||||
if let Some((sn, code)) = saved
|
||||
&& value("serial-no") != sn
|
||||
{
|
||||
if format!("FPV{}", value("uas-code")) == code {
|
||||
input("uas-code").set_value("");
|
||||
clear_field_error("uas-code");
|
||||
}
|
||||
state.borrow_mut().saved_identity = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if event
|
||||
@@ -896,6 +918,7 @@ pub fn init() {
|
||||
photos::reset(&state.borrow().photos, index, "");
|
||||
}
|
||||
state.borrow_mut().dirty = false;
|
||||
state.borrow_mut().saved_identity = None;
|
||||
text("draft-state", "保存时校验 SN 与编号");
|
||||
for id in ["serial-no", "uas-code"] {
|
||||
clear_field_error(id);
|
||||
|
||||
Reference in New Issue
Block a user